From ed64b5edff15e702493df21aa3230b81593e6133 Mon Sep 17 00:00:00 2001 From: Michael Lando Date: Fri, 9 Jun 2017 03:19:04 +0300 Subject: [SDC-29] catalog 1707 rebase commit. Change-Id: I43c3dc5cf44abf5da817649bc738938a3e8388c1 Signed-off-by: Michael Lando --- .../tosca-artifacts/tosca-artifacts-view-model.ts | 84 ++++++++++++++++++++++ .../tabs/tosca-artifacts/tosca-artifacts-view.html | 49 +++++++++++++ .../tabs/tosca-artifacts/tosca-artifacts.less | 78 ++++++++++++++++++++ 3 files changed, 211 insertions(+) create mode 100644 catalog-ui/src/app/view-models/workspace/tabs/tosca-artifacts/tosca-artifacts-view-model.ts create mode 100644 catalog-ui/src/app/view-models/workspace/tabs/tosca-artifacts/tosca-artifacts-view.html create mode 100644 catalog-ui/src/app/view-models/workspace/tabs/tosca-artifacts/tosca-artifacts.less (limited to 'catalog-ui/src/app/view-models/workspace/tabs/tosca-artifacts') diff --git a/catalog-ui/src/app/view-models/workspace/tabs/tosca-artifacts/tosca-artifacts-view-model.ts b/catalog-ui/src/app/view-models/workspace/tabs/tosca-artifacts/tosca-artifacts-view-model.ts new file mode 100644 index 0000000000..06022786ee --- /dev/null +++ b/catalog-ui/src/app/view-models/workspace/tabs/tosca-artifacts/tosca-artifacts-view-model.ts @@ -0,0 +1,84 @@ +'use strict'; +import {ArtifactModel, IFileDownload} from "app/models"; +import {IWorkspaceViewModelScope} from "app/view-models/workspace/workspace-view-model"; +import {ComponentGenericResponse} from "../../../../ng2/services/responses/component-generic-response"; +import {ComponentServiceNg2} from "../../../../ng2/services/component-services/component.service"; +export interface IToscaArtifactsScope extends IWorkspaceViewModelScope { + artifacts:Array; + tableHeadersList:Array; + artifactType:string; + downloadFile:IFileDownload; + isLoading:boolean; + sortBy:string; + reverse:boolean; + + getTitle():string; + download(artifact:ArtifactModel):void; + sort(sortBy:string):void; + showNoArtifactMessage():boolean; +} + +export class ToscaArtifactsViewModel { + + static '$inject' = [ + '$scope', + '$filter', + 'ComponentServiceNg2' + ]; + + constructor(private $scope:IToscaArtifactsScope, + private $filter:ng.IFilterService, + private ComponentServiceNg2:ComponentServiceNg2) { + this.initToscaArtifacts(); + this.$scope.updateSelectedMenuItem(); + } + + private initToscaArtifacts = (): void => { + + if(!this.$scope.component.toscaArtifacts) { + this.$scope.isLoading = true; + this.ComponentServiceNg2.getComponentToscaArtifacts(this.$scope.component).subscribe((response:ComponentGenericResponse) => { + this.$scope.component.toscaArtifacts = response.toscaArtifacts; + this.initScope(); + this.$scope.isLoading = false; + }, () => { + this.$scope.isLoading = false; + }); + } else { + this.initScope(); + } + } + + private initScope = ():void => { + this.$scope.isLoading = false; + this.$scope.sortBy = 'artifactDisplayName'; + this.$scope.reverse = false; + this.$scope.setValidState(true); + this.$scope.artifactType = 'informational'; + this.$scope.getTitle = ():string => { + return this.$filter("resourceName")(this.$scope.component.name) + ' Artifacts'; + + }; + + this.$scope.tableHeadersList = [ + {title: 'Name', property: 'artifactDisplayName'}, + {title: 'Type', property: 'artifactType'}, + {title: 'Version', property: 'artifactVersion'} + ]; + + this.$scope.artifacts = _.values(this.$scope.component.toscaArtifacts); + this.$scope.sort = (sortBy:string):void => { + this.$scope.reverse = (this.$scope.sortBy === sortBy) ? !this.$scope.reverse : false; + this.$scope.sortBy = sortBy; + }; + + + this.$scope.showNoArtifactMessage = ():boolean => { + if (this.$scope.artifacts.length === 0) { + return true; + } + return false; + }; + + } +} diff --git a/catalog-ui/src/app/view-models/workspace/tabs/tosca-artifacts/tosca-artifacts-view.html b/catalog-ui/src/app/view-models/workspace/tabs/tosca-artifacts/tosca-artifacts-view.html new file mode 100644 index 0000000000..5df6b5c11f --- /dev/null +++ b/catalog-ui/src/app/view-models/workspace/tabs/tosca-artifacts/tosca-artifacts-view.html @@ -0,0 +1,49 @@ +
+
+
+
+
{{header.title}} + +
+
+
+
+ +
+ There are no TOSCA artifacts to display +
+
+ +
+ + {{artifact.artifactDisplayName}} +
+ +
+ {{artifact.artifactType}} +
+ +
+ {{artifact.artifactVersion}} +
+ +
+ +
+
+
+
Label: {{artifact.artifactLabel}}
+
UUID: {{artifact.uniqueId}}
+
Description: {{artifact.description}}
+ + +
+ +
+
+
+
+
diff --git a/catalog-ui/src/app/view-models/workspace/tabs/tosca-artifacts/tosca-artifacts.less b/catalog-ui/src/app/view-models/workspace/tabs/tosca-artifacts/tosca-artifacts.less new file mode 100644 index 0000000000..6dfec2980f --- /dev/null +++ b/catalog-ui/src/app/view-models/workspace/tabs/tosca-artifacts/tosca-artifacts.less @@ -0,0 +1,78 @@ +.workspace-tosca-artifact { + width: 93%; + display: inline-block; + .w-sdc-classic-btn { + float: right; + margin-bottom: 10px; + } + + .details-title{ + font-weight: bold; + margin-right: 5px; + } + + .table{ + height: 490px; + margin-bottom: 0; + } + + + .table-container-flex { + margin-top: 27px; + + .item-opened{ + word-wrap: break-word; + } + + + .flex-item:nth-child(1) { + flex-grow: 15; + .hand; + span.table-arrow { + margin-right: 7px; + } + } + + .flex-item:nth-child(2) { + flex-grow: 6; + } + + .flex-item:nth-child(3) { + flex-grow: 1; + } + + .flex-item:nth-child(4) { + flex-grow: 1; + } + + + + + .table-download-btn{ + &.tosca{ + margin-left: 0; + margin-top: 8px; + } + } + + .download-icon-container{ + position: relative; + + .loader{ + left: 60%; + top: 45px; + border: none; + background-color: transparent; + height: 0px; + width: 63px; + outline: none; + + } + } + + + } + +} + + -- cgit 1.2.3-korg