-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update subnet tab selection to 'group by' selection (#5225)
- Loading branch information
1 parent
5b65761
commit 102e49d
Showing
9 changed files
with
85 additions
and
62 deletions.
There are no files selected for viewing
2 changes: 2 additions & 0 deletions
2
...Controls/GroupSelect/GroupSelect.test.tsx → ...mponents/GroupSelect/GroupSelect.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Select } from "@canonical/react-components"; | ||
import classNames from "classnames"; | ||
|
||
type Props<T> = { | ||
className?: string; | ||
grouping: T | null; | ||
groupOptions: { value: T | string; label: string }[]; | ||
name?: string; | ||
setGrouping: (group: T | null) => void; | ||
setHiddenGroups?: (groups: string[]) => void; | ||
}; | ||
|
||
const GroupSelect = <T extends string>({ | ||
grouping, | ||
setGrouping, | ||
setHiddenGroups, | ||
groupOptions, | ||
name, | ||
className, | ||
}: Props<T>): JSX.Element => { | ||
return ( | ||
<Select | ||
aria-label="Group by" | ||
className={classNames("u-no-padding--right", className)} | ||
defaultValue={grouping ?? ""} | ||
name={name || "machine-groupings"} | ||
onChange={(e: React.ChangeEvent<HTMLSelectElement>) => { | ||
setGrouping((e.target.value as T) ?? null); | ||
setHiddenGroups && setHiddenGroups([]); | ||
}} | ||
options={groupOptions} | ||
/> | ||
); | ||
}; | ||
|
||
export default GroupSelect; |
File renamed without changes.
32 changes: 0 additions & 32 deletions
32
src/app/machines/views/MachineList/MachineListControls/GroupSelect/GroupSelect.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters