config.js 5.9 KB
Newer Older
L
ligang 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
/*
 * 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.
 */

import i18n from '@/module/i18n'
import Permissions from '@/module/permissions'

/**
 * Operation bar config
 * @code code
 * @icon icon
 * @disable disable
 * @desc tooltip
 */
const toolOper = (dagThis) => {
29
  let disabled =!dagThis.$store.state.dag.isDetails// Permissions.getAuth() === false ? false : !dagThis.$store.state.dag.isDetails
L
ligang 已提交
30 31 32
  return [
    {
      code: 'pointer',
33
      icon: 'ans-icon-pointer',
L
ligang 已提交
34
      disable: disabled,
G
i18n  
gongzijian 已提交
35
      desc: `${i18n.$t('Drag Nodes and Selected Items')}`
L
ligang 已提交
36 37 38
    },
    {
      code: 'line',
39
      icon: 'ans-icon-slash',
L
ligang 已提交
40
      disable: disabled,
G
i18n  
gongzijian 已提交
41
      desc: `${i18n.$t('Select Line Connection')}`
L
ligang 已提交
42 43 44
    },
    {
      code: 'remove',
45
      icon: 'ans-icon-trash',
L
ligang 已提交
46
      disable: disabled,
G
i18n  
gongzijian 已提交
47
      desc: `${i18n.$t('Delete selected lines or nodes')}`
L
ligang 已提交
48 49 50
    },
    {
      code: 'download',
51
      icon: 'ans-icon-download',
L
ligang 已提交
52
      disable: !!dagThis.type,
G
i18n  
gongzijian 已提交
53
      desc: `${i18n.$t('Download')}`
L
ligang 已提交
54 55 56
    },
    {
      code: 'screen',
57
      icon: 'ans-icon-max',
L
ligang 已提交
58
      disable: disabled,
G
i18n  
gongzijian 已提交
59
      desc: `${i18n.$t('Full Screen')}`
L
ligang 已提交
60 61 62 63 64 65 66 67 68 69 70 71 72
    }
  ]
}

/**
 * Post status
 * @id Front end definition id
 * @desc tooltip
 * @code Backend definition identifier
 */
let publishStatus = [
  {
    id: 0,
G
i18n  
gongzijian 已提交
73
    desc: `${i18n.$t('Unpublished')}`,
L
ligang 已提交
74 75 76 77
    code: 'NOT_RELEASE'
  },
  {
    id: 1,
G
i18n  
gongzijian 已提交
78
    desc: `${i18n.$t('online')}`,
L
ligang 已提交
79 80 81 82
    code: 'ONLINE'
  },
  {
    id: 2,
G
i18n  
gongzijian 已提交
83
    desc: `${i18n.$t('offline')}`,
L
ligang 已提交
84 85 86 87 88 89 90 91 92 93 94
    code: 'OFFLINE'
  }
]

/**
 * Operation type
 * @desc tooltip
 * @code identifier
 */
let runningType = [
  {
G
i18n  
gongzijian 已提交
95
    desc: `${i18n.$t('Start Process')}`,
L
ligang 已提交
96 97 98
    code: 'START_PROCESS'
  },
  {
G
i18n  
gongzijian 已提交
99
    desc: `${i18n.$t('Execute from the current node')}`,
L
ligang 已提交
100 101 102
    code: 'START_CURRENT_TASK_PROCESS'
  },
  {
G
i18n  
gongzijian 已提交
103
    desc: `${i18n.$t('Recover tolerance fault process')}`,
L
ligang 已提交
104 105 106
    code: 'RECOVER_TOLERANCE_FAULT_PROCESS'
  },
  {
G
i18n  
gongzijian 已提交
107
    desc: `${i18n.$t('Resume the suspension process')}`,
L
ligang 已提交
108 109 110
    code: 'RECOVER_SUSPENDED_PROCESS'
  },
  {
G
i18n  
gongzijian 已提交
111
    desc: `${i18n.$t('Execute from the failed nodes')}`,
L
ligang 已提交
112 113 114
    code: 'START_FAILURE_TASK_PROCESS'
  },
  {
G
i18n  
gongzijian 已提交
115
    desc: `${i18n.$t('Complement Data')}`,
L
ligang 已提交
116 117 118
    code: 'COMPLEMENT_DATA'
  },
  {
G
i18n  
gongzijian 已提交
119
    desc: `${i18n.$t('Scheduling execution')}`,
L
ligang 已提交
120 121 122
    code: 'SCHEDULER'
  },
  {
G
i18n  
gongzijian 已提交
123
    desc: `${i18n.$t('Rerun')}`,
L
ligang 已提交
124 125 126
    code: 'REPEAT_RUNNING'
  },
  {
G
i18n  
gongzijian 已提交
127
    desc: `${i18n.$t('Pause')}`,
L
ligang 已提交
128 129 130
    code: 'PAUSE'
  },
  {
G
i18n  
gongzijian 已提交
131
    desc: `${i18n.$t('Stop')}`,
L
ligang 已提交
132 133 134
    code: 'STOP'
  },
  {
G
i18n  
gongzijian 已提交
135
    desc: `${i18n.$t('Recovery waiting thread')}`,
L
ligang 已提交
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151
    code: 'RECOVER_WAITTING_THREAD'
  }
]

/**
 * Task status
 * @key key
 * @id id
 * @desc tooltip
 * @color color
 * @icoUnicode iconfont
 * @isSpin is loading (Need to execute the code block to write if judgment)
 */
let tasksState = {
  'SUBMITTED_SUCCESS': {
    id: 0,
G
i18n  
gongzijian 已提交
152
    desc: `${i18n.$t('Submitted successfully')}`,
L
ligang 已提交
153
    color: '#A9A9A9',
154
    icoUnicode: 'ans-icon-dot-circle',
L
ligang 已提交
155 156 157 158
    isSpin: false
  },
  'RUNNING_EXEUTION': {
    id: 1,
G
i18n  
gongzijian 已提交
159
    desc: `${i18n.$t('Executing')}`,
L
ligang 已提交
160
    color: '#0097e0',
161
    icoUnicode: 'ans-icon-gear',
L
ligang 已提交
162 163 164 165
    isSpin: true
  },
  'READY_PAUSE': {
    id: 2,
G
i18n  
gongzijian 已提交
166
    desc: `${i18n.$t('Ready to pause')}`,
L
ligang 已提交
167
    color: '#07b1a3',
168
    icoUnicode: 'ans-icon-pause-solid',
L
ligang 已提交
169 170 171 172
    isSpin: false
  },
  'PAUSE': {
    id: 3,
G
i18n  
gongzijian 已提交
173
    desc: `${i18n.$t('Pause')}`,
L
ligang 已提交
174
    color: '#057c72',
175
    icoUnicode: 'ans-icon-pause',
L
ligang 已提交
176 177 178 179
    isSpin: false
  },
  'READY_STOP': {
    id: 4,
G
i18n  
gongzijian 已提交
180
    desc: `${i18n.$t('Ready to stop')}`,
L
ligang 已提交
181
    color: '#FE0402',
182
    icoUnicode: 'ans-icon-coin',
L
ligang 已提交
183 184 185 186
    isSpin: false
  },
  'STOP': {
    id: 5,
G
i18n  
gongzijian 已提交
187
    desc: `${i18n.$t('Stop')}`,
L
ligang 已提交
188
    color: '#e90101',
189
    icoUnicode: 'ans-icon-stop',
L
ligang 已提交
190 191 192 193
    isSpin: false
  },
  'FAILURE': {
    id: 6,
G
i18n  
gongzijian 已提交
194
    desc: `${i18n.$t('failed')}`,
L
ligang 已提交
195
    color: '#000000',
196
    icoUnicode: 'ans-icon-fail-empty',
L
ligang 已提交
197 198 199 200
    isSpin: false
  },
  'SUCCESS': {
    id: 7,
G
i18n  
gongzijian 已提交
201
    desc: `${i18n.$t('success')}`,
L
ligang 已提交
202
    color: '#33cc00',
203
    icoUnicode: 'ans-icon-success-empty',
L
ligang 已提交
204 205 206 207
    isSpin: false
  },
  'NEED_FAULT_TOLERANCE': {
    id: 8,
G
i18n  
gongzijian 已提交
208
    desc: `${i18n.$t('Need fault tolerance')}`,
L
ligang 已提交
209
    color: '#FF8C00',
210
    icoUnicode: 'ans-icon-pen',
L
ligang 已提交
211 212 213 214 215 216
    isSpin: false
  },
  'KILL': {
    id: 9,
    desc: `${i18n.$t('kill')}`,
    color: '#a70202',
217
    icoUnicode: 'ans-icon-minus-circle-empty',
L
ligang 已提交
218 219 220 221
    isSpin: false
  },
  'WAITTING_THREAD': {
    id: 10,
G
i18n  
gongzijian 已提交
222
    desc: `${i18n.$t('Waiting for thread')}`,
L
ligang 已提交
223
    color: '#912eed',
224
    icoUnicode: 'ans-icon-sand-clock',
L
ligang 已提交
225 226 227 228
    isSpin: false
  },
  'WAITTING_DEPEND': {
    id: 11,
G
i18n  
gongzijian 已提交
229
    desc: `${i18n.$t('Waiting for dependence')}`,
L
ligang 已提交
230
    color: '#5101be',
231
    icoUnicode: 'ans-icon-dependence',
L
ligang 已提交
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262
    isSpin: false
  }
}

/**
 * Node type
 * @key key
 * @desc tooltip
 * @color color (tree and gantt)
 */
let tasksType = {
  'SHELL': {
    desc: 'SHELL',
    color: '#646464'
  },
  'SUB_PROCESS': {
    desc: 'SUB_PROCESS',
    color: '#0097e0'
  },
  'PROCEDURE': {
    desc: 'PROCEDURE',
    color: '#525CCD'
  },
  'SQL': {
    desc: 'SQL',
    color: '#7A98A1'
  },
  'SPARK': {
    desc: 'SPARK',
    color: '#E46F13'
  },
263 264 265 266
  'FLINK': {
    desc: 'FLINK',
    color: '#E46F13'
  },
L
ligang 已提交
267 268 269 270 271 272 273 274 275 276 277
  'MR': {
    desc: 'MapReduce',
    color: '#A0A5CC'
  },
  'PYTHON': {
    desc: 'PYTHON',
    color: '#FED52D'
  },
  'DEPENDENT': {
    desc: 'DEPENDENT',
    color: '#2FBFD8'
278 279 280 281
  },
  'HTTP': {
    desc: 'HTTP',
    color: '#E46F13'
L
ligang 已提交
282 283 284 285 286 287 288 289 290 291 292
  }
}


export {
  toolOper,
  publishStatus,
  runningType,
  tasksState,
  tasksType
}