diff --git a/app/portainer/views/users/edit/userController.js b/app/portainer/views/users/edit/userController.js index 65a0dae44..7205713f4 100644 --- a/app/portainer/views/users/edit/userController.js +++ b/app/portainer/views/users/edit/userController.js @@ -123,7 +123,7 @@ angular.module('portainer.app').controller('UserController', [ $scope.formValues.Administrator = user.Role === 1; $scope.formValues.username = user.Username; $scope.AuthenticationMethod = data.settings.AuthenticationMethod; - $scope.requiredPasswordLength = data.settings.InternalAuthSettings.RequiredPasswordLength; + $scope.requiredPasswordLength = data.settings.RequiredPasswordLength; }) .catch(function error(err) { Notifications.error('Failure', err, 'Unable to retrieve user information'); diff --git a/app/portainer/views/users/usersController.js b/app/portainer/views/users/usersController.js index 0265aa5de..173da8dfd 100644 --- a/app/portainer/views/users/usersController.js +++ b/app/portainer/views/users/usersController.js @@ -121,7 +121,7 @@ angular.module('portainer.app').controller('UsersController', [ users = assignAuthMethod(users, $scope.AuthenticationMethod); $scope.users = users; $scope.teams = _.orderBy(data.teams, 'Name', 'asc'); - $scope.requiredPasswordLength = data.settings.InternalAuthSettings.RequiredPasswordLength; + $scope.requiredPasswordLength = data.settings.RequiredPasswordLength; $scope.teamSync = data.settings.TeamSync; }) .catch(function error(err) { diff --git a/app/react/portainer/environments/EdgeAutoCreateScriptView/AutomaticEdgeEnvCreation/AutomaticEdgeEnvCreation.tsx b/app/react/portainer/environments/EdgeAutoCreateScriptView/AutomaticEdgeEnvCreation/AutomaticEdgeEnvCreation.tsx index 2671cf6a9..61946d9b0 100644 --- a/app/react/portainer/environments/EdgeAutoCreateScriptView/AutomaticEdgeEnvCreation/AutomaticEdgeEnvCreation.tsx +++ b/app/react/portainer/environments/EdgeAutoCreateScriptView/AutomaticEdgeEnvCreation/AutomaticEdgeEnvCreation.tsx @@ -99,7 +99,7 @@ export function AutomaticEdgeEnvCreation() { edgeKey={edgeKey} isLoading={edgeKeyMutation.isLoading} url={url} - tunnelUrl={settings?.Edge.TunnelServerAddress} + tunnelUrl={settings?.Edge?.TunnelServerAddress || ''} /> )} @@ -116,7 +116,7 @@ export function AutomaticEdgeEnvCreation() { settings && settings.EnableEdgeComputeFeatures && settings.EdgePortainerUrl && - settings.Edge.TunnelServerAddress + settings.Edge?.TunnelServerAddress ); } } diff --git a/app/react/portainer/environments/wizard/EnvironmentsCreationView/shared/EdgeAgentTab/EdgeAgentForm/EdgeAgentForm.tsx b/app/react/portainer/environments/wizard/EnvironmentsCreationView/shared/EdgeAgentTab/EdgeAgentForm/EdgeAgentForm.tsx index 9b4e89330..1f793a526 100644 --- a/app/react/portainer/environments/wizard/EnvironmentsCreationView/shared/EdgeAgentTab/EdgeAgentForm/EdgeAgentForm.tsx +++ b/app/react/portainer/environments/wizard/EnvironmentsCreationView/shared/EdgeAgentTab/EdgeAgentForm/EdgeAgentForm.tsx @@ -115,7 +115,7 @@ export function buildInitialValues(settings: Settings): FormValues { name: '', portainerUrl: settings.EdgePortainerUrl || buildApiUrlDefaultValue(), tunnelServerAddr: - settings.Edge.TunnelServerAddress || buildTunnelDefaultValue(), + settings.Edge?.TunnelServerAddress || buildTunnelDefaultValue(), pollFrequency: 0, meta: { groupId: 1, diff --git a/app/react/portainer/settings/AuthenticationView/InternalAuth/InternalAuth.tsx b/app/react/portainer/settings/AuthenticationView/InternalAuth/InternalAuth.tsx index 8d0500e98..fac7e0b09 100644 --- a/app/react/portainer/settings/AuthenticationView/InternalAuth/InternalAuth.tsx +++ b/app/react/portainer/settings/AuthenticationView/InternalAuth/InternalAuth.tsx @@ -1,4 +1,4 @@ -import { Settings } from '@/react/portainer/settings/types'; +import { InternalAuthSettings } from '@/react/portainer/settings/types'; import { confirmDestructive } from '@@/modals/confirm'; import { FormSectionTitle } from '@@/form-components/FormSectionTitle'; @@ -10,7 +10,7 @@ import { SaveAuthSettingsButton } from './SaveAuthSettingsButton'; export interface Props { onSaveSettings(): void; isLoading: boolean; - value: Settings['InternalAuthSettings']; + value: InternalAuthSettings; onChange(value: number): void; } diff --git a/app/react/portainer/settings/EdgeComputeView/DeploymentSyncOptions/DeploymentSyncOptions.tsx b/app/react/portainer/settings/EdgeComputeView/DeploymentSyncOptions/DeploymentSyncOptions.tsx index 2951d435e..b1330215c 100644 --- a/app/react/portainer/settings/EdgeComputeView/DeploymentSyncOptions/DeploymentSyncOptions.tsx +++ b/app/react/portainer/settings/EdgeComputeView/DeploymentSyncOptions/DeploymentSyncOptions.tsx @@ -44,9 +44,9 @@ export function DeploymentSyncOptions() { const initialValues: FormValues = { Edge: { - CommandInterval: settingsQuery.data.Edge.CommandInterval, - PingInterval: settingsQuery.data.Edge.PingInterval, - SnapshotInterval: settingsQuery.data.Edge.SnapshotInterval, + CommandInterval: settingsQuery.data.Edge?.CommandInterval || 0, + PingInterval: settingsQuery.data.Edge?.PingInterval || 0, + SnapshotInterval: settingsQuery.data.Edge?.SnapshotInterval || 0, }, EdgeAgentCheckinInterval: settingsQuery.data.EdgeAgentCheckinInterval, }; diff --git a/app/react/portainer/settings/EdgeComputeView/EdgeComputeSettings/EdgeComputeSettings.tsx b/app/react/portainer/settings/EdgeComputeView/EdgeComputeSettings/EdgeComputeSettings.tsx index c999b6a1b..637f2f678 100644 --- a/app/react/portainer/settings/EdgeComputeView/EdgeComputeSettings/EdgeComputeSettings.tsx +++ b/app/react/portainer/settings/EdgeComputeView/EdgeComputeSettings/EdgeComputeSettings.tsx @@ -29,7 +29,7 @@ export function EdgeComputeSettings({ settings, onSubmit }: Props) { EnableEdgeComputeFeatures: settings.EnableEdgeComputeFeatures, EdgePortainerUrl: settings.EdgePortainerUrl, Edge: { - TunnelServerAddress: settings.Edge?.TunnelServerAddress, + TunnelServerAddress: settings.Edge?.TunnelServerAddress || '', }, EnforceEdgeID: settings.EnforceEdgeID, }; diff --git a/app/react/portainer/settings/EdgeComputeView/EdgeComputeSettingsView.tsx b/app/react/portainer/settings/EdgeComputeView/EdgeComputeSettingsView.tsx index ba10c9cf9..af35df4bf 100644 --- a/app/react/portainer/settings/EdgeComputeView/EdgeComputeSettingsView.tsx +++ b/app/react/portainer/settings/EdgeComputeView/EdgeComputeSettingsView.tsx @@ -5,10 +5,11 @@ import { isBE } from '../../feature-flags/feature-flags.service'; import { EdgeComputeSettings } from './EdgeComputeSettings'; import { DeploymentSyncOptions } from './DeploymentSyncOptions/DeploymentSyncOptions'; import { AutomaticEdgeEnvCreation } from './AutomaticEdgeEnvCreation'; +import { FormValues } from './EdgeComputeSettings/types'; interface Props { settings: Settings; - onSubmit(values: Settings): void; + onSubmit(values: FormValues): void; } export function EdgeComputeSettingsView({ settings, onSubmit }: Props) { diff --git a/app/react/portainer/settings/queries/useSettings.ts b/app/react/portainer/settings/queries/useSettings.ts index 2ba089a65..467998d76 100644 --- a/app/react/portainer/settings/queries/useSettings.ts +++ b/app/react/portainer/settings/queries/useSettings.ts @@ -40,7 +40,7 @@ interface AuthenticatedResponse extends PublicSettingsResponse { } interface EdgeAdminResponse extends AuthenticatedResponse { - Edge: EdgeSettings; + Edge?: EdgeSettings; /** TrustOnFirstConnect makes Portainer accepting edge agent connection by default */ TrustOnFirstConnect: boolean; /** EnforceEdgeID makes Portainer store the Edge ID instead of accepting anyone */ @@ -53,12 +53,12 @@ interface EdgeAdminResponse extends AuthenticatedResponse { interface AdminResponse extends EdgeAdminResponse { /** A list of label name & value that will be used to hide containers when querying containers */ - BlackListedLabels: Pair[]; - LDAPSettings: LDAPSettings; - OAuthSettings: OAuthSettings; - InternalAuthSettings: InternalAuthSettings; - openAMTConfiguration: OpenAMTConfiguration; - fdoConfiguration: FDOConfiguration; + BlackListedLabels?: Pair[]; + LDAPSettings?: LDAPSettings; + OAuthSettings?: OAuthSettings; + InternalAuthSettings?: InternalAuthSettings; + openAMTConfiguration?: OpenAMTConfiguration; + fdoConfiguration?: FDOConfiguration; /** The interval in which environment(endpoint) snapshots are created */ SnapshotInterval: string; /** URL to the templates that will be displayed in the UI when navigating to App Templates */ diff --git a/app/react/portainer/settings/types.ts b/app/react/portainer/settings/types.ts index 454a3c839..42f984888 100644 --- a/app/react/portainer/settings/types.ts +++ b/app/react/portainer/settings/types.ts @@ -125,13 +125,13 @@ export interface EdgeSettings { export interface Settings { LogoURL: string; CustomLoginBanner: string; - BlackListedLabels: Pair[]; + BlackListedLabels?: Pair[]; AuthenticationMethod: AuthenticationMethod; - InternalAuthSettings: InternalAuthSettings; - LDAPSettings: LDAPSettings; - OAuthSettings: OAuthSettings; - openAMTConfiguration: OpenAMTConfiguration; - fdoConfiguration: FDOConfiguration; + InternalAuthSettings?: InternalAuthSettings; + LDAPSettings?: LDAPSettings; + OAuthSettings?: OAuthSettings; + openAMTConfiguration?: OpenAMTConfiguration; + fdoConfiguration?: FDOConfiguration; Features: { [key: Feature]: boolean }; SnapshotInterval: string; TemplatesURL: string; @@ -149,7 +149,7 @@ export interface Settings { DefaultRegistry: DefaultRegistry; ExperimentalFeatures?: ExperimentalFeatures; GlobalDeploymentOptions?: GlobalDeploymentOptions; - Edge: EdgeSettings; + Edge?: EdgeSettings; } export interface GlobalDeploymentOptions {