Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 61aeb07

Browse files
committedApr 8, 2024·
(temp) facing error
1 parent cbc8105 commit 61aeb07

File tree

4 files changed

+98
-0
lines changed

4 files changed

+98
-0
lines changed
 

‎site/frontend/src/pages/graphs/page.vue

+26
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {withLoading} from "../../utils/loading";
44
import {GraphData, GraphKind, GraphsSelector} from "../../graph/data";
55
import DataSelector, {SelectionParams} from "./data-selector.vue";
66
import {
7+
changeUrl,
78
createUrlWithAppendedParams,
89
getUrlParams,
910
navigateToUrlParams,
@@ -12,6 +13,8 @@ import {renderPlots} from "../../graph/render";
1213
import {BenchmarkInfo, loadBenchmarkInfo} from "../../api";
1314
import AsOf from "../../components/as-of.vue";
1415
import {loadGraphs} from "../../graph/api";
16+
import Tabs from "./tabs.vue";
17+
import {Tab} from "../../types";
1518
1619
function loadSelectorFromUrl(urlParams: Dict<string>): GraphsSelector {
1720
const start = urlParams["start"] ?? "";
@@ -112,6 +115,28 @@ function updateSelection(params: SelectionParams) {
112115
);
113116
}
114117
118+
function storeTabToUrl(urlParams: Dict<string>, tab: Tab) {
119+
urlParams["tab"] = tab as string;
120+
changeUrl(urlParams);
121+
}
122+
123+
function loadTabFromUrl(urlParams: Dict<string>): Tab | null {
124+
const tab = urlParams["tab"] ?? "";
125+
const tabs = {
126+
compile: Tab.CompileTime,
127+
runtime: Tab.Runtime,
128+
};
129+
return tabs[tab] ?? null;
130+
}
131+
132+
const initialTab: Tab = loadTabFromUrl(getUrlParams()) ?? Tab.CompileTime;
133+
const tab: Ref<Tab> = ref(initialTab);
134+
135+
function changeTab(newTab: Tab) {
136+
tab.value = newTab;
137+
storeTabToUrl(getUrlParams(), newTab);
138+
}
139+
115140
const info: BenchmarkInfo = await loadBenchmarkInfo();
116141
117142
const loading = ref(true);
@@ -143,6 +168,7 @@ loadGraphData(selector, loading);
143168
<h3>This may take a while!</h3>
144169
</div>
145170
<div v-else>
171+
<Tabs @change-tab="changeTab" :initial-tab="initialTab" />
146172
<div id="charts"></div>
147173
<div
148174
v-if="!hasSpecificSelection(selector)"
+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<script setup lang="ts">
2+
import {Tab} from "../../types";
3+
import {ref, Ref} from "vue";
4+
import TabComponent from "../../components/tab.vue";
5+
6+
const props = withDefaults(
7+
defineProps<{
8+
initialTab?: Tab;
9+
}>(),
10+
{
11+
initialTab: Tab.CompileTime,
12+
}
13+
);
14+
const emit = defineEmits<{
15+
(e: "changeTab", tab: Tab): void;
16+
}>();
17+
18+
function changeTab(tab: Tab) {
19+
activeTab.value = tab;
20+
emit("changeTab", tab);
21+
}
22+
23+
const activeTab: Ref<Tab> = ref(props.initialTab);
24+
</script>
25+
26+
<template>
27+
<div class="wrapper">
28+
<TabComponent
29+
tooltip="Compilation time benchmarks: measure how long does it take to compile various crates using the compared rustc."
30+
title="Compile-time"
31+
:selected="activeTab === Tab.CompileTime"
32+
@click="changeTab(Tab.CompileTime)"
33+
>
34+
<template v-slot:summary>
35+
gargagfefefe
36+
</template>
37+
</TabComponent>
38+
<TabComponent
39+
tooltip="Runtime benchmarks: measure how long does it take to execute (i.e. how fast are) programs compiled by the compared rustc."
40+
title="Runtime"
41+
:selected="activeTab === Tab.Runtime"
42+
@click="changeTab(Tab.Runtime)"
43+
>
44+
<template v-slot:summary>
45+
feafa
46+
</template>
47+
</TabComponent>
48+
</div>
49+
</template>
50+
51+
<style scoped lang="scss">
52+
.wrapper {
53+
display: flex;
54+
flex-direction: column;
55+
align-items: center;
56+
padding: 20px 0;
57+
58+
@media (min-width: 600px) {
59+
justify-content: center;
60+
flex-direction: row;
61+
align-items: normal;
62+
}
63+
}
64+
</style>

‎site/frontend/src/types.ts

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export enum Tab {
2+
CompileTime = "compile",
3+
Runtime = "runtime",
4+
Bootstrap = "bootstrap",
5+
ArtifactSize = "artifact-size",
6+
}

‎site/frontend/templates/pages/graphs.html

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
margin: 0;
4444
}
4545
</style>
46+
<link rel="stylesheet" type="text/css" href="scripts/graphs.css">
47+
4648
{% endblock %}
4749
{% block content %}
4850
<div id="app"></div>

0 commit comments

Comments
 (0)
Please sign in to comment.