mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 15:59:41 +02:00
refactor(edge/stacks): migrate create view to react [EE-2223] (#11575)
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux version:]) (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:arm platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:s390x platform:linux version:]) (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
Some checks are pending
ci / build_images (map[arch:amd64 platform:linux version:]) (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:arm platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Waiting to run
ci / build_images (map[arch:s390x platform:linux version:]) (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:
parent
f22aed34b5
commit
8a81d95253
64 changed files with 1878 additions and 1005 deletions
|
@ -6,6 +6,7 @@ test('render should include description', async () => {
|
|||
const onClick = vi.fn();
|
||||
const { findByText } = render(
|
||||
<FileUploadForm
|
||||
value={undefined}
|
||||
title="test button"
|
||||
onChange={onClick}
|
||||
description={<span>test description</span>}
|
||||
|
|
|
@ -6,8 +6,8 @@ import { FormSectionTitle } from '@@/form-components/FormSectionTitle';
|
|||
import { FileUploadField } from '@@/form-components/FileUpload/FileUploadField';
|
||||
|
||||
export interface Props {
|
||||
onChange(value: unknown): void;
|
||||
value?: File;
|
||||
onChange(value?: File): void;
|
||||
value: File | undefined;
|
||||
title?: string;
|
||||
required?: boolean;
|
||||
description: ReactNode;
|
||||
|
|
|
@ -12,6 +12,7 @@ interface Props {
|
|||
defaultFolded?: boolean;
|
||||
titleClassName?: string;
|
||||
className?: string;
|
||||
htmlFor?: string;
|
||||
}
|
||||
|
||||
export function FormSection({
|
||||
|
@ -22,13 +23,14 @@ export function FormSection({
|
|||
defaultFolded = isFoldable,
|
||||
titleClassName,
|
||||
className,
|
||||
htmlFor = '',
|
||||
}: PropsWithChildren<Props>) {
|
||||
const [isExpanded, setIsExpanded] = useState(!defaultFolded);
|
||||
|
||||
return (
|
||||
<div className={className}>
|
||||
<FormSectionTitle
|
||||
htmlFor={isFoldable ? `foldingButton${title}` : ''}
|
||||
htmlFor={isFoldable ? `foldingButton${title}` : htmlFor}
|
||||
titleSize={titleSize}
|
||||
className={titleClassName}
|
||||
>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import clsx from 'clsx';
|
||||
import uuid from 'uuid';
|
||||
import { ComponentProps, PropsWithChildren, ReactNode } from 'react';
|
||||
import { ComponentProps, PropsWithChildren, ReactNode, useState } from 'react';
|
||||
|
||||
import { FeatureId } from '@/react/portainer/feature-flags/enums';
|
||||
import { AutomationTestingProps } from '@/types';
|
||||
|
@ -33,7 +33,7 @@ export function SwitchField({
|
|||
checked,
|
||||
label,
|
||||
index,
|
||||
name = uuid(),
|
||||
name,
|
||||
labelClass,
|
||||
fieldClass,
|
||||
'data-cy': dataCy,
|
||||
|
@ -44,13 +44,14 @@ export function SwitchField({
|
|||
setTooltipHtmlMessage,
|
||||
valueExplanation,
|
||||
}: PropsWithChildren<Props>) {
|
||||
const [toggleId] = useState(() => `toggle_${uuid()}`);
|
||||
const toggleName = name ? `toggle_${name}` : '';
|
||||
|
||||
return (
|
||||
<div className={clsx(styles.root, fieldClass)}>
|
||||
<label
|
||||
className={clsx('space-right control-label !p-0 text-left', labelClass)}
|
||||
htmlFor={toggleName}
|
||||
htmlFor={toggleId}
|
||||
>
|
||||
{label}
|
||||
{tooltip && (
|
||||
|
@ -60,7 +61,7 @@ export function SwitchField({
|
|||
<Switch
|
||||
className={clsx('space-right', switchClass)}
|
||||
name={toggleName}
|
||||
id={toggleName}
|
||||
id={toggleId}
|
||||
checked={checked}
|
||||
disabled={disabled}
|
||||
onChange={onChange}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue