Skip to content
Snippets Groups Projects
Commit 76645b00cd63 authored by Raphaël Gomès's avatar Raphaël Gomès
Browse files

web-ui: sort results based on rank of Mercurial commit

parent 9b0780bf18eb
No related branches found
No related tags found
No related merge requests found
Pipeline #55428 skipped
<script lang="ts">
import Chart from "chart.js/auto";
import nodemap from "../../../mercurial-mapping.json";
import { onMount } from "svelte";
import { COLORS } from "../config.js";
......@@ -4,6 +3,6 @@
import { onMount } from "svelte";
import { COLORS } from "../config.js";
import { getNodeForResult, sortVersions } from "../utils";
import { getNodeForResult, getRankForResult, sortVersions } from "../utils";
export let title: string;
export let data;
......@@ -14,6 +13,9 @@
*/
const groupResults = (results) => {
return results.reduce((acc, result) => {
if (getRankForResult(result) == null) {
return acc;
}
const dataEnvName = result["data-env-vars"]["name"];
const key =
dataEnvName.slice(dataEnvName.split("-", 1)[0].length + 1) +
......@@ -38,8 +40,8 @@
).entries()) {
const graphData = [];
const sorted = [...results].sort((a, b) => {
const nodeA = nodemap[getNodeForResult(a)];
const nodeB = nodemap[getNodeForResult(b)];
const nodeA = getRankForResult(a);
const nodeB = getRankForResult(b);
return nodeA - nodeB;
});
for (const result of sorted) {
......
......@@ -54,4 +54,8 @@
export const getNodeForResult = (result) => {
return result["bin-env-vars"]["hg"]["changeset"]["node"];
};
export const getRankForResult = (result) => {
return result["bin-env-vars"]["hg"]["changeset"]["rank"];
};
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment