Browse Source

Change all Chinese names to English (#1207)

* Modify webpack configuration

* Change all Chinese names to English
pull/2/head
break60 5 years ago committed by qiaozhanwei
parent
commit
01c2b12d57
  1. 12
      dolphinscheduler-ui/build/combo.js
  2. 2
      dolphinscheduler-ui/build/config.js
  3. 62
      dolphinscheduler-ui/src/js/conf/home/pages/monitor/pages/servers/_source/gaugeOption.js
  4. 2
      dolphinscheduler-ui/src/js/conf/home/pages/monitor/pages/servers/alert.vue
  5. 2
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/_source/instanceConditions/common.js
  6. 4
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/email.vue
  7. 2
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/defineUserCount.vue
  8. 14
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/gantt/_source/gantt.js
  9. 8
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/gantt/index.vue
  10. 34
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/index.vue
  11. 8
      dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/taskInstance/index.vue
  12. 2
      dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue
  13. 2
      dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/details/_source/utils.js
  14. 2
      dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/details/index.vue
  15. 3
      dolphinscheduler-ui/src/js/conf/home/pages/security/pages/warningGroups/_source/list.vue
  16. 44
      dolphinscheduler-ui/src/js/module/ana-charts/common.js
  17. 10
      dolphinscheduler-ui/src/js/module/ana-charts/index.js
  18. 84
      dolphinscheduler-ui/src/js/module/ana-charts/packages/bar/index.js
  19. 10
      dolphinscheduler-ui/src/js/module/ana-charts/packages/base.js
  20. 30
      dolphinscheduler-ui/src/js/module/ana-charts/packages/funnel/index.js
  21. 56
      dolphinscheduler-ui/src/js/module/ana-charts/packages/line/index.js
  22. 30
      dolphinscheduler-ui/src/js/module/ana-charts/packages/pie/index.js
  23. 34
      dolphinscheduler-ui/src/js/module/ana-charts/packages/radar/index.js
  24. 34
      dolphinscheduler-ui/src/js/module/ana-charts/packages/scatter/index.js
  25. 6
      dolphinscheduler-ui/src/js/module/components/crontab/source/_source/input-number.vue
  26. 64
      dolphinscheduler-ui/src/js/module/components/crontab/source/_times/day.vue
  27. 44
      dolphinscheduler-ui/src/js/module/components/crontab/source/_times/hour.vue
  28. 42
      dolphinscheduler-ui/src/js/module/components/crontab/source/_times/minute.vue
  29. 42
      dolphinscheduler-ui/src/js/module/components/crontab/source/_times/month.vue
  30. 46
      dolphinscheduler-ui/src/js/module/components/crontab/source/_times/second.vue
  31. 44
      dolphinscheduler-ui/src/js/module/components/crontab/source/_times/year.vue
  32. 8
      dolphinscheduler-ui/src/js/module/components/crontab/source/app.vue
  33. 6
      dolphinscheduler-ui/src/js/module/components/crontab/source/util/index.js
  34. 18
      dolphinscheduler-ui/src/js/module/components/secondaryMenu/_source/menu.js

12
dolphinscheduler-ui/build/combo.js

@ -55,7 +55,7 @@ var jslibs = {
'local': [] 'local': []
} }
// css集合 // css
csslibs = { csslibs = {
'base': [ 'base': [
'normalize/7.0.0/normalize.min.css', 'normalize/7.0.0/normalize.min.css',
@ -72,14 +72,14 @@ csslibs = {
] ]
} }
// 创建文件夹目录 // Create folder directory
var dirPath = path.resolve(__dirname, '..', 'src/combo/' + version) var dirPath = path.resolve(__dirname, '..', 'src/combo/' + version)
if (!fs.existsSync(dirPath)) { if (!fs.existsSync(dirPath)) {
fs.mkdirSync(dirPath) fs.mkdirSync(dirPath)
console.log('文件夹创建成功') console.log('Folder created successfully')
} else { } else {
console.log('文件夹已存在') console.log('Folder already exists')
} }
var jsKeys = Object.keys(jslibs) var jsKeys = Object.keys(jslibs)
@ -93,7 +93,7 @@ jsUrl.forEach((v, i) => {
var stream = fs.createWriteStream(path.join(dirPath, jsKeys[i] + '.js'), { encoding: 'utf-8' }) var stream = fs.createWriteStream(path.join(dirPath, jsKeys[i] + '.js'), { encoding: 'utf-8' })
request(url).pipe(stream).on('close', function (err) { request(url).pipe(stream).on('close', function (err) {
if (!err) { if (!err) {
console.log('文件[' + version + '/' + jsKeys[i] + '.js' + ']下载完毕') console.log('file[' + version + '/' + jsKeys[i] + '.js' + ']Download completed')
} }
}) })
}) })
@ -109,7 +109,7 @@ cssUrl.forEach((v, i) => {
var stream = fs.createWriteStream(path.join(dirPath, cssKeys[i] + '.css'), { encoding: 'utf-8' }) var stream = fs.createWriteStream(path.join(dirPath, cssKeys[i] + '.css'), { encoding: 'utf-8' })
request(url).pipe(stream).on('close', function (err) { request(url).pipe(stream).on('close', function (err) {
if (!err) { if (!err) {
console.log('文件[' + version + '/' + cssKeys[i] + '.css' + ']下载完毕') console.log('file[' + version + '/' + cssKeys[i] + '.css' + ']Download completed')
} }
}) })
}) })

2
dolphinscheduler-ui/build/config.js

@ -65,7 +65,7 @@ const minifierConfig = isProduction ? {
const getPageEntry = view => jsEntry[view] ? view : '' const getPageEntry = view => jsEntry[view] ? view : ''
// 重新定向输出页面 // Redirect output page
const pageRewriter = { const pageRewriter = {
'view/home/index.*': 'index.html' 'view/home/index.*': 'index.html'
} }

62
dolphinscheduler-ui/src/js/conf/home/pages/monitor/pages/servers/_source/gaugeOption.js

@ -19,47 +19,47 @@ export default function (value) {
series: [ series: [
{ {
type: 'gauge', type: 'gauge',
center: ['50%', '45%'], // 仪表位置 center: ['50%', '45%'], // Instrument position
radius: '80%', // 仪表大小 radius: '80%', // Instrument size
startAngle: 200, // 开始角度 startAngle: 200, // Starting angle
endAngle: -20, // 结束角度 endAngle: -20, // End angle
axisLine: { axisLine: {
show: false, show: false,
lineStyle: { // 属性lineStyle控制线条样式 lineStyle: { // Property linestyle controls line style
color: [ color: [
[ 0.5, new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ // eslint-disable-line [ 0.5, new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ // eslint-disable-line
offset: 1, offset: 1,
color: '#E75F25' // 50% 处的颜色 color: '#E75F25' // 50% Color in place
}, { }, {
offset: 0.8, offset: 0.8,
color: '#D9452C' // 40% 处的颜色 color: '#D9452C' // 40% Color in place
}], false) ], // 100% 处的颜色 }], false) ], // 100% Color in place
[ 0.7, new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ // eslint-disable-line [ 0.7, new echarts.graphic.LinearGradient(0, 0, 1, 0, [{ // eslint-disable-line
offset: 1, offset: 1,
color: '#FFC539' // 70% 处的颜色 color: '#FFC539' // 70% Color in place
}, { }, {
offset: 0.8, offset: 0.8,
color: '#FE951E' // 66% 处的颜色 color: '#FE951E' // 66% Color in place
}, { }, {
offset: 0, offset: 0,
color: '#E75F25' // 50% 处的颜色 color: '#E75F25' // 50% Color in place
}], false) ], }], false) ],
[ 0.9, new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ // eslint-disable-line [ 0.9, new echarts.graphic.LinearGradient(0, 0, 0, 1, [{ // eslint-disable-line
offset: 1, offset: 1,
color: '#C7DD6B' // 90% 处的颜色 color: '#C7DD6B' // 90% Color in place
}, { }, {
offset: 0.8, offset: 0.8,
color: '#FEEC49' // 86% 处的颜色 color: '#FEEC49' // 86% Color in place
}, { }, {
offset: 0, offset: 0,
color: '#FFC539' // 70% 处的颜色 color: '#FFC539' // 70% Color in place
}], false) ], }], false) ],
[1, new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { // eslint-disable-line [1, new echarts.graphic.LinearGradient(0, 0, 0, 1, [ { // eslint-disable-line
offset: 0.2, offset: 0.2,
color: '#1CAD52' // 92% 处的颜色 color: '#1CAD52' // 92% Color in place
}, { }, {
offset: 0, offset: 0,
color: '#C7DD6B' // 90% 处的颜色 color: '#C7DD6B' // 90% Color in place
}], false) ] }], false) ]
], ],
width: 10 width: 10
@ -74,7 +74,7 @@ export default function (value) {
axisLabel: { axisLabel: {
show: false show: false
}, },
pointer: { // 指针样式 pointer: { // Pointer style
length: '45%' length: '45%'
}, },
detail: { detail: {
@ -83,34 +83,34 @@ export default function (value) {
}, },
{ {
type: 'gauge', type: 'gauge',
center: ['50%', '45%'], // 默认全局居中 center: ['50%', '45%'], // Default global center
radius: '70%', radius: '70%',
startAngle: 200, startAngle: 200,
endAngle: -20, endAngle: -20,
axisLine: { axisLine: {
show: true, show: true,
lineStyle: { // 属性lineStyle控制线条样式 lineStyle: { // Property linestyle controls line style
color: [ // 表盘颜色 color: [ // Dial Color
[ 0.5, '#DA462C' ], // 0-50%处的颜色 [ 0.5, '#DA462C' ], // 0-50%Color in place
[ 0.7, '#FF9618' ], // 51%-70%处的颜色 [ 0.7, '#FF9618' ], // 51%-70%Color in place
[ 0.9, '#FFED44' ], // 70%-90%处的颜色 [ 0.9, '#FFED44' ], // 70%-90%Color in place
[ 1, '#20AE51' ]// 90%-100%处的颜色 [ 1, '#20AE51' ]// 90%-100%Color in place
], ],
width: 30// 表盘宽度 width: 30// Dial width
} }
}, },
splitLine: { // 分割线样式(及10、20等长线样式) splitLine: { // Split line style (and 10, 20 equal length line style)
length: 30, length: 30,
lineStyle: { // 属性lineStyle控制线条样式 lineStyle: { // Property linestyle controls line style
width: 2 width: 2
} }
}, },
axisTick: { // 刻度线样式(及短线样式) axisTick: { // Tick mark style (and short line style)
length: 20 length: 20
}, },
axisLabel: { // 文字样式(及“10”、“20”等文字样式) axisLabel: { // Text style (and text styles such as "10", "20")
color: 'black', color: 'black',
distance: 5 // 文字离表盘的距离 distance: 5 // Distance between text and dial
}, },
detail: { detail: {
formatter: '{score|{value}%}', formatter: '{score|{value}%}',
@ -120,7 +120,7 @@ export default function (value) {
rich: { rich: {
score: { score: {
color: 'white', color: 'white',
fontFamily: '微软雅黑', fontFamily: 'Microsoft YaHei',
fontSize: 32 fontSize: 32
} }
} }

2
dolphinscheduler-ui/src/js/conf/home/pages/monitor/pages/servers/alert.vue

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
<template> <template>
<m-list-construction title="Alert服务"> <m-list-construction title="Alert Service">
<template slot="content"> <template slot="content">
<template v-if="masterList.length"> <template v-if="masterList.length">
<m-list :list="masterList"></m-list> <m-list :list="masterList"></m-list>

2
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/_source/instanceConditions/common.js

@ -18,7 +18,7 @@
import i18n from '@/module/i18n' import i18n from '@/module/i18n'
/** /**
* 状态码表 * State code table
*/ */
let stateType = [ let stateType = [
{ {

4
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/definition/pages/list/_source/email.vue

@ -146,7 +146,7 @@
* Carriage return * Carriage return
*/ */
_emailEnter () { _emailEnter () {
// list // not list Hand filling
if (!this.emailList.length) { if (!this.emailList.length) {
this._manualEmail() this._manualEmail()
return return
@ -157,7 +157,7 @@
* delete email * delete email
*/ */
_emailDelete () { _emailDelete () {
// // Do not delete in case of input method in Chinese
if (!this.isCn) { if (!this.isCn) {
this.emailWidth = 0 this.emailWidth = 0
if (_.isInteger(this.activeIndex)) { if (_.isInteger(this.activeIndex)) {

2
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/index/_source/defineUserCount.vue

@ -56,7 +56,7 @@
}) })
const myChart = Chart.bar('#process-definition-bar', this.defineUserList, {}) const myChart = Chart.bar('#process-definition-bar', this.defineUserList, {})
myChart.echart.setOption(bar) myChart.echart.setOption(bar)
// // Jump not allowed on home page
if (this.projectId) { if (this.projectId) {
myChart.echart.on('click', e => { myChart.echart.on('click', e => {
this.$router.push({ this.$router.push({

14
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/gantt/_source/gantt.js

@ -66,16 +66,16 @@ Gantt.prototype.init = function ({ el, tasks }) {
.orient('left') .orient('left')
.tickSize(0) .tickSize(0)
// 时间纬度 // time dimension
this.compXAxisTimes() this.compXAxisTimes()
// 时间刻度计算 // Timescale calculation
this.initializeXAxis() this.initializeXAxis()
// 绘制图表 // Drawing charts
this.drawChart() this.drawChart()
} }
/** /**
* 计算时间纬度 * Calculate time latitude
*/ */
Gantt.prototype.compXAxisTimes = function () { Gantt.prototype.compXAxisTimes = function () {
if (this.tasks === undefined || this.tasks.length < 1) { if (this.tasks === undefined || this.tasks.length < 1) {
@ -90,7 +90,7 @@ Gantt.prototype.compXAxisTimes = function () {
} }
/** /**
* 时间刻度处理 * Timescale processing
*/ */
Gantt.prototype.initializeXAxis = function () { Gantt.prototype.initializeXAxis = function () {
this.x = d3.time.scale() this.x = d3.time.scale()
@ -116,7 +116,7 @@ Gantt.prototype.initializeXAxis = function () {
} }
/** /**
* 绘制图表 * Drawing charts
*/ */
Gantt.prototype.drawChart = function () { Gantt.prototype.drawChart = function () {
const svg = d3.select(this.el) const svg = d3.select(this.el)
@ -163,7 +163,7 @@ Gantt.prototype.drawChart = function () {
}) })
} }
/** /**
* tip提示 * Tip prompt
*/ */
Gantt.prototype.tip = function (d) { Gantt.prototype.tip = function (d) {
let str = `<div style="text-align: left;word-break:break-all">` let str = `<div style="text-align: left;word-break:break-all">`

8
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/gantt/index.vue

@ -55,15 +55,15 @@
name: 'instance-gantt-index', name: 'instance-gantt-index',
data () { data () {
return { return {
// // Node state
tasksState: tasksState, tasksState: tasksState,
// loading // loading
isLoading: true, isLoading: true,
// gantt // gantt data
ganttData: { ganttData: {
taskNames: [] taskNames: []
}, },
// // Data available
isNodata: false isNodata: false
} }
}, },
@ -71,7 +71,7 @@
methods: { methods: {
...mapActions('dag', ['getViewGantt']), ...mapActions('dag', ['getViewGantt']),
/** /**
* 获取数据 * get data
*/ */
_getViewGantt () { _getViewGantt () {
this.isLoading = true this.isLoading = true

34
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/instance/pages/list/index.vue

@ -52,17 +52,17 @@
return { return {
// loading // loading
isLoading: true, isLoading: true,
// // total
total: null, total: null,
// // data
processInstanceList: [], processInstanceList: [],
// Parameter // Parameter
searchParams: { searchParams: {
// // Search keywords
searchVal: '', searchVal: '',
// // Number of pages
pageSize: 10, pageSize: 10,
// // Current page
pageNo: 1, pageNo: 1,
// host // host
host: '', host: '',
@ -87,7 +87,7 @@
this._debounceGET() this._debounceGET()
}, },
/** /**
* 分页事件 * Paging event
*/ */
_page (val) { _page (val) {
this.searchParams.pageNo = val this.searchParams.pageNo = val
@ -95,7 +95,7 @@
this._debounceGET() this._debounceGET()
}, },
/** /**
* 获取list数据 * get list data
*/ */
_getProcessInstanceListP (flag) { _getProcessInstanceListP (flag) {
this.isLoading = !flag this.isLoading = !flag
@ -109,20 +109,20 @@
}) })
}, },
/** /**
* 更新 * update
*/ */
_onUpdate () { _onUpdate () {
this._debounceGET() this._debounceGET()
}, },
/** /**
* 路由变动 * Routing changes
*/ */
_routerView () { _routerView () {
return this.$route.name === 'projects-instance-details' return this.$route.name === 'projects-instance-details'
}, },
/** /**
* 防抖请求接口 * Anti shake request interface
* @desc 防止函数多次被调用 * @desc Prevent functions from being called multiple times
*/ */
_debounceGET: _.debounce(function (flag) { _debounceGET: _.debounce(function (flag) {
this._getProcessInstanceListP(flag) this._getProcessInstanceListP(flag)
@ -132,7 +132,7 @@
}) })
}, },
watch: { watch: {
// // Routing changes
'$route' (a, b) { '$route' (a, b) {
if (a.name === 'instance' && b.name === 'projects-instance-details') { if (a.name === 'instance' && b.name === 'projects-instance-details') {
this._debounceGET() this._debounceGET()
@ -149,27 +149,27 @@
} }
}, },
created () { created () {
// id // Delete process definition ID
localStore.removeItem('subProcessId') localStore.removeItem('subProcessId')
// // Route parameter merge
if (!_.isEmpty(this.$route.query)) { if (!_.isEmpty(this.$route.query)) {
this.searchParams = _.assign(this.searchParams, this.$route.query) this.searchParams = _.assign(this.searchParams, this.$route.query)
} }
// // Judge the request data according to the route
if (!this._routerView()) { if (!this._routerView()) {
this._debounceGET() this._debounceGET()
} }
}, },
mounted () { mounted () {
// // Cycle acquisition status
this.setIntervalP = setInterval(() => { this.setIntervalP = setInterval(() => {
this._debounceGET('false') this._debounceGET('false')
}, 90000) }, 90000)
}, },
beforeDestroy () { beforeDestroy () {
// // Destruction wheel
clearInterval(this.setIntervalP) clearInterval(this.setIntervalP)
}, },
components: { mList, mInstanceConditions, mSpin, mListConstruction, mSecondaryMenu, mNoData } components: { mList, mInstanceConditions, mSpin, mListConstruction, mSecondaryMenu, mNoData }

8
dolphinscheduler-ui/src/js/conf/home/pages/projects/pages/taskInstance/index.vue

@ -108,8 +108,8 @@
}) })
}, },
/** /**
* 防抖请求接口 * Anti shake request interface
* @desc 防止函数多次被调用 * @desc Prevent functions from being called multiple times
*/ */
_debounceGET: _.debounce(function (flag) { _debounceGET: _.debounce(function (flag) {
this._getList(flag) this._getList(flag)
@ -131,13 +131,13 @@
created () { created () {
}, },
mounted () { mounted () {
// // Cycle acquisition status
this.setIntervalP = setInterval(() => { this.setIntervalP = setInterval(() => {
this._debounceGET('false') this._debounceGET('false')
}, 90000) }, 90000)
}, },
beforeDestroy () { beforeDestroy () {
// // Destruction wheel
clearInterval(this.setIntervalP) clearInterval(this.setIntervalP)
}, },
components: { mList, mInstanceConditions, mSpin, mListConstruction, mSecondaryMenu, mNoData } components: { mList, mInstanceConditions, mSpin, mListConstruction, mSecondaryMenu, mNoData }

2
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/create/index.vue

@ -166,7 +166,7 @@
this._handlerEditor() this._handlerEditor()
}, },
destroyed () { destroyed () {
editor.toTextArea() // editor.toTextArea() // uninstall
editor.off($('.code-create-mirror'), 'keypress', this.keypress) editor.off($('.code-create-mirror'), 'keypress', this.keypress)
}, },
computed: {}, computed: {},

2
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/details/_source/utils.js

@ -16,7 +16,7 @@
*/ */
/** /**
* 处理后缀名 * Processing suffix
*/ */
const handlerSuffix = { const handlerSuffix = {
'.txt': 'textile', '.txt': 'textile',

2
dolphinscheduler-ui/src/js/conf/home/pages/resource/pages/file/pages/details/index.vue

@ -195,7 +195,7 @@
}, },
mounted () { mounted () {
if (this.isNoType) { if (this.isNoType) {
// // get data
this._getViewResources() this._getViewResources()
} }
}, },

3
dolphinscheduler-ui/src/js/conf/home/pages/security/pages/warningGroups/_source/list.vue

@ -78,8 +78,7 @@
<x-button type="primary" size="xsmall" shape="circle" @click="_delete(item,$index)">{{$t('Confirm')}}</x-button> <x-button type="primary" size="xsmall" shape="circle" @click="_delete(item,$index)">{{$t('Confirm')}}</x-button>
</div> </div>
<template slot="reference"> <template slot="reference">
<x-button v-if="item.id==1" type="error" shape="circle" size="xsmall" data-toggle="tooltip" icon="iconfont icon-shanchu" :title="$t('delete')" disabled></x-button> <x-button type="error" shape="circle" size="xsmall" data-toggle="tooltip" icon="iconfont icon-shanchu" :title="$t('delete')" :disabled="item.id==1?true: false"></x-button>
<x-button v-else type="error" shape="circle" size="xsmall" data-toggle="tooltip" icon="iconfont icon-shanchu" :title="$t('delete')"></x-button>
</template> </template>
</x-poptip> </x-poptip>
</td> </td>

44
dolphinscheduler-ui/src/js/module/ana-charts/common.js

@ -1,9 +1,25 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/** /**
* 根据参数找到容器并初始化图表然后返回一个或者一组图表实例 * Find the container and initialize the chart according to the parameters, and then return one or a group of chart instances
* @param {*} Target 图表组件类 * @param {*} Target Chart component class
* @param {*} el 选择器或者 DOM 对象 * @param {*} el Selector or DOM object
* @param {*} data 数据源 * @param {*} data data source
* @param {*} options 可选项 * @param {*} options Optional
*/ */
export const init = (Target, el, data, options) => { export const init = (Target, el, data, options) => {
const list = getChartContainers(el) const list = getChartContainers(el)
@ -15,11 +31,11 @@ export const init = (Target, el, data, options) => {
} }
/** /**
* 统一图表容器为 DOM 元素数组 * Unified chart container is an array of DOM elements
* @param {*} el 选择器或者 DOM 对象 * @param {*} el Selector or DOM object
*/ */
function getChartContainers (el) { function getChartContainers (el) {
// 未传参数,直接返回 // Parameter not transmitted, return directly
if (!el) { if (!el) {
return return
} }
@ -33,7 +49,7 @@ function getChartContainers (el) {
} }
} }
if (!el) { if (!el) {
throw new Error('找不到对应的dom对象') throw new Error('No corresponding DOM object found!')
} }
let list let list
if (HTMLElement.prototype.isPrototypeOf(el)) { if (HTMLElement.prototype.isPrototypeOf(el)) {
@ -42,20 +58,20 @@ function getChartContainers (el) {
list = Array.from(el) list = Array.from(el)
} }
if (!list) { if (!list) {
throw new Error('未找到对应的dom对象') throw new Error('No corresponding DOM object found!')
} }
return list return list
} }
/** /**
* 检测在指定对象中是否存在指定的属性名 * Detects whether the specified property name exists in the specified object
* @param {Object} model 待检测模型 * @param {Object} model Model to be tested
* @param {...any} params 待检测属性名 * @param {...any} params Property name to be tested
*/ */
export const checkKeyInModel = (model, ...params) => { export const checkKeyInModel = (model, ...params) => {
for (const key of params) { for (const key of params) {
if (!model.hasOwnProperty(key)) { if (!model.hasOwnProperty(key)) {
throw new Error('数据格式错误未找到指定属性' + key) throw new Error('Data format error! The specified property was not found:' + key)
} }
} }
} }

10
dolphinscheduler-ui/src/js/module/ana-charts/index.js

@ -34,15 +34,15 @@ const components = {
} }
const Chart = { const Chart = {
// 默认配置 // Default configuration
settings: {}, settings: {},
/** /**
* 配置全局属性 * Configure global properties
* @param {Object} options 全局配置项 * @param {Object} options Global configuration item
*/ */
config (options) { config (options) {
const { theme } = options const { theme } = options
// 注册主题 // Registration theme
if (theme) { if (theme) {
checkKeyInModel(theme, 'name', 'data') checkKeyInModel(theme, 'name', 'data')
echarts.registerTheme(theme.name, theme.data) echarts.registerTheme(theme.name, theme.data)
@ -53,7 +53,7 @@ const Chart = {
} }
} }
// 注入不同组件对应方法 // Corresponding methods for injection of different components
for (const key in components) { for (const key in components) {
if (components.hasOwnProperty(key)) { if (components.hasOwnProperty(key)) {
Chart[key.toLowerCase()] = (el, data, options) => { Chart[key.toLowerCase()] = (el, data, options) => {

84
dolphinscheduler-ui/src/js/module/ana-charts/packages/bar/index.js

@ -20,27 +20,27 @@ import { checkKeyInModel, init } from '../../common'
const TYPE = 'bar' const TYPE = 'bar'
/** /**
* 柱状图 * Histogram
*/ */
export default class Bar extends Base { export default class Bar extends Base {
/** /**
* 单独导出时调用的初始化方法 * Initialization method called on separate export
* @param {*} el 选择器或者 DOM 对象 * @param {*} el Selector or DOM object
* @param {*} data 数据源 * @param {*} data data source
* @param {*} options 可选项 * @param {*} options Optional
*/ */
static init (el, data, options) { static init (el, data, options) {
return init(Bar, el, data, options) return init(Bar, el, data, options)
} }
/** /**
* 将用户配置转换为符合 ECharts API 格式的配置格式 * Convert user configuration to a configuration format that conforms to the format of echarts API
*/ */
transform () { transform () {
const { data = [] } = this.settings const { data = [] } = this.settings
if (data.length === 0) { if (data.length === 0) {
throw new Error('数据源为空') throw new Error('Data source is empty')
} }
if (Object.keys(data[0]).length > 2) { if (Object.keys(data[0]).length > 2) {
@ -52,22 +52,22 @@ export default class Bar extends Base {
} }
/** /**
* 单条柱 * Single column
*/ */
setSingleBar () { setSingleBar () {
const { const {
// 数据 // data
data = [], data = [],
// 属性字典 // Attribute dictionary
keyMap = { keyMap = {
xAxisKey: 'key', xAxisKey: 'key',
dataKey: 'value' dataKey: 'value'
}, },
// 图表标题 // Chart title
title = '单条柱状图' title = 'Single bar histogram'
} = this.settings } = this.settings
// x 轴对应属性名,数据值对应的属性名 // X axis corresponds to attribute name, data value corresponds to attribute name
const { xAxisKey, dataKey } = keyMap const { xAxisKey, dataKey } = keyMap
checkKeyInModel(data[0], xAxisKey, dataKey) checkKeyInModel(data[0], xAxisKey, dataKey)
@ -89,27 +89,27 @@ export default class Bar extends Base {
} }
/** /**
* 多条柱 * Multiple columns
*/ */
setMultipleBars () { setMultipleBars () {
const { const {
// 数据 // data
data = [], data = [],
// 属性字典 // Attribute dictionary
keyMap = { keyMap = {
xAxisKey: 'key', xAxisKey: 'key',
legendKey: 'typeName', legendKey: 'typeName',
dataKey: 'value' dataKey: 'value'
}, },
// 图表标题 // Chart title
title = '多条柱状图', title = 'Multiple histogram',
// 折柱混合时,指定的折线数据索引 // The specified index of polyline data when the column is mixed
lineTypes lineTypes
} = this.settings } = this.settings
// x 轴对应属性名,图例对应的属性名,数据值对应的属性名 // Attribute name corresponding to X axis, legend and data value
const { xAxisKey, legendKey, dataKey } = keyMap const { xAxisKey, legendKey, dataKey } = keyMap
// 是否使用时间轴数据 // Use timeline data or not
const timeline = Object.keys(data[0]).length === 4 const timeline = Object.keys(data[0]).length === 4
const timelineKey = keyMap.timelineKey || 'timeline' const timelineKey = keyMap.timelineKey || 'timeline'
if (timeline) { if (timeline) {
@ -118,7 +118,7 @@ export default class Bar extends Base {
checkKeyInModel(data[0], xAxisKey, legendKey, dataKey) checkKeyInModel(data[0], xAxisKey, legendKey, dataKey)
} }
// 规范折柱混合索引 // Standard mixed index of folded columns
let lineTypeList = [] let lineTypeList = []
if (lineTypes) { if (lineTypes) {
if (!Array.isArray(lineTypes)) { if (!Array.isArray(lineTypes)) {
@ -128,7 +128,7 @@ export default class Bar extends Base {
} }
} }
// 时间轴默认配置 // Timeline default configuration
const timelineOptions = { const timelineOptions = {
timeline: { timeline: {
axisType: 'category', axisType: 'category',
@ -139,7 +139,7 @@ export default class Bar extends Base {
options: [] options: []
} }
// 初始值 // Initial value
const legendData = [] const legendData = []
const series = [] const series = []
const xAxis = { const xAxis = {
@ -151,24 +151,24 @@ export default class Bar extends Base {
const xAxisItem = data[i][xAxisKey] const xAxisItem = data[i][xAxisKey]
const dataItem = data[i][dataKey] const dataItem = data[i][dataKey]
// 图例 // Legend
if (!legendData.includes(legendItem)) { if (!legendData.includes(legendItem)) {
legendData.push(legendItem) legendData.push(legendItem)
} }
// x // x axis
if (!xAxis.data.includes(xAxisItem)) { if (!xAxis.data.includes(xAxisItem)) {
xAxis.data.push(xAxisItem) xAxis.data.push(xAxisItem)
} }
// 时间轴 // time axis
if (timeline) { if (timeline) {
const timelineItem = data[i][timelineKey] const timelineItem = data[i][timelineKey]
// 设置时间轴 label // Set timeline label
if (!timelineOptions.timeline.data.includes(timelineItem)) { if (!timelineOptions.timeline.data.includes(timelineItem)) {
timelineOptions.timeline.data.push(timelineItem) timelineOptions.timeline.data.push(timelineItem)
} }
// 通用的系列配置 // Universal family configuration
if (!series.some(s => s.name === legendItem)) { if (!series.some(s => s.name === legendItem)) {
let seriesType = TYPE let seriesType = TYPE
if (lineTypeList.length !== 0 && lineTypeList.includes(legendItem)) { if (lineTypeList.length !== 0 && lineTypeList.includes(legendItem)) {
@ -179,10 +179,10 @@ export default class Bar extends Base {
type: seriesType type: seriesType
}) })
} }
// 系列数据 // Series data
let targetOptions = timelineOptions.options.find(o => o._helpName === timelineItem) let targetOptions = timelineOptions.options.find(o => o._helpName === timelineItem)
if (!targetOptions) { if (!targetOptions) {
// 初始化 option // Initialization option
targetOptions = { targetOptions = {
_helpName: timelineItem, _helpName: timelineItem,
title: { text: title.replace('$timeline', timelineItem) }, title: { text: title.replace('$timeline', timelineItem) },
@ -192,7 +192,7 @@ export default class Bar extends Base {
} }
let targetSeries = targetOptions.series.find(d => d._helpName === legendItem) let targetSeries = targetOptions.series.find(d => d._helpName === legendItem)
if (!targetSeries) { if (!targetSeries) {
// 初始化系列数据 // Initialize series data
targetSeries = { targetSeries = {
_helpName: legendItem, _helpName: legendItem,
data: [] data: []
@ -201,7 +201,7 @@ export default class Bar extends Base {
} }
targetSeries.data.push(dataItem) targetSeries.data.push(dataItem)
} else { } else {
// 非时间轴数据处理 // Non timeline data processing
let targetSeries = series.find(s => s.name === legendItem) let targetSeries = series.find(s => s.name === legendItem)
if (!targetSeries) { if (!targetSeries) {
let seriesType = TYPE let seriesType = TYPE
@ -226,28 +226,28 @@ export default class Bar extends Base {
} }
/** /**
* 绘制图表 * Drawing charts
*/ */
apply () { apply () {
const { title, xAxis, series, legendData, timelineOptions } = this.options const { title, xAxis, series, legendData, timelineOptions } = this.options
const { const {
// 是否为横向图 // Whether it is a horizontal drawing
reverseAxis = false, reverseAxis = false,
// 自定义 y 轴 // Custom Y axis
yAxis, yAxis,
// 是否为堆叠图 // Is it a stacking diagram
stack = false, stack = false,
// 注入配置到 series // Injection configuration to series
insertSeries insertSeries
} = this.settings } = this.settings
const valueAxis = { type: 'value' } const valueAxis = { type: 'value' }
let yAxisModel = reverseAxis ? xAxis : valueAxis let yAxisModel = reverseAxis ? xAxis : valueAxis
let xAxisModel = reverseAxis ? valueAxis : xAxis let xAxisModel = reverseAxis ? valueAxis : xAxis
// 使用自定义 y 轴覆盖 // Use custom Y-axis overlay
if (yAxis) { if (yAxis) {
yAxisModel = yAxis yAxisModel = yAxis
} }
// 设置堆叠图 // Set up stack chart
if (stack) { if (stack) {
series.forEach(set => { series.forEach(set => {
set.stack = '总量' set.stack = '总量'
@ -265,7 +265,7 @@ export default class Bar extends Base {
_series = this.injectDataIntoSeries(insertSeries, _series) _series = this.injectDataIntoSeries(insertSeries, _series)
} }
// 时间轴 // time axis
if (timelineOptions) { if (timelineOptions) {
let opts = { let opts = {
baseOption: { baseOption: {
@ -293,7 +293,7 @@ export default class Bar extends Base {
this.echart.clear() this.echart.clear()
this.echart.setOption(opts, true) this.echart.setOption(opts, true)
} else { } else {
// 简单图表标题为空时,图表垂直居中 // When the simple chart title is empty, the chart is vertically centered
const top = !title && this.simple ? '3%' : 60 const top = !title && this.simple ? '3%' : 60
let opts = { let opts = {

10
dolphinscheduler-ui/src/js/module/ana-charts/packages/base.js

@ -24,23 +24,23 @@ export default class Base {
if (options) { if (options) {
this.options = options this.options = options
if (settings.theme) { if (settings.theme) {
// 使用已经注册的自定义主题 // Use a registered custom theme
this.echart = echarts.init(element, settings.theme) this.echart = echarts.init(element, settings.theme)
} else if (Chart.settings.defaultTheme) { } else if (Chart.settings.defaultTheme) {
// 使用全局配置的主题 // Topics using global configuration
this.echart = echarts.init(element, Chart.settings.defaultTheme) this.echart = echarts.init(element, Chart.settings.defaultTheme)
} else { } else {
this.echart = echarts.init(element) this.echart = echarts.init(element)
} }
// 响应窗口 resize 事件 // Response window resize event
window.addEventListener('resize', () => this.echart.resize()) window.addEventListener('resize', () => this.echart.resize())
this.apply() this.apply()
} }
} }
/** /**
* 刷新数据 * refresh data
* @param {*} data 图表数据 * @param {*} data Icon data
*/ */
setData (data) { setData (data) {
if (data && data.length !== 0) { if (data && data.length !== 0) {

30
dolphinscheduler-ui/src/js/module/ana-charts/packages/funnel/index.js

@ -20,29 +20,29 @@ import { checkKeyInModel, init } from '../../common'
const TYPE = 'funnel' const TYPE = 'funnel'
/** /**
* 漏斗图 * Funnel plot
*/ */
export default class Funnel extends Base { export default class Funnel extends Base {
/** /**
* 单独导出时调用的初始化方法 * Initialization method called on separate export
* @param {*} el 选择器或者 DOM 对象 * @param {*} el Selector or DOM pair
* @param {*} data 数据源 * @param {*} data data source
* @param {*} options 可选项 * @param {*} options Optional
*/ */
static init (el, data, options) { static init (el, data, options) {
return init(Funnel, el, data, options) return init(Funnel, el, data, options)
} }
/** /**
* 将用户配置转换为符合 ECharts API 格式的配置格式 * Convert user configuration to a configuration format that conforms to the format of echarts API
*/ */
transform () { transform () {
const { const {
// 数据 // data
data = [], data = [],
// 标题 // title
title = '漏斗图', title = 'Funnel plot',
// 属性字典 // Attribute dictionary
keyMap = { keyMap = {
textKey: 'key', textKey: 'key',
dataKey: 'value' dataKey: 'value'
@ -50,10 +50,10 @@ export default class Funnel extends Base {
} = this.settings } = this.settings
if (data.length === 0) { if (data.length === 0) {
throw new Error('数据源为空') throw new Error('Data source is empty!')
} }
// 文本对应属性名,数据值对应的属性名 // Attribute name corresponding to text and attribute name corresponding to data value
const { textKey, dataKey } = keyMap const { textKey, dataKey } = keyMap
checkKeyInModel(data[0], textKey, dataKey) checkKeyInModel(data[0], textKey, dataKey)
@ -99,7 +99,7 @@ export default class Funnel extends Base {
data: [] data: []
}] }]
// 填充数据 // Fill data
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
const element = data[i] const element = data[i]
const { [dataKey]: value, [textKey]: name, ...other } = element const { [dataKey]: value, [textKey]: name, ...other } = element
@ -115,12 +115,12 @@ export default class Funnel extends Base {
} }
/** /**
* 绘制图表 * Drawing charts
*/ */
apply () { apply () {
let { title, series, legendData } = this.options let { title, series, legendData } = this.options
// 注入配置到series // Injection configuration to series
let { insertSeries } = this.settings let { insertSeries } = this.settings
let _series = series let _series = series
if (insertSeries && insertSeries.length && series.length) { if (insertSeries && insertSeries.length && series.length) {

56
dolphinscheduler-ui/src/js/module/ana-charts/packages/line/index.js

@ -20,27 +20,27 @@ import { checkKeyInModel, init } from '../../common'
const TYPE = 'line' const TYPE = 'line'
/** /**
* 折线图 * Broken line diagram
*/ */
export default class Line extends Base { export default class Line extends Base {
/** /**
* 单独导出时调用的初始化方法 * Initialization method called on separate export
* @param {*} el 选择器或者 DOM 对象 * @param {*} el Selector or DOM object
* @param {*} data 数据源 * @param {*} data data source
* @param {*} options 可选项 * @param {*} options Optional
*/ */
static init (el, data, options) { static init (el, data, options) {
return init(Line, el, data, options) return init(Line, el, data, options)
} }
/** /**
* 将用户配置转换为符合 ECharts API 格式的配置格式 * Convert user configuration to a configuration format that conforms to the format of echarts API
*/ */
transform () { transform () {
const { data = [] } = this.settings const { data = [] } = this.settings
if (data.length === 0) { if (data.length === 0) {
throw new Error('数据源为空') throw new Error('Data source is empty!')
} }
if (Object.keys(data[0]).length > 2) { if (Object.keys(data[0]).length > 2) {
@ -52,22 +52,22 @@ export default class Line extends Base {
} }
/** /**
* 单条折线 * Single broken line
*/ */
setSingleLine () { setSingleLine () {
const { const {
// 数据 // data
data = [], data = [],
// 属性字典 // Attribute dictionary
keyMap = { keyMap = {
xAxisKey: 'key', xAxisKey: 'key',
dataKey: 'value' dataKey: 'value'
}, },
// 图表标题 // Chart title
title = '单条折线图' title = 'Single line chart'
} = this.settings } = this.settings
// x 轴对应属性名,数据值对应的属性名 // X axis corresponds to attribute name, data value corresponds to attribute name
const { xAxisKey, dataKey } = keyMap const { xAxisKey, dataKey } = keyMap
checkKeyInModel(data[0], xAxisKey, dataKey) checkKeyInModel(data[0], xAxisKey, dataKey)
@ -89,23 +89,23 @@ export default class Line extends Base {
} }
/** /**
* 多条折线 * Multiple broken lines
*/ */
setMultipleLines () { setMultipleLines () {
const { const {
// 数据 // data
data = [], data = [],
// 属性字典 // Attribute dictionary
keyMap = { keyMap = {
xAxisKey: 'key', xAxisKey: 'key',
legendKey: 'typeName', legendKey: 'typeName',
dataKey: 'value' dataKey: 'value'
}, },
// 图表标题 // Chart title
title = '多条折线图' title = 'Multiple line chart'
} = this.settings } = this.settings
// x 轴对应属性名,图例对应的属性名,数据值对应的属性名 // Attribute name corresponding to X axis, legend and data value
const { xAxisKey, legendKey, dataKey } = keyMap const { xAxisKey, legendKey, dataKey } = keyMap
checkKeyInModel(data[0], xAxisKey, legendKey, dataKey) checkKeyInModel(data[0], xAxisKey, legendKey, dataKey)
@ -121,17 +121,17 @@ export default class Line extends Base {
const xAxisItem = data[i][xAxisKey] const xAxisItem = data[i][xAxisKey]
const dataItem = data[i][dataKey] const dataItem = data[i][dataKey]
// 图例 // Legend
if (!legendData.includes(legendItem)) { if (!legendData.includes(legendItem)) {
legendData.push(legendItem) legendData.push(legendItem)
} }
// x 轴 // X axis
if (!xAxis.data.includes(xAxisItem)) { if (!xAxis.data.includes(xAxisItem)) {
xAxis.data.push(xAxisItem) xAxis.data.push(xAxisItem)
} }
// 系列 // series
let targetSeries = series.find(s => s.name === legendItem) let targetSeries = series.find(s => s.name === legendItem)
if (!targetSeries) { if (!targetSeries) {
targetSeries = { targetSeries = {
@ -148,26 +148,26 @@ export default class Line extends Base {
} }
/** /**
* 绘制图表 * Drawing charts
*/ */
apply () { apply () {
const { title, xAxis, series, legendData = [] } = this.options const { title, xAxis, series, legendData = [] } = this.options
const { const {
// 是否为横向图 // Whether it is a horizontal drawing
reverseAxis = false, reverseAxis = false,
// 自定义 y 轴 // Custom Y axis
yAxis, yAxis,
// 注入配置到 series // Injection configuration to series
insertSeries insertSeries
} = this.settings } = this.settings
const valueAxis = { type: 'value' } const valueAxis = { type: 'value' }
let yAxisModel = reverseAxis ? xAxis : valueAxis let yAxisModel = reverseAxis ? xAxis : valueAxis
let xAxisModel = reverseAxis ? valueAxis : xAxis let xAxisModel = reverseAxis ? valueAxis : xAxis
// 使用自定义 y 轴覆盖 // Use custom Y-axis overlay
if (yAxis) { if (yAxis) {
yAxisModel = yAxis yAxisModel = yAxis
} }
// 简单图表标题为空时,图表垂直居中 // When the simple chart title is empty, the chart is vertically centered
const top = !title && this.simple ? '3%' : 60 const top = !title && this.simple ? '3%' : 60
let _series = series let _series = series

30
dolphinscheduler-ui/src/js/module/ana-charts/packages/pie/index.js

@ -20,31 +20,31 @@ import { checkKeyInModel, init } from '../../common'
const TYPE = 'pie' const TYPE = 'pie'
/** /**
* 饼图 * Pie chart
*/ */
export default class Pie extends Base { export default class Pie extends Base {
/** /**
* 单独导出时调用的初始化方法 * Initialization method called on separate export
* @param {*} el 选择器或者 DOM 对象 * @param {*} el Selector or DOM object
* @param {*} data 数据源 * @param {*} data data source
* @param {*} options 可选项 * @param {*} options Optional
*/ */
static init (el, data, options) { static init (el, data, options) {
return init(Pie, el, data, options) return init(Pie, el, data, options)
} }
/** /**
* 将用户配置转换为符合 ECharts API 格式的配置格式 * Convert user configuration to a configuration format that conforms to the format of echarts API
*/ */
transform () { transform () {
const { const {
// 数据 // data
data = [], data = [],
// 标题 // title
title = '饼图', title = 'Pie chart',
// 是否环形图 // Ring chart or not
ring = false, ring = false,
// 属性字典 // Attribute dictionary
keyMap = { keyMap = {
textKey: 'key', textKey: 'key',
dataKey: 'value' dataKey: 'value'
@ -55,7 +55,7 @@ export default class Pie extends Base {
throw new Error('数据源为空') throw new Error('数据源为空')
} }
// 文本对应属性名,数据值对应的属性名 // Attribute name corresponding to text and attribute name corresponding to data value
const { textKey, dataKey } = keyMap const { textKey, dataKey } = keyMap
checkKeyInModel(data[0], textKey, dataKey) checkKeyInModel(data[0], textKey, dataKey)
@ -69,7 +69,7 @@ export default class Pie extends Base {
data: [] data: []
}] }]
// 填充数据 // Fill data
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
const element = data[i] const element = data[i]
const { [dataKey]: value, [textKey]: name, ...other } = element const { [dataKey]: value, [textKey]: name, ...other } = element
@ -85,12 +85,12 @@ export default class Pie extends Base {
} }
/** /**
* 绘制图表 * Drawing charts
*/ */
apply () { apply () {
let { title, series, legendData } = this.options let { title, series, legendData } = this.options
// 注入配置到series // Injection configuration to series
let { insertSeries } = this.settings let { insertSeries } = this.settings
let _series = series let _series = series
if (insertSeries && insertSeries.length && series.length) { if (insertSeries && insertSeries.length && series.length) {

34
dolphinscheduler-ui/src/js/module/ana-charts/packages/radar/index.js

@ -20,29 +20,29 @@ import { checkKeyInModel, init } from '../../common'
const TYPE = 'radar' const TYPE = 'radar'
/** /**
* 雷达图 * Radar chart
*/ */
export default class Radar extends Base { export default class Radar extends Base {
/** /**
* 单独导出时调用的初始化方法 * Initialization method called on separate export
* @param {*} el 选择器或者 DOM 对象 * @param {*} el Selector or DOM object
* @param {*} data 数据源 * @param {*} data data source
* @param {*} options 可选项 * @param {*} options Optional
*/ */
static init (el, data, options) { static init (el, data, options) {
return init(Radar, el, data, options) return init(Radar, el, data, options)
} }
/** /**
* 将用户配置转换为符合 ECharts API 格式的配置格式 * Convert user configuration to a configuration format that conforms to the format of echarts API
*/ */
transform () { transform () {
const { const {
// 数据 // data
data = [], data = [],
// 图表标题 // Chart title
title = '雷达图', title = 'Radar chart',
// 属性字典 // Attribute dictionary
keyMap = { keyMap = {
textKey: 'key', textKey: 'key',
legendKey: 'typeName', legendKey: 'typeName',
@ -51,10 +51,10 @@ export default class Radar extends Base {
} = this.settings } = this.settings
if (data.length === 0) { if (data.length === 0) {
throw new Error('数据源为空') throw new Error('Data source is empty!')
} }
// 文本对应属性名,图例对应的属性名,数据值对应的属性名 // Attribute name corresponding to text, attribute name corresponding to legend, attribute name corresponding to data value
const { textKey, legendKey, dataKey } = keyMap const { textKey, legendKey, dataKey } = keyMap
checkKeyInModel(data[0], textKey, legendKey, dataKey) checkKeyInModel(data[0], textKey, legendKey, dataKey)
@ -62,18 +62,18 @@ export default class Radar extends Base {
const seriesData = [] const seriesData = []
const indicator = [] const indicator = []
// 设置图例并初始化数据系列 // Set legend and initialize data series
for (let i = 0; i < data.length; i++) { for (let i = 0; i < data.length; i++) {
const legendItem = data[i][legendKey] const legendItem = data[i][legendKey]
const textItem = data[i][textKey] const textItem = data[i][textKey]
const dataItem = data[i][dataKey] const dataItem = data[i][dataKey]
// 图例 // Legend
if (!legendData.includes(legendItem)) { if (!legendData.includes(legendItem)) {
legendData.push(legendItem) legendData.push(legendItem)
} }
// 系列 // series
let targetSeries = seriesData.find(s => s.name === legendItem) let targetSeries = seriesData.find(s => s.name === legendItem)
if (!targetSeries) { if (!targetSeries) {
targetSeries = { targetSeries = {
@ -86,7 +86,7 @@ export default class Radar extends Base {
targetSeries.value.push(dataItem) targetSeries.value.push(dataItem)
targetSeries._raw.push(data[i]) targetSeries._raw.push(data[i])
// 指标 // index
let targetIndicator = indicator.find(i => i.name === textItem) let targetIndicator = indicator.find(i => i.name === textItem)
if (!targetIndicator) { if (!targetIndicator) {
indicator.push({ name: textItem }) indicator.push({ name: textItem })
@ -97,7 +97,7 @@ export default class Radar extends Base {
} }
/** /**
* 绘制图表 * Drawing charts
*/ */
apply () { apply () {
const { title, seriesData, legendData = [], indicator } = this.options const { title, seriesData, legendData = [], indicator } = this.options

34
dolphinscheduler-ui/src/js/module/ana-charts/packages/scatter/index.js

@ -20,29 +20,29 @@ import { checkKeyInModel, init } from '../../common'
const TYPE = 'scatter' const TYPE = 'scatter'
/** /**
* 气泡图 * Bubble chart
*/ */
export default class Scatter extends Base { export default class Scatter extends Base {
/** /**
* 单独导出时调用的初始化方法 * Initialization method called on separate export
* @param {*} el 选择器或者 DOM 对象 * @param {*} el Selector or DOM object
* @param {*} data 数据源 * @param {*} data data source
* @param {*} options 可选项 * @param {*} options Optional
*/ */
static init (el, data, options) { static init (el, data, options) {
return init(Scatter, el, data, options) return init(Scatter, el, data, options)
} }
/** /**
* 将用户配置转换为符合 ECharts API 格式的配置格式 * Convert user configuration to a configuration format that conforms to the format of echarts API
*/ */
transform () { transform () {
const { const {
// 数据 // data
data = [], data = [],
// 图表标题 // Chart title
title = '气泡图', title = 'Bubble chart',
// 属性字典 // Attribute dictionary
keyMap = { keyMap = {
xKey: 'x', xKey: 'x',
yKey: 'y', yKey: 'y',
@ -53,7 +53,7 @@ export default class Scatter extends Base {
} = this.settings } = this.settings
if (data.length === 0) { if (data.length === 0) {
throw new Error('数据源为空') throw new Error('Data source is empty!')
} }
const legendData = [] const legendData = []
@ -72,12 +72,12 @@ export default class Scatter extends Base {
...other ...other
} = data[i] } = data[i]
// 图例 // Legend
if (!legendData.includes(legendItem)) { if (!legendData.includes(legendItem)) {
legendData.push(legendItem) legendData.push(legendItem)
} }
// 系列 // series
let targetSeries = series.find(s => s.name === legendItem) let targetSeries = series.find(s => s.name === legendItem)
if (!targetSeries) { if (!targetSeries) {
targetSeries = { targetSeries = {
@ -115,17 +115,17 @@ export default class Scatter extends Base {
} }
/** /**
* 绘制图表 * Drawing charts
*/ */
apply () { apply () {
const { title, series, legendData = [] } = this.options const { title, series, legendData = [] } = this.options
let { let {
// 自定义 x 轴 // Custom X axis
xAxis, xAxis,
// 自定义 y 轴 // Custom Y axis
yAxis, yAxis,
// 注入配置到 series // Injection configuration to series
insertSeries insertSeries
} = this.settings } = this.settings
let _series = series let _series = series

6
dolphinscheduler-ui/src/js/module/components/crontab/source/_source/input-number.vue

@ -49,15 +49,15 @@
// if (parseInt($val) >= this.min || parseInt($val) <= this.max) { // if (parseInt($val) >= this.min || parseInt($val) <= this.max) {
// return // return
// } // }
// // Verify integer
if (!$reg.test($val)) { if (!$reg.test($val)) {
this.value = this.min this.value = this.min
} }
// // Maximum value
if (this.value > this.max) { if (this.value > this.max) {
this.value = this.max this.value = this.max
} }
// // minimum value
if (this.min > this.value) { if (this.min > this.value) {
this.value = this.min this.value = this.min
} }

64
dolphinscheduler-ui/src/js/module/components/crontab/source/_times/day.vue

@ -145,19 +145,19 @@
dayValue: '*', dayValue: '*',
weekValue: '?', weekValue: '?',
everyDayVal: '*', everyDayVal: '*',
WkintervalWeekPerformVal: 2, // WkintervalWeekPerformVal: 2, // Every few days
WkintervalWeekStartVal: 2, // WkintervalWeekStartVal: 2, // What day of the week
selectWeekList: _.map(_.cloneDeep(selectList['week']), v => { selectWeekList: _.map(_.cloneDeep(selectList['week']), v => {
return { return {
value: v.value, value: v.value,
label: `${this.$t(v.label)}` label: `${this.$t(v.label)}`
} }
}), }),
intervalDayPerformVal: 1, // intervalDayPerformVal: 1, // Every other day
intervalDayStartVal: 1, // intervalDayStartVal: 1, // From the day
WkspecificWeekVal: [], // WkspecificWeekVal: [], // Specific day of the week
selectSpecificWeekList: selectList['specificWeek'], selectSpecificWeekList: selectList['specificWeek'],
WkspecificDayVal: [], // WkspecificDayVal: [], // Specific day of the week
selectSpecificDayList: selectList['day'], selectSpecificDayList: selectList['day'],
monthLastDaysVal: 'L', monthLastDaysVal: 'L',
monthLastWorkingDays: 'LW', monthLastWorkingDays: 'LW',
@ -185,7 +185,7 @@
weekVal: String weekVal: String
}, },
methods: { methods: {
// // Every few weeks
onWkintervalWeekPerform (val) { onWkintervalWeekPerform (val) {
this.WkintervalWeekPerformVal = val this.WkintervalWeekPerformVal = val
if (this.radioDay === 'WkintervalWeek') { if (this.radioDay === 'WkintervalWeek') {
@ -193,81 +193,81 @@
this.weekValue = `${this.WkintervalWeekStartVal}/${this.WkintervalWeekPerformVal}` this.weekValue = `${this.WkintervalWeekStartVal}/${this.WkintervalWeekPerformVal}`
} }
}, },
// // Every other day
onIntervalDayPerform (val) { onIntervalDayPerform (val) {
this.intervalDayPerformVal = val this.intervalDayPerformVal = val
if (this.radioDay === 'intervalDay') { if (this.radioDay === 'intervalDay') {
this.dayValue = `${this.intervalDayStartVal}/${this.intervalDayPerformVal}` this.dayValue = `${this.intervalDayStartVal}/${this.intervalDayPerformVal}`
} }
}, },
// // From week day
onIntervalDayStart (val) { onIntervalDayStart (val) {
this.intervalDayStartVal = val this.intervalDayStartVal = val
if (this.radioDay === 'intervalDay') { if (this.radioDay === 'intervalDay') {
this.dayValue = `${this.intervalDayStartVal}/${this.intervalDayPerformVal}` this.dayValue = `${this.intervalDayStartVal}/${this.intervalDayPerformVal}`
} }
}, },
// // By the end of this month
onMonthTailBefore (val) { onMonthTailBefore (val) {
this.monthTailBeforeVal = val this.monthTailBeforeVal = val
if (this.radioDay === 'monthTailBefore') { if (this.radioDay === 'monthTailBefore') {
this.dayValue = `L-${this.monthTailBeforeVal}` this.dayValue = `L-${this.monthTailBeforeVal}`
} }
}, },
// // Last working day
onRecentlyWorkingDaysMonth (val) { onRecentlyWorkingDaysMonth (val) {
this.recentlyWorkingDaysMonthVal = val this.recentlyWorkingDaysMonthVal = val
if (this.radioDay === 'recentlyWorkingDaysMonth') { if (this.radioDay === 'recentlyWorkingDaysMonth') {
this.dayValue = `${this.recentlyWorkingDaysMonthVal}W` this.dayValue = `${this.recentlyWorkingDaysMonthVal}W`
} }
}, },
// // On the day of this month
onWkmonthNumWeeksDay (val) { onWkmonthNumWeeksDay (val) {
this.WkmonthNumWeeksDayVal = val this.WkmonthNumWeeksDayVal = val
this.weekValue = `${this.WkmonthNumWeeksWeekVal}#${this.WkmonthNumWeeksDayVal}` this.weekValue = `${this.WkmonthNumWeeksWeekVal}#${this.WkmonthNumWeeksDayVal}`
}, },
// // Reset every day
everyDayReset () { everyDayReset () {
this.dayValue = _.cloneDeep(this.everyDayVal) this.dayValue = _.cloneDeep(this.everyDayVal)
}, },
// * // Reset interval week starts from *
WkintervalWeekReset () { WkintervalWeekReset () {
this.weekValue = `${this.WkintervalWeekStartVal}/${this.WkintervalWeekPerformVal}` this.weekValue = `${this.WkintervalWeekStartVal}/${this.WkintervalWeekPerformVal}`
}, },
// * // Reset interval days from *
intervalDayReset () { intervalDayReset () {
this.dayValue = `${this.intervalDayStartVal}/${this.intervalDayPerformVal}` this.dayValue = `${this.intervalDayStartVal}/${this.intervalDayPerformVal}`
}, },
// // Specific week (multiple choices)
WkspecificWeekReset () { WkspecificWeekReset () {
this.weekValue = this.WkspecificWeekVal.length ? this.WkspecificWeekVal.join(',') : '*' this.weekValue = this.WkspecificWeekVal.length ? this.WkspecificWeekVal.join(',') : '*'
}, },
// // Specific days (multiple choices)
specificDayReset () { specificDayReset () {
this.dayValue = this.WkspecificDayVal.length ? this.WkspecificDayVal.join(',') : '*' this.dayValue = this.WkspecificDayVal.length ? this.WkspecificDayVal.join(',') : '*'
}, },
// // On the last day of the month
monthLastDaysReset () { monthLastDaysReset () {
this.dayValue = _.cloneDeep(this.monthLastDaysVal) this.dayValue = _.cloneDeep(this.monthLastDaysVal)
}, },
// // On the last working day of the month
monthLastWorkingDaysReset () { monthLastWorkingDaysReset () {
this.dayValue = _.cloneDeep(this.monthLastWorkingDays) this.dayValue = _.cloneDeep(this.monthLastWorkingDays)
}, },
// * // At the end of the month*
monthLastWeeksReset () { monthLastWeeksReset () {
this.dayValue = _.cloneDeep(this.monthLastWeeksVal) this.dayValue = _.cloneDeep(this.monthLastWeeksVal)
}, },
// // By the end of this month
monthTailBeforeReset () { monthTailBeforeReset () {
this.dayValue = `L-${this.monthTailBeforeVal}` this.dayValue = `L-${this.monthTailBeforeVal}`
}, },
// // Last working day (Monday to Friday) to this month
recentlyWorkingDaysMonthReset () { recentlyWorkingDaysMonthReset () {
this.dayValue = `${this.recentlyWorkingDaysMonthVal}W` this.dayValue = `${this.recentlyWorkingDaysMonthVal}W`
}, },
// // On the day of this month
WkmonthNumReset () { WkmonthNumReset () {
this.weekValue = `${this.WkmonthNumWeeksWeekVal}#${this.WkmonthNumWeeksDayVal}` this.weekValue = `${this.WkmonthNumWeeksWeekVal}#${this.WkmonthNumWeeksDayVal}`
} }
@ -281,7 +281,7 @@
this.$emit('on-week-value', val) this.$emit('on-week-value', val)
// console.log('weekValue=> ' + val) // console.log('weekValue=> ' + val)
}, },
// // Selected type
radioDay (val) { radioDay (val) {
switch (val) { switch (val) {
case 'everyDay': case 'everyDay':
@ -336,14 +336,14 @@
this.weekValue = `${val}/${this.WkintervalWeekPerformVal}` this.weekValue = `${val}/${this.WkintervalWeekPerformVal}`
} }
}, },
// // Specific day of the week (multiple choice)
WkspecificWeekVal (val) { WkspecificWeekVal (val) {
if (this.radioDay === 'WkspecificWeek') { if (this.radioDay === 'WkspecificWeek') {
this.dayValue = `?` this.dayValue = `?`
this.weekValue = val.join(',') this.weekValue = val.join(',')
} }
}, },
// // Specific days (multiple choices)
WkspecificDayVal (val) { WkspecificDayVal (val) {
if (this.radioDay === 'specificDay') { if (this.radioDay === 'specificDay') {
this.weekValue = `?` this.weekValue = `?`
@ -371,19 +371,19 @@
let isWeek1 = $weekVal.indexOf('/') !== -1 let isWeek1 = $weekVal.indexOf('/') !== -1
let isWeek2 = $weekVal.indexOf('#') !== -1 let isWeek2 = $weekVal.indexOf('#') !== -1
// // Initialization
if ($dayVal === '*' && $weekVal === '?') { if ($dayVal === '*' && $weekVal === '?') {
console.log('初始化') console.log('Initialization')
this.radioDay = 'everyDay' this.radioDay = 'everyDay'
return return
} }
// // week
if (isWeek1 || isWeek2 || isWeek($weekVal)) { if (isWeek1 || isWeek2 || isWeek($weekVal)) {
this.dayValue = `?` this.dayValue = `?`
/** /**
* 按顺序标序号处理(除去天) * Processing by sequence number (excluding days)
* @param [ * @param [
* WkintervalWeek=>(/), * WkintervalWeek=>(/),
* WkspecificWeek=>(TUE,WED), * WkspecificWeek=>(TUE,WED),
@ -414,7 +414,7 @@
this.radioDay = 'WkmonthNumWeeks' this.radioDay = 'WkmonthNumWeeks'
} }
// // Processing week
if (isStr($weekVal, '/')) { if (isStr($weekVal, '/')) {
hanleWeekOne() hanleWeekOne()
} else if (isStr($weekVal, '#')) { } else if (isStr($weekVal, '#')) {
@ -426,7 +426,7 @@
this.weekValue = `?` this.weekValue = `?`
/** /**
* 按顺序标序号处理(除去周) * Processing by sequence number (excluding week)
* @param [ * @param [
* everyDay=>(*), * everyDay=>(*),
* intervalDay=>(1/1), * intervalDay=>(1/1),

44
dolphinscheduler-ui/src/js/module/components/crontab/source/_times/hour.vue

@ -91,46 +91,46 @@
event: 'hourValueEvent' event: 'hourValueEvent'
}, },
methods: { methods: {
// 1 // Interval execution time1
onIntervalPerform (val) { onIntervalPerform (val) {
this.intervalPerformVal = val this.intervalPerformVal = val
if (this.radioHour === 'intervalHour') { if (this.radioHour === 'intervalHour') {
this.hourValue = `${this.intervalStartVal}/${this.intervalPerformVal}` this.hourValue = `${this.intervalStartVal}/${this.intervalPerformVal}`
} }
}, },
// 2 // Interval start time2
onIntervalStart (val) { onIntervalStart (val) {
this.intervalStartVal = val this.intervalStartVal = val
if (this.radioHour === 'intervalHour') { if (this.radioHour === 'intervalHour') {
this.hourValue = `${this.intervalStartVal}/${this.intervalPerformVal}` this.hourValue = `${this.intervalStartVal}/${this.intervalPerformVal}`
} }
}, },
// // Specific hours
onspecificHours (arr) { onspecificHours (arr) {
}, },
// // Cycle start value
onCycleStart (val) { onCycleStart (val) {
this.cycleStartVal = val this.cycleStartVal = val
if (this.radioHour === 'cycleHour') { if (this.radioHour === 'cycleHour') {
this.hourValue = `${this.cycleStartVal}-${this.cycleEndVal}` this.hourValue = `${this.cycleStartVal}-${this.cycleEndVal}`
} }
}, },
// // Cycle end value
onCycleEnd (val) { onCycleEnd (val) {
this.cycleEndVal = val this.cycleEndVal = val
if (this.radioHour === 'cycleHour') { if (this.radioHour === 'cycleHour') {
this.hourValue = `${this.cycleStartVal}-${this.cycleEndVal}` this.hourValue = `${this.cycleStartVal}-${this.cycleEndVal}`
} }
}, },
// // Reset every hour
everyReset () { everyReset () {
this.hourValue = '*' this.hourValue = '*'
}, },
// // Reset interval hours
intervalReset () { intervalReset () {
this.hourValue = `${this.intervalStartVal}/${this.intervalPerformVal}` this.hourValue = `${this.intervalStartVal}/${this.intervalPerformVal}`
}, },
// // Reset specific hours
specificReset () { specificReset () {
if (this.specificHoursVal.length) { if (this.specificHoursVal.length) {
this.hourValue = this.specificHoursVal.join(',') this.hourValue = this.specificHoursVal.join(',')
@ -138,31 +138,31 @@
this.hourValue = '*' this.hourValue = '*'
} }
}, },
// // Reset cycle hours
cycleReset () { cycleReset () {
this.hourValue = `${this.cycleStartVal}-${this.cycleEndVal}` this.hourValue = `${this.cycleStartVal}-${this.cycleEndVal}`
}, },
/** /**
* 解析参数值 * Parse parameter value
*/ */
analyticalValue () { analyticalValue () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let $hourVal = _.cloneDeep(this.value) let $hourVal = _.cloneDeep(this.value)
// // Interval hour
let $interval = isStr($hourVal, '/') let $interval = isStr($hourVal, '/')
// // Specific hours
let $specific = isStr($hourVal, ',') let $specific = isStr($hourVal, ',')
// // Cycle hour
let $cycle = isStr($hourVal, '-') let $cycle = isStr($hourVal, '-')
// // Every hour
if ($hourVal === '*') { if ($hourVal === '*') {
this.radioHour = 'everyHour' this.radioHour = 'everyHour'
this.hourValue = '*' this.hourValue = '*'
return return
} }
// () // Positive integer (hour)
if ($hourVal.length === 1 && _.isInteger(parseInt($hourVal)) || if ($hourVal.length === 1 && _.isInteger(parseInt($hourVal)) ||
$hourVal.length === 2 && _.isInteger(parseInt($hourVal)) $hourVal.length === 2 && _.isInteger(parseInt($hourVal))
) { ) {
@ -171,7 +171,7 @@
return return
} }
// // Interval hour
if ($interval) { if ($interval) {
this.radioHour = 'intervalHour' this.radioHour = 'intervalHour'
this.intervalStartVal = parseInt($interval[0]) this.intervalStartVal = parseInt($interval[0])
@ -180,14 +180,14 @@
return return
} }
// // Specific hours
if ($specific) { if ($specific) {
this.radioHour = 'specificHour' this.radioHour = 'specificHour'
this.specificHoursVal = $specific this.specificHoursVal = $specific
return return
} }
// // Cycle hour
if ($cycle) { if ($cycle) {
this.radioHour = 'cycleHour' this.radioHour = 'cycleHour'
this.cycleStartVal = parseInt($cycle[0]) this.cycleStartVal = parseInt($cycle[0])
@ -200,11 +200,11 @@
} }
}, },
watch: { watch: {
// // Derived value
hourValue (val) { hourValue (val) {
this.$emit('hourValueEvent', val) this.$emit('hourValueEvent', val)
}, },
// // Selected type
radioHour (val) { radioHour (val) {
switch (val) { switch (val) {
case 'everyHour': case 'everyHour':
@ -221,7 +221,7 @@
break break
} }
}, },
// // Specific hours
specificHoursVal (arr) { specificHoursVal (arr) {
this.hourValue = arr.join(',') this.hourValue = arr.join(',')
} }
@ -230,7 +230,7 @@
}, },
created () { created () {
this.analyticalValue().then(() => { this.analyticalValue().then(() => {
console.log('数据结构解析成功!') console.log('Data structure parsing succeeded!')
}) })
}, },
beforeMount () { beforeMount () {

42
dolphinscheduler-ui/src/js/module/components/crontab/source/_times/minute.vue

@ -91,7 +91,7 @@
event: 'minuteValueEvent' event: 'minuteValueEvent'
}, },
methods: { methods: {
// 1 // Interval execution time1
onIntervalPerform (val) { onIntervalPerform (val) {
console.log(val) console.log(val)
this.intervalPerformVal = val this.intervalPerformVal = val
@ -99,39 +99,39 @@
this.minuteValue = `${this.intervalStartVal}/${this.intervalPerformVal}` this.minuteValue = `${this.intervalStartVal}/${this.intervalPerformVal}`
} }
}, },
// 2 // Interval start time2
onIntervalStart (val) { onIntervalStart (val) {
this.intervalStartVal = val this.intervalStartVal = val
if (this.radioMinute === 'intervalMinute') { if (this.radioMinute === 'intervalMinute') {
this.minuteValue = `${this.intervalStartVal}/${this.intervalPerformVal}` this.minuteValue = `${this.intervalStartVal}/${this.intervalPerformVal}`
} }
}, },
// // Specific points
onspecificMinutes (arr) { onspecificMinutes (arr) {
}, },
// // Cycle start value
onCycleStart (val) { onCycleStart (val) {
this.cycleStartVal = val this.cycleStartVal = val
if (this.radioMinute === 'cycleMinute') { if (this.radioMinute === 'cycleMinute') {
this.minuteValue = `${this.cycleStartVal}-${this.cycleEndVal}` this.minuteValue = `${this.cycleStartVal}-${this.cycleEndVal}`
} }
}, },
// // Cycle end value
onCycleEnd (val) { onCycleEnd (val) {
this.cycleEndVal = val this.cycleEndVal = val
if (this.radioMinute === 'cycleMinute') { if (this.radioMinute === 'cycleMinute') {
this.minuteValue = `${this.cycleStartVal}-${this.cycleEndVal}` this.minuteValue = `${this.cycleStartVal}-${this.cycleEndVal}`
} }
}, },
// // Reset every point
everyReset () { everyReset () {
this.minuteValue = '*' this.minuteValue = '*'
}, },
// // Reset interval minute
intervalReset () { intervalReset () {
this.minuteValue = `${this.intervalStartVal}/${this.intervalPerformVal}` this.minuteValue = `${this.intervalStartVal}/${this.intervalPerformVal}`
}, },
// // Reset specific minutes
specificReset () { specificReset () {
if (this.specificMinutesVal.length) { if (this.specificMinutesVal.length) {
this.minuteValue = this.specificMinutesVal.join(',') this.minuteValue = this.specificMinutesVal.join(',')
@ -139,31 +139,31 @@
this.minuteValue = '*' this.minuteValue = '*'
} }
}, },
// // Reset cycle minutes
cycleReset () { cycleReset () {
this.minuteValue = `${this.cycleStartVal}-${this.cycleEndVal}` this.minuteValue = `${this.cycleStartVal}-${this.cycleEndVal}`
}, },
/** /**
* 解析参数值 * Parse parameter value
*/ */
analyticalValue () { analyticalValue () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let $minuteVal = _.cloneDeep(this.value) let $minuteVal = _.cloneDeep(this.value)
// // Interval score
let $interval = isStr($minuteVal, '/') let $interval = isStr($minuteVal, '/')
// // Specific points
let $specific = isStr($minuteVal, ',') let $specific = isStr($minuteVal, ',')
// // Periodic Division
let $cycle = isStr($minuteVal, '-') let $cycle = isStr($minuteVal, '-')
// // Every point
if ($minuteVal === '*') { if ($minuteVal === '*') {
this.radioMinute = 'everyMinute' this.radioMinute = 'everyMinute'
this.minuteValue = '*' this.minuteValue = '*'
return return
} }
// // Positive integer (min)
if ($minuteVal.length === 1 && _.isInteger(parseInt($minuteVal)) || if ($minuteVal.length === 1 && _.isInteger(parseInt($minuteVal)) ||
$minuteVal.length === 2 && _.isInteger(parseInt($minuteVal)) $minuteVal.length === 2 && _.isInteger(parseInt($minuteVal))
) { ) {
@ -172,7 +172,7 @@
return return
} }
// // nterval score
if ($interval) { if ($interval) {
this.radioMinute = 'intervalMinute' this.radioMinute = 'intervalMinute'
this.intervalStartVal = parseInt($interval[0]) this.intervalStartVal = parseInt($interval[0])
@ -181,14 +181,14 @@
return return
} }
// // Specific minutes
if ($specific) { if ($specific) {
this.radioMinute = 'specificMinute' this.radioMinute = 'specificMinute'
this.specificMinutesVal = $specific this.specificMinutesVal = $specific
return return
} }
// // Periodic Division
if ($cycle) { if ($cycle) {
this.radioMinute = 'cycleMinute' this.radioMinute = 'cycleMinute'
this.cycleStartVal = parseInt($cycle[0]) this.cycleStartVal = parseInt($cycle[0])
@ -201,11 +201,11 @@
} }
}, },
watch: { watch: {
// // Derived value
minuteValue (val) { minuteValue (val) {
this.$emit('minuteValueEvent', val) this.$emit('minuteValueEvent', val)
}, },
// // Selected type
radioMinute (val) { radioMinute (val) {
switch (val) { switch (val) {
case 'everyMinute': case 'everyMinute':
@ -222,7 +222,7 @@
break break
} }
}, },
// // pecific minutes
specificMinutesVal (arr) { specificMinutesVal (arr) {
this.minuteValue = arr.join(',') this.minuteValue = arr.join(',')
} }

42
dolphinscheduler-ui/src/js/module/components/crontab/source/_times/month.vue

@ -91,46 +91,46 @@
event: 'monthValueEvent' event: 'monthValueEvent'
}, },
methods: { methods: {
// 1 // Interval execution time1
onIntervalPerform (val) { onIntervalPerform (val) {
this.intervalPerformVal = val this.intervalPerformVal = val
if (this.radioMonth === 'intervalMonth') { if (this.radioMonth === 'intervalMonth') {
this.monthValue = `${this.intervalStartVal}/${this.intervalPerformVal}` this.monthValue = `${this.intervalStartVal}/${this.intervalPerformVal}`
} }
}, },
// 2 // Interval start time2
onIntervalStart (val) { onIntervalStart (val) {
this.intervalStartVal = val this.intervalStartVal = val
if (this.radioMonth === 'intervalMonth') { if (this.radioMonth === 'intervalMonth') {
this.monthValue = `${this.intervalStartVal}/${this.intervalPerformVal}` this.monthValue = `${this.intervalStartVal}/${this.intervalPerformVal}`
} }
}, },
// // Specific months
onspecificlMonths (arr) { onspecificlMonths (arr) {
}, },
// // Cycle start value
onCycleStart (val) { onCycleStart (val) {
this.cycleStartVal = val this.cycleStartVal = val
if (this.radioMonth === 'cycleMonth') { if (this.radioMonth === 'cycleMonth') {
this.monthValue = `${this.cycleStartVal}-${this.cycleEndVal}` this.monthValue = `${this.cycleStartVal}-${this.cycleEndVal}`
} }
}, },
// // Cycle end value
onCycleEnd (val) { onCycleEnd (val) {
this.cycleEndVal = val this.cycleEndVal = val
if (this.radioMonth === 'cycleMonth') { if (this.radioMonth === 'cycleMonth') {
this.monthValue = `${this.cycleStartVal}-${this.cycleEndVal}` this.monthValue = `${this.cycleStartVal}-${this.cycleEndVal}`
} }
}, },
// // Reset every month
everyReset () { everyReset () {
this.monthValue = '*' this.monthValue = '*'
}, },
// // Reset every month
intervalReset () { intervalReset () {
this.monthValue = `${this.intervalStartVal}/${this.intervalPerformVal}` this.monthValue = `${this.intervalStartVal}/${this.intervalPerformVal}`
}, },
// // Reset specific months
specificReset () { specificReset () {
if (this.specificMonthVal.length) { if (this.specificMonthVal.length) {
this.monthValue = this.specificMonthVal.join(',') this.monthValue = this.specificMonthVal.join(',')
@ -138,31 +138,31 @@
this.monthValue = '*' this.monthValue = '*'
} }
}, },
// // Months of reset cycle
cycleReset () { cycleReset () {
this.monthValue = `${this.cycleStartVal}-${this.cycleEndVal}` this.monthValue = `${this.cycleStartVal}-${this.cycleEndVal}`
}, },
/** /**
* 解析参数值 * Parse parameter value
*/ */
analyticalValue () { analyticalValue () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let $monthVal = _.cloneDeep(this.value) let $monthVal = _.cloneDeep(this.value)
// // Interval month
let $interval = isStr($monthVal, '/') let $interval = isStr($monthVal, '/')
// // Specific months
let $specific = isStr($monthVal, ',') let $specific = isStr($monthVal, ',')
// // Cycle month
let $cycle = isStr($monthVal, '-') let $cycle = isStr($monthVal, '-')
// // Every month
if ($monthVal === '*') { if ($monthVal === '*') {
this.radioMonth = 'everyMonth' this.radioMonth = 'everyMonth'
this.monthValue = '*' this.monthValue = '*'
return return
} }
// () // Positive integer (month)
if ($monthVal.length === 1 && _.isInteger(parseInt($monthVal)) || if ($monthVal.length === 1 && _.isInteger(parseInt($monthVal)) ||
$monthVal.length === 2 && _.isInteger(parseInt($monthVal)) $monthVal.length === 2 && _.isInteger(parseInt($monthVal))
) { ) {
@ -171,7 +171,7 @@
return return
} }
// // Interval month
if ($interval) { if ($interval) {
this.radioMonth = 'intervalMonth' this.radioMonth = 'intervalMonth'
this.intervalStartVal = parseInt($interval[0]) this.intervalStartVal = parseInt($interval[0])
@ -180,14 +180,14 @@
return return
} }
// // Specific months
if ($specific) { if ($specific) {
this.radioMonth = 'specificlMonth' this.radioMonth = 'specificlMonth'
this.specificMonthVal = $specific this.specificMonthVal = $specific
return return
} }
// // Cycle month
if ($cycle) { if ($cycle) {
this.radioMonth = 'cycleMonth' this.radioMonth = 'cycleMonth'
this.cycleStartVal = parseInt($cycle[0]) this.cycleStartVal = parseInt($cycle[0])
@ -200,11 +200,11 @@
} }
}, },
watch: { watch: {
// // Derived value
monthValue (val) { monthValue (val) {
this.$emit('monthValueEvent', val) this.$emit('monthValueEvent', val)
}, },
// // Selected type
radioMonth (val) { radioMonth (val) {
switch (val) { switch (val) {
case 'everyMonth': case 'everyMonth':
@ -221,7 +221,7 @@
break break
} }
}, },
// // Specific months
specificMonthVal (arr) { specificMonthVal (arr) {
this.monthValue = arr.join(',') this.monthValue = arr.join(',')
} }

46
dolphinscheduler-ui/src/js/module/components/crontab/source/_times/second.vue

@ -91,7 +91,7 @@
event: 'secondValueEvent' event: 'secondValueEvent'
}, },
methods: { methods: {
// 1 // Interval execution time1
onIntervalPerform (val) { onIntervalPerform (val) {
console.log(val) console.log(val)
console.log('++') console.log('++')
@ -100,39 +100,39 @@
this.secondValue = `${this.intervalStartVal}/${this.intervalPerformVal}` this.secondValue = `${this.intervalStartVal}/${this.intervalPerformVal}`
} }
}, },
// 2 // Interval start time2
onIntervalStart (val) { onIntervalStart (val) {
this.intervalStartVal = val this.intervalStartVal = val
if (this.radioSecond === 'intervalSecond') { if (this.radioSecond === 'intervalSecond') {
this.secondValue = `${this.intervalStartVal}/${this.intervalPerformVal}` this.secondValue = `${this.intervalStartVal}/${this.intervalPerformVal}`
} }
}, },
// // Specific seconds
onSpecificSeconds (arr) { onSpecificSeconds (arr) {
}, },
// // Cycle start value
onCycleStart (val) { onCycleStart (val) {
this.cycleStartVal = val this.cycleStartVal = val
if (this.radioSecond === 'cycleSecond') { if (this.radioSecond === 'cycleSecond') {
this.secondValue = `${this.cycleStartVal}-${this.cycleEndVal}` this.secondValue = `${this.cycleStartVal}-${this.cycleEndVal}`
} }
}, },
// // Cycle end value
onCycleEnd (val) { onCycleEnd (val) {
this.cycleEndVal = val this.cycleEndVal = val
if (this.radioSecond === 'cycleSecond') { if (this.radioSecond === 'cycleSecond') {
this.secondValue = `${this.cycleStartVal}-${this.cycleEndVal}` this.secondValue = `${this.cycleStartVal}-${this.cycleEndVal}`
} }
}, },
// // Reset every second
everyReset () { everyReset () {
this.secondValue = '*' this.secondValue = '*'
}, },
// // Reset interval seconds
intervalReset () { intervalReset () {
this.secondValue = `${this.intervalStartVal}/${this.intervalPerformVal}` this.secondValue = `${this.intervalStartVal}/${this.intervalPerformVal}`
}, },
// // Reset specific seconds
specificReset () { specificReset () {
if (this.specificSecondsVal.length) { if (this.specificSecondsVal.length) {
this.secondValue = this.specificSecondsVal.join(',') this.secondValue = this.specificSecondsVal.join(',')
@ -140,31 +140,31 @@
this.secondValue = '*' this.secondValue = '*'
} }
}, },
// // Reset cycle seconds
cycleReset () { cycleReset () {
this.secondValue = `${this.cycleStartVal}-${this.cycleEndVal}` this.secondValue = `${this.cycleStartVal}-${this.cycleEndVal}`
}, },
/** /**
* 解析参数值 * Parse parameter value
*/ */
analyticalValue () { analyticalValue () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let $secondVal = _.cloneDeep(this.value) let $secondVal = _.cloneDeep(this.value)
// // Interval seconds
let $interval = isStr($secondVal, '/') let $interval = isStr($secondVal, '/')
// // Specific seconds
let $specific = isStr($secondVal, ',') let $specific = isStr($secondVal, ',')
// // Cycle second
let $cycle = isStr($secondVal, '-') let $cycle = isStr($secondVal, '-')
// // Every second
if ($secondVal === '*') { if ($secondVal === '*') {
this.radioSecond = 'everySecond' this.radioSecond = 'everySecond'
this.secondValue = '*' this.secondValue = '*'
return return
} }
// () // Positive integer (seconds)
if ($secondVal.length === 1 && _.isInteger(parseInt($secondVal)) || if ($secondVal.length === 1 && _.isInteger(parseInt($secondVal)) ||
$secondVal.length === 2 && _.isInteger(parseInt($secondVal)) $secondVal.length === 2 && _.isInteger(parseInt($secondVal))
) { ) {
@ -173,7 +173,7 @@
return return
} }
// // Interval seconds
if ($interval) { if ($interval) {
this.radioSecond = 'intervalSecond' this.radioSecond = 'intervalSecond'
this.intervalStartVal = parseInt($interval[0]) this.intervalStartVal = parseInt($interval[0])
@ -182,14 +182,14 @@
return return
} }
// // Specific seconds
if ($specific) { if ($specific) {
this.radioSecond = 'specificSecond' this.radioSecond = 'specificSecond'
this.specificSecondsVal = $specific this.specificSecondsVal = $specific
return return
} }
// // Cycle second
if ($cycle) { if ($cycle) {
this.radioSecond = 'cycleSecond' this.radioSecond = 'cycleSecond'
this.cycleStartVal = parseInt($cycle[0]) this.cycleStartVal = parseInt($cycle[0])
@ -202,17 +202,17 @@
} }
}, },
watch: { watch: {
// value // Value change reparse structure
value () { value () {
this.analyticalValue().then(() => { this.analyticalValue().then(() => {
console.log('数据结构解析成功!') console.log('数据结构解析成功!')
}) })
}, },
// // Derived value
secondValue (val) { secondValue (val) {
this.$emit('secondValueEvent', val) this.$emit('secondValueEvent', val)
}, },
// // Selected type
radioSecond (val) { radioSecond (val) {
switch (val) { switch (val) {
case 'everySecond': case 'everySecond':
@ -229,7 +229,7 @@
break break
} }
}, },
// // Specific seconds
specificSecondsVal (arr) { specificSecondsVal (arr) {
this.secondValue = arr.join(',') this.secondValue = arr.join(',')
} }
@ -238,7 +238,7 @@
}, },
created () { created () {
this.analyticalValue().then(() => { this.analyticalValue().then(() => {
console.log('数据结构解析成功!') console.log('Data structure parsing succeeded!')
}) })
}, },
beforeMount () { beforeMount () {

44
dolphinscheduler-ui/src/js/module/components/crontab/source/_times/year.vue

@ -91,7 +91,7 @@
event: 'yearValueEvent' event: 'yearValueEvent'
}, },
methods: { methods: {
// 1 // Interval execution time1
onIntervalPerform (val) { onIntervalPerform (val) {
console.log(val) console.log(val)
this.intervalPerformVal = val this.intervalPerformVal = val
@ -99,39 +99,39 @@
this.yearValue = `${this.intervalStartVal}/${this.intervalPerformVal}` this.yearValue = `${this.intervalStartVal}/${this.intervalPerformVal}`
} }
}, },
// 2 // Interval start time2
onIntervalStart (val) { onIntervalStart (val) {
this.intervalStartVal = val this.intervalStartVal = val
if (this.radioYear === 'intervalYear') { if (this.radioYear === 'intervalYear') {
this.yearValue = `${this.intervalStartVal}/${this.intervalPerformVal}` this.yearValue = `${this.intervalStartVal}/${this.intervalPerformVal}`
} }
}, },
// // Specific year
onspecificYears (arr) { onspecificYears (arr) {
}, },
// // Cycle start value
onCycleStart (val) { onCycleStart (val) {
this.cycleStartVal = val this.cycleStartVal = val
if (this.radioYear === 'cycleYear') { if (this.radioYear === 'cycleYear') {
this.yearValue = `${this.cycleStartVal}-${this.cycleEndVal}` this.yearValue = `${this.cycleStartVal}-${this.cycleEndVal}`
} }
}, },
// // Cycle end value
onCycleEnd (val) { onCycleEnd (val) {
this.cycleEndVal = val this.cycleEndVal = val
if (this.radioYear === 'cycleYear') { if (this.radioYear === 'cycleYear') {
this.yearValue = `${this.cycleStartVal}-${this.cycleEndVal}` this.yearValue = `${this.cycleStartVal}-${this.cycleEndVal}`
} }
}, },
// // Reset every year
everyReset () { everyReset () {
this.yearValue = '*' this.yearValue = '*'
}, },
// // Reset every other year
intervalReset () { intervalReset () {
this.yearValue = `${this.intervalStartVal}/${this.intervalPerformVal}` this.yearValue = `${this.intervalStartVal}/${this.intervalPerformVal}`
}, },
// // Reset specific years
specificReset () { specificReset () {
if (this.specificYearVal.length) { if (this.specificYearVal.length) {
this.yearValue = this.specificYearVal.join(',') this.yearValue = this.specificYearVal.join(',')
@ -139,38 +139,38 @@
this.yearValue = '*' this.yearValue = '*'
} }
}, },
// // Reset cycle years
cycleReset () { cycleReset () {
this.yearValue = `${this.cycleStartVal}-${this.cycleEndVal}` this.yearValue = `${this.cycleStartVal}-${this.cycleEndVal}`
}, },
/** /**
* 解析参数值 * Parse parameter value
*/ */
analyticalValue () { analyticalValue () {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let $yearVal = _.cloneDeep(this.value) let $yearVal = _.cloneDeep(this.value)
// // Interval year
let $interval = isStr($yearVal, '/') let $interval = isStr($yearVal, '/')
// // Specific year
let $specific = isStr($yearVal, ',') let $specific = isStr($yearVal, ',')
// // Cycle year
let $cycle = isStr($yearVal, '-') let $cycle = isStr($yearVal, '-')
// // Every year
if ($yearVal === '*') { if ($yearVal === '*') {
this.radioYear = 'everyYear' this.radioYear = 'everyYear'
this.yearValue = '*' this.yearValue = '*'
return return
} }
// () // Positive integer (year)
if ($yearVal.length === 4 && _.isInteger(parseInt($yearVal))) { if ($yearVal.length === 4 && _.isInteger(parseInt($yearVal))) {
this.radioYear = 'specificYear' this.radioYear = 'specificYear'
this.specificYearVal = [$yearVal] this.specificYearVal = [$yearVal]
return return
} }
// // Interval year
if ($interval) { if ($interval) {
this.radioYear = 'intervalYear' this.radioYear = 'intervalYear'
this.intervalStartVal = parseInt($interval[0]) this.intervalStartVal = parseInt($interval[0])
@ -179,14 +179,14 @@
return return
} }
// // Specific years
if ($specific) { if ($specific) {
this.radioYear = 'specificYear' this.radioYear = 'specificYear'
this.specificYearVal = $specific this.specificYearVal = $specific
return return
} }
// // Cycle year
if ($cycle) { if ($cycle) {
this.radioYear = 'cycleYear' this.radioYear = 'cycleYear'
this.cycleStartVal = parseInt($cycle[0]) this.cycleStartVal = parseInt($cycle[0])
@ -199,11 +199,11 @@
} }
}, },
watch: { watch: {
// // Derived value
yearValue (val) { yearValue (val) {
this.$emit('yearValueEvent', val) this.$emit('yearValueEvent', val)
}, },
// // Selected type
radioYear (val) { radioYear (val) {
switch (val) { switch (val) {
case 'everyYear': case 'everyYear':
@ -220,7 +220,7 @@
break break
} }
}, },
// // Specific years
specificYearVal (arr) { specificYearVal (arr) {
this.yearValue = arr.join(',') this.yearValue = arr.join(',')
} }
@ -229,7 +229,7 @@
}, },
created () { created () {
this.analyticalValue().then(() => { this.analyticalValue().then(() => {
console.log('数据结构解析成功!') console.log('Data structure parsing succeeded!')
}) })
}, },
beforeMount () { beforeMount () {

8
dolphinscheduler-ui/src/js/module/components/crontab/source/app.vue

@ -42,11 +42,11 @@
<m-hour v-model="hourVal"></m-hour> <m-hour v-model="hourVal"></m-hour>
</template> </template>
<!-- start --> <!-- day start -->
<template v-if="tabVal === 'day'"> <template v-if="tabVal === 'day'">
<m-day @on-day-value="_onDayValue" @on-week-value="_onWeekValue" :day-val="dayVal" :week-val="weekVal"></m-day> <m-day @on-day-value="_onDayValue" @on-week-value="_onWeekValue" :day-val="dayVal" :week-val="weekVal"></m-day>
</template> </template>
<!-- end --> <!-- day end -->
<template v-if="tabVal === 'month'"> <template v-if="tabVal === 'month'">
<m-month v-model="monthVal"></m-month> <m-month v-model="monthVal"></m-month>
@ -131,10 +131,10 @@
beforeCreate () { beforeCreate () {
}, },
created () { created () {
// win // International binding under win
window.localeCrontab = this.locale window.localeCrontab = this.locale
// // Initialization
this._reset() this._reset()
}, },
beforeMount () { beforeMount () {

6
dolphinscheduler-ui/src/js/module/components/crontab/source/util/index.js

@ -18,9 +18,9 @@
import _ from 'lodash' import _ from 'lodash'
/** /**
* 生成指定区间数字 * Generate specified interval number
* @param start 起始数值 * @param start Starting value
* @param end 结束数值 * @param end End value
*/ */
const range = (start, end) => { const range = (start, end) => {
let length = end - start + 1 let length = end - start + 1

18
dolphinscheduler-ui/src/js/module/components/secondaryMenu/_source/menu.js

@ -211,30 +211,12 @@ let menu = {
id: 1, id: 1,
disabled: true disabled: true
}, },
// {
// name: 'Alert',
// path: 'servers-alert',
// id: 2,
// disabled: true
// },
// {
// name: 'RpcServer',
// path: 'servers-rpcserver',
// id: 3,
// disabled: true
// },
{ {
name: 'Zookeeper', name: 'Zookeeper',
path: 'servers-zookeeper', path: 'servers-zookeeper',
id: 4, id: 4,
disabled: true disabled: true
}, },
// {
// name: 'ApiServer',
// path: 'servers-apiserver',
// id: 5,
// disabled: true
// },
{ {
name: 'DB', name: 'DB',
path: 'servers-db', path: 'servers-db',

Loading…
Cancel
Save