Skip to content

Commit

Permalink
feat: schedule前端页面支持shell,k8s shell任务 #213
Browse files Browse the repository at this point in the history
  • Loading branch information
felixncheng committed Jul 23, 2024
1 parent 2cd94fa commit f79a9d4
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,15 +1,27 @@
import request from '@/utils/request'

function encodeBase64(data) {
data.source = btoa(data.source)
return data
}

function decodeBase64(res) {
for (const item of res.data.records) {
item.source = atob(item.source)
}
return res
}

export const list = (data) => request({
url: '/job/list',
method: 'get',
params: data
})
}).then(res => decodeBase64(res))

export const create = (data) => request({
url: '/job/create',
method: 'post',
data: data
data: encodeBase64(data)
})

export const update = (id, data) => request({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ export default (safe) => {
},
{
label: '调度类型',
prop: 'scheduleType',
prop: 'scheduleType1', // 这里字段名不能跟下面的scheduleType重复,不然下面框的控制会失效
dicUrl: '/dict/ScheduleType',
props: {
value: 'scheduleType'
},
display: false
},
{
Expand Down Expand Up @@ -146,6 +149,7 @@ export default (safe) => {
label: 'Cron表达式',
display: true,
type: 'input',
placeholder: '请输入Cron表达式',
value: '',
rules: [{
required: true,
Expand All @@ -164,7 +168,8 @@ export default (safe) => {
},
{
label: '调度配置',
prop: 'scheduleConf'
prop: 'scheduleConf',
display: false
}
]
},
Expand All @@ -178,6 +183,45 @@ export default (safe) => {
type: 'select',
value: 1,
dicUrl: '/dict/JobMode',
control: (val, form) => {
if (val === 1) {
return {
image: {
display: false
},
jobHandler: {
display: true
},
source: {
display: false
},
}
} else if (val === 2) {
return {
image: {
display: false
},
jobHandler: {
display: false
},
source: {
display: true
},
}
} else if (val === 3) {
return {
image: {
display: true
},
jobHandler: {
display: false
},
source: {
display: true
},
}
}
},
rules: [{
required: true,
message: '请选择运行模式',
Expand All @@ -188,12 +232,32 @@ export default (safe) => {
label: 'jobHandler',
prop: 'jobHandler',
type: 'input',
display: false,
rules: [{
required: true,
message: '请输入job handler',
trigger: 'blur'
}]
},
{
label: '镜像',
prop: 'image',
type: 'input',
display: false,
rules: [{
message: '请输入镜像',
trigger: 'blur'
}]
},
{
label: '资源',
prop: 'source',
type: 'textarea',
display: false,
placeholder: '请输入资源',
maxlength: 10240,
showWordLimit: true,
span: 24
},
{
label: '任务参数',
prop: 'jobParam',
Expand Down

0 comments on commit f79a9d4

Please sign in to comment.