@@ -4,6 +4,7 @@ import {withLoading} from "../../utils/loading";
44import {GraphData , GraphKind , GraphsSelector } from " ../../graph/data" ;
55import DataSelector , {SelectionParams } from " ./data-selector.vue" ;
66import {
7+ changeUrl ,
78 createUrlWithAppendedParams ,
89 getUrlParams ,
910 navigateToUrlParams ,
@@ -12,6 +13,8 @@ import {renderPlots} from "../../graph/render";
1213import {BenchmarkInfo , loadBenchmarkInfo } from " ../../api" ;
1314import AsOf from " ../../components/as-of.vue" ;
1415import {loadGraphs } from " ../../graph/api" ;
16+ import Tabs from " ./tabs.vue" ;
17+ import {Tab } from " ../../types" ;
1518
1619function 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+
115140const info: BenchmarkInfo = await loadBenchmarkInfo ();
116141
117142const 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)"
0 commit comments