Browse Source

fix: can't execute workflow using JS CustomEvent

Ahmad Kholid 2 years ago
parent
commit
00968c1222
2 changed files with 13 additions and 20 deletions
  1. 0 4
      src/components/ui/UiModal.vue
  2. 13 16
      src/content/services/shortcutListener.js

+ 0 - 4
src/components/ui/UiModal.vue

@@ -78,9 +78,6 @@ export default {
     const show = ref(false);
     const show = ref(false);
     const modalContent = ref(null);
     const modalContent = ref(null);
 
 
-    function onClickOverlay(event) {
-      console.log(event);
-    }
     function toggleBodyOverflow(value) {
     function toggleBodyOverflow(value) {
       document.body.classList.toggle('overflow-hidden', value);
       document.body.classList.toggle('overflow-hidden', value);
     }
     }
@@ -115,7 +112,6 @@ export default {
       show,
       show,
       closeModal,
       closeModal,
       modalContent,
       modalContent,
-      onClickOverlay,
     };
     };
   },
   },
 };
 };

+ 13 - 16
src/content/services/shortcutListener.js

@@ -64,18 +64,21 @@ function workflowShortcutsListener(findWorkflow, shortcutsObj) {
   });
   });
 }
 }
 async function getWorkflows() {
 async function getWorkflows() {
-  const { workflows, workflowHosts } = await browser.storage.local.get([
+  const {
+    workflows: localWorkflows,
+    workflowHosts,
+    teamWorkflows,
+  } = await browser.storage.local.get([
     'workflows',
     'workflows',
     'workflowHosts',
     'workflowHosts',
+    'teamWorkflows',
   ]);
   ]);
-  const localWorkflows = Array.isArray(workflows)
-    ? workflows
-    : Object.values(workflows);
-
-  return {
-    local: localWorkflows,
-    hosted: Object.values(workflowHosts || {}),
-  };
+
+  return [
+    ...Object.values(workflowHosts || {}),
+    ...Object.values(localWorkflows || {}),
+    ...Object.values(Object.values(teamWorkflows || {})[0] || {}),
+  ];
 }
 }
 
 
 export default async function () {
 export default async function () {
@@ -84,7 +87,7 @@ export default async function () {
     let workflows = await getWorkflows();
     let workflows = await getWorkflows();
 
 
     const findWorkflow = (id, publicId = false) => {
     const findWorkflow = (id, publicId = false) => {
-      let workflow = workflows.local.find((item) => {
+      const workflow = workflows.find((item) => {
         if (publicId) {
         if (publicId) {
           return item.settings.publicId === id;
           return item.settings.publicId === id;
         }
         }
@@ -92,12 +95,6 @@ export default async function () {
         return item.id === id;
         return item.id === id;
       });
       });
 
 
-      if (!workflow) {
-        workflow = workflows.hosted.find(({ hostId }) => hostId === id);
-
-        if (workflow) workflow.id = workflow.hostId;
-      }
-
       return workflow;
       return workflow;
     };
     };