Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discover] UI Updates to Dataset Configurator #8166

Merged
merged 10 commits into from
Oct 8, 2024
Prev Previous commit
adding i18n translation for no time filter option
Signed-off-by: Sean Li <lnse@amazon.com>
sejli committed Oct 3, 2024
commit 542d89f0ce24d59fb67ebd41b3e9b15deb14fad9
Original file line number Diff line number Diff line change
@@ -41,9 +41,14 @@
const languages = type?.supportedLanguages(baseDataset) || [];

const [dataset, setDataset] = useState<Dataset>(baseDataset);
const [timeFields, setTimeFields] = useState<DatasetField[]>([]);

Check warning on line 44 in src/plugins/data/public/ui/dataset_selector/configurator.tsx

Codecov / codecov/patch

src/plugins/data/public/ui/dataset_selector/configurator.tsx#L44

Added line #L44 was not covered by tests
const [timeFieldName, setTimeFieldName] = useState<string | undefined>(dataset.timeFieldName);
sejli marked this conversation as resolved.
Show resolved Hide resolved
const noTimeFilter = "I don't want to use the time filter";
const noTimeFilter = i18n.translate(

Check warning on line 46 in src/plugins/data/public/ui/dataset_selector/configurator.tsx

Codecov / codecov/patch

src/plugins/data/public/ui/dataset_selector/configurator.tsx#L46

Added line #L46 was not covered by tests
'data.explorer.datasetSelector.advancedSelector.configurator.timeField.noTimeFieldOptionLabel',
{
defaultMessage: "I don't want to use the time filter",
}
);
const [language, setLanguage] = useState<string>(() => {
const currentLanguage = queryString.getQuery().language;
if (languages.includes(currentLanguage)) {
@@ -52,8 +57,8 @@
return languages[0];
});

const submitDisabled = useMemo(() => {
return (

Check warning on line 61 in src/plugins/data/public/ui/dataset_selector/configurator.tsx

Codecov / codecov/patch

src/plugins/data/public/ui/dataset_selector/configurator.tsx#L60-L61

Added lines #L60 - L61 were not covered by tests
timeFieldName === undefined &&
!(
languageService.getLanguage(language)?.hideDatePicker ||
@@ -153,7 +158,7 @@
>
<EuiSelect
options={[
...timeFields.map((field) => ({

Check warning on line 161 in src/plugins/data/public/ui/dataset_selector/configurator.tsx

Codecov / codecov/patch

src/plugins/data/public/ui/dataset_selector/configurator.tsx#L161

Added line #L161 was not covered by tests
text: field.displayName || field.name,
value: field.name,
})),
@@ -163,8 +168,8 @@
value={timeFieldName}
onChange={(e) => {
const value = e.target.value === noTimeFilter ? undefined : e.target.value;
setTimeFieldName(e.target.value);
setDataset({ ...dataset, timeFieldName: value });

Check warning on line 172 in src/plugins/data/public/ui/dataset_selector/configurator.tsx

Codecov / codecov/patch

src/plugins/data/public/ui/dataset_selector/configurator.tsx#L171-L172

Added lines #L171 - L172 were not covered by tests
}}
hasNoInitialSelection
/>