diff --git a/src/components/AddSchedule/ScheduleForm.vue b/src/components/AddSchedule/ScheduleForm.vue
index 684f795..1fbd062 100644
--- a/src/components/AddSchedule/ScheduleForm.vue
+++ b/src/components/AddSchedule/ScheduleForm.vue
@@ -244,9 +244,14 @@ export default class Addschedule extends Vue {
handleScheduleNameChange (value) {
this.scheduleForm.previous_task = ''
this.handleInput('schedule_name', value)
- this.taskList = this.scheduleList.find(
+ const schedule = this.scheduleList.find(
item => item.name === value
- )?.entities
+ )
+ this.taskList = schedule?.entities
+ this.handleInput('date', [schedule?.schedule.start_time, schedule?.schedule.end_time])
+ this.handleInput('cron', schedule?.schedule.crontab)
+ this.expressionChange()
+ this.handleInput('schedule_desc', schedule?.description)
this.$emit('onTaskListChange', {
previousTaskList: this.taskList,
scheduleList: this.scheduleList
diff --git a/src/page/Schedules/Instance/index.vue b/src/page/Schedules/Instance/index.vue
index d29c826..4a53916 100644
--- a/src/page/Schedules/Instance/index.vue
+++ b/src/page/Schedules/Instance/index.vue
@@ -38,7 +38,7 @@
{
+ this.cancelSearch = c
+ })
+ }).then(res => {
+ this.instanceList = cloneDeep(res.data?.data || [])
+ }).catch(err => {
+ console.log(err)
+ }).finally (() => {
+ this.cancelSearch = ''
+ this.filterInstance()
this.stopLoading()
- }
+ this.pollingData()
+ })
}
/**
@@ -284,15 +305,43 @@ export default class Instance extends Vue {
* @Date: 2022-03-17 10:58:13
*/
async handleAction ({ id, state }, index) {
+ if (this.cancelSearch) {
+ this.cancelSearch('cancel')
+ }
+ this.pollingData()
try {
this.startLoading()
await this.setInstanceState({ id, status: ACTION_OF_STATE[state][index] })
// dolphin 切换状态有延迟,延迟 500 ms 再刷新列表
setTimeout(async () => {
- await this.queryInstance()
+ await this.getInstanceState({ id, state })
}, 500)
} catch (err) {
console.log(err)
+ } finally {
+ this.pollingData()
+ }
+ }
+
+ async getInstanceState ({ id, state }) {
+ try {
+ const res = await this.getInstance(id)
+ if (res.data) {
+ if (res.data === state) {
+ await this.getInstanceState({ id, state })
+ } else {
+ this.instanceList = this.instanceList.map(i => {
+ if (i.id === id) {
+ i.state = res.data
+ }
+ return i
+ })
+ }
+ }
+ } catch (err) {
+ console.log(err)
+ } finally {
+ this.filterInstance()
}
}
@@ -340,26 +389,40 @@ export default class Instance extends Vue {
handleFilterChange ({ release_type }) {
this.releaseTypeFilters = release_type
this.resetPageIndex()
- this.filterSchedules()
+ this.filterInstance()
}
handleSizeChange (pageSize) {
this.pagination.pageSize = pageSize
this.resetPageIndex()
- this.filterSchedules()
+ this.filterInstance()
}
handleCurrentChange (pageIndex) {
this.pagination.pageIndex = pageIndex
- this.filterSchedules()
+ this.filterInstance()
}
resetPageIndex () {
this.pagination.pageIndex = 1
}
+ pollingData () {
+ if (this.timer) {
+ clearInterval(this.timer)
+ this.timer = null
+ } else {
+ this.timer = setInterval(() => {
+ this.queryInstance()
+ }, 5000)
+ }
+ }
+
startLoading () {
- this.loading = true
+ if (this.isInit) {
+ this.loading = true
+ this.isInit = false
+ }
}
stopLoading () {
@@ -369,6 +432,13 @@ export default class Instance extends Vue {
mounted () {
this.params = this.$route.params
this.queryInstance()
+ this.pollingData()
+ }
+
+ destroyed () {
+ if (this.timer) {
+ clearInterval(this.timer)
+ }
}
}
diff --git a/src/page/Schedules/Schedules/index.vue b/src/page/Schedules/Schedules/index.vue
index 280ff65..5d11f28 100644
--- a/src/page/Schedules/Schedules/index.vue
+++ b/src/page/Schedules/Schedules/index.vue
@@ -22,7 +22,7 @@
show-overflow-tooltip
:prop="'id'"
:label="$t('schedules.schId')"
- :min-width="'100'"
+ :min-width="'120'"
>