mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-05 23:47:54 +08:00
enhance ux of stop button
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-dialog
|
<el-dialog
|
||||||
modal-class="runing-overlay__modal"
|
modal-class="runing-overlay__modal"
|
||||||
:model-value="runingTaskInfo"
|
:model-value="isDialogVisible"
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
:close-on-press-escape="false"
|
:close-on-press-escape="false"
|
||||||
:show-close="false"
|
:show-close="false"
|
||||||
@@ -93,6 +93,16 @@ function messageHandler (ev, { data }) {
|
|||||||
}
|
}
|
||||||
const unListenMessage = ipcRenderer.on('worker-to-gui-message', messageHandler)
|
const unListenMessage = ipcRenderer.on('worker-to-gui-message', messageHandler)
|
||||||
onUnmounted(unListenMessage)
|
onUnmounted(unListenMessage)
|
||||||
|
|
||||||
|
const isDialogVisible = ref(false)
|
||||||
|
defineExpose({
|
||||||
|
show() {
|
||||||
|
isDialogVisible.value = true
|
||||||
|
},
|
||||||
|
hide() {
|
||||||
|
isDialogVisible.value = false
|
||||||
|
}
|
||||||
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@@ -100,7 +110,11 @@ onUnmounted(unListenMessage)
|
|||||||
position: absolute;
|
position: absolute;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
backdrop-filter: blur(5px);
|
backdrop-filter: blur(3px);
|
||||||
|
|
||||||
|
background-color: transparent;
|
||||||
|
background-image: radial-gradient(transparent 1px, #fff 1px);
|
||||||
|
background-size: 4px 4px;
|
||||||
|
|
||||||
.el-overlay-dialog {
|
.el-overlay-dialog {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|||||||
@@ -1062,9 +1062,9 @@
|
|||||||
pointerEvents: 'none'
|
pointerEvents: 'none'
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<RuningOverlay worker-id="geekAutoStartWithBossMain" :run-record-id="runRecordId">
|
<RuningOverlay worker-id="geekAutoStartWithBossMain" :run-record-id="runRecordId" ref="runningOverlayRef">
|
||||||
<template #op-buttons>
|
<template #op-buttons>
|
||||||
<el-button @click="handleStopButtonClick">结束任务</el-button>
|
<el-button type="danger" plain @click="handleStopButtonClick" :loading="isStopButtonLoading">结束任务</el-button>
|
||||||
</template>
|
</template>
|
||||||
</RuningOverlay>
|
</RuningOverlay>
|
||||||
</div>
|
</div>
|
||||||
@@ -1432,6 +1432,7 @@ const formRules = {
|
|||||||
|
|
||||||
const formRef = ref<InstanceType<typeof ElForm>>()
|
const formRef = ref<InstanceType<typeof ElForm>>()
|
||||||
const runRecordId = ref(null)
|
const runRecordId = ref(null)
|
||||||
|
const runningOverlayRef = ref(null)
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
gtagRenderer('save_config_and_launch_clicked', {
|
gtagRenderer('save_config_and_launch_clicked', {
|
||||||
has_dingtalk_robot_token: !!formContent.value?.dingtalkRobotAccessToken,
|
has_dingtalk_robot_token: !!formContent.value?.dingtalkRobotAccessToken,
|
||||||
@@ -1470,6 +1471,7 @@ const handleSubmit = async () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
runningOverlayRef.value?.show()
|
||||||
const { runRecordId: rrId } = await electron.ipcRenderer.invoke('run-geek-auto-start-chat-with-boss')
|
const { runRecordId: rrId } = await electron.ipcRenderer.invoke('run-geek-auto-start-chat-with-boss')
|
||||||
runRecordId.value = rrId
|
runRecordId.value = rrId
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -1851,9 +1853,17 @@ onUnmounted(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const isStopButtonLoading = ref(false)
|
||||||
const handleStopButtonClick = async () => {
|
const handleStopButtonClick = async () => {
|
||||||
gtagRenderer('gascwb_stop_button_clicked')
|
gtagRenderer('gascwb_stop_button_clicked')
|
||||||
electron.ipcRenderer.invoke('stop-geek-auto-start-chat-with-boss')
|
isStopButtonLoading.value = true
|
||||||
|
try {
|
||||||
|
await electron.ipcRenderer.invoke('stop-geek-auto-start-chat-with-boss')
|
||||||
|
runningOverlayRef.value?.hide()
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
isStopButtonLoading.value = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -228,9 +228,9 @@
|
|||||||
pointerEvents: 'none'
|
pointerEvents: 'none'
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<RuningOverlay worker-id="readNoReplyAutoReminderMain" :run-record-id="runRecordId">
|
<RuningOverlay worker-id="geekAutoStartWithBossMain" :run-record-id="runRecordId" ref="runningOverlayRef">
|
||||||
<template #op-buttons>
|
<template #op-buttons>
|
||||||
<el-button @click="handleStopButtonClick">结束任务</el-button>
|
<el-button type="danger" plain @click="handleStopButtonClick" :loading="isStopButtonLoading">结束任务</el-button>
|
||||||
</template>
|
</template>
|
||||||
</RuningOverlay>
|
</RuningOverlay>
|
||||||
</div>
|
</div>
|
||||||
@@ -450,6 +450,7 @@ async function checkIsCanRun() {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
const runRecordId = ref(null)
|
const runRecordId = ref(null)
|
||||||
|
const runningOverlayRef = ref(null)
|
||||||
const handleSubmit = async () => {
|
const handleSubmit = async () => {
|
||||||
gtagRenderer('run_read_no_reply_reminder_clicked', {
|
gtagRenderer('run_read_no_reply_reminder_clicked', {
|
||||||
throttle_interval_minutes: formContent.value.autoReminder.throttleIntervalMinutes,
|
throttle_interval_minutes: formContent.value.autoReminder.throttleIntervalMinutes,
|
||||||
@@ -488,6 +489,7 @@ const handleSubmit = async () => {
|
|||||||
gtagRenderer('run_read_no_reply_reminder_launched')
|
gtagRenderer('run_read_no_reply_reminder_launched')
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
runningOverlayRef.value?.show()
|
||||||
const { runRecordId: rrId } = await electron.ipcRenderer.invoke('run-read-no-reply-auto-reminder')
|
const { runRecordId: rrId } = await electron.ipcRenderer.invoke('run-read-no-reply-auto-reminder')
|
||||||
runRecordId.value = rrId
|
runRecordId.value = rrId
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
@@ -602,9 +604,17 @@ onUnmounted(() => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const isStopButtonLoading = ref(false)
|
||||||
const handleStopButtonClick = async () => {
|
const handleStopButtonClick = async () => {
|
||||||
gtagRenderer('rnrr_stop_button_clicked')
|
gtagRenderer('rnrr_stop_button_clicked')
|
||||||
electron.ipcRenderer.invoke('stop-read-no-reply-auto-reminder')
|
isStopButtonLoading.value = true
|
||||||
|
try {
|
||||||
|
electron.ipcRenderer.invoke('stop-read-no-reply-auto-reminder')
|
||||||
|
runningOverlayRef.value?.hide()
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
isStopButtonLoading.value = false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user