mirror of
https://github.com/portainer/portainer.git
synced 2025-08-09 07:45:22 +02:00
refactor(azure): migrate module to react [EE-2782] (#6689)
* refactor(azure): migrate module to react [EE-2782] * fix(azure): remove optional chain * feat(azure): apply new icons in dashboard * feat(azure): apply new icons in dashboard * feat(ui): allow single string for breadcrumbs * refactor(azure/containers): use Table.content * feat(azure/containers): implement new ui [EE-3538] * fix(azure/containers): use correct icon * chore(tests): mock svg as component * fix(azure): fix tests Co-authored-by: matias.spinarolli <matias.spinarolli@portainer.io>
This commit is contained in:
parent
b059641c80
commit
82b848af0c
97 changed files with 1723 additions and 1430 deletions
|
@ -1,10 +1,9 @@
|
|||
import { FormikErrors } from 'formik';
|
||||
|
||||
import { FormError } from '@@/form-components/FormError';
|
||||
import { Input } from '@@/form-components/Input';
|
||||
import { InputList } from '@@/form-components/InputList';
|
||||
import {
|
||||
InputListError,
|
||||
ItemProps,
|
||||
} from '@@/form-components/InputList/InputList';
|
||||
import { ItemProps } from '@@/form-components/InputList/InputList';
|
||||
|
||||
export interface VariableDefinition {
|
||||
name: string;
|
||||
|
@ -16,7 +15,7 @@ export interface VariableDefinition {
|
|||
interface Props {
|
||||
value: VariableDefinition[];
|
||||
onChange: (value: VariableDefinition[]) => void;
|
||||
errors?: InputListError<VariableDefinition>[] | string;
|
||||
errors?: FormikErrors<VariableDefinition>[];
|
||||
isVariablesNamesFromParent?: boolean;
|
||||
}
|
||||
|
||||
|
@ -57,6 +56,8 @@ interface DefinitionItemProps extends ItemProps<VariableDefinition> {
|
|||
}
|
||||
|
||||
function Item({ item, onChange, error, isNameReadonly }: DefinitionItemProps) {
|
||||
const errorObj = typeof error === 'object' ? error : {};
|
||||
|
||||
return (
|
||||
<div className="flex gap-2">
|
||||
<div>
|
||||
|
@ -67,7 +68,7 @@ function Item({ item, onChange, error, isNameReadonly }: DefinitionItemProps) {
|
|||
placeholder="Name (e.g var_name)"
|
||||
readOnly={isNameReadonly}
|
||||
/>
|
||||
{error?.name && <FormError>{error.name}</FormError>}
|
||||
{errorObj?.name && <FormError>{errorObj.name}</FormError>}
|
||||
</div>
|
||||
<div>
|
||||
<Input
|
||||
|
@ -76,7 +77,7 @@ function Item({ item, onChange, error, isNameReadonly }: DefinitionItemProps) {
|
|||
placeholder="Label"
|
||||
name="label"
|
||||
/>
|
||||
{error?.label && <FormError>{error.label}</FormError>}
|
||||
{errorObj?.label && <FormError>{errorObj.label}</FormError>}
|
||||
</div>
|
||||
<div>
|
||||
<Input
|
||||
|
@ -85,7 +86,7 @@ function Item({ item, onChange, error, isNameReadonly }: DefinitionItemProps) {
|
|||
onChange={handleChange}
|
||||
placeholder="Description"
|
||||
/>
|
||||
{error?.description && <FormError>{error.description}</FormError>}
|
||||
{errorObj?.description && <FormError>{errorObj.description}</FormError>}
|
||||
</div>
|
||||
<div>
|
||||
<Input
|
||||
|
@ -94,7 +95,9 @@ function Item({ item, onChange, error, isNameReadonly }: DefinitionItemProps) {
|
|||
placeholder="Default Value"
|
||||
name="defaultValue"
|
||||
/>
|
||||
{error?.defaultValue && <FormError>{error.defaultValue}</FormError>}
|
||||
{errorObj?.defaultValue && (
|
||||
<FormError>{errorObj.defaultValue}</FormError>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue