From b9c8b3e378e88a0feff4d477d9d97eb5db075382 Mon Sep 17 00:00:00 2001 From: Gareth George Date: Fri, 22 Dec 2023 08:52:57 +0000 Subject: [PATCH] fix: backup ordering in tree view --- webui/src/components/OperationTree.tsx | 6 ++++-- webui/src/views/App.tsx | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/webui/src/components/OperationTree.tsx b/webui/src/components/OperationTree.tsx index 58fc8465..1ffa2933 100644 --- a/webui/src/components/OperationTree.tsx +++ b/webui/src/components/OperationTree.tsx @@ -297,12 +297,14 @@ const buildTreeLeaf = (operations: BackupInfo[]): OpTreeNode[] => { } return { - key: b.id!, + key: b.id, backup: b, icon: icon, }; }); - entries.sort(sortByKey); + entries.sort((a, b) => { + return b.backup!.startTimeMs - a.backup!.startTimeMs; + }); return entries; }; diff --git a/webui/src/views/App.tsx b/webui/src/views/App.tsx index 9fd93ace..a300b538 100644 --- a/webui/src/views/App.tsx +++ b/webui/src/views/App.tsx @@ -14,7 +14,6 @@ import { Config } from "../../gen/ts/v1/config.pb"; import { useAlertApi } from "../components/Alerts"; import { useShowModal } from "../components/ModalManager"; import { MainContentArea, useSetContent } from "./MainContentArea"; -import { AddPlanModal } from "./AddPlanModal"; import { uiBuildVersion } from "../state/buildcfg"; import { ActivityBar } from "../components/ActivityBar"; @@ -121,7 +120,8 @@ const getSidenavItems = (config: Config | null): MenuProps["items"] => { size="small" shape="circle" icon={} - onClick={() => { + onClick={async () => { + const { AddPlanModal } = await import("./AddPlanModal"); showModal(); }} />