Remove function button 24/114524/4
authorAhmedeldeeb50 <ahmed.eldeeb.ext@orange.com>
Tue, 3 Nov 2020 11:01:21 +0000 (13:01 +0200)
committerKAPIL SINGAL <ks220y@att.com>
Tue, 3 Nov 2020 14:03:24 +0000 (14:03 +0000)
fix view mode in function tab

Issue-ID: CCSDK-2900

Signed-off-by: Ahmedeldeeb50 <ahmed.eldeeb.ext@orange.com>
Change-Id: Ia8c25db097d7a4010b11eb462a1805038fdc8b7d

cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.component.html
cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.html
cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/functions-attribute/functions-attribute.component.ts

index 27d493e..61cc1b4 100644 (file)
                                      Action Attributes
                                  </button> -->
                             </div>
-                            <div class="col text-center">
+                            <!-- <div class="col text-center">
                                 <button (click)="sidebarRight2.open()" type="button" class="btn btn-secondary">
                                     Function Attributes
                                 </button>
-                            </div>
+                            </div> -->
                         </div>
                         <button (click)="insertCustomActionIntoBoard()" type="button" class="btn new-action">
                             + &nbsp;&nbsp;New Action
index 4decbf3..e908bdd 100644 (file)
             </div>
         </div>
     </div>
-    <button class="btn btn-info" (click)="displayFunctionData()">Save</button>
+    <button class="btn btn-info" (click)="saveFunctionData()">Save</button>
 </div>
 
 <!--function - Select Template - Modal-->
index 5ab4b43..7103552 100644 (file)
@@ -62,7 +62,8 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy {
                     //  this.currentFuncion = this.designerState.template.node_templates[this.functionName];
                     // reset inouts&outputs
                     this.toNodeProcess(this.designerState.template.node_templates[this.functionName], this.functionName);
-                    this.getNodeType(this.functionName);
+                    const type = this.designerState.template.node_templates[this.functionName].type;
+                    this.getNodeType(type);
                 }
             });
 
@@ -99,7 +100,7 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy {
         this.currentFuncion['instance-name'] = functionName;
         // tslint:disable-next-line: no-string-literal
         this.currentFuncion['type'] = nodeTemplate['type'];
-        if (Object.keys(nodeTemplate.interfaces).length > 0) {
+        if (nodeTemplate.interfaces && Object.keys(nodeTemplate.interfaces).length > 0) {
             const nodeName = Object.keys(nodeTemplate.interfaces)[0];
             // tslint:disable-next-line: no-string-literal
             const inputs = nodeTemplate.interfaces[nodeName]['operations']['process']['inputs'];
@@ -125,13 +126,14 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy {
         this.ngUnsubscribe.complete();
     }
 
-    displayFunctionData() {
+    saveFunctionData() {
 
         // tslint:disable-next-line: variable-name
         const node_templates = {};
+        const finalFunctionData = this.currentFuncion;
         // tslint:disable-next-line: no-string-literal
-        const type = this.currentFuncion['type'];
-        const instanceName = this.currentFuncion['instance-name'];
+        const type = finalFunctionData['type'];
+        const instanceName = finalFunctionData['instance-name'];
         // insert selected templates in nodeTemplates.artifacts
         this.selectedTemplates.forEach((value, key) => {
             console.log(key);
@@ -154,23 +156,23 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy {
         // instantiate the final node_template object to save
 
         this.nodeTemplates.type = type;
-        node_templates[this.currentFuncion['instance-name']] = this.nodeTemplates;
+        node_templates[finalFunctionData['instance-name']] = this.nodeTemplates;
 
-        delete this.currentFuncion['instance-name'];
+        delete finalFunctionData['instance-name'];
         // tslint:disable-next-line: no-string-literal
-        delete this.currentFuncion['type'];
+        delete finalFunctionData['type'];
 
         this.nodeTemplates.interfaces = {
             [this.interfaceChildName]: {
                 operations: {
                     process: {
-                        ...this.currentFuncion,
+                        ...finalFunctionData,
                     }
                 }
             }
         };
 
-        console.log(this.currentFuncion);
+        console.log(finalFunctionData);
         console.log(node_templates);
         // tslint:disable-next-line: no-unused-expression
         this.designerStore.addNodeTemplate(instanceName, type, node_templates[instanceName]);
@@ -231,6 +233,7 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy {
         this.functionStore.state$
             .subscribe(state => {
                 console.log(state);
+                console.log(nodeName);
                 const functions = state.serverFunctions;
                 // tslint:disable-next-line: prefer-for-of
                 for (let i = 0; i < functions.length; i++) {
@@ -257,6 +260,7 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy {
         }
         const nodeName = Object.keys(interfaces)[0];
         this.interfaceChildName = nodeName;
+        console.log(nodeName + ' ------ ' + type);
         console.log(interfaces[nodeName]['operations']['process'][type]);
         const fields = interfaces[nodeName]['operations']['process'][type];
         this.artifactPrefix = false;