diff options
6 files changed, 28 insertions, 18 deletions
diff --git a/cds-ui/client/src/app/common/shared/components/home/home.component.html b/cds-ui/client/src/app/common/shared/components/home/home.component.html index e23263f9a..dc0181cff 100644 --- a/cds-ui/client/src/app/common/shared/components/home/home.component.html +++ b/cds-ui/client/src/app/common/shared/components/home/home.component.html @@ -42,7 +42,7 @@ limitations under the License. <mat-toolbar color=""primary>Menu</mat-toolbar> <mat-nav-list> <a mat-list-item [routerLink]="['/blueprint']">Controlled Blueprint</a> - <a mat-list-item [routerLink]="['/resource-definition']">Data dictionory</a> + <a mat-list-item [routerLink]="['/resource-definition']">Resource Definition</a> </mat-nav-list> </mat-sidenav> 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 bcf2d1549..53bbc6dfa 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 @@ -70,7 +70,7 @@ limitations under the License. color: white; border-radius: 2em; padding: 0.5em; - min-width: 6em;">Save Changes</button> + min-width: 6em;" (click)="updateBlueprint()">Save Changes</button> </div> <div style="height: 6em; width: 100%;"> @@ -98,7 +98,7 @@ limitations under the License. color: white; border-radius: 2em; padding: 0.5em; - min-width: 6em;">Download</button> + min-width: 6em;" (click)="download()">Download</button> </div> </div> diff --git a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.scss b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.scss index f189af656..58f0ab85d 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.scss +++ b/cds-ui/client/src/app/feature-modules/blueprint/modify-template/editor/editor.component.scss @@ -26,14 +26,14 @@ limitations under the License. .fileViewContainer { width: 20%; margin: 2px; - height: 450px !important; + height: 490px !important; overflow-x: scroll; overflow-y: scroll; } .editorConatiner { width: 80%; background-color: gainsboro; - height: 450px !important; + height: 490px !important; } } 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 5092a698e..37ac522af 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 @@ -161,7 +161,7 @@ export class EditorComponent implements OnInit { } }); - if (this.selectedFile == this.blueprintName) { + if (this.selectedFile == this.blueprintName.trim()) { this.blueprint = JSON.parse(this.text); } else { this.blueprint = this.blueprintdata; diff --git a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.html b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.html index bb00d7f1a..66e3aeb36 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.html +++ b/cds-ui/client/src/app/feature-modules/blueprint/select-template/search-template/search-template.component.html @@ -22,5 +22,5 @@ limitations under the License. <input type="file" accept=".zip" (change)="fileChanged($event)"> </div> <div> - <button mat-button matStepperNext class="matStepNextBtn" (click)="updateBlueprintState()">Upload</button> + <button mat-button matStepperNext class="matStepNextBtn" (click)="updateBlueprintState()" [disabled]="!validfile">Upload</button> </div>
\ No newline at end of file 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 1ce33f6ab..777faee68 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 @@ -41,6 +41,7 @@ export class SearchTemplateComponent implements OnInit { fileText: object[]; blueprintState: IBlueprintState; bpState: Observable<IBlueprintState>; + validfile: boolean = false; @ViewChild('fileInput') fileInput; result: string = ''; @@ -60,7 +61,7 @@ export class SearchTemplateComponent implements OnInit { fileChanged(e: any) { this.file = e.target.files[0]; - + this.zipFile.files = {}; this.zipFile.loadAsync(this.file) .then((zip) => { if(zip) { @@ -70,14 +71,6 @@ export class SearchTemplateComponent implements OnInit { } updateBlueprintState() { - // let fileReader = new FileReader(); - // fileReader.readAsText(this.file); - // var me = this; - // fileReader.onload = function () { - // var data: IBlueprint = JSON.parse(fileReader.result.toString()); - // me.store.dispatch(new LoadBlueprintSuccess(data)); - // } - let data: IBlueprint = this.activationBlueprint ? JSON.parse(this.activationBlueprint.toString()) : this.activationBlueprint; let blueprintState = { blueprint: data, @@ -90,6 +83,8 @@ export class SearchTemplateComponent implements OnInit { } async buildFileViewData(zip) { + this.validfile = false; + this.paths = []; for (var file in zip.files) { this.fileObject = { name: zip.files[file].name, @@ -99,8 +94,23 @@ export class SearchTemplateComponent implements OnInit { this.fileObject.data = value; this.paths.push(this.fileObject); } - this.fetchTOSACAMetadata(); - this.tree = this.arrangeTreeData(this.paths); + + if(this.paths) { + this.paths.forEach(path =>{ + if(path.name.includes("TOSCA.meta")) { + this.validfile = true + } + }); + } else { + alert('Please update proper file'); + } + + if(this.validfile) { + this.fetchTOSACAMetadata(); + this.tree = this.arrangeTreeData(this.paths); + } else { + alert('Please update proper file with TOSCA metadata'); + } } arrangeTreeData(paths) { |