Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add plugin and theme binding check field #23

Merged
merged 2 commits into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions console/src/components/entity-fields/PluginBindingCheckField.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<script lang="ts" setup>
import type { Plugin } from "@halo-dev/api-client";
import { VEntityField, VStatusDot } from "@halo-dev/components";

withDefaults(
defineProps<{
plugin: Plugin;
}>(),
{}
);
</script>

<template>
<VEntityField>
<template #description>
<VStatusDot v-tooltip="`未绑定应用市场,在应用市场覆盖安装之后即可检测新版本`" state="default" />
</template>
</VEntityField>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<script lang="ts" setup>
import type { Theme } from "@halo-dev/api-client";
import { VStatusDot } from "@halo-dev/components";
withDefaults(
defineProps<{
theme: Theme;
}>(),
{}
);
</script>

<template>
<VStatusDot v-tooltip="`未绑定应用市场,在应用市场覆盖安装之后即可检测新版本`" state="default" />
</template>
19 changes: 19 additions & 0 deletions console/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import AppStore from "./views/AppStore.vue";
import type { Plugin, Theme } from "@halo-dev/api-client";
import PluginVersionCheckField from "./components/entity-fields/PluginVersionCheckField.vue";
import ThemeVersionCheckOperationItem from "./components/operation-items/ThemeVersionCheckOperationItem.vue";
import PluginBindingCheckField from "./components/entity-fields/PluginBindingCheckField.vue";
import ThemeBindingCheckOperationItem from "./components/operation-items/ThemeBindingCheckOperationItem.vue";
import ViewAppStoreOperationItem from "./components/operation-items/ViewAppStoreOperationItem.vue";
import { STORE_APP_ID } from "./constant";

Expand Down Expand Up @@ -70,6 +72,15 @@ export default definePlugin({
plugin: plugin,
},
},
{
priority: 42,
position: "end",
component: markRaw(PluginBindingCheckField),
props: {
plugin: plugin,
},
hidden: !!plugin.value.metadata.annotations?.[STORE_APP_ID],
},
];
},
"theme:list-item:operation:create": (theme: Ref<Theme>) => {
Expand All @@ -81,6 +92,14 @@ export default definePlugin({
theme,
},
},
{
priority: 1,
component: markRaw(ThemeBindingCheckOperationItem),
props: {
theme,
},
hidden: !!theme.value.metadata.annotations?.[STORE_APP_ID],
},
];
},
"plugin:list-item:operation:create": (plugin: Ref<Plugin>) => {
Expand Down
Loading