You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by li...@apache.org on 2020/03/12 09:58:54 UTC

[incubator-dolphinscheduler] branch dev-resource-tree updated: Limit customization file content to no more than 3000 lines(#2128) (#2140)

This is an automated email from the ASF dual-hosted git repository.

lidongdai pushed a commit to branch dev-resource-tree
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git


The following commit(s) were added to refs/heads/dev-resource-tree by this push:
     new cec97d0  Limit customization file content to no more than 3000 lines(#2128) (#2140)
cec97d0 is described below

commit cec97d04cef15502a24708cd137524a8678a5b9f
Author: break60 <79...@qq.com>
AuthorDate: Thu Mar 12 17:58:48 2020 +0800

    Limit customization file content to no more than 3000 lines(#2128) (#2140)
    
    * Change crumb position
    
    * UDF changed to multiple choice
    
    * Limit customization file content to no more than 3000 lines
    
    * Limit customization file content to no more than 3000 lines(#2128)
---
 .../resource/pages/file/pages/create/index.vue     |  4 +++
 .../pages/resource/pages/file/pages/edit/index.vue | 38 ++++++++++++++--------
 .../resource/pages/file/pages/subFile/index.vue    |  4 +++
 .../src/js/module/i18n/locale/en_US.js             |  1 +
 .../src/js/module/i18n/locale/zh_CN.js             |  1 +
 5 files changed, 34 insertions(+), 14 deletions(-)

diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue
index 0348f32..fac37a4 100755
--- a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue
@@ -136,6 +136,10 @@
           this.$message.warning(`${i18n.$t('Please enter the resource content')}`)
           return false
         }
+        if (editor.doc.size>3000) {
+          this.$message.warning(`${i18n.$t('Resource content cannot exceed 3000 lines')}`)
+          return false
+        }
 
         return true
       },
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/edit/index.vue b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/edit/index.vue
index a9aee1c..5a67abf 100644
--- a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/edit/index.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/edit/index.vue
@@ -44,6 +44,7 @@
   </m-list-construction>
 </template>
 <script>
+  import i18n from '@/module/i18n'
   import _ from 'lodash'
   import { mapActions } from 'vuex'
   import { filtTypeArr } from '../_source/common'
@@ -78,20 +79,29 @@
     methods: {
       ...mapActions('resource', ['getViewResources', 'updateContent']),
       ok () {
-        this.spinnerLoading = true
-        this.updateContent({
-          id: this.$route.params.id,
-          content: editor.getValue()
-        }).then(res => {
-          this.$message.success(res.msg)
-          setTimeout(() => {
+        if (this._validation()) {
+            this.spinnerLoading = true
+            this.updateContent({
+            id: this.$route.params.id,
+            content: editor.getValue()
+          }).then(res => {
+            this.$message.success(res.msg)
+            setTimeout(() => {
+              this.spinnerLoading = false
+              this.close()
+            }, 800)
+          }).catch(e => {
+            this.$message.error(e.msg || '')
             this.spinnerLoading = false
-            this.close()
-          }, 800)
-        }).catch(e => {
-          this.$message.error(e.msg || '')
-          this.spinnerLoading = false
-        })
+          })
+        }
+      },
+      _validation () {
+        if (editor.doc.size>3000) {
+          this.$message.warning(`${i18n.$t('Resource content cannot exceed 3000 lines')}`)
+          return false
+        }
+        return true
       },
       close () {
         this.$router.push({ name: 'file' })
@@ -101,7 +111,7 @@
         this.getViewResources({
           id: this.$route.params.id,
           skipLineNum: 0,
-          limit: 2000
+          limit: 3000
         }).then(res => {
           this.name = res.data.alias.split('.')[0]
           if (!res.data) {
diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subFile/index.vue b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subFile/index.vue
index 1e63635..9894ff9 100755
--- a/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subFile/index.vue
+++ b/dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/subFile/index.vue
@@ -137,6 +137,10 @@
           this.$message.warning(`${i18n.$t('Please enter the resource content')}`)
           return false
         }
+        if (editor.doc.size>3000) {
+          this.$message.warning(`${i18n.$t('Resource content cannot exceed 3000 lines')}`)
+          return false
+        }
 
         return true
       },
diff --git a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
index 77305d8..a2ea708 100644
--- a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
+++ b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
@@ -233,6 +233,7 @@ export default {
   'File Content': 'File Content',
   'Create': 'Create',
   'Please enter the resource content': 'Please enter the resource content',
+  'Resource content cannot exceed 3000 lines': 'Resource content cannot exceed 3000 lines',
   'File Details': 'File Details',
   'Download Details': 'Download Details',
   'Return': 'Return',
diff --git a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
index 70c4ffd..66a6437 100644
--- a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
+++ b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
@@ -235,6 +235,7 @@ export default {
   'Upload File Size': '文件大小不能超过1G',
   'Create': '创建',
   'Please enter the resource content': '请输入资源内容',
+  'Resource content cannot exceed 3000 lines': '资源内容不能超过3000行',
   'File Details': '文件详情',
   'Download Details': '下载详情',
   'Return': '返回',