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:59:21 UTC
[incubator-dolphinscheduler] branch dev updated: Limit
customization file content to no more than 3000 lines(#2128) (#2141)
This is an automated email from the ASF dual-hosted git repository.
lidongdai pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-dolphinscheduler.git
The following commit(s) were added to refs/heads/dev by this push:
new 712a1bc Limit customization file content to no more than 3000 lines(#2128) (#2141)
712a1bc is described below
commit 712a1bc126ed32259edaaa9e2c8b6afb71fd2f6e
Author: break60 <79...@qq.com>
AuthorDate: Thu Mar 12 17:59:16 2020 +0800
Limit customization file content to no more than 3000 lines(#2128) (#2141)
* Change DOM label
* Change name to lowercase
* Limit customization file content to no more than 3000 lines
---
.../resource/pages/file/pages/create/index.vue | 5 ++-
.../pages/resource/pages/file/pages/edit/index.vue | 38 ++++++++++++++--------
.../src/js/module/i18n/locale/en_US.js | 1 +
.../src/js/module/i18n/locale/zh_CN.js | 1 +
4 files changed, 30 insertions(+), 15 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 caa31ed..df84f0f 100644
--- 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
@@ -132,7 +132,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..a0d1d7d 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
@@ -45,6 +45,7 @@
</template>
<script>
import _ from 'lodash'
+ import i18n from '@/module/i18n'
import { mapActions } from 'vuex'
import { filtTypeArr } from '../_source/common'
import mNoType from '../details/_source/noType'
@@ -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/module/i18n/locale/en_US.js b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
index e8ac57a..4507250 100755
--- a/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
+++ b/dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
@@ -229,6 +229,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 c720906..132b4d8 100755
--- a/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
+++ b/dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js
@@ -228,6 +228,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': '返回',