Skip to content

Commit

Permalink
Merge pull request apache#215 from ikun-Lg/master
Browse files Browse the repository at this point in the history
add TabTitle
  • Loading branch information
chickenlj authored Mar 13, 2024
2 parents c250151 + b22a681 commit 6bbae26
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 12 deletions.
10 changes: 9 additions & 1 deletion ui-vue3/src/layout/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@
<a-layout-content class="layout-content">
<router-view v-slot="{ Component }">
<transition name="slide-fade">
<component :is="Component" />
<component :is="Component">
<template v-slot:tabTitle>
<h1>
{{ route.params && Object.values(route.params)[0] }}
</h1>
</template>
</component>
</transition>
</router-view>
</a-layout-content>
Expand Down Expand Up @@ -91,13 +97,15 @@ router.beforeEach((to, from, next) => {
margin-right: 5px;
}
}
.layout-content {
margin: 16px;
padding: 16px 16px 24px;
background: #fff;
overflow-y: auto;
max-height: 88vh;
}
.layout-footer {
height: 40px;
}
Expand Down
3 changes: 3 additions & 0 deletions ui-vue3/src/layout/tab/layout_tab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<template>
<div class="__container_router_tab_index">
<div :key="key">
<slot name="tabTitle"></slot>
<a-tabs
v-if="tabRoute.meta.tab"
@change="router.push({ name: activeKey || '' })"
Expand Down Expand Up @@ -46,6 +47,7 @@ import _ from 'lodash'
const router = useRouter()
const tabRoute = useRoute()
let meta: any = tabRoute.meta
const tabRouters = computed(() => {
let meta: any = tabRoute.meta
Expand All @@ -55,6 +57,7 @@ let activeKey = ref(tabRoute.name)
let transitionFlag = ref(false)
let key = _.uniqueId('__tab_page')
router.beforeEach((to, from, next) => {
console.log(tabRoute)
key = _.uniqueId('__tab_page')
transitionFlag.value = true
activeKey.value = <string>to.name
Expand Down
10 changes: 5 additions & 5 deletions ui-vue3/src/router/defaultRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export const routes: Readonly<RouteRecordType[]> = [
}
},
{
path: '/detail/:instance',
path: '/detail/:pathId',
name: 'instanceDomain.details',
component: () => import('../views/resources/instances/tabs/details.vue'),
meta: {
Expand All @@ -161,7 +161,7 @@ export const routes: Readonly<RouteRecordType[]> = [
}
},
{
path: '/monitor/:instance',
path: '/monitor/:pathId',
name: 'instanceDomain.monitor',
component: () => import('../views/resources/instances/tabs/monitor.vue'),
meta: {
Expand All @@ -170,7 +170,7 @@ export const routes: Readonly<RouteRecordType[]> = [
}
},
{
path: '/linktracking/:instance',
path: '/linktracking/:pathId',
name: 'instanceDomain.linkTracking',
component: () => import('../views/resources/instances/tabs/linkTracking.vue'),
meta: {
Expand All @@ -179,7 +179,7 @@ export const routes: Readonly<RouteRecordType[]> = [
}
},
{
path: '/configuration/:instance',
path: '/configuration/:pathId',
name: 'instanceDomain.configuration',
component: () => import('../views/resources/instances/tabs/configuration.vue'),
meta: {
Expand All @@ -188,7 +188,7 @@ export const routes: Readonly<RouteRecordType[]> = [
}
},
{
path: '/event/:instance',
path: '/event/:pathId',
name: 'instanceDomain.event',
component: () => import('../views/resources/instances/tabs/event.vue'),
meta: {
Expand Down
12 changes: 6 additions & 6 deletions ui-vue3/src/views/resources/instances/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,22 @@ let columns = [
title: 'instanceDomain.instanceIP',
key: 'ip',
dataIndex: 'ip',
sorter: (a: any, b: any) => sortString(a.instanceIP, b.instanceIP),
sorter: (a: any, b: any) => sortString(a.ip, b.ip),
width: 140
},
{
title: 'instanceDomain.instanceName',
key: 'name',
dataIndex: 'name',
sorter: (a: any, b: any) => sortString(a.instanceName, b.instanceName),
sorter: (a: any, b: any) => sortString(a.name, b.name),
width: 140
},
{
title: 'instanceDomain.deployState',
key: 'deployState',
dataIndex: 'deployState',
width: 120,
sorter: (a: any, b: any) => sortString(a.instanceNum, b.instanceNum)
sorter: (a: any, b: any) => sortString(a.deployState, b.deployState)
},
{
Expand All @@ -102,14 +102,14 @@ let columns = [
title: 'instanceDomain.registerCluster',
key: 'registerClusters',
dataIndex: 'registerClusters',
sorter: (a: any, b: any) => sortString(a.registerCluster, b.registerCluster),
sorter: (a: any, b: any) => sortString(a.registerClusters, b.registerClusters),
width: 140
},
{
title: 'instanceDomain.CPU',
key: 'cpu',
dataIndex: 'cpu',
sorter: (a: any, b: any) => sortString(a.CPU, b.CPU),
sorter: (a: any, b: any) => sortString(a.cpu, b.cpu),
width: 140
},
{
Expand All @@ -123,7 +123,7 @@ let columns = [
title: 'instanceDomain.startTime_k8s',
key: 'startTime_k8s',
dataIndex: 'startTime',
sorter: (a: any, b: any) => sortString(a.startTime_k8s, b.startTime_k8s),
sorter: (a: any, b: any) => sortString(a.startTime, b.startTime),
width: 200
},
{
Expand Down

0 comments on commit 6bbae26

Please sign in to comment.