Browse Source

fix: element exist falllback not executed

Ahmad Kholid 3 years ago
parent
commit
1763537883

+ 1 - 4
src/background/workflowEngine/blocksHandler/handlerElementExists.js

@@ -12,10 +12,7 @@ function elementExists(block) {
 
 
         resolve({
         resolve({
           data,
           data,
-          nextBlockId: this.getBlockConnections(
-            block.id,
-            data ? 1 : 'fallback'
-          ),
+          nextBlockId: this.getBlockConnections(block.id, data ? 1 : 2),
         });
         });
       })
       })
       .catch((error) => {
       .catch((error) => {

+ 2 - 11
src/components/block/BlockElementExists.vue

@@ -3,7 +3,7 @@
     :id="componentId"
     :id="componentId"
     class="element-exists"
     class="element-exists"
     style="width: 195px"
     style="width: 195px"
-    @edit="editBlock"
+    @edit="$emit('edit')"
     @delete="$emit('delete', id)"
     @delete="$emit('delete', id)"
   >
   >
     <Handle :id="`${id}-input-1`" type="target" :position="Position.Left" />
     <Handle :id="`${id}-input-1`" type="target" :position="Position.Left" />
@@ -44,7 +44,6 @@
 <script setup>
 <script setup>
 import { useI18n } from 'vue-i18n';
 import { useI18n } from 'vue-i18n';
 import { Handle, Position } from '@braks/vue-flow';
 import { Handle, Position } from '@braks/vue-flow';
-import emitter from '@/lib/mitt';
 import { useComponentId } from '@/composable/componentId';
 import { useComponentId } from '@/composable/componentId';
 import { useEditorBlock } from '@/composable/editorBlock';
 import { useEditorBlock } from '@/composable/editorBlock';
 import BlockBase from './BlockBase.vue';
 import BlockBase from './BlockBase.vue';
@@ -63,19 +62,11 @@ const props = defineProps({
     default: () => ({}),
     default: () => ({}),
   },
   },
 });
 });
-defineEmits(['delete']);
+defineEmits(['delete', 'edit']);
 
 
 const { t } = useI18n();
 const { t } = useI18n();
 const block = useEditorBlock(props.label);
 const block = useEditorBlock(props.label);
 const componentId = useComponentId('block-delay');
 const componentId = useComponentId('block-delay');
-
-function editBlock() {
-  emitter.emit('editor:edit-block', {
-    ...block.details,
-    data: props.data,
-    blockId: block.id,
-  });
-}
 </script>
 </script>
 <style>
 <style>
 .drawflow .element-exists .outputs {
 .drawflow .element-exists .outputs {

+ 2 - 1
src/popup/pages/Home.vue

@@ -32,7 +32,7 @@
         v-tooltip.group="t('common.dashboard')"
         v-tooltip.group="t('common.dashboard')"
         icon
         icon
         :title="t('common.dashboard')"
         :title="t('common.dashboard')"
-        @click="openDashboard"
+        @click="openDashboard('')"
       >
       >
         <v-remixicon name="riHome5Line" />
         <v-remixicon name="riHome5Line" />
       </ui-button>
       </ui-button>
@@ -193,6 +193,7 @@ function deleteWorkflow({ id, name }) {
   });
   });
 }
 }
 function openDashboard(url) {
 function openDashboard(url) {
+  console.log(url);
   sendMessage('open:dashboard', url, 'background');
   sendMessage('open:dashboard', url, 'background');
 }
 }
 async function initElementSelector() {
 async function initElementSelector() {