Skip to content

Commit a93ffec

Browse files
committed
feat(config): implement auto-restart policy management in config store
feat(service): enhance service log handling and normalization refactor(proxy): normalize service names for improved type mapping refactor(websocket): standardize service name normalization in WebSocket plugin
1 parent e182c5e commit a93ffec

7 files changed

Lines changed: 467 additions & 67 deletions

File tree

components/ServiceCard.vue

Lines changed: 3 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,13 @@ import { useStatusStore } from "~/stores/status.js";
44
import {PROCESS_STATUS, SERVICE_ACTIONS} from "~/constants/enums.js";
55
import {performServiceAction} from "~/composables/serviceActions.js";
66
import { extractRestartInfo } from "~/helper/restartInfo.js";
7-
import { configRepository } from "~/services/config.js";
7+
import { useConfigStore } from "~/stores/config.js";
88
9-
let autoRestartPolicyPromise = null
10-
let autoRestartPolicyCache = null
11-
let autoRestartPolicyLoaded = false
12-
13-
const loadAutoRestartPolicy = async () => {
14-
if (autoRestartPolicyPromise) return autoRestartPolicyPromise
15-
const repo = configRepository()
16-
autoRestartPolicyPromise = repo.getConfig()
17-
.then((config) => {
18-
autoRestartPolicyCache = config?.dumb?.auto_restart ?? null
19-
autoRestartPolicyLoaded = true
20-
return autoRestartPolicyCache
21-
})
22-
.catch((error) => {
23-
console.warn('Failed to load auto-restart policy:', error)
24-
autoRestartPolicyCache = null
25-
autoRestartPolicyLoaded = true
26-
return null
27-
})
28-
return autoRestartPolicyPromise
29-
}
30-
31-
const getAutoRestartPolicy = async () => {
32-
if (autoRestartPolicyLoaded) return autoRestartPolicyCache
33-
return loadAutoRestartPolicy()
34-
}
359
const { processService } = useService()
3610
const router = useRouter()
3711
const toast = useToast()
3812
const statusStore = useStatusStore()
13+
const configStore = useConfigStore()
3914
4015
const props = defineProps({
4116
process: {type: Object}
@@ -176,7 +151,7 @@ const showRestartBadge = computed(() => {
176151
})
177152
178153
const resolveAutoRestartAllowed = async () => {
179-
const policy = await getAutoRestartPolicy()
154+
const policy = await configStore.getAutoRestartPolicy()
180155
const name = props.process?.process_name
181156
if (!policy || policy.enabled !== true || !name) {
182157
autoRestartAllowed.value = false

0 commit comments

Comments
 (0)