Skip to content

Commit

Permalink
增加job分类
Browse files Browse the repository at this point in the history
  • Loading branch information
凌云 committed Apr 22, 2020
1 parent fe3f015 commit 3266028
Show file tree
Hide file tree
Showing 8 changed files with 253 additions and 184 deletions.
8 changes: 8 additions & 0 deletions src/api/datax-job-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,11 @@ export function getJobIdList(params) {
params
})
}

export function getJobProjectList(params) {
return request({
url: 'api/job/projects',
method: 'get',
params
})
}
64 changes: 50 additions & 14 deletions src/views/datax/jobInfo/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
<div class="app-container">
<div class="filter-container">
<el-input v-model="listQuery.jobDesc" placeholder="任务名称" style="width: 200px;" class="filter-item" />
<el-input v-model="listQuery.author" placeholder="负责人" style="width: 200px;" class="filter-item" />
<el-select v-model="jobProjects" multiple placeholder="所属项目" class="filter-item">
<el-option v-for="item in jobProjectList" :key="item.jobProject" :label="item.jobProject" :value="item.jobProject" />
</el-select>

<el-select v-model="authors" multiple placeholder="负责人" class="filter-item">
<el-option v-for="item in authorList" :key="item.id" :label="item.nickname" :value="item.id" />
</el-select>
<el-select v-model="listQuery.glueType" placeholder="任务类型" style="width: 200px" class="filter-item">
<el-option v-for="item in glueTypes" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
Expand Down Expand Up @@ -30,7 +36,10 @@
<el-table-column label="任务名称" align="center" width="200">
<template slot-scope="scope">{{ scope.row.jobDesc }}</template>
</el-table-column>
<el-table-column label="Cron" align="center" width="100">
<el-table-column label="所属项目" align="center" width="120">
<template slot-scope="scope">{{ scope.row.jobProject }}</template>
</el-table-column>
<el-table-column label="Cron" align="center" width="150">
<template slot-scope="scope">
<span>{{ scope.row.jobCron }}</span>
</template>
Expand Down Expand Up @@ -104,23 +113,21 @@
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="110px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="执行器" prop="jobGroup">
<el-select v-model="temp.jobGroup" placeholder="请选择执行器">
<el-option v-for="item in executorList" :key="item.id" :label="item.title" :value="item.id" />
</el-select>
<el-form-item label="任务名称" prop="jobDesc">
<el-input v-model="temp.jobDesc" size="medium" placeholder="请输入任务描述" style="width: 56%"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="任务名称" prop="jobDesc">
<el-input v-model="temp.jobDesc" size="medium" placeholder="请输入任务描述" />
<el-form-item label="所属项目" prop="jobProject">
<el-input v-model="temp.jobProject" size="medium" placeholder="请输入所属项目" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="路由策略" prop="executorRouteStrategy">
<el-select v-model="temp.executorRouteStrategy" placeholder="请选择路由策略">
<el-option v-for="item in routeStrategies" :key="item.value" :label="item.label" :value="item.value" />
<el-form-item label="执行器" prop="jobGroup">
<el-select v-model="temp.jobGroup" placeholder="请选择执行器">
<el-option v-for="item in executorList" :key="item.id" :label="item.title" :value="item.id" />
</el-select>
</el-form-item>
</el-col>
Expand All @@ -140,12 +147,13 @@
</el-col>

<el-col :span="12">
<el-form-item label="负责人" prop="author">
<el-select v-model="temp.author" multiple placeholder="请输入负责人" value-key="id">
<el-option v-for="item in authorList" :key="item.id" :label="item.nickname" :value="item" />
<el-form-item label="路由策略" prop="executorRouteStrategy">
<el-select v-model="temp.executorRouteStrategy" placeholder="请选择路由策略">
<el-option v-for="item in routeStrategies" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
</el-col>

</el-row>
<el-row :gutter="20">
<el-col :span="12">
Expand All @@ -155,6 +163,13 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="负责人" prop="author">
<el-select v-model="temp.author" multiple placeholder="请输入负责人" value-key="id">
<el-option v-for="item in authorList" :key="item.id" :label="item.nickname" :value="item" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
Expand Down Expand Up @@ -285,13 +300,16 @@ export default {
callback()
}
return {
jobProjects:'',
authors:'',
list: null,
listLoading: true,
total: 0,
listQuery: {
current: 1,
size: 10,
jobGroup: 0,
jobProject: '',
triggerStatus: -1,
jobDesc: '',
glueType: '',
Expand All @@ -311,6 +329,7 @@ export default {
executorBlockStrategy: [{ required: true, message: 'executorBlockStrategy is required', trigger: 'change' }],
glueType: [{ required: true, message: 'jobType is required', trigger: 'change' }],
jobDesc: [{ required: true, message: 'jobDesc is required', trigger: 'blur' }],
jobProject: [{ required: true, message: 'jobProject is required', trigger: 'blur' }],
jobCron: [{ required: true, message: 'jobCron is required', trigger: 'blur' }],
author: [{ required: true, message: 'author is required', trigger: 'blur' }],
incStartTime: [{ trigger: 'blur', validator: validateIncStartTime }]
Expand Down Expand Up @@ -351,6 +370,7 @@ export default {
executorList: '',
authorList: '',
JobIdList: '',
jobProjectList:'',
blockStrategies: [
{ value: 'SERIAL_EXECUTION', label: '单机串行' },
{ value: 'DISCARD_LATER', label: '丢弃后续调度' },
Expand Down Expand Up @@ -405,6 +425,7 @@ export default {
this.getExecutor()
this.getUsers()
this.getJobIdList()
this.getJobProject()
},
methods: {
Expand All @@ -420,6 +441,13 @@ export default {
this.authorList = content
})
},
getJobProject(){
job.getJobProjectList().then(response=>{
const { content } = response
this.jobProjectList= content
console.log(content)
})
},
getJobIdList() {
job.getJobIdList().then(response => {
const { content } = response
Expand All @@ -428,6 +456,14 @@ export default {
},
fetchData() {
this.listLoading = true
if (this.authors) {
this.listQuery.author = this.authors.toString()
}
if (this.jobProjects) {
this.listQuery.jobProject = this.jobProjects.toString()
}
job.getList(this.listQuery).then(response => {
const { content } = response
this.total = content.recordsTotal
Expand Down
26 changes: 15 additions & 11 deletions src/views/datax/jobLog/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,20 +120,22 @@
</el-button>
</div>
</el-dialog>
<el-dialog title="日志查看" :visible.sync="logShow" width="78%">
<el-dialog title="日志查看" :visible.sync="dialogVisible" width="95%">
<div class="log-container">
<pre :loading="logLoading" v-text="logContent" />
</div>
<div slot="footer" class="dialog-footer">
<el-button @click="dialogFormVisible = false">
<el-button @click="dialogVisible = false">
关闭
</el-button>
<el-button type="primary" @click="loadLog">
刷新日志
</el-button>
</div>
</el-dialog>

</div>

</template>

<script>
Expand All @@ -158,6 +160,7 @@ export default {
},
data() {
return {
dialogVisible: false,
list: null,
listLoading: true,
total: 0,
Expand Down Expand Up @@ -214,11 +217,11 @@ export default {
fromLineNum: 1
},
// 日志内容
logContent: undefined,
logContent: '',
// 显示日志
logShow: false,
// 日志显示加载中效果
logLoading: false
logLoading: false,
}
},
created() {
Expand Down Expand Up @@ -276,14 +279,16 @@ export default {
handleViewJobLog(row) {
// const str = location.href.split('#')[0]
// window.open(`${str}#/ router的name `)
this.dialogVisible= true
this.jobLogQuery.executorAddress = row.executorAddress
this.jobLogQuery.id = row.id
this.jobLogQuery.triggerTime = Date.parse(row.triggerTime)
// if (this.logShow === false) {
// this.logShow = true
// }
window.open(`#/data/log?executorAddress=${this.jobLogQuery.executorAddress}&triggerTime=${this.jobLogQuery.triggerTime}&id=${this.jobLogQuery.id}&fromLineNum=${this.jobLogQuery.fromLineNum}`)
// this.loadLog()
if (this.logShow === false) {
this.logShow = true
}
// window.open(`#/data/log?executorAddress=${this.jobLogQuery.executorAddress}&triggerTime=${this.jobLogQuery.triggerTime}&id=${this.jobLogQuery.id}&fromLineNum=${this.jobLogQuery.fromLineNum}`)
this.loadLog()
},
// 获取日志
loadLog() {
Expand Down Expand Up @@ -324,9 +329,8 @@ export default {
margin-bottom: 20px;
background: #f5f5f5;
width: 100%;
height: 500px;
height: 400px;
overflow: scroll;
pre {
display: block;
padding: 10px;
Expand Down
39 changes: 25 additions & 14 deletions src/views/datax/jobTemplate/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@
<el-table-column label="任务描述" align="center">
<template slot-scope="scope">{{ scope.row.jobDesc }}</template>
</el-table-column>
<el-table-column label="所属项目" align="center">
<template slot-scope="scope">{{ scope.row.jobProject }}</template>
</el-table-column>
<el-table-column label="Cron" align="center">
<template slot-scope="scope">
<span>{{ scope.row.jobCron }}</span>
Expand Down Expand Up @@ -83,26 +86,25 @@
<el-form ref="dataForm" :rules="rules" :model="temp" label-position="left" label-width="110px">
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="执行器" prop="jobGroup">
<el-select v-model="temp.jobGroup" placeholder="请选择执行器">
<el-option v-for="item in executorList" :key="item.id" :label="item.title" :value="item.id" />
</el-select>
<el-form-item label="任务描述" prop="jobDesc">
<el-input v-model="temp.jobDesc" size="medium" placeholder="请输入任务描述" style="width: 56%"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="任务描述" prop="jobDesc">
<el-input v-model="temp.jobDesc" size="medium" placeholder="请输入任务描述" />
<el-form-item label="所属项目" prop="jobProject">
<el-input v-model="temp.jobProject" size="medium" placeholder="请输入所属项目" />
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
<el-form-item label="路由策略" prop="executorRouteStrategy">
<el-select v-model="temp.executorRouteStrategy" placeholder="请选择路由策略">
<el-option v-for="item in routeStrategies" :key="item.value" :label="item.label" :value="item.value" />
<el-form-item label="执行器" prop="jobGroup">
<el-select v-model="temp.jobGroup" placeholder="请选择执行器">
<el-option v-for="item in executorList" :key="item.id" :label="item.title" :value="item.id" />
</el-select>
</el-form-item>
</el-col>

<el-col :span="12">
<el-form-item label="Cron" prop="jobCron">
<el-input v-model="temp.jobCron" placeholder="请输入Cron表达式" />
Expand All @@ -118,9 +120,9 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="负责人" prop="author">
<el-select v-model="temp.author" multiple placeholder="请输入负责人" value-key="id">
<el-option v-for="item in authorList" :key="item.id" :label="item.nickname" :value="item" />
<el-form-item label="路由策略" prop="executorRouteStrategy">
<el-select v-model="temp.executorRouteStrategy" placeholder="请选择路由策略">
<el-option v-for="item in routeStrategies" :key="item.value" :label="item.label" :value="item.value" />
</el-select>
</el-form-item>
</el-col>
Expand All @@ -133,6 +135,13 @@
</el-select>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label="负责人" prop="author">
<el-select v-model="temp.author" multiple placeholder="请输入负责人" value-key="id">
<el-option v-for="item in authorList" :key="item.id" :label="item.nickname" :value="item" />
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :span="12">
Expand Down Expand Up @@ -280,6 +289,7 @@ export default {
executorRouteStrategy: [{ required: true, message: 'executorRouteStrategy is required', trigger: 'change' }],
executorBlockStrategy: [{ required: true, message: 'executorBlockStrategy is required', trigger: 'change' }],
jobDesc: [{ required: true, message: 'jobDesc is required', trigger: 'blur' }],
jobProject: [{ required: true, message: 'jobProject is required', trigger: 'blur' }],
jobCron: [{ required: true, message: 'jobCron is required', trigger: 'blur' }],
author: [{ required: true, message: 'author is required', trigger: 'blur' }],
incStartTime: [{ trigger: 'blur', validator: validateIncStartTime }]
Expand All @@ -289,8 +299,8 @@ export default {
jobGroup: '',
jobCron: '',
jobDesc: '',
executorRouteStrategy: '',
executorBlockStrategy: '',
executorRouteStrategy: 'RANDOM',
executorBlockStrategy: 'DISCARD_LATER',
childJobId: '',
parentJobId: '',
executorFailRetryCount: '',
Expand Down Expand Up @@ -393,6 +403,7 @@ export default {
this.resetTemp()
this.dialogStatus = 'create'
this.dialogFormVisible = true
this.temp.jobGroup = this.executorList[0]["id"]
this.$nextTick(() => {
this.$refs['dataForm'].clearValidate()
})
Expand Down
6 changes: 3 additions & 3 deletions src/views/datax/json-build/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@
<el-table-column label="任务描述" align="center">
<template slot-scope="scope">{{ scope.row.jobDesc }}</template>
</el-table-column>
<el-table-column label="所属项目" align="center">
<template slot-scope="scope">{{ scope.row.jobProject }}</template>
</el-table-column>
<el-table-column label="Cron" align="center">
<template slot-scope="scope"><span>{{ scope.row.jobCron }}</span></template>
</el-table-column>
<el-table-column label="路由策略" align="center">
<template slot-scope="scope"> {{ routeStrategies.find(t => t.value === scope.row.executorRouteStrategy).label }}</template>
</el-table-column>
<el-table-column label="负责人" align="center">
<template slot-scope="scope">{{ scope.row.author }}</template>
</el-table-column>
</el-table>
<pagination v-show="total>0" :total="total" :page.sync="listQuery.current" :limit.sync="listQuery.size" @pagination="fetchData" />
</el-drawer>
Expand Down
Loading

0 comments on commit 3266028

Please sign in to comment.