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

web-ui: sort everything to make the experience predictable and consistent

parent 43127194
No related branches found
No related tags found
1 merge request!7Address listed issues with web UI
<script lang="ts">
import Benchmark from "./lib/Benchmark.svelte";
import {sortByFirst} from "./utils";
</script>
<main>
......@@ -8,7 +9,7 @@
{#await import("../../results-new.json")}
<h2>Loading...</h2>
{:then allResults}
{#each Object.entries(allResults.default) as [name, results]}
{#each Object.entries(allResults.default).sort(sortByFirst) as [name, results]}
<Benchmark {name} {results} />
{/each}
{/await}
......
<script lang="ts">
import Graph from "./Graph.svelte";
import { sortByFirst } from "../utils";
export let name;
export let results;
......@@ -23,7 +24,7 @@
<div class="benchmark">
<h2>{name}</h2>
<div class="graphs">
{#each Object.entries(groupResults(results)) as [repoName, data]}
{#each Object.entries(groupResults(results)).sort(sortByFirst) as [repoName, data]}
<Graph title={repoName} {data} />
{/each}
</div>
......
......@@ -2,7 +2,7 @@
import Chart from "chart.js/auto";
import { onMount } from "svelte";
import { COLORS } from "../config.js";
import { getNodeForResult, getRankForResult, sortVersions } from "../utils";
import { getNodeForResult, getRankForResult, sortVersions, sortByFirst } from "../utils";
export let title: string;
export let data;
......@@ -36,7 +36,7 @@
for (const [index, [dataEnvName, results]] of Object.entries(
groupResults(data)
).entries()) {
).sort(sortByFirst).entries()) {
const graphData = [];
const sorted = [...results].sort((a, b) => {
const nodeA = getRankForResult(a);
......
......@@ -52,6 +52,16 @@
return 0;
};
export const sortByFirst = (a: [string, any], b: [string, any]): number => {
if (a[0] < b[0]) {
return -1
} else if (a[0] == b[0]) {
return 0
} else {
return 1
}
}
export const getNodeForResult = (result) => {
return result["bin-env-vars"]["hg"]["changeset"]["node"];
};
......
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