summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Timoney <dtimoney@att.com>2019-04-16 13:33:01 +0000
committerGerrit Code Review <gerrit@onap.org>2019-04-16 13:33:01 +0000
commit8344dc8ae21ece556581b9820b0f018e68ae4a0d (patch)
tree4f6fb71611f4eed35d5cf39c872d303af2f4b0a7
parent114206c8104c7815851f411342c0e2bd5cffa096 (diff)
parent789d7aed42ec7ee9bff6e0f1b09c71696a53d26b (diff)
Merge "Fixed issue ccsdk-1223"
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.html6
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.ts66
-rw-r--r--cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts7
3 files changed, 55 insertions, 24 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 5a3973a5e..619412c17 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
@@ -35,13 +35,13 @@ limitations under the License.
<button mat-icon-button disabled></button>
<button mat-icon-button (click)="selectFileToView(node)">{{node.name}}</button>
</mat-tree-node>
- <mat-tree-node *matTreeNodeDef="let node;when: hasChild" matTreeNodePadding (click)="activeNode = node" [ngClass]="{ 'background-highlight': activeNode === node }">
+ <mat-tree-node *matTreeNodeDef="let node;when: hasChild" matTreeNodePadding (click)="selectFolder(node);activeNode = node" [ngClass]="{ 'background-highlight': activeNode === node }">
<button mat-icon-button matTreeNodeToggle [attr.aria-label]="'toggle ' + node.name">
<mat-icon class="mat-icon-rtl-mirror">
{{treeControl.isExpanded(node) ? 'expand_more' : 'chevron_right'}}
</mat-icon>
</button>
- <button mat-icon-button (click)="selectFolder(node)">{{node.name}}</button>
+ <button mat-icon-button>{{node.name}}</button>
</mat-tree-node>
</mat-tree>
</div>
@@ -49,7 +49,7 @@ limitations under the License.
<!-- <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)="updateBlueprint()"></i>
+ <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>
</div>
<button *ngIf="viewTemplateMode" class="btn-active" (click)="loadConfigParams()">Load Config Parameters</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 73cc72cfd..1f8526a53 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
@@ -165,7 +165,7 @@ export class EditorComponent implements OnInit {
blueprint.push(this.blueprintdata[key]);
}
}
- this.metadata=blueprintState.blueprint.metadata;
+ this.metadata = blueprintState.blueprint.metadata;
let metadatavalues = [];
for (let key in this.metadata) {
if (this.metadata.hasOwnProperty(key)) {
@@ -181,21 +181,21 @@ export class EditorComponent implements OnInit {
}
updateBlueprint() {
- console.log(this.blueprint);
- this.filesData.forEach(fileNode => {
- if (this.selectedFile && fileNode.name.includes(this.blueprintName.trim()) && fileNode.name.includes(this.selectedFile.trim())) {
- fileNode.data = this.text;
- } else if (this.selectedFile && fileNode.name.includes(this.currentFilePath)) {
- // this.selectedFile && fileNode.name.includes(this.selectedFile.trim())) {
- fileNode.data = this.text;
- }
- });
+ // console.log(this.blueprint);
+ // this.filesData.forEach(fileNode => {
+ // if (this.selectedFile && fileNode.name.includes(this.blueprintName.trim()) && fileNode.name.includes(this.selectedFile.trim())) {
+ // fileNode.data = this.text;
+ // } else if (this.selectedFile && fileNode.name.includes(this.currentFilePath)) {
+ // // this.selectedFile && fileNode.name.includes(this.selectedFile.trim())) {
+ // fileNode.data = this.text;
+ // }
+ // });
- if (this.selectedFile && this.selectedFile == this.blueprintName.trim()) {
- this.blueprint = JSON.parse(this.text);
- } else {
- this.blueprint = this.blueprintdata;
- }
+ // if (this.selectedFile && this.selectedFile == this.blueprintName.trim()) {
+ // this.blueprint = JSON.parse(this.text);
+ // } else {
+ // this.blueprint = this.blueprintdata;
+ // }
let blueprintState = {
blueprint: this.blueprint,
@@ -243,11 +243,11 @@ export class EditorComponent implements OnInit {
console.log("processed");
}
});
- window.alert('Blueprint enriched successfully' );
+ window.alert('Blueprint enriched successfully');
});
});
}
-
+
saveToBackend() {
@@ -300,7 +300,9 @@ export class EditorComponent implements OnInit {
create() {
this.filesData.forEach((path) => {
- this.zipFile.file(path.name, path.data);
+ let index = path.name.indexOf("/");
+ let name = path.name.slice(index + 1, path.name.length);
+ this.zipFile.file(name, path.data);
});
}
@@ -318,6 +320,13 @@ export class EditorComponent implements OnInit {
// console.log(error);
// }
// );
+
+ // this.create();
+ // var zipFilename = "baseconfiguration.zip";
+ // this.zipFile.generateAsync({ type: "blob" })
+ // .then(blob => {
+ // saveAs(blob, zipFilename);
+ // });
}
setEditorMode() {
switch (this.fileExtension) {
@@ -436,7 +445,7 @@ export class EditorComponent implements OnInit {
this.blueprintName = (((toscaData['Entry-Definitions']).split('/'))[1]).toString();;
console.log(toscaData);
}
-
+
arrangeTreeData(paths) {
const tree = [];
@@ -557,4 +566,23 @@ export class EditorComponent implements OnInit {
return paramValue;
}
}
+
+ saveEditedChanges() {
+ this.filesData.forEach(fileNode => {
+ if (this.selectedFile && fileNode.name.includes(this.blueprintName.trim()) && fileNode.name.includes(this.selectedFile.trim())) {
+ fileNode.data = this.text;
+ } else if (this.selectedFile && fileNode.name.includes(this.currentFilePath)) {
+ // this.selectedFile && fileNode.name.includes(this.selectedFile.trim())) {
+ fileNode.data = this.text;
+ }
+ });
+
+ if (this.selectedFile && this.selectedFile == this.blueprintName.trim()) {
+ this.blueprint = JSON.parse(this.text);
+ } else {
+ this.blueprint = this.blueprintdata;
+ }
+
+ this.updateBlueprint();
+ }
}
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
index 36876233d..9c11f7684 100644
--- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
+++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.ts
@@ -42,7 +42,7 @@ export class SearchTemplateComponent implements OnInit {
blueprintState: IBlueprintState;
bpState: Observable<IBlueprintState>;
validfile: boolean = false;
-
+ uploadedFileName: string;
@ViewChild('fileInput') fileInput;
result: string = '';
@@ -62,6 +62,7 @@ export class SearchTemplateComponent implements OnInit {
fileChanged(e: any) {
this.paths = [];
this.file = e.target.files[0];
+ this.uploadedFileName = (this.file.name.split('.'))[0];
this.zipFile.files = {};
this.zipFile.loadAsync(this.file)
.then((zip) => {
@@ -88,7 +89,9 @@ export class SearchTemplateComponent implements OnInit {
this.paths = [];
for (var file in zip.files) {
this.fileObject = {
- name: zip.files[file].name,
+ // nameForUIDisplay: this.uploadedFileName + '/' + zip.files[file].name,
+ // name: zip.files[file].name,
+ name: this.uploadedFileName + '/' + zip.files[file].name,
data: ''
};
const value = <any>await zip.files[file].async('string');