Skip to content

Commit 31d26ff

Browse files
author
Huaqiao Zhang
committed
fix: profile editor save button not work sometimes
Signed-off-by: Huaqiao Zhang <[email protected]>
1 parent 6bab898 commit 31d26ff

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

web/src/app/device-service/profile/edit-profile/edit-profile.component.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
<span class="text-danger fa fa-edit mr-2"></span>{{profileName}}
55
</span>
66
<span class="float-right">
7-
<button class="btn btn-primary btn-sm">
8-
<span><i class="fa fa-save mr-1" (click)="update()"></i>Save</span>
7+
<button class="btn btn-primary btn-sm" (click)="update()">
8+
<span><i class="fa fa-save mr-1"></i>Save</span>
99
</button>
1010
</span>
1111
</div>

web/src/app/device-service/profile/edit-profile/edit-profile.component.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ import { ActivatedRoute,Router } from '@angular/router';
33

44
import { MetadataService } from '../../../services/metadata.service';
55
import { MessageService } from '../../../message/message.service';
6-
import { DeviceProfileResponse } from '../../../contracts/v2/responses/device-profile-response';
76

87
@Component({
98
selector: 'app-edit-profile',
109
templateUrl: './edit-profile.component.html',
1110
styleUrls: ['./edit-profile.component.css']
1211
})
13-
export class EditProfileComponent implements OnInit,OnDestroy {
12+
export class EditProfileComponent implements OnInit, OnDestroy {
1413

1514
profileYamlSource?: any;
1615
codeMirrorEditor: any;
@@ -29,16 +28,14 @@ export class EditProfileComponent implements OnInit,OnDestroy {
2928
this.metaSvc.findProfileYamlByNameViaUIBackend(params['profileName']).subscribe((data: any) => {
3029
// this.profileYamlSource = data;
3130
this.codeMirrorEditor.setValue(data);
31+
this.codeMirrorEditor.refresh();
3232
});
3333
}
3434
});
3535
}
3636

3737
update() {
38-
// this.profileYamlSource = this.codeMirrorEditor.getValue();
39-
let d = $("#editor").val()
40-
// console.log(d)
41-
// return
38+
this.codeMirrorEditor.refresh();
4239
this.metaSvc.updateProfileYamlContentViaUIBackend(this.codeMirrorEditor.getValue()).subscribe(data => {
4340
this.msgSvc.success('Update profile', `name: ${this.profileName}`);
4441
this.router.navigate(['../device-profile-list'], { relativeTo: this.route });

0 commit comments

Comments
 (0)