aboutsummaryrefslogtreecommitdiffstats
path: root/cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.store.ts
diff options
context:
space:
mode:
authorAhmed Abbas <ahmad.helmy@orange.com>2020-02-24 14:59:21 +0200
committerAhmed Abbas <ahmad.helmy@orange.com>2020-02-24 21:08:52 +0200
commit2203e84a0fd3308ce99e4de6ed2519e663008316 (patch)
tree7780cf9966983953e705331c3cf67e36b385a9ce /cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.store.ts
parentebcc45b8c8703cadc49cf3a0b888545845ccb9e6 (diff)
add single function to action and save it to frontend store.
Issue-ID: CCSDK-2017 Signed-off-by: Ahmed Abbas <ahmad.helmy@orange.com> Change-Id: I866eadb31bcb56aec5aa05a1dd4b0989c47c6210
Diffstat (limited to 'cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.store.ts')
-rw-r--r--cds-ui/designer-client/src/app/modules/feature-modules/packages/designer/designer.store.ts59
1 files changed, 53 insertions, 6 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 be98eec88..f2972d03b 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
@@ -22,8 +22,10 @@ limitations under the License.
import {Injectable} from '@angular/core';
import {Store} from '../../../../common/core/stores/Store';
import {DesignerService} from './designer.service';
-import {ModelType} from '../model/ModelType.model';
-import {DesignerDashboardState} from '../model/designer-dashboard.state';
+import {ModelType} from './model/ModelType.model';
+import {DesignerDashboardState} from './model/designer.dashboard.state';
+import { DeclarativeWorkflow } from './model/designer.workflow';
+import { NodeTemplate } from './model/desinger.nodeTemplate.model';
@Injectable({
@@ -35,15 +37,60 @@ export class DesignerStore extends Store<DesignerDashboardState> {
super(new DesignerDashboardState());
}
- public getFuntions() {
+ public retrieveFuntions() {
const modelDefinitionType = 'node_type';
this.designerService.getFunctions(modelDefinitionType).subscribe(
- (modelType: ModelType[]) => {
- console.log(modelType);
+ (modelTypeList: ModelType[]) => {
+ console.log(modelTypeList);
this.setState({
...this.state,
- functions: modelType,
+ serverFunctions: modelTypeList,
});
});
}
+
+ /**
+ * adds empty workflow with name only.
+ * called when blank action is added to the board
+ * declarative workflow just contain the steps but its order is determind by dg-graph
+ */
+ addDeclarativeWorkFlow(workflowName: string) {
+ this.setState({
+ ...this.state,
+ template: {
+ ...this.state.template,
+ workflows:
+ this.state.template.workflows.set(workflowName, new DeclarativeWorkflow())
+ }
+ });
+ }
+
+ addStepToDeclarativeWorkFlow(workflowName: string, stepType: string) {
+ const currentWorkflow: DeclarativeWorkflow = this.state.template.workflows.get(workflowName);
+ currentWorkflow.steps = {
+ target: stepType,
+ description: ''
+ };
+ const allNewWorkflowsMap =
+ this.state.template.workflows.set(workflowName, currentWorkflow);
+ this.setState({
+ ...this.state,
+ template: {
+ ...this.state.template,
+ workflows: allNewWorkflowsMap
+ }
+ });
+ }
+
+
+ addNodeTemplate(nodeTemplateName: string) {
+ this.setState({
+ ...this.state,
+ template: {
+ ...this.state.template,
+ node_templates:
+ this.state.template.node_templates.set(nodeTemplateName, new NodeTemplate())
+ }
+ });
+ }
}