Skip to content

Commit

Permalink
sorting fields in dropdowns
Browse files Browse the repository at this point in the history
  • Loading branch information
jgowdyelastic committed May 26, 2022
1 parent 4966b58 commit c69a52d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
Expand Up @@ -27,7 +27,7 @@ interface JobMessagesProps {
messages: JobMessage[];
loading: boolean;
error: string;
refreshMessage?: React.MouseEventHandler<HTMLButtonElement>;
refreshMessage?: () => Promise<void>;
actionHandler?: (message: JobMessage) => void;
}

Expand All @@ -51,7 +51,7 @@ export const JobMessages: FC<JobMessagesProps> = ({
})}
>
<EuiButtonIcon
onClick={refreshMessage}
onClick={() => refreshMessage()}
iconType="refresh"
aria-label={i18n.translate('xpack.ml.jobMessages.refreshAriaLabel', {
defaultMessage: 'Refresh',
Expand Down
Expand Up @@ -25,7 +25,10 @@ export const ByFieldSelector: FC<Props> = ({ detectorIndex }) => {

const runtimeCategoryFields = useMemo(() => filterCategoryFields(jobCreator.runtimeFields), []);
const allCategoryFields = useMemo(
() => [...newJobCapsService.categoryFields, ...runtimeCategoryFields],
() =>
[...newJobCapsService.categoryFields, ...runtimeCategoryFields].sort((a, b) =>
a.name.localeCompare(b.name)
),
[]
);

Expand Down
Expand Up @@ -25,7 +25,10 @@ export const PopulationFieldSelector: FC = () => {

const runtimeCategoryFields = useMemo(() => filterCategoryFields(jobCreator.runtimeFields), []);
const allCategoryFields = useMemo(
() => [...newJobCapsService.categoryFields, ...runtimeCategoryFields],
() =>
[...newJobCapsService.categoryFields, ...runtimeCategoryFields].sort((a, b) =>
a.name.localeCompare(b.name)
),
[]
);
const categoryFields = useFilteredCategoryFields(
Expand Down
Expand Up @@ -21,7 +21,10 @@ export const RareFieldSelector: FC = () => {

const runtimeCategoryFields = useMemo(() => filterCategoryFields(jobCreator.runtimeFields), []);
const allCategoryFields = useMemo(
() => [...newJobCapsService.categoryFields, ...runtimeCategoryFields],
() =>
[...newJobCapsService.categoryFields, ...runtimeCategoryFields].sort((a, b) =>
a.name.localeCompare(b.name)
),
[]
);
const categoryFields = useFilteredCategoryFields(
Expand Down
Expand Up @@ -25,7 +25,10 @@ export const SplitFieldSelector: FC = () => {

const runtimeCategoryFields = useMemo(() => filterCategoryFields(jobCreator.runtimeFields), []);
const allCategoryFields = useMemo(
() => [...newJobCapsService.categoryFields, ...runtimeCategoryFields],
() =>
[...newJobCapsService.categoryFields, ...runtimeCategoryFields].sort((a, b) =>
a.name.localeCompare(b.name)
),
[]
);
const categoryFields = useFilteredCategoryFields(
Expand Down

0 comments on commit c69a52d

Please sign in to comment.