fixed model-template add new

This commit is contained in:
VLE2FE 2020-08-25 08:16:11 +02:00
parent bf02c1b99e
commit 141064b38d
2 changed files with 6 additions and 2 deletions

View File

@ -1,6 +1,8 @@
<h2>Models</h2>
<rb-icon-button icon="add" mode="primary" (click)="newModel = !newModel" class="space-below">New model</rb-icon-button>
<rb-icon-button icon="add" mode="primary" (click)="newModel = !newModel; oldModelGroup = ''" class="space-below">
New model
</rb-icon-button>
<form *ngIf="newModel" #modelForm="ngForm">
<rb-form-input name="group" label="group" appValidate="string" required [(ngModel)]="modelGroup" #groupInput="ngModel"

View File

@ -38,7 +38,9 @@ export class ModelTemplatesComponent implements OnInit {
}
saveModel() {
if (this.modelGroup !== this.oldModelGroup) { // group was changed, delete model in old group
console.log(this.modelGroup);
console.log(this.oldModelGroup);
if (this.oldModelGroup !== '' && this.modelGroup !== this.oldModelGroup) { // group was changed, delete model in old group
this.deleteModel(this.oldModelGroup, this.oldModelName);
}
this.api.post('/model/' + this.modelGroup, this.model, () => {