Skip to content

Commit

Permalink
perf: Optimizing the display of SubNet in node
Browse files Browse the repository at this point in the history
  • Loading branch information
jamebal committed Sep 26, 2024
1 parent 17fa656 commit cf925d3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
8 changes: 6 additions & 2 deletions src/views/node/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,20 @@ const columns = computed((): DataTableColumns<NodeData> => [
title: t('app.name'),
key: 'name',
render(rowData) {
let routes = []
if (rowData.routes && rowData.routes.length > 0) {
routes = rowData.routes.filter(route => route.isPrimary)
}
return h(
'div',
{ style: { whiteSpace: 'pre-line' } },
[
h('span', rowData.givenName),
h('br'),
h('span', { style: { color: 'var(--test-color-fringe)' } }, rowData.name),
rowData.routes && rowData.routes.length > 0
routes.length > 0
? h(NodeSubNetDetails, {
nodeData: rowData,
routes: rowData.routes,
})
: '',
],
Expand Down
12 changes: 6 additions & 6 deletions src/views/node/nodeSubNetDetails.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<script setup lang="ts">
import type { NodeData } from '@/service/api/node'
import RouteTable from '@/views/route/routeTable.vue'
import type { RouteData } from '@/service'
const props = defineProps(
{
nodeData: {
type: Object as PropType<NodeData>,
routes: {
type: Array as () => Array<RouteData>,
required: true,
},
},
)
const routeCount = props.nodeData.routes?.length
const enableCount = props.nodeData.routes?.filter(route => route?.enabled)?.length
const routeCount = props.routes?.length
const enableCount = props.routes?.filter(route => route?.enabled)?.length
const { t } = useI18n()
</script>
Expand All @@ -24,7 +24,7 @@ const { t } = useI18n()
{{ `${t('app.subnets')} ${enableCount}/${routeCount}` }}
</n-tag>
</template>
<RouteTable :routes="nodeData.routes" hide-node-name />
<RouteTable :routes="routes" hide-node-name />
</n-popover>
</template>

Expand Down

0 comments on commit cf925d3

Please sign in to comment.