Bläddra i källkod

feat: add "get tab URL" block

Ahmad Kholid 3 år sedan
förälder
incheckning
21990c0bb3

+ 0 - 1
src/background/workflowEngine/blocksHandler/handlerLogData.js

@@ -2,7 +2,6 @@ import dbLogs from '@/db/logs';
 
 export async function logData({ id, data }) {
   if (!data.workflowId) {
-    console.log(data);
     throw new Error('No workflow is selected');
   }
 

+ 1 - 1
src/components/block/BlockBase.vue

@@ -1,5 +1,5 @@
 <template>
-  <div class="block-base relative w-48" @dblclick="$emit('edit')">
+  <div class="block-base relative w-48" @dblclick.stop="$emit('edit')">
     <slot name="prepend" />
     <ui-card :class="contentClass" class="z-10 relative block-base__content">
       <slot></slot>

+ 5 - 1
src/components/block/BlockConditions.vue

@@ -1,5 +1,9 @@
 <template>
-  <ui-card :id="componentId" class="w-64 relative" @dblclick="$emit('edit')">
+  <ui-card
+    :id="componentId"
+    class="w-64 relative"
+    @dblclick.stop="$emit('edit')"
+  >
     <Handle :id="`${id}-input-1`" type="target" :position="Position.Left" />
     <div class="flex items-center">
       <div

+ 3 - 2
src/components/newtab/workflow/WorkflowEditor.vue

@@ -3,9 +3,9 @@
     :id="props.id"
     :class="{ disabled: options.disabled }"
     :default-edge-options="{
+      updateable: true,
+      selectable: true,
       type: settings.lineType,
-      updatable: !options.disabled,
-      selectable: !options.disabled,
       markerEnd: settings.arrow ? MarkerType.ArrowClosed : '',
     }"
   >
@@ -137,6 +137,7 @@ const editor = useVueFlow({
 });
 editor.onConnect((params) => {
   params.class = `source-${params.sourceHandle} target-${params.targetHandle}`;
+  params.updateable = true;
   editor.addEdges([params]);
 });
 editor.onEdgeUpdate(({ edge, connection }) => {

+ 1 - 1
src/components/newtab/workflow/edit/EditLogData.vue

@@ -9,7 +9,7 @@
     <ui-select
       :model-value="data.workflowId"
       :placeholder="t('workflow.blocks.execute-workflow.select')"
-      class="mt-4"
+      class="mt-4 w-full"
       @change="updateData({ workflowId: $event })"
     >
       <option

+ 2 - 0
src/lib/vRemixicon.js

@@ -21,6 +21,7 @@ import {
   riSortDesc,
   riTimeLine,
   riFlagLine,
+  riLinksLine,
   riGroupLine,
   riGuideLine,
   riChat3Line,
@@ -139,6 +140,7 @@ export const icons = {
   riSortDesc,
   riTimeLine,
   riFlagLine,
+  riLinksLine,
   riGroupLine,
   riGuideLine,
   riChat3Line,

+ 9 - 0
src/locales/en/blocks.json

@@ -114,6 +114,15 @@
         "description": "Get the latest log data of a workflow",
         "data": "Log data"
       },
+      "tab-url": {
+        "name": "Get tab URL",
+        "description": "Get the tab URL",
+        "select": "Select tab",
+        "types": {
+          "active-tab": "Active tab",
+          "all": "All tabs"
+        }
+      },
       "reload-tab": {
         "name": "Reload tab",
         "description": "Reload the active tab"

+ 0 - 2
src/newtab/pages/workflows/[id].vue

@@ -349,7 +349,6 @@ const updateHostedWorkflow = throttle(async () => {
   }
 }, 5000);
 const onNodesChange = debounce((changes) => {
-  console.log('nodes', changes);
   changes.forEach(({ type, id }) => {
     if (type === 'remove') {
       if (editState.blockData.blockId === id) {
@@ -362,7 +361,6 @@ const onNodesChange = debounce((changes) => {
   });
 }, 250);
 const onEdgesChange = debounce((changes) => {
-  console.log('edges', changes);
   changes.forEach(({ type }) => {
     if (state.dataChanged) return;
     state.dataChanged = type !== 'select';

+ 23 - 3
src/utils/shared.js

@@ -763,7 +763,7 @@ export const tasks = {
     description: 'Insert data into table or variable',
     icon: 'riDatabase2Line',
     component: 'BlockBasic',
-    category: 'general',
+    category: 'data',
     editComponent: 'EditInsertData',
     inputs: 1,
     outputs: 1,
@@ -952,7 +952,7 @@ export const tasks = {
     icon: 'riDeleteBin7Line',
     editComponent: 'EditDeleteData',
     component: 'BlockBasic',
-    category: 'general',
+    category: 'data',
     inputs: 1,
     outputs: 1,
     allowedInputs: true,
@@ -1014,7 +1014,6 @@ export const tasks = {
     outputs: 1,
     allowedInputs: true,
     maxConnection: 1,
-    refDataKeys: ['message', 'title', 'iconUrl', 'imageUrl'],
     data: {
       disableBlock: false,
       description: '',
@@ -1025,6 +1024,27 @@ export const tasks = {
       variableName: '',
     },
   },
+  'tab-url': {
+    name: 'Get tab URL',
+    description: 'Get the tab URL',
+    icon: 'riLinksLine',
+    editComponent: 'EditTabURL',
+    component: 'BlockBasic',
+    category: 'browser',
+    inputs: 1,
+    outputs: 1,
+    allowedInputs: true,
+    maxConnection: 1,
+    data: {
+      disableBlock: false,
+      description: '',
+      type: 'active-tab',
+      dataColumn: '',
+      saveData: true,
+      assignVariable: false,
+      variableName: '',
+    },
+  },
 };
 
 export const categories = {