mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-05-06 20:02:47 +08:00
show running overlay when enter config page
This commit is contained in:
@@ -1681,7 +1681,7 @@
|
||||
>
|
||||
<RunningOverlay
|
||||
ref="runningOverlayRef"
|
||||
worker-id="geekAutoStartWithBossMain"
|
||||
:worker-id="CURRENT_WORKER_ID"
|
||||
:run-record-id="runRecordId"
|
||||
>
|
||||
<template #op-buttons="{ currentRunningStatus }">
|
||||
@@ -1714,7 +1714,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onBeforeUnmount, ref, watch, nextTick, onUnmounted } from 'vue'
|
||||
import { computed, onBeforeUnmount, ref, watch, onUnmounted, onMounted } from 'vue'
|
||||
import { ElForm, ElMessage } from 'element-plus'
|
||||
import { QuestionFilled, ArrowDown } from '@element-plus/icons-vue'
|
||||
import { useRouter } from 'vue-router'
|
||||
@@ -1742,6 +1742,7 @@ import JobSourceDragOrderer from '../../../features/JobSourceDragOrderer/index.v
|
||||
import expectJobFilterTemplateList from './expectJobFilterTemplateList'
|
||||
import RunningOverlay from '@renderer/features/RunningOverlay/index.vue'
|
||||
import { RUNNING_STATUS_ENUM } from '../../../../../common/enums/auto-start-chat'
|
||||
import { useTaskManagerStore } from '@renderer/store'
|
||||
import {
|
||||
getJobDetailRegExpMatchLogicConfig,
|
||||
isJobDetailRegExpEmpty,
|
||||
@@ -2084,6 +2085,24 @@ const formRules = {
|
||||
const formRef = ref<InstanceType<typeof ElForm>>()
|
||||
const runRecordId = ref(null)
|
||||
const runningOverlayRef = ref(null)
|
||||
const taskManagerStore = useTaskManagerStore()
|
||||
const CURRENT_WORKER_ID = 'geekAutoStartWithBossMain'
|
||||
|
||||
onMounted(async () => {
|
||||
await taskManagerStore.getRunningTasks()
|
||||
const existingWorker = taskManagerStore.runningTasks?.find(
|
||||
(it) => it.workerId === CURRENT_WORKER_ID
|
||||
)
|
||||
if (existingWorker) {
|
||||
runRecordId.value = existingWorker.runtimeStorage?.stepStatusMapByStepId
|
||||
? Object.values(existingWorker.runtimeStorage.stepStatusMapByStepId)[0]?.runRecordId
|
||||
: null
|
||||
if (runRecordId.value) {
|
||||
runningOverlayRef.value?.show()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const handleSubmit = async () => {
|
||||
gtagRenderer('save_config_and_launch_clicked', {
|
||||
has_dingtalk_robot_token: !!formContent.value?.dingtalkRobotAccessToken,
|
||||
|
||||
@@ -318,7 +318,7 @@
|
||||
>
|
||||
<RunningOverlay
|
||||
ref="runningOverlayRef"
|
||||
worker-id="readNoReplyAutoReminderMain"
|
||||
:worker-id="CURRENT_WORKER_ID"
|
||||
:run-record-id="runRecordId"
|
||||
>
|
||||
<template #op-buttons="{ currentRunningStatus }">
|
||||
@@ -351,7 +351,7 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onUnmounted, ref, watch } from 'vue'
|
||||
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||
import { dayjs, ElForm, ElMessage, ElMessageBox, ElSelect, ElOption } from 'element-plus'
|
||||
import { useRouter } from 'vue-router'
|
||||
import {
|
||||
@@ -366,6 +366,7 @@ import mittBus from '../../utils/mitt'
|
||||
import { QuestionFilled } from '@element-plus/icons-vue'
|
||||
import RunningOverlay from '@renderer/features/RunningOverlay/index.vue'
|
||||
import { DEFAULT_CONSTANT_OPEN_CONTENT_SEGS } from '../../../../common/constant'
|
||||
import { useTaskManagerStore } from '@renderer/store'
|
||||
const gtagRenderer = (name, params?: object) => {
|
||||
return baseGtagRenderer(name, {
|
||||
scene: 'rnrr-config',
|
||||
@@ -607,6 +608,24 @@ async function checkIsCanRun() {
|
||||
}
|
||||
const runRecordId = ref(null)
|
||||
const runningOverlayRef = ref(null)
|
||||
const taskManagerStore = useTaskManagerStore()
|
||||
const CURRENT_WORKER_ID = 'readNoReplyAutoReminderMain'
|
||||
|
||||
onMounted(async () => {
|
||||
await taskManagerStore.getRunningTasks()
|
||||
const existingWorker = taskManagerStore.runningTasks?.find(
|
||||
(it) => it.workerId === CURRENT_WORKER_ID
|
||||
)
|
||||
if (existingWorker) {
|
||||
runRecordId.value = existingWorker.runtimeStorage?.stepStatusMapByStepId
|
||||
? Object.values(existingWorker.runtimeStorage.stepStatusMapByStepId)[0]?.runRecordId
|
||||
: null
|
||||
if (runRecordId.value) {
|
||||
runningOverlayRef.value?.show()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
const handleSubmit = async () => {
|
||||
gtagRenderer('run_read_no_reply_reminder_clicked', {
|
||||
throttle_interval_minutes: formContent.value.autoReminder.throttleIntervalMinutes,
|
||||
|
||||
@@ -22,13 +22,13 @@ export const useUpdateStore = defineStore('update', () => {
|
||||
|
||||
export const useTaskManagerStore = defineStore('taskManager', () => {
|
||||
const runningTasks = ref<unknown[]>([])
|
||||
function getRunningTasks() {
|
||||
async function getRunningTasks() {
|
||||
const { ipcRenderer } = electron
|
||||
ipcRenderer.invoke('get-task-manager-list').then(res => {
|
||||
runningTasks.value = res.workers ?? []
|
||||
})
|
||||
const res = await ipcRenderer.invoke('get-task-manager-list')
|
||||
runningTasks.value = res.workers ?? []
|
||||
}
|
||||
const throttledGetRunningTasks = throttle(getRunningTasks, 2000)
|
||||
setInterval(throttledGetRunningTasks, 2 * 1000)
|
||||
getRunningTasks()
|
||||
return { runningTasks, getRunningTasks: throttledGetRunningTasks }
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user