Skip to content

Commit b2501a6

Browse files
author
ssongliu
committed
fix: Fix some route redirection issues
1 parent 5a46e1d commit b2501a6

8 files changed

Lines changed: 21 additions & 18 deletions

File tree

frontend/src/layout/components/Sidebar/components/Collapse.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ onMounted(() => {
402402
padding: 3px 0;
403403
}
404404
.msg-tag {
405+
margin-top: 3px;
405406
float: right;
406407
background-color: transparent;
407408
color: var(--panel-main-bg-color-1);

frontend/src/routers/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ router.beforeEach((to, from, next) => {
1111
NProgress.start();
1212
axiosCanceler.removeAllPending();
1313
const globalStore = GlobalStore();
14+
if (!globalStore.isAdmin && to.name === 'Panel') {
15+
next({
16+
name: 'Alert',
17+
});
18+
NProgress.done();
19+
return;
20+
}
1421
if (to.name !== 'entrance' && !globalStore.isLogin) {
1522
next({
1623
name: 'entrance',

frontend/src/routers/router.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@ const xpackEEModules: Record<string, RouteRecordRaw> = import.meta.glob('../xpac
77
modules = { ...modules, ...xpackModules, ...xpackEEModules };
88

99
const homeRouter: RouteRecordRaw = {
10-
path: '/',
10+
path: '/dashboard',
1111
name: 'Home-Menu',
1212
component: Layout,
13-
redirect: '/',
13+
redirect: '/dashboard',
1414
meta: {
1515
keepAlive: true,
1616
title: 'menu.home',
1717
icon: 'p-home',
1818
},
1919
children: [
2020
{
21-
path: '/',
21+
path: '/dashboard',
2222
name: 'home',
2323
component: () => import('@/views/home/index.vue'),
2424
meta: {

frontend/src/views/log/operation/index.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
<el-option :label="$t('commons.status.success')" value="Success" />
4242
<el-option :label="$t('commons.status.failed')" value="Failed" />
4343
</el-select>
44-
<el-select v-model="searchNode" @change="search()" clearable class="p-w-200">
44+
<el-select v-if="globalStore.isAdmin" v-model="searchNode" @change="search()" clearable class="p-w-200">
4545
<template #prefix>{{ $t('xpack.node.node') }}</template>
4646
<el-option :label="$t('commons.table.all')" value="" />
4747
<el-option v-for="(node, index) in nodes" :key="index" :label="node.name" :value="node.name" />
@@ -207,9 +207,10 @@ const onSubmitClean = async () => {
207207
};
208208
209209
onMounted(() => {
210-
if (globalStore.isMasterProductPro) {
210+
if (globalStore.isAdmin && globalStore.isMasterProductPro) {
211211
loadNodes();
212212
}
213+
searchNode.value = globalStore.isAdmin ? '' : globalStore.currentNode;
213214
search();
214215
});
215216
</script>

frontend/src/views/login/components/login-form.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ const login = (formEl: FormInstance | undefined) => {
427427
menuStore.setMenuList([]);
428428
tabsStore.removeAllTabs();
429429
globalStore.isAdmin = res.data.role === 'ADMIN';
430-
changeToLocal();
430+
await changeToLocal();
431431
MsgSuccess(i18n.t('commons.msg.loginSuccess'));
432432
localStorage.removeItem('dashboardCache');
433433
localStorage.removeItem('upgradeChecked');
@@ -473,7 +473,7 @@ const mfaLogin = async (auto: boolean) => {
473473
tabsStore.removeAllTabs();
474474
MsgSuccess(i18n.t('commons.msg.loginSuccess'));
475475
globalStore.isAdmin = res.data.role === 'ADMIN';
476-
changeToLocal();
476+
await changeToLocal();
477477
localStorage.removeItem('dashboardCache');
478478
localStorage.removeItem('upgradeChecked');
479479
routerToName('home');
@@ -522,7 +522,7 @@ const passkeyLogin = async () => {
522522
globalStore.setAgreeLicense(true);
523523
menuStore.setMenuList([]);
524524
tabsStore.removeAllTabs();
525-
changeToLocal();
525+
await changeToLocal();
526526
MsgSuccess(i18n.t('commons.msg.loginSuccess'));
527527
localStorage.removeItem('dashboardCache');
528528
localStorage.removeItem('upgradeChecked');
@@ -531,7 +531,6 @@ const passkeyLogin = async () => {
531531
} catch (res: any) {
532532
if (res?.message) {
533533
MsgError(i18n.t('commons.login.passkeyFailed'));
534-
console.log(res.message);
535534
}
536535
} finally {
537536
isLoggingIn = false;

frontend/src/views/setting/panel/index.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<el-col :span="1"><br /></el-col>
88
<el-col :xs="24" :sm="20" :md="15" :lg="12" :xl="12">
99
<el-form-item :label="$t('setting.user')" prop="userName">
10-
<el-input disabled v-model="form.userName">
10+
<el-input type="password" disabled v-model="form.userName">
1111
<template #append>
1212
<el-button @click="onChangeUserName()" icon="Setting">
1313
{{ $t('commons.button.set') }}
@@ -335,7 +335,7 @@ const search = async () => {
335335
form.systemIP = agentRes.data.systemIP;
336336
337337
const res = await getSettingInfo();
338-
form.userName = res.data.userName;
338+
form.userName = '******';
339339
form.password = '******';
340340
form.theme = res.data.theme;
341341
form.menuTabs = res.data.menuTabs;
@@ -388,7 +388,7 @@ const onChangePassword = () => {
388388
passwordRef.value.acceptParams({ complexityVerification: form.complexityVerification });
389389
};
390390
const onChangeUserName = () => {
391-
userNameRef.value.acceptParams({ userName: form.userName });
391+
userNameRef.value.acceptParams();
392392
};
393393
const onChangeTitle = () => {
394394
panelNameRef.value.acceptParams({ panelName: form.panelName });

frontend/src/views/setting/panel/username/index.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ import router from '@/routers';
2525
import { GlobalStore } from '@/store';
2626
const globalStore = GlobalStore();
2727
28-
interface DialogProps {
29-
userName: string;
30-
}
3128
const drawerVisible = ref();
3229
const loading = ref();
3330
@@ -39,8 +36,7 @@ const rules = reactive({
3936
});
4037
const formRef = ref<FormInstance>();
4138
42-
const acceptParams = (params: DialogProps): void => {
43-
form.userName = params.userName;
39+
const acceptParams = (): void => {
4440
drawerVisible.value = true;
4541
};
4642

frontend/src/views/setting/safe/index.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,6 @@ const registerPasskey = async () => {
446446
await loadPasskeys();
447447
} catch (res: any) {
448448
if (res?.message) {
449-
console.log(res.message);
450449
MsgError(i18n.global.t('setting.passkeyFailed'));
451450
}
452451
} finally {

0 commit comments

Comments
 (0)