Browse Source

Add required limit to SQL (#1275)

* Checkbox change background color and env to Chinese

* Remove space before and after login user name

* Modify crontab style

* Add required limit to SQL
break60 5 years ago
parent
commit
07353e0fd8

+ 27 - 13
dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/sql.vue

@@ -43,9 +43,9 @@
         </div>
       </div>
     </m-list-box>
-    <template v-if="!sqlType && showType.length">
+    <template v-if="!sqlType">
       <m-list-box>
-        <div slot="text">{{$t('Title')}}</div>
+        <div slot="text"><b class='requiredIcon'>*</b>{{$t('Title')}}</div>
         <div slot="content">
           <x-input
             type="input"
@@ -56,7 +56,7 @@
         </div>
       </m-list-box>
       <m-list-box>
-        <div slot="text">{{$t('Recipient')}}</div>
+        <div slot="text"><b class='requiredIcon'>*</b>{{$t('Recipient')}}</div>
         <div slot="content">
           <m-email ref="refEmail" v-model="receivers" :disabled="isDetails" :repeat-data="receiversCc"></m-email>
         </div>
@@ -195,6 +195,9 @@
        */
       _onSqlType (a) {
         this.sqlType = a
+        if(a==0) {
+          this.showType = ['TABLE']
+        }
       },
       /**
        * return udfs
@@ -240,12 +243,24 @@
         if (!this.$refs.refDs._verifDatasource()) {
           return false
         }
+        if (this.sqlType==0 && !this.showType.length) {
+          this.$message.warning(`${i18n.$t('One form or attachment must be selected')}`)
+          return false
+        }
+        if (this.sqlType==0 && !this.title) {
+          this.$message.warning(`${i18n.$t('Mail subject required')}`)
+          return false
+        }
+        if (this.sqlType==0 && !this.receivers.length) {
+          this.$message.warning(`${i18n.$t('Recipient required')}`)
+          return false
+        }
         // receivers Subcomponent verification
-        if (!this.$refs.refEmail._manualEmail()) {
+        if (!this.sqlType && !this.$refs.refEmail._manualEmail()) {
           return false
         }
         // receiversCc Subcomponent verification
-        if (!this.$refs.refCc._manualEmail()) {
+        if (!this.sqlType && !this.$refs.refCc._manualEmail()) {
           return false
         }
         // udfs Subcomponent verification Verification only if the data type is HIVE
@@ -356,14 +371,6 @@
           this.connParams = ''
         }
       },
-      //
-      showType (val) {
-        if (!val.length) {
-          this.title = ''
-          this.receivers = []
-          this.receiversCc = []
-        }
-      }
     },
     created () {
       let o = this.backfillItem
@@ -412,3 +419,10 @@
     components: { mListBox, mDatasource, mLocalParams, mUdfs, mSqlType, mStatementList, mEmail }
   }
 </script>
+<style lang="scss" rel="stylesheet/scss">
+  .requiredIcon {
+    color: #ff0000;
+    padding-right: 4px;
+  }
+</style>
+

+ 3 - 0
dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js

@@ -119,6 +119,9 @@ export default {
   'SQL Statement': 'SQL Statement',
   'UDF Function': 'UDF Function',
   'Please enter a SQL Statement(required)': 'Please enter a SQL Statement(required)',
+  'One form or attachment must be selected': 'One form or attachment must be selected',
+  'Recipient required': 'Recipient required',
+  'Mail subject required': 'Mail subject required',
   'Child Node': 'Child Node',
   'Please select a sub-Process': 'Please select a sub-Process',
   'Edit': 'Edit',

+ 3 - 0
dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js

@@ -119,6 +119,9 @@ export default {
   'SQL Statement': 'sql语句',
   'UDF Function': 'UDF函数',
   'Please enter a SQL Statement(required)': '请输入sql语句(必填)',
+  'One form or attachment must be selected': '表格、附件必须勾选一个',
+  'Recipient required': '收件人邮箱必填',
+  'Mail subject required': '邮件主题必填',
   'Child Node': '子节点',
   'Please select a sub-Process': '请选择子工作流',
   'Edit': '编辑',