Browse Source

fix: workflow state redirect

Ahmad Kholid 3 years ago
parent
commit
10a0c0ecbc

+ 7 - 0
src/components/newtab/workflow/WorkflowBuilderSearchBlocks.vue

@@ -50,6 +50,7 @@
   </div>
   </div>
 </template>
 </template>
 <script setup>
 <script setup>
+/* eslint-disable vue/no-mutating-props */
 import { reactive } from 'vue';
 import { reactive } from 'vue';
 import { useI18n } from 'vue-i18n';
 import { useI18n } from 'vue-i18n';
 import { useShortcut } from '@/composable/shortcut';
 import { useShortcut } from '@/composable/shortcut';
@@ -115,6 +116,8 @@ function extractBlocks() {
       name: t(`workflow.blocks.${name}.name`),
       name: t(`workflow.blocks.${name}.name`),
     })
     })
   );
   );
+
+  props.editor.precanvas.style.transition = 'transform 250ms ease';
 }
 }
 function clearState() {
 function clearState() {
   if (!state.selected) {
   if (!state.selected) {
@@ -133,6 +136,10 @@ function clearState() {
     canvasX: 0,
     canvasX: 0,
     canvasY: 0,
     canvasY: 0,
   });
   });
+
+  setTimeout(() => {
+    props.editor.precanvas.style.transition = '';
+  }, 500);
 }
 }
 function onSelectItem({ item }) {
 function onSelectItem({ item }) {
   if (props.editor.zoom !== 1) {
   if (props.editor.zoom !== 1) {

+ 13 - 2
src/newtab/pages/logs/Running.vue

@@ -80,6 +80,7 @@ import { useRoute, useRouter } from 'vue-router';
 import { useI18n } from 'vue-i18n';
 import { useI18n } from 'vue-i18n';
 import { countDuration } from '@/utils/helper';
 import { countDuration } from '@/utils/helper';
 import { sendMessage } from '@/utils/message';
 import { sendMessage } from '@/utils/message';
+import dbLogs from '@/db/logs';
 import dayjs from '@/lib/dayjs';
 import dayjs from '@/lib/dayjs';
 import LogsHistory from '@/components/newtab/logs/LogsHistory.vue';
 import LogsHistory from '@/components/newtab/logs/LogsHistory.vue';
 
 
@@ -103,9 +104,19 @@ function stopWorkflow() {
 
 
 watch(
 watch(
   running,
   running,
-  () => {
+  async () => {
     if (!running.value && route.params.id) {
     if (!running.value && route.params.id) {
-      router.replace('/logs');
+      const log = await dbLogs.items
+        .where('id')
+        .equals(route.params.id)
+        .first();
+      let path = 'logs';
+
+      if (log) {
+        path = `/logs/${route.params.id}`;
+      }
+
+      router.replace(path);
     }
     }
   },
   },
   { immediate: true }
   { immediate: true }