-
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add plugin detail modal as global component (#6233)
#### What type of PR is this? /area ui /kind feature /milestone 2.17.x #### What this PR does / why we need it: 添加 PluginDetailModal,用于打开插件的设置界面。并在扩展设置页面适配以测试。 <img width="1643" alt="image" src="https://github.com/halo-dev/halo/assets/21301288/4bb38ab1-ed51-4437-8202-ccaf9f79cb41"> #### Which issue(s) this PR fixes: Fixes #6232 #### Does this PR introduce a user-facing change? ```release-note 为 UI 添加通用的插件设置弹窗,以供插件主动调用 ```
- Loading branch information
Showing
8 changed files
with
218 additions
and
136 deletions.
There are no files selected for viewing
120 changes: 10 additions & 110 deletions
120
ui/console-src/modules/system/plugins/PluginDetail.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
ui/console-src/modules/system/plugins/components/PluginDetailModal.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<script lang="ts" setup> | ||
import type { Plugin, Setting } from "@halo-dev/api-client"; | ||
import { IconLink, VButton, VModal, VTabbar } from "@halo-dev/components"; | ||
import { provide, ref, toRefs, type Ref } from "vue"; | ||
import { usePluginDetailTabs } from "../composables/use-plugin"; | ||
const props = withDefaults(defineProps<{ name: string }>(), {}); | ||
const emit = defineEmits<{ | ||
(event: "close"): void; | ||
}>(); | ||
const modal = ref<InstanceType<typeof VModal> | null>(null); | ||
const { name } = toRefs(props); | ||
const { plugin, setting, tabs, activeTab } = usePluginDetailTabs(name, false); | ||
provide<Ref<string>>("activeTab", activeTab); | ||
provide<Ref<Plugin | undefined>>("plugin", plugin); | ||
provide<Ref<Setting | undefined>>("setting", setting); | ||
</script> | ||
|
||
<template> | ||
<VModal | ||
ref="modal" | ||
:title="plugin?.spec.displayName" | ||
:centered="true" | ||
:width="920" | ||
height="calc(100vh - 20px)" | ||
mount-to-body | ||
@close="emit('close')" | ||
> | ||
<template #actions> | ||
<span> | ||
<RouterLink | ||
:to="{ | ||
name: 'PluginDetail', | ||
params: { name }, | ||
}" | ||
> | ||
<IconLink /> | ||
</RouterLink> | ||
</span> | ||
</template> | ||
<VTabbar | ||
v-model:active-id="activeTab" | ||
:items=" | ||
tabs.map((tab) => { | ||
return { label: tab.label, id: tab.id }; | ||
}) | ||
" | ||
type="outline" | ||
/> | ||
<div class="-m-4 mt-2"> | ||
<template v-for="tab in tabs" :key="tab.id"> | ||
<component :is="tab.component" v-if="activeTab === tab.id" /> | ||
</template> | ||
</div> | ||
<template #footer> | ||
<VButton @click="modal?.close()"> | ||
{{ $t("core.common.buttons.close") }} | ||
</VButton> | ||
</template> | ||
</VModal> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 3 additions & 11 deletions
14
...c/modules/system/plugins/tabs/Setting.vue → ...ystem/plugins/components/tabs/Setting.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.