diff options
author | 2020-10-25 20:11:51 +0000 | |
---|---|---|
committer | 2020-10-25 20:11:51 +0000 | |
commit | 1741f11216bc1325673373996f806bdc4ec81b42 (patch) | |
tree | 2ee7c3bb43e56b5c7966316b3c8661193e072eef /cds-ui/designer-client/src/app/modules | |
parent | 275846a635bcd2d17258d316af75bf69d43d7d52 (diff) | |
parent | 7004cffc6b82c448abe62b1642b91f2e45ec2e0b (diff) |
Merge "save resource-resolution component to the package"
Diffstat (limited to 'cds-ui/designer-client/src/app/modules')
2 files changed, 26 insertions, 13 deletions
diff --git a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.store.ts b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.store.ts index 37fc64051..d3326165f 100644 --- a/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.store.ts +++ b/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.store.ts @@ -19,12 +19,12 @@ limitations under the License. ============LICENSE_END============================================ */ -import {Injectable} from '@angular/core'; -import {Store} from '../../../../common/core/stores/Store'; -import {DesignerService} from './designer.service'; -import {DesignerDashboardState} from './model/designer.dashboard.state'; -import {DeclarativeWorkflow} from './model/designer.workflow'; -import {NodeTemplate} from './model/desinger.nodeTemplate.model'; +import { Injectable } from '@angular/core'; +import { Store } from '../../../../common/core/stores/Store'; +import { DesignerService } from './designer.service'; +import { DesignerDashboardState } from './model/designer.dashboard.state'; +import { DeclarativeWorkflow } from './model/designer.workflow'; +import { NodeTemplate } from './model/desinger.nodeTemplate.model'; @Injectable({ @@ -93,14 +93,14 @@ export class DesignerStore extends Store<DesignerDashboardState> { * you can add node template and don't add workflow step when you add dependencies for the * dg-generic function for example */ - addNodeTemplate(nodeTemplateName: string, type: string) { + addNodeTemplate(nodeTemplateName: string, type: string, nodeTemplate: {} = new NodeTemplate(type)) { this.setState({ ...this.state, template: { ...this.state.template, node_templates: { ...this.state.template.node_templates, - [nodeTemplateName]: new NodeTemplate(type) + [nodeTemplateName]: nodeTemplate } } }); 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 624f9c7a8..20305e853 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 @@ -75,6 +75,12 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { } displayFunctionData() { + + // tslint:disable-next-line: variable-name + const node_templates = {}; + const type = 'component-resource-resolution'; + const instanceName = this.currentFuncion['instance-name']; + // insert selected templates in nodeTemplates.artifacts this.selectedTemplates.forEach((value, key) => { console.log(key); console.log(value); @@ -93,20 +99,27 @@ export class FunctionsAttributeComponent implements OnInit, OnDestroy { }; } }); + // instantiate the final node_template object to save + + this.nodeTemplates.type = 'component-resource-resolution'; + node_templates[this.currentFuncion['instance-name']] = this.nodeTemplates; + + delete this.currentFuncion['instance-name']; + this.nodeTemplates.interfaces = { ResourceResolutionComponent: { operations: { process: { - ...this.currentFuncion + ...this.currentFuncion, } } } }; - setTimeout(() => { - console.log(this.currentFuncion); - console.log(this.nodeTemplates); - }, 1500); + console.log(this.currentFuncion); + console.log(node_templates); + // tslint:disable-next-line: no-unused-expression + this.designerStore.addNodeTemplate(instanceName, type, node_templates[instanceName]); } // Template logic private setIsMappingOrTemplate(key: string, templateAndMapping: TemplateAndMapping, isFromTemplate: boolean) { |