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.ts | 79 +++++++++++++++++++++- 1 file changed, 78 insertions(+), 1 deletion(-) (limited to 'cds-ui/client/src/app/feature-modules/blueprint/deploy-template/deploy-template.component.ts') 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); + } + } -- cgit 1.2.3-korg