mirror of
https://github.com/portainer/portainer.git
synced 2025-07-23 15:29:42 +02:00
fix(edge/aeec): make edge id generator field mandatory EE-6010 (#10545)
This commit is contained in:
parent
9e60723e4d
commit
f10356641a
4 changed files with 15 additions and 3 deletions
|
@ -19,6 +19,7 @@ const edgePropertiesFormInitialValues: ScriptFormValues = {
|
||||||
edgeGroupsIds: [],
|
edgeGroupsIds: [],
|
||||||
group: 0,
|
group: 0,
|
||||||
tagsIds: [],
|
tagsIds: [],
|
||||||
|
edgeIdGenerator: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -45,6 +46,7 @@ export function EdgeScriptForm({
|
||||||
initialValues={edgePropertiesFormInitialValues}
|
initialValues={edgePropertiesFormInitialValues}
|
||||||
validationSchema={() => validationSchema(isNomadTokenVisible)}
|
validationSchema={() => validationSchema(isNomadTokenVisible)}
|
||||||
onSubmit={() => {}}
|
onSubmit={() => {}}
|
||||||
|
validateOnMount
|
||||||
>
|
>
|
||||||
{({ values, setFieldValue }) => (
|
{({ values, setFieldValue }) => (
|
||||||
<>
|
<>
|
||||||
|
|
|
@ -6,6 +6,13 @@ export function validationSchema(isNomadTokenVisible?: boolean) {
|
||||||
return object().shape({
|
return object().shape({
|
||||||
allowSelfSignedCertificates: boolean(),
|
allowSelfSignedCertificates: boolean(),
|
||||||
envVars: string(),
|
envVars: string(),
|
||||||
|
edgeIdGenerator: string()
|
||||||
|
.required('Edge ID Generator is required')
|
||||||
|
.test(
|
||||||
|
'valid edge id generator',
|
||||||
|
'edge id generator cannot be empty',
|
||||||
|
(value) => !!(value && value.length)
|
||||||
|
),
|
||||||
...nomadValidation(isNomadTokenVisible),
|
...nomadValidation(isNomadTokenVisible),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,8 @@ export function EdgeScriptSettingsFieldset({
|
||||||
hideIdGetter,
|
hideIdGetter,
|
||||||
showMetaFields,
|
showMetaFields,
|
||||||
}: Props) {
|
}: Props) {
|
||||||
const { values, setFieldValue } = useFormikContext<ScriptFormValues>();
|
const { values, setFieldValue, errors } =
|
||||||
|
useFormikContext<ScriptFormValues>();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
@ -50,8 +51,10 @@ export function EdgeScriptSettingsFieldset({
|
||||||
<>
|
<>
|
||||||
<FormControl
|
<FormControl
|
||||||
label="Edge ID Generator"
|
label="Edge ID Generator"
|
||||||
tooltip="A bash script one liner that will generate the edge id and will be assigned to the PORTAINER_EDGE_ID environment variable"
|
tooltip="Enter a single-line bash command that generates a unique Edge ID. For example, you can use 'uuidgen' or 'uuid'. The result will be assigned to the 'PORTAINER_EDGE_ID' environment variable."
|
||||||
inputId="edge-id-generator-input"
|
inputId="edge-id-generator-input"
|
||||||
|
required
|
||||||
|
errors={errors.edgeIdGenerator}
|
||||||
>
|
>
|
||||||
<Input
|
<Input
|
||||||
type="text"
|
type="text"
|
||||||
|
|
|
@ -17,7 +17,7 @@ export interface ScriptFormValues {
|
||||||
os: OS;
|
os: OS;
|
||||||
platform: Platform;
|
platform: Platform;
|
||||||
|
|
||||||
edgeIdGenerator?: string;
|
edgeIdGenerator: string;
|
||||||
|
|
||||||
group: EnvironmentGroupId;
|
group: EnvironmentGroupId;
|
||||||
edgeGroupsIds: Array<EdgeGroup['Id']>;
|
edgeGroupsIds: Array<EdgeGroup['Id']>;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue