generated from halo-dev/plugin-starter
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add supports for open app detail in plugin operation item (#4)
支持在插件项的操作菜单中打开应用市场的应用详情页面。 <img width="592" alt="image" src="https://github.com/halo-dev/plugin-app-store/assets/21301288/365fd748-acef-4546-ad16-ce5bed3306d5"> /kind feature ```release-note None ```
- Loading branch information
Showing
2 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
console/src/components/operation-items/ViewAppStoreOperationItem.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,48 @@ | ||
<script lang="ts" setup> | ||
import { VDropdownItem } from "@halo-dev/components"; | ||
import { nextTick, ref } from "vue"; | ||
import AppDetailModal from "../AppDetailModal.vue"; | ||
import storeApiClient from "@/utils/store-api-client"; | ||
import type { ApplicationDetail, ApplicationSearchResult } from "@/types"; | ||
const props = withDefaults( | ||
defineProps<{ | ||
appId: string; | ||
}>(), | ||
{} | ||
); | ||
const detailModal = ref(false); | ||
const visible = ref(false); | ||
const app = ref<ApplicationSearchResult>(); | ||
async function handleOpenDetailModal() { | ||
const { data } = await storeApiClient.get<ApplicationDetail>( | ||
`/apis/api.store.halo.run/v1alpha1/applications/${props.appId}` | ||
); | ||
app.value = { | ||
application: data.application, | ||
latestRelease: data.latestRelease?.release, | ||
owner: data.owner, | ||
}; | ||
detailModal.value = true; | ||
nextTick(() => { | ||
visible.value = true; | ||
}); | ||
} | ||
function onDetailModalClose() { | ||
visible.value = false; | ||
setTimeout(() => { | ||
detailModal.value = false; | ||
app.value = undefined; | ||
}, 200); | ||
} | ||
</script> | ||
|
||
<template> | ||
<VDropdownItem @click="handleOpenDetailModal">应用市场</VDropdownItem> | ||
<AppDetailModal v-if="detailModal" v-model:visible="visible" :app="app" tab="releases" @close="onDetailModalClose" /> | ||
</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