Browse Source

feat: searchable log

Ahmad Kholid 2 years ago
parent
commit
3e741a38ba

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

@@ -121,7 +121,7 @@ const state = shallowReactive({
 });
 });
 
 
 function installPackage() {
 function installPackage() {
-  packageStore.insert({ ...props.data }).then(() => {
+  packageStore.insert({ ...props.data }, false).then(() => {
     state.isInstalled = true;
     state.isInstalled = true;
   });
   });
 }
 }

+ 39 - 20
src/components/newtab/logs/LogsHistory.vue

@@ -12,21 +12,28 @@
     <div class="flex-1">
     <div class="flex-1">
       <div class="rounded-lg bg-gray-900 dark:bg-gray-800 text-gray-100 dark">
       <div class="rounded-lg bg-gray-900 dark:bg-gray-800 text-gray-100 dark">
         <div
         <div
-          v-if="currentLog.status === 'error' && errorBlock"
-          class="border-b px-4 pt-4 text-gray-200 pb-4 mb-4"
+          class="border-b px-4 pt-4 flex items-center text-gray-200 pb-4 mb-4"
         >
         >
-          <p class="leading-tight line-clamp">
-            {{ errorBlock.message }}
-          </p>
-          <p class="cursor-pointer" title="Jump to item" @click="jumpToError">
-            On the {{ errorBlock.name }} block
-            <v-remixicon
-              name="riArrowLeftLine"
-              class="inline-block -ml-1"
-              size="18"
-              rotate="135"
-            />
-          </p>
+          <div v-if="currentLog.status === 'error' && errorBlock">
+            <p class="leading-tight line-clamp">
+              {{ errorBlock.message }}
+            </p>
+            <p class="cursor-pointer" title="Jump to item" @click="jumpToError">
+              On the {{ errorBlock.name }} block
+              <v-remixicon
+                name="riArrowLeftLine"
+                class="inline-block -ml-1"
+                size="18"
+                rotate="135"
+              />
+            </p>
+          </div>
+          <div class="flex-grow" />
+          <ui-input
+            v-model="state.search"
+            :placeholder="t('common.search')"
+            prepend-icon="riSearch2Line"
+          />
         </div>
         </div>
         <div
         <div
           id="log-history"
           id="log-history"
@@ -291,6 +298,7 @@ const { t, te } = useI18n();
 
 
 const state = shallowReactive({
 const state = shallowReactive({
   itemId: '',
   itemId: '',
+  search: '',
   activeTab: 'all',
   activeTab: 'all',
 });
 });
 const pagination = shallowReactive({
 const pagination = shallowReactive({
@@ -299,13 +307,24 @@ const pagination = shallowReactive({
 });
 });
 const activeLog = shallowRef(null);
 const activeLog = shallowRef(null);
 
 
+const translatedLog = computed(() =>
+  props.currentLog.history.map(translateLog)
+);
+const filteredLog = computed(() =>
+  translatedLog.value.filter((log) => {
+    const query = state.search.toLocaleLowerCase();
+
+    return (
+      log.name.toLocaleLowerCase().includes(query) ||
+      log.description?.toLocaleLowerCase().includes(query)
+    );
+  })
+);
 const history = computed(() =>
 const history = computed(() =>
-  props.currentLog.history
-    .slice(
-      (pagination.currentPage - 1) * pagination.perPage,
-      pagination.currentPage * pagination.perPage
-    )
-    .map(translateLog)
+  filteredLog.value.slice(
+    (pagination.currentPage - 1) * pagination.perPage,
+    pagination.currentPage * pagination.perPage
+  )
 );
 );
 const errorBlock = computed(() => {
 const errorBlock = computed(() => {
   if (props.currentLog.status !== 'error') return null;
   if (props.currentLog.status !== 'error') return null;

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

@@ -17,7 +17,7 @@
       @change="updateData({ variableName: $event })"
       @change="updateData({ variableName: $event })"
     />
     />
   </template>
   </template>
-  <template v-if="table">
+  <template v-if="table && workflow.columns?.value">
     <ui-checkbox
     <ui-checkbox
       :model-value="data.saveData"
       :model-value="data.saveData"
       block
       block