Browse Source

fix: last block not appear in log

Ahmad Kholid 3 years ago
parent
commit
cc6c6e3cbc

+ 8 - 3
src/background/collection-engine/flow-handler.js

@@ -1,6 +1,6 @@
 import WorkflowEngine from '../workflow-engine';
 import WorkflowEngine from '../workflow-engine';
 import dataExporter from '@/utils/data-exporter';
 import dataExporter from '@/utils/data-exporter';
-
+/* to-do pass prev workflow tab id into the next one */
 export function workflow(flow) {
 export function workflow(flow) {
   return new Promise((resolve, reject) => {
   return new Promise((resolve, reject) => {
     const currentWorkflow = this.workflows.find(({ id }) => id === flow.itemId);
     const currentWorkflow = this.workflows.find(({ id }) => id === flow.itemId);
@@ -36,8 +36,13 @@ export function workflow(flow) {
         workflowId: currentWorkflow.id,
         workflowId: currentWorkflow.id,
         workflowName: currentWorkflow.name,
         workflowName: currentWorkflow.name,
       });
       });
-
-      resolve({ id, name: currentWorkflow.name, type: status, message });
+      console.log(engine);
+      resolve({
+        id,
+        message,
+        type: status,
+        name: currentWorkflow.name,
+      });
     });
     });
   });
   });
 }
 }

+ 6 - 7
src/background/workflow-engine/index.js

@@ -269,15 +269,14 @@ class WorkflowEngine {
         .then((result) => {
         .then((result) => {
           clearTimeout(this.workflowTimeout);
           clearTimeout(this.workflowTimeout);
           this.workflowTimeout = null;
           this.workflowTimeout = null;
+          this.logs.push({
+            type: 'success',
+            name: tasks[block.name].name,
+            data: result.data,
+            duration: Math.round(Date.now() - started),
+          });
 
 
           if (result.nextBlockId) {
           if (result.nextBlockId) {
-            this.logs.push({
-              type: 'success',
-              name: tasks[block.name].name,
-              data: result.data,
-              duration: Math.round(Date.now() - started),
-            });
-
             this._blockHandler(this.blocks[result.nextBlockId], result.data);
             this._blockHandler(this.blocks[result.nextBlockId], result.data);
           } else {
           } else {
             this.logs.push({
             this.logs.push({

+ 3 - 0
src/components/newtab/workflow/WorkflowBuilder.vue

@@ -162,6 +162,9 @@ export default {
       editor.value.on('connectionRemoved', () => {
       editor.value.on('connectionRemoved', () => {
         emitter.emit('editor:data-changed');
         emitter.emit('editor:data-changed');
       });
       });
+      editor.value.on('contextmenu', (event) => {
+        console.log(event);
+      });
 
 
       setTimeout(() => {
       setTimeout(() => {
         editor.value.zoom_refresh();
         editor.value.zoom_refresh();

+ 1 - 1
src/newtab/pages/Collections.vue

@@ -2,7 +2,7 @@
   <div class="container pt-8 pb-4">
   <div class="container pt-8 pb-4">
     <h1 class="text-2xl font-semibold">Collections</h1>
     <h1 class="text-2xl font-semibold">Collections</h1>
     <p class="text-gray-600 dark:text-gray-200">
     <p class="text-gray-600 dark:text-gray-200">
-      Execute your workflows continuously
+      Execute your workflows in sequence
     </p>
     </p>
     <div class="flex items-center my-6 space-x-4">
     <div class="flex items-center my-6 space-x-4">
       <ui-input
       <ui-input

+ 1 - 1
src/newtab/pages/collections/[id].vue

@@ -129,7 +129,7 @@
                         ? 'bg-yellow-200'
                         ? 'bg-yellow-200'
                         : 'bg-green-200',
                         : 'bg-green-200',
                     ]"
                     ]"
-                    class="absolute w-2 left-0 top-0 h-full"
+                    class="absolute w-1 left-0 top-0 h-full"
                   ></span>
                   ></span>
                   <v-remixicon :name="element.icon" class="mr-4" />
                   <v-remixicon :name="element.icon" class="mr-4" />
                   <p class="flex-1 text-overflow">{{ element.name }}</p>
                   <p class="flex-1 text-overflow">{{ element.name }}</p>