mirror of
https://github.com/portainer/portainer.git
synced 2025-07-25 00:09:40 +02:00
refactor(edge): move edge codebase to react (#7781)
This commit is contained in:
parent
75f40fe485
commit
1e4c4e2616
54 changed files with 254 additions and 187 deletions
|
@ -1,35 +0,0 @@
|
|||
import _ from 'lodash';
|
||||
|
||||
import { Select } from '@@/form-components/ReactSelect';
|
||||
|
||||
import { EdgeGroup } from '../edge-groups/types';
|
||||
|
||||
type SingleValue = EdgeGroup['Id'];
|
||||
|
||||
interface Props {
|
||||
items: EdgeGroup[];
|
||||
value: SingleValue[];
|
||||
onChange: (value: SingleValue[]) => void;
|
||||
}
|
||||
|
||||
export function EdgeGroupsSelector({ items, value, onChange }: Props) {
|
||||
const valueGroups = _.compact(
|
||||
value.map((id) => items.find((item) => item.Id === id))
|
||||
);
|
||||
|
||||
return (
|
||||
<Select
|
||||
aria-label="Edge groups"
|
||||
options={items}
|
||||
isMulti
|
||||
getOptionLabel={(item) => item.Name}
|
||||
getOptionValue={(item) => String(item.Id)}
|
||||
value={valueGroups}
|
||||
onChange={(value) => {
|
||||
onChange(value.map((item) => item.Id));
|
||||
}}
|
||||
placeholder="Select one or multiple group(s)"
|
||||
closeMenuOnSelect={false}
|
||||
/>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue