Browse Source

feat(editor): enable save button when data is changed

Ahmad Kholid 3 năm trước cách đây
mục cha
commit
7848be1fe0

+ 10 - 1
src/components/newtab/workflow/WorkflowDetailsCard.vue

@@ -35,7 +35,12 @@
     </p>
   </div>
   <div class="flex px-4 mt-2 space-x-2">
-    <ui-button variant="accent" class="flex-1" @click="$emit('save')">
+    <ui-button
+      :disabled="!dataChanged"
+      variant="accent"
+      class="flex-1"
+      @click="$emit('save')"
+    >
       <v-remixicon name="riSaveLine" class="mr-2 -ml-1" />
       Save
     </ui-button>
@@ -118,6 +123,10 @@ defineProps({
     type: Object,
     default: () => ({}),
   },
+  dataChanged: {
+    type: Boolean,
+    default: false,
+  },
 });
 defineEmits([
   'update',

+ 1 - 1
src/components/ui/UiButton.vue

@@ -8,7 +8,7 @@
       icon ? 'p-2' : 'py-2 px-4',
       circle ? 'rounded-full' : 'rounded-lg',
       {
-        'opacity-70 bg-opacity-70': disabled,
+        'opacity-70': disabled,
         'pointer-events-none': loading || disabled,
       },
     ]"

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

@@ -12,6 +12,7 @@
       <workflow-details-card
         v-else
         :workflow="workflow"
+        :data-changed="state.isDataChanged"
         @save="saveWorkflow"
         @execute="executeWorkflow"
         @update="updateWorkflow"