1
0
mirror of https://github.com/1Panel-dev/1Panel.git synced 2025-03-14 01:34:47 +08:00

feat: 解决快速安装应用跳转失败问题 (#2178)

This commit is contained in:
zhengkunwang 2023-09-04 22:22:18 +08:00 committed by GitHub
parent 0c2d971d72
commit fb00ba812a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 59 additions and 53 deletions

View File

@ -130,7 +130,7 @@ const setting = () => {
}; };
const goRouter = async (key: string) => { const goRouter = async (key: string) => {
router.push({ name: 'AppDetail', params: { appKey: key } }); router.push({ name: 'AppAll', query: { install: key } });
}; };
const onCheck = async () => { const onCheck = async () => {

View File

@ -28,17 +28,6 @@ const appStoreRouter = {
requiresAuth: false, requiresAuth: false,
}, },
}, },
{
path: 'detail/:appKey',
name: 'AppDetail',
component: () => import('@/views/app-store/detail/index.vue'),
props: true,
hidden: true,
meta: {
activeMenu: '/apps',
requiresAuth: false,
},
},
{ {
path: 'installed', path: 'installed',
name: 'AppInstalled', name: 'AppInstalled',

View File

@ -176,6 +176,7 @@ const canUpdate = ref(false);
const syncing = ref(false); const syncing = ref(false);
const detailRef = ref(); const detailRef = ref();
const installRef = ref(); const installRef = ref();
const installKey = ref('');
const getColor = (index: number) => { const getColor = (index: number) => {
return colorArr[index]; return colorArr[index];
@ -245,6 +246,15 @@ const searchByName = (name: string) => {
}; };
onMounted(() => { onMounted(() => {
if (router.currentRoute.value.query.install) {
installKey.value = String(router.currentRoute.value.query.install);
const params = {
app: {
key: installKey.value,
},
};
installRef.value.acceptParams(params);
}
search(req); search(req);
}); });
</script> </script>

View File

@ -4,41 +4,35 @@
<DrawerHeader :header="$t('app.detail')" :back="handleClose" /> <DrawerHeader :header="$t('app.detail')" :back="handleClose" />
</template> </template>
<div class="brief" v-loading="loadingApp"> <div class="brief" v-loading="loadingApp">
<el-row :gutter="20"> <div class="detail flex">
<div> <div class="w-12 h-12 bg-gray-100 rounded p-1 shadow-md icon">
<el-col :span="3"> <img :src="app.icon" alt="App Icon" class="w-full h-full rounded" />
<el-avatar shape="square" :size="180" :src="app.icon" />
</el-col>
</div> </div>
<el-col :span="18"> <div class="ml-4">
<div class="detail"> <div class="name mb-2">
<div class="name"> <span>{{ app.name }}</span>
<span>{{ app.name }}</span>
</div>
<div class="description">
<span>
{{ language == 'zh' || language == 'tw' ? app.shortDescZh : app.shortDescEn }}
</span>
</div>
<br />
<div v-if="!loadingDetail">
<el-alert
style="width: 300px"
v-if="!appDetail.enable"
:title="$t('app.limitHelper')"
type="warning"
show-icon
:closable="false"
/>
</div>
<div>
<el-button round v-if="appDetail.enable" @click="openInstall" type="primary">
{{ $t('app.install') }}
</el-button>
</div>
</div> </div>
</el-col> <div class="description mb-4">
</el-row> <span>
{{ language == 'zh' || language == 'tw' ? app.shortDescZh : app.shortDescEn }}
</span>
</div>
<br />
<div v-if="!loadingDetail" class="mb-2">
<el-alert
style="width: 300px"
v-if="!appDetail.enable"
:title="$t('app.limitHelper')"
type="warning"
show-icon
:closable="false"
/>
</div>
<el-button round v-if="appDetail.enable" @click="openInstall" type="primary">
{{ $t('app.install') }}
</el-button>
</div>
</div>
<div class="divider"></div> <div class="divider"></div>
<div> <div>
<el-row> <el-row>
@ -170,7 +164,9 @@ defineExpose({
} }
} }
.detail { .icon {
width: 180px;
height: 180px;
} }
.version { .version {

View File

@ -11,7 +11,13 @@
</template> </template>
<el-row v-loading="loading"> <el-row v-loading="loading">
<el-col :span="22" :offset="1"> <el-col :span="22" :offset="1">
<el-alert :title="$t('app.appInstallWarn')" class="common-prompt" :closable="false" type="error" /> <el-alert
:title="$t('app.appInstallWarn')"
class="common-prompt"
:closable="false"
type="error"
v-if="canEditPort(installData.app.key)"
/>
<el-form <el-form
@submit.prevent @submit.prevent
ref="paramForm" ref="paramForm"
@ -191,6 +197,9 @@ const appVersions = ref<string[]>([]);
const handleClose = () => { const handleClose = () => {
open.value = false; open.value = false;
resetForm(); resetForm();
if (router.currentRoute.value.query.install) {
router.push({ name: 'AppAll' });
}
}; };
const paramKey = ref(1); const paramKey = ref(1);

View File

@ -249,8 +249,8 @@ const getLabel = (row: ParamObj): string => {
} }
}; };
const toPage = (appKey: string) => { const toPage = (key: string) => {
router.push({ name: 'AppDetail', params: { appKey: appKey } }); router.push({ name: 'AppAll', query: { install: key } });
}; };
onMounted(() => { onMounted(() => {

View File

@ -355,7 +355,7 @@ const loadDB = async () => {
}; };
const goRouter = async () => { const goRouter = async () => {
router.push({ name: 'AppDetail', params: { appKey: 'mysql' } }); router.push({ name: 'AppAll', query: { install: 'mysql' } });
}; };
const onChange = async (info: any) => { const onChange = async (info: any) => {
@ -372,7 +372,7 @@ const goDashboard = async () => {
}; };
const getAppDetail = (key: string) => { const getAppDetail = (key: string) => {
router.push({ name: 'AppDetail', params: { appKey: key } }); router.push({ name: 'AppAll', query: { install: key } });
}; };
const loadDashboardPort = async () => { const loadDashboardPort = async () => {

View File

@ -102,7 +102,7 @@ const goDashboard = async () => {
dialogPortJumpRef.value.acceptParams({ port: redisCommandPort.value }); dialogPortJumpRef.value.acceptParams({ port: redisCommandPort.value });
}; };
const getAppDetail = (key: string) => { const getAppDetail = (key: string) => {
router.push({ name: 'AppDetail', params: { appKey: key } }); router.push({ name: 'AppAll', query: { install: key } });
}; };
const loadDashboardPort = async () => { const loadDashboardPort = async () => {

View File

@ -64,7 +64,7 @@ const acceptParams = (): void => {
}; };
const goInstall = (key: string) => { const goInstall = (key: string) => {
router.push({ name: 'AppDetail', params: { appKey: key } }); router.push({ name: 'AppAll', query: { install: key } });
}; };
const search = async (req: App.AppReq) => { const search = async (req: App.AppReq) => {

View File

@ -635,6 +635,8 @@ onMounted(() => {
<style scoped lang="scss"> <style scoped lang="scss">
.path { .path {
display: flex;
align-items: center;
border: 1px solid #ebeef5; border: 1px solid #ebeef5;
background-color: var(--panel-path-bg); background-color: var(--panel-path-bg);
height: 30px; height: 30px;