mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 05:19:39 +02:00
feat(edge): associate edge env to meta fields [EE-3209] (#8551)
* refactor(edge/groups): load edge groups in selector fix(edge/stacks): remove double groups title * feat(edge): supply meta fields to edge script [EE-5043] * feat(edge): auto assign aeec envs to groups and tags [EE-5043] fix [EE-5043] fix(envs): fix global key test * fix(edge/groups): save group type * refactor(edge/devices): move loading of devices to table * refactor(tags): select paramter for query * feat(edge/devices): show meta fields * refactor(home): simplify filter * feat(edge/devices): filter by meta fields * refactor(edge/devices): break filter and loading hook
This commit is contained in:
parent
03712966e4
commit
70710cfeb7
32 changed files with 554 additions and 263 deletions
|
@ -1,4 +1,8 @@
|
|||
import { OptionsOrGroups } from 'react-select';
|
||||
import {
|
||||
GroupBase,
|
||||
OptionsOrGroups,
|
||||
SelectComponentsConfig,
|
||||
} from 'react-select';
|
||||
import _ from 'lodash';
|
||||
|
||||
import { AutomationTestingProps } from '@/types';
|
||||
|
@ -10,9 +14,10 @@ export interface Option<TValue> {
|
|||
label: string;
|
||||
}
|
||||
|
||||
type Group<TValue> = { label: string; options: Option<TValue>[] };
|
||||
|
||||
type Options<TValue> = OptionsOrGroups<Option<TValue>, Group<TValue>>;
|
||||
type Options<TValue> = OptionsOrGroups<
|
||||
Option<TValue>,
|
||||
GroupBase<Option<TValue>>
|
||||
>;
|
||||
|
||||
interface SharedProps extends AutomationTestingProps {
|
||||
name?: string;
|
||||
|
@ -28,6 +33,11 @@ interface MultiProps<TValue> extends SharedProps {
|
|||
onChange(value: readonly TValue[]): void;
|
||||
options: Options<TValue>;
|
||||
isMulti: true;
|
||||
components?: SelectComponentsConfig<
|
||||
Option<TValue>,
|
||||
true,
|
||||
GroupBase<Option<TValue>>
|
||||
>;
|
||||
}
|
||||
|
||||
interface SingleProps<TValue> extends SharedProps {
|
||||
|
@ -35,6 +45,11 @@ interface SingleProps<TValue> extends SharedProps {
|
|||
onChange(value: TValue | null): void;
|
||||
options: Options<TValue>;
|
||||
isMulti?: never;
|
||||
components?: SelectComponentsConfig<
|
||||
Option<TValue>,
|
||||
false,
|
||||
GroupBase<Option<TValue>>
|
||||
>;
|
||||
}
|
||||
|
||||
type Props<TValue> = MultiProps<TValue> | SingleProps<TValue>;
|
||||
|
@ -66,6 +81,7 @@ export function SingleSelect<TValue = string>({
|
|||
placeholder,
|
||||
isClearable,
|
||||
bindToBody,
|
||||
components,
|
||||
}: SingleProps<TValue>) {
|
||||
const selectedValue =
|
||||
value || (typeof value === 'number' && value === 0)
|
||||
|
@ -86,6 +102,7 @@ export function SingleSelect<TValue = string>({
|
|||
placeholder={placeholder}
|
||||
isDisabled={disabled}
|
||||
menuPortalTarget={bindToBody ? document.body : undefined}
|
||||
components={components}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
@ -124,6 +141,7 @@ export function MultiSelect<TValue = string>({
|
|||
disabled,
|
||||
isClearable,
|
||||
bindToBody,
|
||||
components,
|
||||
}: Omit<MultiProps<TValue>, 'isMulti'>) {
|
||||
const selectedOptions = findSelectedOptions(options, value);
|
||||
return (
|
||||
|
@ -142,12 +160,13 @@ export function MultiSelect<TValue = string>({
|
|||
placeholder={placeholder}
|
||||
isDisabled={disabled}
|
||||
menuPortalTarget={bindToBody ? document.body : undefined}
|
||||
components={components}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
||||
function isGroup<TValue>(
|
||||
option: Option<TValue> | Group<TValue>
|
||||
): option is Group<TValue> {
|
||||
option: Option<TValue> | GroupBase<Option<TValue>>
|
||||
): option is GroupBase<Option<TValue>> {
|
||||
return 'options' in option;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue