Skip to content

Commit

Permalink
configuration fix new VMTemplate create (#200)
Browse files Browse the repository at this point in the history
Co-authored-by: Maksym Veres <[email protected]>
  • Loading branch information
maxsva and Maksym Veres authored Mar 8, 2024
1 parent be564ba commit 8eb8228
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,22 +86,35 @@ <h4>Basic Information</h4>
</tr>
</thead>
<tbody>
<tr>
<td>Name</td>
<td *ngIf="template.name == uneditedTemplate.name">{{ template.name }}</td>
<td *ngIf="template.name != uneditedTemplate.name">
<span class="del-elem arrow-after">{{ uneditedTemplate.name }}</span >
<span class="add-elem">{{ template.name }}</span >
</td>
</tr>
<tr>
<td>Image</td>
<td *ngIf="template.image == uneditedTemplate.image">{{ template.image }}</td>
<td *ngIf="template.image != uneditedTemplate.image">
<span class="del-elem arrow-after">{{ uneditedTemplate.image }}</span >
<span class="add-elem">{{ template.image }}</span >
</td>
</tr>
<ng-container *ngIf="!!this.editTemplate; else newTemplate">
<tr>
<td>Name</td>
<td *ngIf="template.name == uneditedTemplate.name">{{ template.name }}</td>
<td *ngIf="template.name != uneditedTemplate.name">
<span class="del-elem arrow-after">{{ uneditedTemplate.name }}</span >
<span class="add-elem">{{ template.name }}</span >
</td>
</tr>
<tr>
<td>Image</td>
<td *ngIf="template.image == uneditedTemplate.image">{{ template.image }}</td>
<td *ngIf="template.image != uneditedTemplate.image">
<span class="del-elem arrow-after">{{ uneditedTemplate.image }}</span >
<span class="add-elem">{{ template.image }}</span >
</td>
</tr>
</ng-container>
<ng-template #newTemplate>
<tr>
<td>Name</td>
<td>{{ template.name }}</td>
</tr>
<tr>
<td>Image</td>
<td>{{ template.image }}</td>
</tr>
</ng-template>

</tbody>
</table>

Expand Down Expand Up @@ -147,31 +160,40 @@ <h3>Cloud Config</h3>
</table>
</td>
</ng-container>
<ng-container *ngIf="item.key !== cloudConfigKey && item.key !== vmServiceKey">
<!-- view of unedit value -->
<td *ngIf="uneditedTemplate.config_map.hasOwnProperty(item.key)">{{ item.key }}</td>
<td *ngIf="item.value == uneditedTemplate.config_map[item.key]">{{ item.value }}</td>
<!-- view of new key -->
<ng-container *ngIf="!uneditedTemplate.config_map.hasOwnProperty(item.key)">
<td class="add-elem">{{ item.key }}</td>
<td class="add-elem">{{ item.value }}</td>
</ng-container>
<!-- view of edit value -->
<td *ngIf="uneditedTemplate.config_map.hasOwnProperty(item.key) && item.value != uneditedTemplate.config_map[item.key]">
<span class="del-elem arrow-after">{{ uneditedTemplate.config_map[item.key] }}</span >
<span class="add-elem">{{ item.value }}</span >
</td>

<ng-container *ngIf="!!this.editTemplate; else newTemplate">
<ng-container *ngIf="item.key !== cloudConfigKey && item.key !== vmServiceKey">
<!-- view of unedit value -->
<td *ngIf="uneditedTemplate.config_map.hasOwnProperty(item.key)">{{ item.key }}</td>
<td *ngIf="item.value == uneditedTemplate.config_map[item.key]">{{ item.value }}</td>
<!-- view of new key -->
<ng-container *ngIf="!uneditedTemplate.config_map.hasOwnProperty(item.key)">
<td class="add-elem">{{ item.key }}</td>
<td class="add-elem">{{ item.value }}</td>
</ng-container>
<!-- view of edit value -->
<td *ngIf="uneditedTemplate.config_map.hasOwnProperty(item.key) && item.value != uneditedTemplate.config_map[item.key]">
<span class="del-elem arrow-after">{{ uneditedTemplate.config_map[item.key] }}</span >
<span class="add-elem">{{ item.value }}</span >
</td>
</ng-container>
</ng-container>
<ng-template #newTemplate>
<td>{{ item.key }}</td>
<td>{{ item.value }}</td>
</ng-template>
</tr>
<!-- view deleted key -->
<tr *ngFor="let item of uneditedTemplate.config_map | keyvalue">
<ng-container *ngIf="item.key !== cloudConfigKey && item.key !== vmServiceKey">
<ng-container *ngIf="!template.config_map.hasOwnProperty(item.key)">
<td class="del-elem">{{ item.key }}</td>
<td class="del-elem">{{ item.value }}</td >
</ng-container></ng-container>
</tr>
<ng-container *ngIf="!!this.editTemplate">
<!-- view deleted key -->
<tr *ngFor="let item of uneditedTemplate.config_map | keyvalue">
<ng-container *ngIf="item.key !== cloudConfigKey && item.key !== vmServiceKey">
<ng-container *ngIf="!template.config_map.hasOwnProperty(item.key)">
<td class="del-elem">{{ item.key }}</td>
<td class="del-elem">{{ item.value }}</td >
</ng-container>
</ng-container>
</tr>
</ng-container>

</tbody>
</table>
</clr-wizard-page>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export class EditVmtemplateComponent implements OnInit, OnChanges {
) {}

ngOnInit(): void {
this._build();
this._build();
}

@ViewChild('wizard', { static: true }) wizard: ClrWizard;
Expand Down Expand Up @@ -242,4 +242,6 @@ export class EditVmtemplateComponent implements OnInit, OnChanges {
}
this.uneditedTemplate = JSON.parse(JSON.stringify(this.template));
}

}

0 comments on commit 8eb8228

Please sign in to comment.