diff options
author | 2020-02-27 16:35:57 +0200 | |
---|---|---|
committer | 2020-02-27 17:33:43 +0200 | |
commit | b2b847587d7c06db5737a06820d1809b9aeb73e1 (patch) | |
tree | c927c31a70e9232554dd8bc4d5bc681a0a92b52d /cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts | |
parent | 71f6d98f1003dc9acc212e4132f03bb21c0b73c8 (diff) |
Adding view and edit feature
Issue-ID: CCSDK-2123
Signed-off-by: shaaban Altanany <shaaban.eltanany.ext@orange.com>
Change-Id: I6fa4469a982a3c6f76002909813480c9ac4d0e65
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts')
-rw-r--r-- | cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts | 57 |
1 files changed, 36 insertions, 21 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts index eb486cf4f..b99925716 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/package-creation/metadata-tab/metadata-tab.component.ts @@ -1,8 +1,9 @@ -import { Component, OnInit } from '@angular/core'; -import { PackageCreationService } from '../package-creation.service'; -import { MetaDataTabModel } from '../mapping-models/metadata/MetaDataTab.model'; -import { PackageCreationStore } from '../package-creation.store'; -import { PackageStore } from '../../configuration-dashboard/package.store'; +import {Component, OnInit} from '@angular/core'; +import {PackageCreationService} from '../package-creation.service'; +import {MetaDataTabModel} from '../mapping-models/metadata/MetaDataTab.model'; +import {PackageCreationStore} from '../package-creation.store'; +import {PackageStore} from '../../configuration-dashboard/package.store'; +import {ActivatedRoute} from '@angular/router'; @Component({ @@ -11,37 +12,47 @@ import { PackageStore } from '../../configuration-dashboard/package.store'; styleUrls: ['./metadata-tab.component.css'] }) export class MetadataTabComponent implements OnInit { - + packageNameAndVersionEnables = true; counter = 0; tags = new Set<string>(); customKeysMap = new Map(); modes: object[] = [ - { name: 'Designer Mode', style: 'mode-icon icon-designer-mode' }, - { name: 'Scripting Mode', style: 'mode-icon icon-scripting-mode' }, - { name: 'Generic Script Mode', style: 'mode-icon icon-generic-script-mode' }]; + {name: 'Designer Mode', style: 'mode-icon icon-designer-mode'}]; + /* {name: 'Scripting Mode', style: 'mode-icon icon-scripting-mode'}, + {name: 'Generic Script Mode', style: 'mode-icon icon-generic-script-mode'}];*/ private metaDataTab: MetaDataTabModel = new MetaDataTabModel(); private errorMessage: string; - constructor( - private packageCreationService: PackageCreationService, - private packageCreationStore: PackageCreationStore, - private packageStore: PackageStore) { + constructor(private route: ActivatedRoute, + private packageCreationService: PackageCreationService, + private packageCreationStore: PackageCreationStore, + private packageStore: PackageStore) { } ngOnInit() { this.metaDataTab.templateTags = this.tags; this.metaDataTab.mapOfCustomKey = this.customKeysMap; - this.packageCreationStore.changeMetaData(this.metaDataTab); - this.packageStore.state$.subscribe(element => { - if (element && element.configuration) { - console.log('from element2'); + const id = this.route.snapshot.paramMap.get('id'); + id ? this.packageNameAndVersionEnables = false : + this.packageNameAndVersionEnables = true; + this.packageCreationStore.state$.subscribe(element => { + + if (element && element.metaData) { + + this.metaDataTab.name = element.metaData.name; + this.metaDataTab.version = element.metaData.version; + this.metaDataTab.description = element.metaData.description; + this.tags = element.metaData.templateTags; + this.metaDataTab.templateTags = this.tags; console.log(element); - this.metaDataTab.name = element.configuration.artifactName; - this.metaDataTab.version = element.configuration.artifactVersion; - this.metaDataTab.description = element.configuration.artifactDescription; - this.tags = new Set(element.configuration.tags.split(',')); + if (element.metaData.mode && element.metaData.mode.includes(' DEFAULT')) { + this.metaDataTab.mode = 'Designer Mode'; + } + + this.customKeysMap = element.metaData.mapOfCustomKey; + // this.tags = element.metaData.templateTags; } }); @@ -95,4 +106,8 @@ export class MetadataTabComponent implements OnInit { } } + + saveMetaDataToStore() { + this.packageCreationStore.changeMetaData(this.metaDataTab); + } } |