Workflow manager: edit and delete workflows

This CL adds the ability to view/edit and delete workflows in the
workflow manager. With this, the workflow manager initial prototype is
complete, since it allows the user to fully manage their workflows, even
if the UI might be subject to change to further improve it in the
future.

Bug: twpowertools:74
Change-Id: I4f8d1b7ab54dcc600dbd10fcb8e605bcb61d36bb
diff --git a/src/workflows/manager/components/WorkflowEditor.js b/src/workflows/manager/components/WorkflowEditor.js
index dcd38cd..33c9224 100644
--- a/src/workflows/manager/components/WorkflowEditor.js
+++ b/src/workflows/manager/components/WorkflowEditor.js
@@ -73,7 +73,7 @@
     ];
   }
 
-  save() {
+  checkValidity() {
     let allValid = true;
 
     // Check the workflow name is set
@@ -83,8 +83,19 @@
     const actionEditors = this.renderRoot.querySelectorAll('wf-action-editor');
     for (const editor of actionEditors) allValid &&= editor.checkValidity();
 
+    return allValid;
+  }
+
+  save(uuid) {
+    const allValid = this.checkValidity();
+
     // Save the workflow if the validation checks passed
-    if (allValid) WorkflowsStorage.add(this.workflow);
+    if (allValid) {
+      if (!uuid)
+        WorkflowsStorage.add(this.workflow);
+      else
+        WorkflowsStorage.update(uuid, this.workflow);
+    }
 
     return allValid;
   }