Skip to content

Commit

Permalink
[dataquery/dictionary] Add option to display enums as either value or…
Browse files Browse the repository at this point in the history
… field in dataquery module (#9224)

The dataquery module was showing the backend enum value, rather than the frontend label, which isn't very useful to most users.

This adds an option for the user to select how they want to display enums.

It also updates the menu label from "alpha" to "beta" since the module has now been tested with large data sets.

Fixes #9221
  • Loading branch information
driusan committed May 3, 2024
1 parent bb5b3f4 commit 8b3eed6
Show file tree
Hide file tree
Showing 9 changed files with 217 additions and 53 deletions.
6 changes: 5 additions & 1 deletion modules/dataquery/jsx/definefilters.addfiltermodal.tsx
Expand Up @@ -414,7 +414,11 @@ function valueInput(fielddict: FieldDictionary,
i++
) {
const opt = fielddict.options[i];
opts[opt] = opt;
if (fielddict.labels) {
opts[opt] = fielddict.labels[i];
} else {
opts[opt] = opt;
}
}
if (op == 'in') {
return <SelectElement
Expand Down
4 changes: 2 additions & 2 deletions modules/dataquery/jsx/hooks/usebreadcrumbs.tsx
Expand Up @@ -19,7 +19,7 @@ function useBreadcrumbs(
useEffect(() => {
const breadcrumbs = [
{
text: 'Data Query Tool (Alpha)',
text: 'Data Query Tool (Beta)',
/**
* OnClick handler for the main breadcrumb
*
Expand Down Expand Up @@ -77,7 +77,7 @@ function useBreadcrumbs(
*/
onClick: (e) => {
e.preventDefault();
setActiveTab('View Data');
setActiveTab('ViewData');
},
});
}
Expand Down
1 change: 1 addition & 0 deletions modules/dataquery/jsx/types.tsx
Expand Up @@ -111,6 +111,7 @@ export type FieldDictionary = {
cardinality: 'unique' | 'single' | 'optional' | 'many',
visits?: string[], // session only
options?: string[], // enum only
labels?: string[], // enum only, and only if provided
}

export interface DictionaryCategory {
Expand Down

0 comments on commit 8b3eed6

Please sign in to comment.