Add ability to save and view a list of workflows
This CL introduces the following functionality:
- Introduces some logic to handle the persistence of workflows in the
browser storage.
- Lets the user save created workflows in the "create workflow" dialog.
- Shows a list of workflows. If the user hasn't added any workflow, a
placeholder image is shown alongside a text which invites the user to
create a new workflow.
Bug: twpowertools:74
Change-Id: Icba09d20468bafc1415b802a3c935e22669546e6
diff --git a/src/workflows/manager/components/WorkflowEditor.js b/src/workflows/manager/components/WorkflowEditor.js
index 4a8ab90..dcd38cd 100644
--- a/src/workflows/manager/components/WorkflowEditor.js
+++ b/src/workflows/manager/components/WorkflowEditor.js
@@ -7,6 +7,7 @@
import {repeat} from 'lit/directives/repeat.js';
import * as pb from '../../proto/main_pb.js';
+import WorkflowsStorage from '../../workflowsStorage.js';
export default class WFWorkflowEditor extends LitElement {
static properties = {
@@ -82,7 +83,8 @@
const actionEditors = this.renderRoot.querySelectorAll('wf-action-editor');
for (const editor of actionEditors) allValid &&= editor.checkValidity();
- // @TODO: Save if allValid === true
+ // Save the workflow if the validation checks passed
+ if (allValid) WorkflowsStorage.add(this.workflow);
return allValid;
}