Skip to content

Commit

Permalink
feat: sort table on daglist page on webui
Browse files Browse the repository at this point in the history
  • Loading branch information
yottahmd committed May 20, 2022
1 parent a2b46a5 commit 6252306
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion internal/admin/handlers/web/templates/index.gohtml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,17 @@
function DAGsTable({ dags = [], groups = [], group = "" }) {
const root = { Name: "" };
const currGrp = "{{.Group}}";
const sortedDags = React.useMemo(() => {
return dags.sort((a, b) => {
if (a.File < b.File) {
return -1;
}
if (a.File > b.File) {
return 1;
}
return 0;
});
}, [dags])
return (
<table class="table is-bordered is-fullwidth card">
<thead className="has-background-light">
Expand All @@ -248,7 +259,7 @@
{groups.map((item) => {
return <GroupItem key={item.Name} group={item}></GroupItem>;
})}
{dags
{sortedDags
.filter((dag) => !dag.Error)
.map((dag) => {
return <DAGItem key={dag.File} dag={dag} group={group}></DAGItem>;
Expand Down

0 comments on commit 6252306

Please sign in to comment.