From 39ba35a576b26c28ed01391f8361a82150ead4bd Mon Sep 17 00:00:00 2001 From: Arundathi Patil Date: Tue, 26 Feb 2019 16:01:13 +0530 Subject: Deploy component Created UI for buleprint deploy and save Issue-ID: CCSDK-1102 Change-Id: I1c3874361cffc5e446f187d7ea4e4622c94948c8 Signed-off-by: Arundathi Patil --- .../deploy-template/deploy-template.component.html | 39 +++++++++-- .../deploy-template/deploy-template.component.ts | 79 +++++++++++++++++++++- .../deploy-template/deploy-template.module.ts | 4 +- 3 files changed, 116 insertions(+), 6 deletions(-) diff --git a/cds-ui/client/src/app/feature-modules/blueprint/deploy-template/deploy-template.component.html b/cds-ui/client/src/app/feature-modules/blueprint/deploy-template/deploy-template.component.html index fc7083df3..739ef0479 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/deploy-template/deploy-template.component.html +++ b/cds-ui/client/src/app/feature-modules/blueprint/deploy-template/deploy-template.component.html @@ -18,8 +18,39 @@ See the License for the specific language governing permissions and limitations under the License. ============LICENSE_END============================================ --> +
+
+ + + + + + {{node.name}} + + + + + {{node.name}} + + +
-

- deploy-template works! -

- +
+ + +
+ +
diff --git a/cds-ui/client/src/app/feature-modules/blueprint/deploy-template/deploy-template.component.ts b/cds-ui/client/src/app/feature-modules/blueprint/deploy-template/deploy-template.component.ts index 22854e670..ab636b905 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/deploy-template/deploy-template.component.ts +++ b/cds-ui/client/src/app/feature-modules/blueprint/deploy-template/deploy-template.component.ts @@ -19,6 +19,59 @@ limitations under the License. ============LICENSE_END============================================ */ import { Component, OnInit } from '@angular/core'; +import {FlatTreeControl} from '@angular/cdk/tree'; +import {MatTreeFlatDataSource, MatTreeFlattener} from '@angular/material/tree'; + +interface FoodNode { + name: string; + children?: FoodNode[]; +} + +const TREE_DATA: FoodNode[] = [ + { + name: 'Definitions', + children: [ + {name: 'activation-blueprint.json'}, + {name: 'artifacts_types.json'}, + {name: 'data_types.json'}, + ] + }, + { + name: 'Scripts', + children: [ + { + name: 'kotlin', + children: [ + {name: 'ScriptComponent.cba.kts'}, + {name: 'ResourceAssignmentProcessor.cba.kts'}, + ] + } + ] + }, + { + name: 'Templates', + children: [ + { + name: 'baseconfig-template' + } + ] + }, + { + name: 'TOSCA-Metada', + children: [ + { + name: 'TOSCA.meta' + } + ] + }, +]; + +/** Flat node with expandable and level information */ +interface ExampleFlatNode { + expandable: boolean; + name: string; + level: number; +} @Component({ selector: 'app-deploy-template', @@ -27,9 +80,33 @@ import { Component, OnInit } from '@angular/core'; }) export class DeployTemplateComponent implements OnInit { - constructor() { } + private transformer = (node: FoodNode, level: number) => { + return { + expandable: !!node.children && node.children.length > 0, + name: node.name, + level: level, + }; + } + + treeControl = new FlatTreeControl( + node => node.level, node => node.expandable); + + treeFlattener = new MatTreeFlattener( + this.transformer, node => node.level, node => node.expandable, node => node.children); + + dataSource = new MatTreeFlatDataSource(this.treeControl, this.treeFlattener); + + constructor() { + this.dataSource.data = TREE_DATA; + } + + hasChild = (_: number, node: ExampleFlatNode) => node.expandable; ngOnInit() { } + fileClicked(file) { + console.log('selected file:' + file); + } + } diff --git a/cds-ui/client/src/app/feature-modules/blueprint/deploy-template/deploy-template.module.ts b/cds-ui/client/src/app/feature-modules/blueprint/deploy-template/deploy-template.module.ts index e39beacb2..5d5a6000e 100644 --- a/cds-ui/client/src/app/feature-modules/blueprint/deploy-template/deploy-template.module.ts +++ b/cds-ui/client/src/app/feature-modules/blueprint/deploy-template/deploy-template.module.ts @@ -22,6 +22,7 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { DeployTemplateComponent } from './deploy-template.component'; import { DeployTemplateRoutingModule } from './deploy-template-routing.module'; +import { AppMaterialModule } from '../../../common/modules/app-material.module'; @NgModule({ declarations: [ @@ -32,7 +33,8 @@ import { DeployTemplateRoutingModule } from './deploy-template-routing.module'; ], imports: [ CommonModule, - DeployTemplateRoutingModule + DeployTemplateRoutingModule, + AppMaterialModule ] }) export class DeployTemplateModule { } -- cgit 1.2.3-korg