File tree Expand file tree Collapse file tree 2 files changed +62
-0
lines changed
components/operation-items Expand file tree Collapse file tree 2 files changed +62
-0
lines changed Original file line number Diff line number Diff line change
1
+ <script lang="ts" setup>
2
+ import { VDropdownItem } from " @halo-dev/components" ;
3
+ import { nextTick , ref } from " vue" ;
4
+ import AppDetailModal from " ../AppDetailModal.vue" ;
5
+ import storeApiClient from " @/utils/store-api-client" ;
6
+ import type { ApplicationDetail , ApplicationSearchResult } from " @/types" ;
7
+
8
+ const props = withDefaults (
9
+ defineProps <{
10
+ appId: string ;
11
+ }>(),
12
+ {}
13
+ );
14
+
15
+ const detailModal = ref (false );
16
+ const visible = ref (false );
17
+ const app = ref <ApplicationSearchResult >();
18
+
19
+ async function handleOpenDetailModal() {
20
+ const { data } = await storeApiClient .get <ApplicationDetail >(
21
+ ` /apis/api.store.halo.run/v1alpha1/applications/${props .appId } `
22
+ );
23
+
24
+ app .value = {
25
+ application: data .application ,
26
+ latestRelease: data .latestRelease ?.release ,
27
+ owner: data .owner ,
28
+ };
29
+
30
+ detailModal .value = true ;
31
+ nextTick (() => {
32
+ visible .value = true ;
33
+ });
34
+ }
35
+
36
+ function onDetailModalClose() {
37
+ visible .value = false ;
38
+ setTimeout (() => {
39
+ detailModal .value = false ;
40
+ app .value = undefined ;
41
+ }, 200 );
42
+ }
43
+ </script >
44
+
45
+ <template >
46
+ <VDropdownItem @click =" handleOpenDetailModal" >应用市场</VDropdownItem >
47
+ <AppDetailModal v-if =" detailModal" v-model:visible =" visible" :app =" app" tab =" releases" @close =" onDetailModalClose" />
48
+ </template >
Original file line number Diff line number Diff line change @@ -9,6 +9,8 @@ import AppStore from "./views/AppStore.vue";
9
9
import type { Plugin , Theme } from "@halo-dev/api-client" ;
10
10
import PluginVersionCheckField from "./components/entity-fields/PluginVersionCheckField.vue" ;
11
11
import ThemeVersionCheckOperationItem from "./components/operation-items/ThemeVersionCheckOperationItem.vue" ;
12
+ import ViewAppStoreOperationItem from "./components/operation-items/ViewAppStoreOperationItem.vue" ;
13
+ import { STORE_APP_ID } from "./constant" ;
12
14
13
15
export default definePlugin ( {
14
16
routes : [
@@ -81,5 +83,17 @@ export default definePlugin({
81
83
} ,
82
84
] ;
83
85
} ,
86
+ "plugin:list-item:operation:create" : ( plugin : Ref < Plugin > ) => {
87
+ return [
88
+ {
89
+ priority : 11 ,
90
+ component : markRaw ( ViewAppStoreOperationItem ) ,
91
+ props : {
92
+ appId : plugin . value . metadata . annotations ?. [ STORE_APP_ID ] ,
93
+ } ,
94
+ hidden : ! plugin . value . metadata . annotations ?. [ STORE_APP_ID ] ,
95
+ } ,
96
+ ] ;
97
+ } ,
84
98
} ,
85
99
} ) ;
You can’t perform that action at this time.
0 commit comments