diff options
author | Ahmedeldeeb50 <ahmed.eldeeb.ext@orange.com> | 2020-11-04 23:52:50 +0200 |
---|---|---|
committer | Ahmedeldeeb50 <ahmed.eldeeb.ext@orange.com> | 2020-11-04 23:54:37 +0200 |
commit | c7f70199ee2dd237d01dadfa7de6842d766a1ef0 (patch) | |
tree | 654f79a8abb982f9a7095317116053733c87c92b /cds-ui/designer-client | |
parent | 6f84d3c628c549001101a8e7266844ea6c6915e2 (diff) |
Display artifacts in Function attributes tab.
Handle Pre-defined Template option
Issue-ID: CCSDK-2900
Signed-off-by: Ahmedeldeeb50 <ahmed.eldeeb.ext@orange.com>
Change-Id: Id77750a5e9e451405c9a01d349e1f210f31bb792
Diffstat (limited to 'cds-ui/designer-client')
4 files changed, 30 insertions, 2 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts index 8ba7ea030..766c50a98 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/configuration-dashboard/configuration-dashboard.component.ts @@ -207,6 +207,8 @@ export class ConfigurationDashboardComponent extends ComponentCanDeactivate impl this.configurationDashboardService.downloadResource(artifactName + '/' + artifactVersion).subscribe(response => { const blob = new Blob([response], { type: 'application/octet-stream' }); saveAs(blob, artifactName + '-' + artifactVersion + '-CBA.zip'); + + }, err => { }, () => { this.ngxService.stop(); }); } diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.html b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.html index e908bdd66..ab5bb123e 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.html +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.html @@ -58,6 +58,8 @@ </div> <div class="custom-control custom-radio custom-control-inline"> <input type="radio" id="functionRadioInline" name="functionRadioInline" + [checked]="!currentFuncion['inputs']['artifact-prefix-names']?.get_input" + (click)="setArtifact(true)" class="custom-control-input"> <label class="custom-control-label" for="functionRadioInline">Pre-defined Template</label> diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts index 7103552d0..362986d96 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts @@ -64,6 +64,7 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { this.toNodeProcess(this.designerState.template.node_templates[this.functionName], this.functionName); const type = this.designerState.template.node_templates[this.functionName].type; this.getNodeType(type); + this.onInitMapping(); } }); @@ -88,7 +89,25 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { }); }); + } + + onInitMapping() { + // selectedTemplates , templateAndMappingMap + this.selectedTemplates = new Map<string, TemplateAndMapping>(); + try { + const functionMap = this.designerState.template.node_templates[this.functionName].artifacts; + console.log(this.templateAndMappingMap); + + Object.keys(functionMap).forEach((file) => { + const filename = file.substring(0, file.lastIndexOf('-')); + console.log(filename); + if (this.templateAndMappingMap.has(filename)) { + this.selectedTemplates.set(filename, this.templateAndMappingMap.get(filename)); + } + }); + + } catch (e) { } } toNodeProcess(nodeTemplate, functionName) { @@ -138,6 +157,11 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { this.selectedTemplates.forEach((value, key) => { console.log(key); console.log(value); + console.log(finalFunctionData.inputs['artifact-prefix-names']); + + if (Array.isArray(finalFunctionData.inputs['artifact-prefix-names'])) { + finalFunctionData.inputs['artifact-prefix-names'].push(key); + } if (value.isMapping) { this.nodeTemplates.artifacts[key + '-mapping'] = { @@ -196,7 +220,7 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { addTemplates() { } setArtifact(predefined: boolean) { if (predefined) { - + this.currentFuncion.inputs['artifact-prefix-names'] = []; } else { this.currentFuncion.inputs['artifact-prefix-names'] = { get_input: 'template-prefix' }; } diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/model/desinger.nodeTemplate.model.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/model/desinger.nodeTemplate.model.ts index bd3240b88..a33db249d 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/model/desinger.nodeTemplate.model.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/model/desinger.nodeTemplate.model.ts @@ -3,10 +3,10 @@ export class NodeTemplate { properties?: { 'dependency-node-templates'?: string[] }; - interfaces?: {}; artifacts?: {}; cabapilities?: {}; requirements?: {}; + interfaces?: {}; constructor(type) { this.type = type; |