From 529d7205b6b3cc36abe4dd2fb507e3c10bb38a79 Mon Sep 17 00:00:00 2001 From: Ahmedeldeeb50 Date: Sun, 17 Jan 2021 17:23:59 +0200 Subject: Remove save button from function Attributes tab Issue-ID: CCSDK-3088 Signed-off-by: Ahmedeldeeb50 Change-Id: I009b2b12826286e017a5f3dcad00b30350bf1a6f --- .../functions-attribute.component.html | 15 +++++----- .../functions-attribute.component.ts | 33 ++++++++++++++++++---- cds-ui/designer-client/tslint.json | 3 +- 3 files changed, 37 insertions(+), 14 deletions(-) (limited to 'cds-ui') 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 a3e662d0f..52b66a3a1 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 @@ -87,8 +87,8 @@ class="icon-required-star" type="button" [ngClass]="{'optional-attribute' : getValue(requiredInput,requiredInputs).required==false}" aria-hidden="true"> - + @@ -123,7 +123,7 @@
@@ -132,7 +132,8 @@ + (focusout)="saveFunctionData()" name="{{'functionRadioInline' + i}}" + class="custom-control-input">
@@ -179,7 +180,7 @@ + (focusout)="saveFunctionData()" class="form-control"> @@ -218,7 +219,7 @@
- + 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 70ccb7305..86552b7db 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 @@ -97,6 +97,8 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { } + + onInitMapping() { // selectedTemplates , templateAndMappingMap // this.selectedTemplates = new Map(); @@ -121,6 +123,7 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { this.selectedTemplates = new Map(this.finalTemplates); } + toNodeProcess(nodeTemplate, functionName) { console.log(nodeTemplate); this.currentFuncion['instance-name'] = functionName; @@ -139,11 +142,11 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { if (inputs) { for (const [key, value] of Object.entries(inputs)) { console.log(key + ' - ' + value); - /* if (typeof value === 'object' || this.isValidJson(value)) { - this.currentFuncion.inputs[key] = JSON.stringify(value); - } else {*/ + /* if (typeof value === 'object' || this.isValidJson(value)) { + this.currentFuncion.inputs[key] = JSON.stringify(value); + } else {*/ this.currentFuncion.inputs[key] = value; - // } + // } } } if (outputs) { @@ -183,11 +186,25 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { addTemplates() { this.finalTemplates = new Map(this.selectedTemplates); + this.saveFunctionData(); } cancel() { this.selectedTemplates = new Map(); } + setProcessAttr(isInput, key, e) { + console.log(e.target.value); + // tslint:disable-next-line: no-string-literal + if (isInput) { + this.currentFuncion['inputs'][key] = e.target.value; + } else { + this.currentFuncion['outputs'][key] = e.target.value; + } + + + this.saveFunctionData(); + } + saveFunctionData() { this.nodeTemplates = new NodeTemplate(''); // tslint:disable-next-line: variable-name @@ -196,6 +213,8 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { // tslint:disable-next-line: no-string-literal const type = finalFunctionData['type']; const instanceName = finalFunctionData['instance-name']; + finalFunctionData.inputs['artifact-prefix-names'] = []; + // insert selected templates in nodeTemplates.artifacts this.selectedTemplates.forEach((value, key) => { console.log(key); @@ -226,7 +245,6 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { } }); // instantiate the final node_template object to save - this.nodeTemplates.type = type; delete this.nodeTemplates.properties; node_templates[finalFunctionData['instance-name']] = this.nodeTemplates; @@ -254,7 +272,7 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { // tslint:disable-next-line: no-unused-expression this.designerStore.addNodeTemplate(instanceName, type, node_templates[instanceName]); // create a new package - this.saveEvent.emit('save'); + // this.saveEvent.emit('save'); } // Template logic private setIsMappingOrTemplate(key: string, templateAndMapping: TemplateAndMapping, isFromTemplate: boolean) { @@ -286,7 +304,10 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { setTemplate(file: string) { if (this.selectedTemplates.has(file)) { + console.log('Not exist'); this.selectedTemplates.delete(file); + this.finalTemplates.delete(file); + } else { this.selectedTemplates.set(file, this.templateAndMappingMap.get(file)); } diff --git a/cds-ui/designer-client/tslint.json b/cds-ui/designer-client/tslint.json index f85fc68d9..d3dd2da59 100644 --- a/cds-ui/designer-client/tslint.json +++ b/cds-ui/designer-client/tslint.json @@ -71,6 +71,7 @@ true, "single" ], + "no-string-literal": false, "trailing-comma": false, "no-conflicting-lifecycle": true, "no-host-metadata-property": true, @@ -88,4 +89,4 @@ "rulesDirectory": [ "codelyzer" ] -} +} \ No newline at end of file -- cgit 1.2.3-korg