Merge pull request #28 in ~VLE2FE/definma-ui from development to master

* commit '141064b38ddf7b75969b0c95aa1c3934a2d60e57':
  fixed model-template add new
This commit is contained in:
Veit Lukas (PEA4-Fe) 2020-08-25 08:16:46 +02:00
commit dae482b6d7
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, () => {