chore: remove unused code related to system configMap (#6695)

#### What type of PR is this?

/area ui
/kind cleanup
/milestone 2.20.x

#### What this PR does / why we need it:

清理 UI 中关于获取 system configmap 的无用代码,目前观察到已经没有任何地方在使用这个数据。

#### Does this PR introduce a user-facing change?

```release-note
None
```
pull/6696/head
Ryan Wang 2024-09-24 14:57:20 +08:00 committed by GitHub
parent 03368281cc
commit 035207b8db
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 1 additions and 38 deletions

View File

@ -19,7 +19,6 @@ import {
setupCoreModules,
setupPluginModules,
} from "@console/setup/setupModules";
import { useSystemConfigMapStore } from "@console/stores/system-configmap";
import { useThemeStore } from "@console/stores/theme";
const app = createApp(App);
@ -97,10 +96,6 @@ async function initApp() {
console.error("Failed to load plugins", e);
}
// load system configMap
const systemConfigMapStore = useSystemConfigMapStore();
await systemConfigMapStore.fetchSystemConfigMap();
if (globalInfoStore.globalInfo?.userInitialized) {
await loadActivatedTheme();
}

View File

@ -9,7 +9,6 @@ import { Toast, VButton } from "@halo-dev/components";
// hooks
import { useGlobalInfoStore } from "@/stores/global-info";
import { useSettingFormConvert } from "@console/composables/use-setting-form";
import { useSystemConfigMapStore } from "@console/stores/system-configmap";
import type { ConfigMap, Setting } from "@halo-dev/api-client";
import { coreApiClient } from "@halo-dev/api-client";
import { useQuery, useQueryClient } from "@tanstack/vue-query";
@ -18,7 +17,6 @@ import { useI18n } from "vue-i18n";
const SYSTEM_CONFIGMAP_NAME = "system";
const { t } = useI18n();
const systemConfigMapStore = useSystemConfigMapStore();
const queryClient = useQueryClient();
const group = inject<Ref<string>>("activeTab", ref("basic"));
@ -52,7 +50,7 @@ const handleSaveConfigMap = async () => {
return;
}
const { data } = await coreApiClient.configMap.updateConfigMap({
await coreApiClient.configMap.updateConfigMap({
name: SYSTEM_CONFIGMAP_NAME,
configMap: configMapToUpdate,
});
@ -61,7 +59,6 @@ const handleSaveConfigMap = async () => {
queryClient.invalidateQueries({ queryKey: ["system-configMap"] });
await useGlobalInfoStore().fetchGlobalInfo();
systemConfigMapStore.configMap = data;
saving.value = false;
};

View File

@ -1,29 +0,0 @@
import type { ConfigMap } from "@halo-dev/api-client";
import { coreApiClient } from "@halo-dev/api-client";
import { defineStore } from "pinia";
interface SystemConfigMapState {
configMap?: ConfigMap;
}
export const useSystemConfigMapStore = defineStore({
id: "system-configmap",
state: (): SystemConfigMapState => ({
configMap: undefined,
}),
actions: {
async fetchSystemConfigMap() {
try {
const { data } = await coreApiClient.configMap.getConfigMap(
{
name: "system",
},
{ mute: true }
);
this.configMap = data;
} catch (error) {
console.error("Failed to fetch system configMap", error);
}
},
},
});