diff options
author | Dan Timoney <dtimoney@att.com> | 2019-02-27 00:42:31 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-02-27 00:42:31 +0000 |
commit | 0995b06fc7e10dd8607ed4fbcb53a15418a8b2f3 (patch) | |
tree | 2cf355664eb6544192e24ba3ffc59c2361368029 /cds-ui/client/src/app/feature-modules/blueprint/deploy-template/deploy-template.component.ts | |
parent | 47f21a59c471c60696efcd09f5fbd07dee6e8d37 (diff) | |
parent | 39ba35a576b26c28ed01391f8361a82150ead4bd (diff) |
Merge "Deploy component"
Diffstat (limited to 'cds-ui/client/src/app/feature-modules/blueprint/deploy-template/deploy-template.component.ts')
-rw-r--r-- | cds-ui/client/src/app/feature-modules/blueprint/deploy-template/deploy-template.component.ts | 79 |
1 files changed, 78 insertions, 1 deletions
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<ExampleFlatNode>( + 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); + } + } |