瀏覽代碼

feat: workflow parameter validation

Ahmad Kholid 2 年之前
父節點
當前提交
9a6e101733
共有 1 個文件被更改,包括 12 次插入2 次删除
  1. 12 2
      src/components/newtab/workflow/edit/EditTrigger.vue

+ 12 - 2
src/components/newtab/workflow/edit/EditTrigger.vue

@@ -37,17 +37,24 @@
     >
       <ul
         class="space-y-2 mt-2 pb-1 overflow-auto scroll"
-        style="max-height: calc(100vh - 15rem)"
+        style="max-height: calc(100vh - 15rem); min-height: 200px"
       >
+        <p
+          v-if="state.parameters.length === 0"
+          class="my-4 text-center text-gray-600 dark:text-gray-200"
+        >
+          No parameters
+        </p>
         <li
           v-for="(param, index) in state.parameters"
           :key="index"
           class="flex items-end space-x-2"
         >
           <ui-input
-            v-model="param.name"
+            :model-value="param.name"
             label="Name"
             placeholder="Parameter name"
+            @change="updateParam(index, $event)"
           />
           <ui-select v-model="param.type" label="Type">
             <option v-for="type in paramTypes" :key="type.id" :value="type.id">
@@ -123,6 +130,9 @@ function addParameter() {
     placeholder: 'Text',
   });
 }
+function updateParam(index, value) {
+  state.parameters[index].name = value.replace(/\s/g, '_');
+}
 
 watch(
   () => state.parameters,