From e811ecb35ae009996897849c2c5cf88535fac3a2 Mon Sep 17 00:00:00 2001 From: sabonerune <102559104+sabonerune@users.noreply.github.com> Date: Fri, 12 May 2023 16:47:30 +0900 Subject: [PATCH] =?UTF-8?q?FIX:=20=E3=82=A8=E3=83=B3=E3=82=B8=E3=83=B3?= =?UTF-8?q?=E3=81=AE=E5=86=8D=E8=B5=B7=E5=8B=95=E6=99=82=E3=81=ABEngineInf?= =?UTF-8?q?o=E3=82=92=E6=9B=B4=E6=96=B0=E3=81=99=E3=82=8B=20(#1311)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/engine.ts | 22 ++++++++++++++++++++++ src/store/type.ts | 8 ++++++++ 2 files changed, 30 insertions(+) diff --git a/src/store/engine.ts b/src/store/engine.ts index f8cca51a22..803b8c9e6e 100644 --- a/src/store/engine.ts +++ b/src/store/engine.ts @@ -31,6 +31,26 @@ export const engineStore = createPartialStore({ }, }, + SET_ENGINE_INFO: { + mutation(state, { engineId, engineInfo }) { + state.engineInfos[engineId] = engineInfo; + }, + }, + + GET_ONLY_ENGINE_INFOS: { + async action({ commit }, { engineIds }) { + const engineInfos = await window.electron.engineInfos(); + for (const engineInfo of engineInfos) { + if (engineIds.includes(engineInfo.uuid)) { + commit("SET_ENGINE_INFO", { + engineId: engineInfo.uuid, + engineInfo, + }); + } + } + }, + }, + GET_SORTED_ENGINE_INFOS: { getter: (state) => { return Object.values(state.engineInfos).sort((a, b) => { @@ -188,6 +208,8 @@ export const engineStore = createPartialStore({ }) ); + await dispatch("GET_ONLY_ENGINE_INFOS", { engineIds }); + const result = await dispatch("POST_ENGINE_START", { engineIds, }); diff --git a/src/store/type.ts b/src/store/type.ts index 1c5ab4c99c..feba5eb2c2 100644 --- a/src/store/type.ts +++ b/src/store/type.ts @@ -735,6 +735,14 @@ export type EngineStoreTypes = { action(): void; }; + SET_ENGINE_INFO: { + mutation: { engineId: EngineId; engineInfo: EngineInfo }; + }; + + GET_ONLY_ENGINE_INFOS: { + action: (payload: { engineIds: EngineId[] }) => Promise; + }; + GET_SORTED_ENGINE_INFOS: { getter: EngineInfo[]; };