1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-22 06:49:40 +02:00

refactor(app): migrate remaining form sections [EE-6231] (#10938)
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux]) (push) Waiting to run
ci / build_manifests (push) Blocked by required conditions
/ triage (push) Waiting to run
Lint / Run linters (push) Waiting to run
Test / test-client (push) Waiting to run
Test / test-server (map[arch:amd64 platform:linux]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Waiting to run
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Waiting to run
Test / test-server (map[arch:arm64 platform:linux]) (push) Waiting to run

This commit is contained in:
Ali 2024-01-11 15:13:28 +13:00 committed by GitHub
parent 0b9cebc685
commit 4e7d1c7088
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
18 changed files with 456 additions and 284 deletions

View file

@ -1,15 +1,31 @@
import { useMemo } from 'react';
import { useCurrentUser } from '@/react/hooks/useUser';
import { InsightsBox } from '@@/InsightsBox';
import { Link } from '@@/Link';
import { TextTip } from '@@/Tip/TextTip';
import { Tooltip } from '@@/Tip/Tooltip';
import { AutocompleteSelect } from '@@/form-components/AutocompleteSelect';
type Props = {
stackName: string;
setStackName: (name: string) => void;
isAdmin?: boolean;
stacks?: string[];
inputClassName?: string;
};
export function StackName({ stackName, setStackName, isAdmin = false }: Props) {
export function StackName({
stackName,
setStackName,
stacks = [],
inputClassName,
}: Props) {
const { isAdmin } = useCurrentUser();
const stackResults = useMemo(
() => stacks.filter((stack) => stack.includes(stackName ?? '')),
[stacks, stackName]
);
const tooltip = (
<>
You may specify a stack name to label resources that you want to group.
@ -68,14 +84,16 @@ export function StackName({ stackName, setStackName, isAdmin = false }: Props) {
Stack
<Tooltip message={tooltip} setHtmlMessage />
</label>
<div className="col-sm-8">
<input
type="text"
className="form-control"
defaultValue={stackName}
onChange={(e) => setStackName(e.target.value)}
id="stack_name"
placeholder="myStack"
<div className={inputClassName || 'col-sm-8'}>
<AutocompleteSelect
searchResults={stackResults?.map((result) => ({
value: result,
label: result,
}))}
value={stackName ?? ''}
onChange={setStackName}
placeholder="e.g. myStack"
inputId="stack_name"
/>
</div>
</div>