Browse Source

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
pull/3/MERGE
break60 4 years ago committed by gaojun2048
parent
commit
f1087ff3a1
  1. 5
      dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue
  2. 38
      dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/edit/index.vue
  3. 1
      dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js
  4. 1
      dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js

5
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')}`) this.$message.warning(`${i18n.$t('Please enter the resource content')}`)
return false return false
} }
if (editor.doc.size>3000) {
this.$message.warning(`${i18n.$t('Resource content cannot exceed 3000 lines')}`)
return false
}
return true return true
}, },
/** /**

38
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/edit/index.vue

@ -45,6 +45,7 @@
</template> </template>
<script> <script>
import _ from 'lodash' import _ from 'lodash'
import i18n from '@/module/i18n'
import { mapActions } from 'vuex' import { mapActions } from 'vuex'
import { filtTypeArr } from '../_source/common' import { filtTypeArr } from '../_source/common'
import mNoType from '../details/_source/noType' import mNoType from '../details/_source/noType'
@ -78,20 +79,29 @@
methods: { methods: {
...mapActions('resource', ['getViewResources', 'updateContent']), ...mapActions('resource', ['getViewResources', 'updateContent']),
ok () { ok () {
this.spinnerLoading = true if (this._validation()) {
this.updateContent({ this.spinnerLoading = true
id: this.$route.params.id, this.updateContent({
content: editor.getValue() id: this.$route.params.id,
}).then(res => { content: editor.getValue()
this.$message.success(res.msg) }).then(res => {
setTimeout(() => { this.$message.success(res.msg)
setTimeout(() => {
this.spinnerLoading = false
this.close()
}, 800)
}).catch(e => {
this.$message.error(e.msg || '')
this.spinnerLoading = false this.spinnerLoading = false
this.close() })
}, 800) }
}).catch(e => { },
this.$message.error(e.msg || '') _validation () {
this.spinnerLoading = false if (editor.doc.size>3000) {
}) this.$message.warning(`${i18n.$t('Resource content cannot exceed 3000 lines')}`)
return false
}
return true
}, },
close () { close () {
this.$router.push({ name: 'file' }) this.$router.push({ name: 'file' })
@ -101,7 +111,7 @@
this.getViewResources({ this.getViewResources({
id: this.$route.params.id, id: this.$route.params.id,
skipLineNum: 0, skipLineNum: 0,
limit: 2000 limit: 3000
}).then(res => { }).then(res => {
this.name = res.data.alias.split('.')[0] this.name = res.data.alias.split('.')[0]
if (!res.data) { if (!res.data) {

1
dolphinscheduler-ui/src/js/module/i18n/locale/en_US.js

@ -229,6 +229,7 @@ export default {
'File Content': 'File Content', 'File Content': 'File Content',
'Create': 'Create', 'Create': 'Create',
'Please enter the resource content': 'Please enter the resource content', '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', 'File Details': 'File Details',
'Download Details': 'Download Details', 'Download Details': 'Download Details',
'Return': 'Return', 'Return': 'Return',

1
dolphinscheduler-ui/src/js/module/i18n/locale/zh_CN.js

@ -228,6 +228,7 @@ export default {
'Upload File Size': '文件大小不能超过1G', 'Upload File Size': '文件大小不能超过1G',
'Create': '创建', 'Create': '创建',
'Please enter the resource content': '请输入资源内容', 'Please enter the resource content': '请输入资源内容',
'Resource content cannot exceed 3000 lines': '资源内容不能超过3000行',
'File Details': '文件详情', 'File Details': '文件详情',
'Download Details': '下载详情', 'Download Details': '下载详情',
'Return': '返回', 'Return': '返回',

Loading…
Cancel
Save