From e20d560ec04fbd5930a8ab9d306da589680dee2f Mon Sep 17 00:00:00 2001 From: Marvin Zhang Date: Sat, 21 Dec 2024 22:07:38 +0800 Subject: [PATCH] refactor: simplify installConfigSetup action and update dependency interface - Removed the id parameter from the installConfigSetup action in the dependency module. - Updated the API endpoint in the installConfigSetup action to remove the id from the URL. - Changed the commit action in useDependencyList to show a dialog instead of setting a tab name. These changes streamline the dependency installation process and improve the user interface interactions. --- src/interfaces/store/modules/dependency.d.ts | 2 +- src/store/modules/dependency.ts | 10 +++++----- src/views/dependency/list/useDependencyList.tsx | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/interfaces/store/modules/dependency.d.ts b/src/interfaces/store/modules/dependency.d.ts index 22dbce4b7422f..50396977d11e9 100644 --- a/src/interfaces/store/modules/dependency.d.ts +++ b/src/interfaces/store/modules/dependency.d.ts @@ -124,6 +124,6 @@ export declare global { getDependencyConfig: StoreAction; saveDependencyConfig: StoreAction; getConfigSetupList: StoreAction; - installConfigSetup: StoreAction; + installConfigSetup: StoreAction; } } diff --git a/src/store/modules/dependency.ts b/src/store/modules/dependency.ts index af6e5d3f94a41..9ea3a774b9688 100644 --- a/src/store/modules/dependency.ts +++ b/src/store/modules/dependency.ts @@ -423,10 +423,10 @@ const actions = { commit('setConfigSetupTableLoading', false); } }, - installConfigSetup: async ( - { state, commit }: StoreActionContext, - { id }: { id: string } - ) => { + installConfigSetup: async ({ + state, + commit, + }: StoreActionContext) => { const { lang, setupForm } = state; const { node_id, version, mode, node_ids } = setupForm; let payload: Record = { @@ -440,7 +440,7 @@ const actions = { } commit('setSetupLoading', true); try { - await post(`${endpoint}/configs/${lang}/setups/${id}/install`, payload); + await post(`${endpoint}/configs/${lang}/setups/install`, payload); ElMessage.success(t('common.message.success.startInstall')); } catch (e: any) { ElMessage.error(e.message); diff --git a/src/views/dependency/list/useDependencyList.tsx b/src/views/dependency/list/useDependencyList.tsx index 5447b052a3c07..ac4dc0577cb11 100644 --- a/src/views/dependency/list/useDependencyList.tsx +++ b/src/views/dependency/list/useDependencyList.tsx @@ -698,7 +698,7 @@ const useDependencyList = () => { }; const onClickTableEmptyConfigNotSetup = () => { - store.commit(`${ns}/setRepoTabName`, 'nodes'); + store.commit(`${ns}/showDialog`, 'setup'); }; const onClickTableEmptyJava = async () => {