diff options
author | Brinda Santh Muthuramalingam <brindasanth@in.ibm.com> | 2019-08-29 18:15:56 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-08-29 18:15:56 +0000 |
commit | b12d13b0b78b7e87912c07a7c946cbbfcee41d47 (patch) | |
tree | 9c1f3355534781973ee0a1b818e1e800b0219902 /cds-ui | |
parent | 7a67ca2716ea5480961177b95b6ea09143351915 (diff) | |
parent | ea48b8bba870f2a2c084333a6439b11a57db32d3 (diff) |
Merge "Read only mode for CBA view"
Diffstat (limited to 'cds-ui')
2 files changed, 25 insertions, 13 deletions
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.html b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.html index 619412c17..6424d3f00 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.html +++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.html @@ -45,12 +45,12 @@ limitations under the License. </mat-tree-node> </mat-tree> </div> - <div class="editorConatiner" [ngClass] = "{ 'apply-scrol-to-editor-container' : viewTemplateMode}"> + <div class="editorConatiner" [ngClass]="{ 'apply-scrol-to-editor-container' : viewTemplateMode}"> <!-- <i class="fa fa-save save-icon" style="font-size:24px" (click)="updateBlueprint()"></i> <ace-editor [(text)]="text" [(mode)]="mode" #editor class="aceEditor"></ace-editor> --> <div class="normal-editor-mode" [ngClass]="{ 'resource-mapping-mode': viewTemplateMode}"> <i class="fa fa-save save-icon" style="font-size:24px" (click)="saveEditedChanges()"></i> - <ace-editor [(text)]="text" [(mode)]="mode" #editor class="aceEditor"></ace-editor> + <ace-editor [(text)]="text" [(mode)]="mode" [(readOnly)]="editorReadOnly" #editor class="aceEditor"></ace-editor> </div> <button *ngIf="viewTemplateMode" class="btn-active" (click)="loadConfigParams()">Load Config Parameters</button> <button *ngIf="viewTemplateMode" class="btn-active">Auto Map to Data dictionary</button> diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts index cfd83f7c5..08f1ca130 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts +++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts @@ -41,6 +41,7 @@ import { EditorService } from './editor.service'; import { SortPipe } from '../../../../common/shared/pipes/sort.pipe'; import { NotificationHandlerService } from 'src/app/common/core/services/notification-handler.service'; import { LoaderService } from 'src/app/common/core/services/loader.service'; +import { SelectTemplateService } from '../../select-template/select-template.service'; interface Node { @@ -111,7 +112,7 @@ export class EditorComponent implements OnInit { metadata: IMetaData; uploadedFileName: string; entryDefinition: string; - + editorReadOnly: boolean = false; private transformer = (node: Node, level: number) => { return { expandable: !!node.children && node.children.length > 0, @@ -129,11 +130,12 @@ export class EditorComponent implements OnInit { dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener); artifactName: any; artifactVersion: any; + options: string; constructor(private store: Store<IAppState>, private editorService: EditorService, - private alertService: NotificationHandlerService, private loader: LoaderService - ) - { + private alertService: NotificationHandlerService, private loader: LoaderService, + private dataService: SelectTemplateService + ) { this.dataSource.data = TREE_DATA; this.bpState = this.store.select('blueprint'); // this.dataSource.data = TREE_DATA; @@ -142,6 +144,12 @@ export class EditorComponent implements OnInit { hasChild = (_: number, node: ExampleFlatNode) => node.expandable; ngOnInit() { + this.dataService.currentMessage.subscribe( + res => { + this.options = res; + // this.metdataFormfields(res); + } + ); this.editorContent(); this.dataSource.data = this.filesTree; } @@ -236,6 +244,10 @@ export class EditorComponent implements OnInit { }) this.fileExtension = this.selectedFile.substr(this.selectedFile.lastIndexOf('.') + 1); this.setEditorMode(); + if(this.options == '3') + { + this.editorReadOnly= true; + } } getEnriched() { @@ -258,7 +270,7 @@ export class EditorComponent implements OnInit { }); this.alertService.success('Blueprint enriched successfully'); }, - (error)=>{ + (error) => { this.alertService.error('Enrich:' + error.message); }); }); @@ -277,8 +289,8 @@ export class EditorComponent implements OnInit { .subscribe( data => { this.alertService.success('Success:' + JSON.stringify(data)); - }, error=>{ - this.alertService.error('Save -' +error.message); + }, error => { + this.alertService.error('Save -' + error.message); }); }); @@ -295,7 +307,7 @@ export class EditorComponent implements OnInit { this.editorService.deployPost(formData) .subscribe(data => { this.alertService.success('Saved Successfully:' + JSON.stringify(data)); - }, error=>{ + }, error => { this.alertService.error('Deploy - ' + error.message); }); @@ -312,7 +324,7 @@ export class EditorComponent implements OnInit { this.editorService.publishBlueprint(formData) .subscribe(data => { this.alertService.success('Published:' + JSON.stringify(data)) - }, error=>{ + }, error => { this.alertService.error('Publish - ' + error.message); }); @@ -331,9 +343,9 @@ export class EditorComponent implements OnInit { download() { console.log(this.artifactName); // status = this.editorService.downloadCBA("/download-blueprint/" + this.artifactName + "/" + this.artifactVersion); - this.editorService.downloadCBA("/"+this.artifactName + "/" + this.artifactVersion); + this.editorService.downloadCBA("/" + this.artifactName + "/" + this.artifactVersion); } - + setEditorMode() { switch (this.fileExtension) { case "xml": |