From e4c6ca02e4dd21e7129a5e1cffc66cbf443a2be0 Mon Sep 17 00:00:00 2001 From: Chaim Lev-Ari Date: Wed, 12 Jun 2024 15:12:10 +0300 Subject: [PATCH] fix(env): strip protocol from url --- .../environments/ItemView/UpdateForm/AgentForm/AgentForm.tsx | 3 ++- .../environments/ItemView/UpdateForm/AzureForm/AzureForm.tsx | 5 ++++- .../ItemView/UpdateForm/OtherTypesForm/OtherTypesForm.tsx | 3 ++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/react/portainer/environments/ItemView/UpdateForm/AgentForm/AgentForm.tsx b/app/react/portainer/environments/ItemView/UpdateForm/AgentForm/AgentForm.tsx index febb27eaa..164bfcb7b 100644 --- a/app/react/portainer/environments/ItemView/UpdateForm/AgentForm/AgentForm.tsx +++ b/app/react/portainer/environments/ItemView/UpdateForm/AgentForm/AgentForm.tsx @@ -3,6 +3,7 @@ import { Form, Formik } from 'formik'; import { Environment } from '@/react/portainer/environments/types'; import { MetadataFieldset } from '@/react/portainer/environments/common/MetadataFieldset'; import { NameField } from '@/react/portainer/environments/common/NameField'; +import { stripProtocol } from '@/portainer/filters/filters'; import { FormSection } from '@@/form-components/FormSection'; @@ -27,7 +28,7 @@ export function AgentForm({ const initialValues: FormValues = { name: environment.Name, - url: environment.URL, + url: stripProtocol(environment.URL), publicUrl: environment.PublicURL || '', meta: { diff --git a/app/react/portainer/environments/ItemView/UpdateForm/AzureForm/AzureForm.tsx b/app/react/portainer/environments/ItemView/UpdateForm/AzureForm/AzureForm.tsx index b1e9c35f7..cc04789b9 100644 --- a/app/react/portainer/environments/ItemView/UpdateForm/AzureForm/AzureForm.tsx +++ b/app/react/portainer/environments/ItemView/UpdateForm/AzureForm/AzureForm.tsx @@ -3,6 +3,7 @@ import { Form, Formik } from 'formik'; import { NameField } from '@/react/portainer/environments/common/NameField'; import { MetadataFieldset } from '@/react/portainer/environments/common/MetadataFieldset'; import { Environment } from '@/react/portainer/environments/types'; +import { stripProtocol } from '@/portainer/filters/filters'; import { FormSection } from '@@/form-components/FormSection'; @@ -37,13 +38,15 @@ export function AzureForm({ authKey: environment.AzureCredentials?.AuthenticationKey || '', }; + const url = stripProtocol(environment.URL); + return ( {({ isValid }) => (
- + diff --git a/app/react/portainer/environments/ItemView/UpdateForm/OtherTypesForm/OtherTypesForm.tsx b/app/react/portainer/environments/ItemView/UpdateForm/OtherTypesForm/OtherTypesForm.tsx index 2606eee3b..fa9d00f17 100644 --- a/app/react/portainer/environments/ItemView/UpdateForm/OtherTypesForm/OtherTypesForm.tsx +++ b/app/react/portainer/environments/ItemView/UpdateForm/OtherTypesForm/OtherTypesForm.tsx @@ -7,6 +7,7 @@ import { isLocalEnvironment, } from '@/react/portainer/environments/utils'; import { MetadataFieldset } from '@/react/portainer/environments/common/MetadataFieldset'; +import { stripProtocol } from '@/portainer/filters/filters'; import { TLSFieldset } from '@@/TLSFieldset'; import { FormSection } from '@@/form-components/FormSection'; @@ -39,7 +40,7 @@ export function OtherTypesForm({ const initialValues: FormValues = { name: environment.Name, - url: environment.URL, + url: stripProtocol(environment.URL), publicUrl: environment.PublicURL || '', tlsConfig: {