Browse Source

feat: include timestamp in workflow log

Ahmad Kholid 2 years ago
parent
commit
bee7cd2b0d

+ 1 - 0
src/background/workflowEngine/worker.js

@@ -181,6 +181,7 @@ class Worker {
         name: block.label,
         name: block.label,
         blockId: block.id,
         blockId: block.id,
         workerId: this.id,
         workerId: this.id,
+        timestamp: startExecuteTime,
         description: block.data.description,
         description: block.data.description,
         replacedValue: replacedBlock.replacedValue,
         replacedValue: replacedBlock.replacedValue,
         duration: Math.round(Date.now() - startExecuteTime),
         duration: Math.round(Date.now() - startExecuteTime),

+ 15 - 7
src/components/newtab/logs/LogsHistory.vue

@@ -34,14 +34,21 @@
               class="transition-transform text-gray-400 -ml-1 mr-2"
               class="transition-transform text-gray-400 -ml-1 mr-2"
             />
             />
           </span>
           </span>
-          <span
-            :title="`${t('log.duration')}: ${Math.round(
-              item.duration / 1000
-            )}s`"
-            class="w-14 flex-shrink-0 text-overflow text-gray-400"
+          <div
+            style="min-width: 54px"
+            class="flex-shrink-0 mr-4 text-overflow text-gray-400"
           >
           >
-            {{ countDuration(0, item.duration || 0) }}
-          </span>
+            <span
+              v-if="item.timestamp"
+              :title="dayjs(item.timestamp).format('YYYY-MM-DDTHH:mm:ss.SSS')"
+            >
+              {{ dayjs(item.timestamp).format('HH:mm:ss') }}
+              {{ `(${countDuration(0, item.duration || 0).trim()})` }}
+            </span>
+            <span v-else :title="`${Math.round(item.duration / 1000)}s`">
+              {{ countDuration(0, item.duration || 0) }}
+            </span>
+          </div>
           <span
           <span
             :class="logsType[item.type]?.color"
             :class="logsType[item.type]?.color"
             :title="item.type"
             :title="item.type"
@@ -134,6 +141,7 @@
 import { computed, shallowReactive } from 'vue';
 import { computed, shallowReactive } from 'vue';
 import { useI18n } from 'vue-i18n';
 import { useI18n } from 'vue-i18n';
 import { countDuration } from '@/utils/helper';
 import { countDuration } from '@/utils/helper';
+import dayjs from '@/lib/dayjs';
 
 
 const props = defineProps({
 const props = defineProps({
   currentLog: {
   currentLog: {