Skip to content

Commit

Permalink
Add metric description tooltip to System Submission Drawer Page (#513)
Browse files Browse the repository at this point in the history
* add metric descriptions

* add metric info in systemSubmitDrawer

* move tooltip to the right
  • Loading branch information
noelchen90 authored Nov 18, 2022
1 parent 5e58902 commit 27b03b6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions frontend/src/components/SystemSubmitDrawer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ export function SystemSubmitDrawer(props: Props) {
const [state, setState] = useState(State.loading);
const [taskCategories, setTaskCategories] = useState<TaskCategory[]>([]);
const [languageCodes, setLanguageCodes] = useState<LanguageCode[]>([]);
const [metricDescriptions, setMetricDescriptions] = useState<{
[key: string]: string;
}>({});
const { filtered: inputLangFiltered, setQuery: setInputLangQuery } =
useSearch<LanguageCode>(languageCodes, filterFunc);
const { filtered: outputLangFiltered, setQuery: setOutputLangQuery } =
Expand Down Expand Up @@ -163,6 +166,7 @@ export function SystemSubmitDrawer(props: Props) {
setState(State.loading);
setTaskCategories(await backendClient.tasksGet());
setLanguageCodes(await backendClient.languageCodesGet());
setMetricDescriptions(await backendClient.metricDescriptionsGet());
setState(State.other);
}

Expand Down Expand Up @@ -686,6 +690,14 @@ export function SystemSubmitDrawer(props: Props) {
options={(selectedTask?.supported_metrics || []).map(
(opt) => ({
value: opt,
label: (
<Tooltip
placement="right"
title={metricDescriptions[opt]}
>
<div>{opt}</div>
</Tooltip>
),
})
)}
/>
Expand Down

0 comments on commit 27b03b6

Please sign in to comment.