2022-05-23 10:09:09 +00:00
|
|
|
<script lang="ts" setup>
|
2024-07-01 08:59:17 +00:00
|
|
|
import type { Plugin, Setting } from "@halo-dev/api-client";
|
2024-05-30 07:01:15 +00:00
|
|
|
import { VAvatar, VCard, VPageHeader, VTabbar } from "@halo-dev/components";
|
|
|
|
import type { Ref } from "vue";
|
2024-07-01 08:59:17 +00:00
|
|
|
import { provide, toRefs } from "vue";
|
|
|
|
import { useRoute } from "vue-router";
|
|
|
|
import { usePluginDetailTabs } from "./composables/use-plugin";
|
2022-07-20 07:24:35 +00:00
|
|
|
|
2023-07-07 04:38:11 +00:00
|
|
|
const route = useRoute();
|
2023-02-22 08:00:12 +00:00
|
|
|
|
2024-07-01 08:59:17 +00:00
|
|
|
const { name } = toRefs(route.params);
|
2023-07-07 04:38:11 +00:00
|
|
|
|
2024-07-01 08:59:17 +00:00
|
|
|
const { plugin, setting, activeTab, tabs } = usePluginDetailTabs(
|
|
|
|
name as Ref<string | undefined>,
|
|
|
|
true
|
|
|
|
);
|
2022-07-20 07:24:35 +00:00
|
|
|
|
2024-07-01 08:59:17 +00:00
|
|
|
provide<Ref<string>>("activeTab", activeTab);
|
2023-07-07 04:38:11 +00:00
|
|
|
provide<Ref<Plugin | undefined>>("plugin", plugin);
|
|
|
|
provide<Ref<Setting | undefined>>("setting", setting);
|
2022-05-23 10:09:09 +00:00
|
|
|
</script>
|
|
|
|
<template>
|
2023-07-07 04:38:11 +00:00
|
|
|
<VPageHeader :title="plugin?.spec?.displayName">
|
|
|
|
<template #icon>
|
|
|
|
<VAvatar
|
|
|
|
v-if="plugin"
|
|
|
|
:src="plugin.status?.logo"
|
|
|
|
:alt="plugin.spec.displayName"
|
|
|
|
class="mr-2"
|
|
|
|
size="sm"
|
|
|
|
/>
|
|
|
|
</template>
|
|
|
|
</VPageHeader>
|
|
|
|
|
|
|
|
<div class="m-0 md:m-4">
|
2023-11-27 09:04:08 +00:00
|
|
|
<VCard :body-class="['!p-0', '!overflow-visible']">
|
2023-07-07 04:38:11 +00:00
|
|
|
<template #header>
|
|
|
|
<VTabbar
|
|
|
|
v-model:active-id="activeTab"
|
|
|
|
:items="tabs.map((item) => ({ id: item.id, label: item.label }))"
|
|
|
|
class="w-full !rounded-none"
|
|
|
|
type="outline"
|
|
|
|
></VTabbar>
|
|
|
|
</template>
|
2023-11-27 09:04:08 +00:00
|
|
|
<div class="rounded-b-base bg-white">
|
2023-07-07 04:38:11 +00:00
|
|
|
<template v-for="tab in tabs" :key="tab.id">
|
|
|
|
<component :is="tab.component" v-if="activeTab === tab.id" />
|
|
|
|
</template>
|
2022-09-23 14:14:40 +00:00
|
|
|
</div>
|
2023-07-07 04:38:11 +00:00
|
|
|
</VCard>
|
|
|
|
</div>
|
2022-05-23 10:09:09 +00:00
|
|
|
</template>
|