Skip to content

Commit

Permalink
feat(task) front add create task button && fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
noovertime7 committed Oct 19, 2022
1 parent 98a46a7 commit 1d046d7
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 30 deletions.
2 changes: 1 addition & 1 deletion front/deploy/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ server {
try_files $uri $uri/ /index.html;
}

location ^~/api {
location ^~/api/ {
proxy_pass http://127.0.0.1/;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
Expand Down
8 changes: 8 additions & 0 deletions front/src/api/agent-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,14 @@ export function AddAgentTask (data) {
})
}

export function AutoAddAgentTask (data) {
return request({
url: '/agent/task_auto_add',
method: 'post',
data
})
}

export function UpdateAgentTask (query) {
return request({
url: '/agent/taskupdate',
Expand Down
18 changes: 9 additions & 9 deletions front/src/components/GlobalHeader/AvatarDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
</span>
<template v-slot:overlay>
<a-menu class="ant-pro-drop-down menu" :selected-keys="[]">
<a-menu-item v-if="menu" key="center" @click="handleToCenter">
<a-icon type="user" />
{{ $t('menu.account.center') }}
</a-menu-item>
<a-menu-item v-if="menu" key="settings" @click="handleToSettings">
<a-icon type="setting" />
{{ $t('menu.account.settings') }}
</a-menu-item>
<a-menu-divider v-if="menu" />
<!-- <a-menu-item v-if="menu" key="center" @click="handleToCenter">-->
<!-- <a-icon type="user" />-->
<!-- {{ $t('menu.account.center') }}-->
<!-- </a-menu-item>-->
<!-- <a-menu-item v-if="menu" key="settings" @click="handleToSettings">-->
<!-- <a-icon type="setting" />-->
<!-- {{ $t('menu.account.settings') }}-->
<!-- </a-menu-item>-->
<!-- <a-menu-divider v-if="menu" />-->
<a-menu-item key="logout" @click="handleLogout">
<a-icon type="logout" />
{{ $t('menu.account.logout') }}
Expand Down
5 changes: 4 additions & 1 deletion front/src/views/cluster/task/mysql/ClusterMysqlTask.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
@onGoBack="handleGoBack"
:hostByEdit="hostByEdit"
:host="hostID"
:auto="auto"
:record="record"
:is="currentComponet"></component>
</a-card>
Expand All @@ -31,11 +32,13 @@ export default {
currentComponet: 'List',
record: '',
hostID: 0,
auto: false,
hostByEdit: ''
}
},
methods: {
handleEdit (record) {
handleEdit (record, isAuto) {
this.auto = isAuto
this.record = record || ''
this.hostByEdit = record.host
this.hostID = record.host_id_by_list
Expand Down
49 changes: 34 additions & 15 deletions front/src/views/cluster/task/mysql/table/Edit.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@
></a-input>
</a-form-item>
<a-form-item
v-show="!auto"
:labelCol="labelCol"
:wrapperCol="wrapperCol"
label="数据库"
hasFeedback
validateStatus="success"
>
<a-input style="width: 100%" placeholder="请输入数据库名" v-decorator="['db_name', {rules: [{ required: true, message: '请输入数据库名',whitespace: true }]}]" />
<a-input style="width: 100%" placeholder="请输入数据库名" v-decorator="['db_name', { rules: []}]" />
</a-form-item>

<a-form-item
Expand All @@ -35,7 +36,7 @@
hasFeedback
validateStatus="success"
>
<a-input style="width: 100%" placeholder="请输入备份周期 ex:30 12 * * *" v-decorator="['backup_cycle', {rules: [{ required: true }]}]" />
<a-input style="width: 100%" placeholder="请输入备份周期 ex:30 12 * * *" v-decorator="['backup_cycle', {rules: [{ required: true,message: '请输入备份周期 ex:30 12 * * *' }]}]" />
</a-form-item>

<a-form-item
Expand All @@ -45,7 +46,7 @@
hasFeedback
validateStatus="success"
>
<a-input-number :min="1" style="width: 100%" placeholder="请输入数据保留周期(天)" v-decorator="['keep_number', {rules: [{ required: true }]}]" />
<a-input-number :min="1" style="width: 100%" placeholder="请输入数据保留周期(天)" v-decorator="['keep_number', {rules: [{ required: true,message: '请输入数据保留周期(天)' }]}]" />
</a-form-item>

<a-form-item
Expand Down Expand Up @@ -157,7 +158,7 @@
<script>
import pick from 'lodash.pick'
import { AddAgentTask, GetAgentTaskDetail, UpdateAgentTask } from '@/api/agent-task'
import { AddAgentTask, AutoAddAgentTask, GetAgentTaskDetail, UpdateAgentTask } from '@/api/agent-task'
export default {
name: 'TableEdit',
Expand All @@ -169,6 +170,10 @@ export default {
host: {
type: Number,
default: 0
},
auto: {
type: Boolean,
default: false
}
},
data () {
Expand Down Expand Up @@ -235,17 +240,31 @@ export default {
}
})
} else {
values['service_name'] = this.service_name
values['host_id'] = this.host
values['is_ding_send'] = this.BoolToInt(this.dingStatus)
values['is_oss_save'] = this.BoolToInt(this.ossStatus)
values['oss_type'] = this.ossType
AddAgentTask(values).then((res) => {
if (res) {
this.$message.success(res.data)
this.handleGoBack()
}
})
if (this.auto) {
values['service_name'] = this.service_name
values['host_id'] = this.host
values['is_ding_send'] = this.BoolToInt(this.dingStatus)
values['is_oss_save'] = this.BoolToInt(this.ossStatus)
values['oss_type'] = this.ossType
AutoAddAgentTask(values).then((res) => {
if (res) {
this.$message.success(res.data)
this.handleGoBack()
}
})
} else {
values['service_name'] = this.service_name
values['host_id'] = this.host
values['is_ding_send'] = this.BoolToInt(this.dingStatus)
values['is_oss_save'] = this.BoolToInt(this.ossStatus)
values['oss_type'] = this.ossType
AddAgentTask(values).then((res) => {
if (res) {
this.$message.success(res.data)
this.handleGoBack()
}
})
}
}
}
})
Expand Down
8 changes: 6 additions & 2 deletions front/src/views/cluster/task/mysql/table/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
</a-col>
<a-col :md="8" :sm="24">
<span
class="table-page-search-submitButtons"
:style="advanced && { float: 'right', overflow: 'hidden' } || {} ">
class="table-page-search-submitButtons">
<a-button type="primary" @click="$refs.table.refresh(true)">查询</a-button>
<a-button style="margin-left: 8px" @click="() => queryParam = {}">重置</a-button>
</span>
Expand All @@ -35,6 +34,7 @@

<div class="table-operator">
<a-button type="primary" icon="plus" @click="handleEdit">新建</a-button>
<a-button type="primary" icon="plus" @click="handleAutoEdit">自动新建</a-button>
<a-button type="primary" ghost="ghost" icon="rocket" @click="startBakByHost()">start all</a-button>
<a-button type="primary" ghost="ghost" icon="poweroff" @click="stopBakByHost()">stop all</a-button>
</div>
Expand Down Expand Up @@ -275,6 +275,10 @@ clear: () => {
record.host_id_by_list = this.getvalue(this.select_host)
this.$emit('onEdit', record)
},
handleAutoEdit (record) {
record.host_id_by_list = this.getvalue(this.select_host)
this.$emit('onEdit', record, true)
},
handleOk () {
},
Expand Down
4 changes: 2 additions & 2 deletions front/src/views/dashboard/Analysis.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@
status="down"
:decreaseTotal="serviceNums.task_decrease_num">
<span slot="subtitle">
<span>任务完成数</span>
<a-tooltip title="每天的任务完成数" slot="action">
<span>任务数量</span>
<a-tooltip title="每天的任务数量" slot="action">
<a-icon type="info-circle-o" :style="{ marginLeft: '8px' }" />
</a-tooltip>
</span>
Expand Down

0 comments on commit 1d046d7

Please sign in to comment.