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

pull/2184/head
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) => {
router.push({ name: 'AppDetail', params: { appKey: key } });
router.push({ name: 'AppAll', query: { install: key } });
};
const onCheck = async () => {

View File

@ -28,17 +28,6 @@ const appStoreRouter = {
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',
name: 'AppInstalled',

View File

@ -176,6 +176,7 @@ const canUpdate = ref(false);
const syncing = ref(false);
const detailRef = ref();
const installRef = ref();
const installKey = ref('');
const getColor = (index: number) => {
return colorArr[index];
@ -245,6 +246,15 @@ const searchByName = (name: string) => {
};
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);
});
</script>

View File

@ -4,41 +4,35 @@
<DrawerHeader :header="$t('app.detail')" :back="handleClose" />
</template>
<div class="brief" v-loading="loadingApp">
<el-row :gutter="20">
<div>
<el-col :span="3">
<el-avatar shape="square" :size="180" :src="app.icon" />
</el-col>
<div class="detail flex">
<div class="w-12 h-12 bg-gray-100 rounded p-1 shadow-md icon">
<img :src="app.icon" alt="App Icon" class="w-full h-full rounded" />
</div>
<el-col :span="18">
<div class="detail">
<div class="name">
<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 class="ml-4">
<div class="name mb-2">
<span>{{ app.name }}</span>
</div>
</el-col>
</el-row>
<div class="description mb-4">
<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>
<el-row>
@ -170,7 +164,9 @@ defineExpose({
}
}
.detail {
.icon {
width: 180px;
height: 180px;
}
.version {

View File

@ -11,7 +11,13 @@
</template>
<el-row v-loading="loading">
<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
@submit.prevent
ref="paramForm"
@ -191,6 +197,9 @@ const appVersions = ref<string[]>([]);
const handleClose = () => {
open.value = false;
resetForm();
if (router.currentRoute.value.query.install) {
router.push({ name: 'AppAll' });
}
};
const paramKey = ref(1);

View File

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

View File

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

View File

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

View File

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

View File

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