Skip to content

Commit

Permalink
status: sort dead to end
Browse files Browse the repository at this point in the history
  • Loading branch information
pulsejet committed May 11, 2024
1 parent 6c6faa1 commit f5db912
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions framework/ndn-testbed-status/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,22 @@ export default defineComponent({
data: () => ({
connectedFace: String(),
routers: {} as Record<string, IRouter>,
unsortedRouters: {} as Record<string, IRouter>,
services: [] as string[],
}),
computed: {
routers() {
const entries = Object.entries(this.unsortedRouters);
entries.sort(([a, a_o], [b, b_o]) => {
const err_c = (a_o.error ? 1 : 0) - (b_o.error ? 1 : 0);
const name_c = a.localeCompare(b)
return err_c || name_c;
})
return Object.fromEntries(entries);
},
},
async mounted() {
// Connect to testbed
const faces = await connectToNetwork();
Expand All @@ -124,15 +136,10 @@ export default defineComponent({
methods: {
async start() {
// Get router list
this.routers = JSON.parse(await this.cat(ROUTERS_JSON));
// Sort routers by name
this.routers = Object.fromEntries(
Object.entries(this.routers).sort(([a], [b]) => a.localeCompare(b))
);
this.unsortedRouters = JSON.parse(await this.cat(ROUTERS_JSON));
// Get each router's status
for (const [name, router] of Object.entries(this.routers)) {
for (const [name, router] of Object.entries(this.unsortedRouters)) {
this.refreshRouter(router);
}
},
Expand Down

0 comments on commit f5db912

Please sign in to comment.