diff --git a/packages/shared/src/index.ts b/packages/shared/src/index.ts index 2ab3ae8b..65c7a8b1 100644 --- a/packages/shared/src/index.ts +++ b/packages/shared/src/index.ts @@ -1,5 +1,6 @@ export * from "./types/plugin"; export * from "./types/menus"; +export * from "./types/formkit"; export * from "./core/plugins"; export * from "./states/pages"; export * from "./layouts"; diff --git a/packages/shared/src/layouts/PluginLayout.vue b/packages/shared/src/layouts/PluginLayout.vue new file mode 100644 index 00000000..04ce920c --- /dev/null +++ b/packages/shared/src/layouts/PluginLayout.vue @@ -0,0 +1,135 @@ + + diff --git a/packages/shared/src/layouts/index.ts b/packages/shared/src/layouts/index.ts index d1b9f7a3..a0d0e50c 100644 --- a/packages/shared/src/layouts/index.ts +++ b/packages/shared/src/layouts/index.ts @@ -2,3 +2,4 @@ export { default as BlankLayout } from "./BlankLayout.vue"; export { default as BasicLayout } from "./BasicLayout.vue"; export { default as SystemSettingsLayout } from "./SystemSettingsLayout.vue"; export { default as UserProfileLayout } from "./UserProfileLayout.vue"; +export { default as PluginLayout } from "./PluginLayout.vue"; diff --git a/packages/shared/src/types/formkit.ts b/packages/shared/src/types/formkit.ts new file mode 100644 index 00000000..ceff6306 --- /dev/null +++ b/packages/shared/src/types/formkit.ts @@ -0,0 +1,10 @@ +import type { Setting, SettingSpec } from "@halo-dev/api-client"; +import type { FormKitSchemaCondition, FormKitSchemaNode } from "@formkit/core"; + +export interface FormKitSettingSpec extends Omit { + formSchema: FormKitSchemaCondition | FormKitSchemaNode[]; +} + +export interface FormKitSetting extends Omit { + spec: Array; +} diff --git a/src/modules/interface/themes/ThemeDetail.vue b/src/modules/interface/themes/ThemeDetail.vue index f1e90f5c..df939e68 100644 --- a/src/modules/interface/themes/ThemeDetail.vue +++ b/src/modules/interface/themes/ThemeDetail.vue @@ -320,7 +320,7 @@ onMounted(handleFetchThemes); diff --git a/src/modules/system/plugins/PluginDetail.vue b/src/modules/system/plugins/PluginDetail.vue index 7714d974..ee86b604 100644 --- a/src/modules/system/plugins/PluginDetail.vue +++ b/src/modules/system/plugins/PluginDetail.vue @@ -1,157 +1,17 @@ diff --git a/src/modules/system/plugins/PluginList.vue b/src/modules/system/plugins/PluginList.vue index 7ae1acf6..765f9d84 100644 --- a/src/modules/system/plugins/PluginList.vue +++ b/src/modules/system/plugins/PluginList.vue @@ -27,7 +27,7 @@ const dialog = useDialog(); const handleRouteToDetail = (plugin: Plugin) => { router.push({ name: "PluginDetail", - params: { pluginName: plugin.metadata.name }, + params: { name: plugin.metadata.name }, }); }; diff --git a/src/modules/system/plugins/PluginSetting.vue b/src/modules/system/plugins/PluginSetting.vue new file mode 100644 index 00000000..aea0b2f5 --- /dev/null +++ b/src/modules/system/plugins/PluginSetting.vue @@ -0,0 +1,149 @@ + + diff --git a/src/modules/system/plugins/module.ts b/src/modules/system/plugins/module.ts index e259d873..6dbe4144 100644 --- a/src/modules/system/plugins/module.ts +++ b/src/modules/system/plugins/module.ts @@ -1,5 +1,11 @@ -import { BasicLayout, definePlugin } from "@halo-dev/admin-shared"; +import { + BasicLayout, + BlankLayout, + definePlugin, + PluginLayout, +} from "@halo-dev/admin-shared"; import PluginList from "./PluginList.vue"; +import PluginSetting from "./PluginSetting.vue"; import PluginDetail from "./PluginDetail.vue"; import { IconPlug } from "@halo-dev/components"; @@ -9,23 +15,37 @@ export default definePlugin({ routes: [ { path: "/plugins", - component: BasicLayout, + component: BlankLayout, children: [ { path: "", - name: "Plugins", - component: PluginList, - meta: { - permissions: ["system:plugins:view"], - }, + component: BasicLayout, + children: [ + { + path: "", + name: "Plugins", + component: PluginList, + meta: { + permissions: ["system:plugins:view"], + }, + }, + ], }, { - path: ":pluginName", - name: "PluginDetail", - component: PluginDetail, - meta: { - permissions: ["system:plugins:view"], - }, + path: ":name", + component: PluginLayout, + children: [ + { + path: "detail", + name: "PluginDetail", + component: PluginDetail, + }, + { + path: "settings/:group", + name: "PluginSetting", + component: PluginSetting, + }, + ], }, ], }, diff --git a/src/modules/system/roles/RoleDetail.vue b/src/modules/system/roles/RoleDetail.vue index 694c18d5..aeb51865 100644 --- a/src/modules/system/roles/RoleDetail.vue +++ b/src/modules/system/roles/RoleDetail.vue @@ -311,8 +311,9 @@ onMounted(() => { :to="{ name: 'PluginDetail', params: { - pluginName: - group.roles[0].metadata.labels?.[pluginLabels.NAME], + name: group.roles[0].metadata.labels?.[ + pluginLabels.NAME + ], }, }" class="hover:text-blue-600"