[Add] gathered user task

This commit is contained in:
xinwen 2020-05-20 16:40:53 +08:00
parent 54fe95f938
commit b895af5cfe
4 changed files with 127 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<template>
<GenericTreeListPage :table-config="tableConfig" :tree-setting="treeSetting" />
<GenericTreeListPage :table-config="tableConfig" :tree-setting="treeSetting" :header-actions="headerActions" />
</template>
<script>
@ -28,8 +28,29 @@ export default {
],
columnsMeta: {
}
},
headerActions: {
hasCreate: false,
hasBulkDelete: false,
hasImport: false,
hasRefresh: false,
extraActions: [
{
name: 'gather-user-tasks',
title: '收集用户任务',
type: 'primary',
has: true,
can: true,
callback: this.onGatherUserTasks
}
]
}
}
},
methods: {
onGatherUserTasks() {
this.$router.push({ name: 'GatherUserTaskList' })
}
}
}
</script>

View File

@ -0,0 +1,46 @@
<template>
<GenericCreateUpdatePage v-bind="$data" />
</template>
<script>
import { GenericCreateUpdatePage } from '@/layout/components'
export default {
components: {
GenericCreateUpdatePage
},
data() {
return {
fields: [
['收集用户任务', ['name', 'nodes', 'is_periodic', 'crontab', 'interval', 'comment']]
],
url: '/api/v1/xpack/gathered-user/tasks/',
fieldsMeta: {
nodes: {
el: {
multiple: true,
value: [],
ajax: {
url: '/api/v1/assets/nodes/',
processResults(data) {
const results = data.results.map((item) => {
return { label: item.name, value: item.id }
})
const more = !!data.next
return { results: results, pagination: more, total: data.count }
}
}
}
},
'is_periodic': {
type: 'switch'
}
}
}
}
}
</script>
<style lang="less" scoped>
</style>

View File

@ -0,0 +1,35 @@
<template>
<GenericListPage :table-config="tableConfig" :header-actions="headerActions" />
</template>
<script>
import GenericListPage from '@/layout/components/GenericListPage'
export default {
components: {
GenericListPage
},
data() {
return {
tableConfig: {
url: '/api/v1/xpack/gathered-user/tasks/',
columns: [
'name', 'nodes', 'periodic_display', 'executed_times', 'actions'
],
columnsMeta: {}
},
headerActions: {
hasBulkDelete: false,
hasImport: false,
hasRefresh: false,
hasExport: false,
createRoute: 'GatherUserTaskCreate'
}
}
}
}
</script>
<style>
</style>

View File

@ -21,9 +21,30 @@ export default {
},
{
path: 'gathered-users',
component: () => import('@/views/xpack/GatherUser'),
name: 'GatherUser',
meta: { title: 'GatherUser' }
component: () => import('@/views/xpack/GatheredUser/GatheredUserList'),
name: 'GatherUserList',
meta: { title: 'GatherUserList' }
},
{
path: 'gathered-users/tasks',
component: () => import('@/views/xpack/GatheredUser/TaskList'),
name: 'GatherUserTaskList',
meta: { title: 'GatherUserTask' },
hidden: true
},
{
path: 'gathered-users/tasks/create',
component: () => import('@/views/xpack/GatheredUser/TaskCreateUpdate'),
name: 'GatherUserTaskCreate',
meta: { title: 'GatherUserTaskCreate', action: 'create' },
hidden: true
},
{
path: 'gathered-users/tasks/update',
component: () => import('@/views/xpack/GatheredUser/TaskCreateUpdate'),
name: 'GatherUserTaskUpdate',
meta: { title: 'GatherUserTaskUpdate', action: 'update' },
hidden: true
}
]
}