1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-10 08:15:25 +02:00

fix(settings): return the right value for public

This commit is contained in:
Chaim Lev-Ari 2024-06-10 16:29:49 +03:00
parent 6f048fb82d
commit 7a8d39eab6
10 changed files with 27 additions and 26 deletions

View file

@ -123,7 +123,7 @@ angular.module('portainer.app').controller('UserController', [
$scope.formValues.Administrator = user.Role === 1; $scope.formValues.Administrator = user.Role === 1;
$scope.formValues.username = user.Username; $scope.formValues.username = user.Username;
$scope.AuthenticationMethod = data.settings.AuthenticationMethod; $scope.AuthenticationMethod = data.settings.AuthenticationMethod;
$scope.requiredPasswordLength = data.settings.InternalAuthSettings.RequiredPasswordLength; $scope.requiredPasswordLength = data.settings.RequiredPasswordLength;
}) })
.catch(function error(err) { .catch(function error(err) {
Notifications.error('Failure', err, 'Unable to retrieve user information'); Notifications.error('Failure', err, 'Unable to retrieve user information');

View file

@ -121,7 +121,7 @@ angular.module('portainer.app').controller('UsersController', [
users = assignAuthMethod(users, $scope.AuthenticationMethod); users = assignAuthMethod(users, $scope.AuthenticationMethod);
$scope.users = users; $scope.users = users;
$scope.teams = _.orderBy(data.teams, 'Name', 'asc'); $scope.teams = _.orderBy(data.teams, 'Name', 'asc');
$scope.requiredPasswordLength = data.settings.InternalAuthSettings.RequiredPasswordLength; $scope.requiredPasswordLength = data.settings.RequiredPasswordLength;
$scope.teamSync = data.settings.TeamSync; $scope.teamSync = data.settings.TeamSync;
}) })
.catch(function error(err) { .catch(function error(err) {

View file

@ -99,7 +99,7 @@ export function AutomaticEdgeEnvCreation() {
edgeKey={edgeKey} edgeKey={edgeKey}
isLoading={edgeKeyMutation.isLoading} isLoading={edgeKeyMutation.isLoading}
url={url} url={url}
tunnelUrl={settings?.Edge.TunnelServerAddress} tunnelUrl={settings?.Edge?.TunnelServerAddress || ''}
/> />
</> </>
)} )}
@ -116,7 +116,7 @@ export function AutomaticEdgeEnvCreation() {
settings && settings &&
settings.EnableEdgeComputeFeatures && settings.EnableEdgeComputeFeatures &&
settings.EdgePortainerUrl && settings.EdgePortainerUrl &&
settings.Edge.TunnelServerAddress settings.Edge?.TunnelServerAddress
); );
} }
} }

View file

@ -115,7 +115,7 @@ export function buildInitialValues(settings: Settings): FormValues {
name: '', name: '',
portainerUrl: settings.EdgePortainerUrl || buildApiUrlDefaultValue(), portainerUrl: settings.EdgePortainerUrl || buildApiUrlDefaultValue(),
tunnelServerAddr: tunnelServerAddr:
settings.Edge.TunnelServerAddress || buildTunnelDefaultValue(), settings.Edge?.TunnelServerAddress || buildTunnelDefaultValue(),
pollFrequency: 0, pollFrequency: 0,
meta: { meta: {
groupId: 1, groupId: 1,

View file

@ -1,4 +1,4 @@
import { Settings } from '@/react/portainer/settings/types'; import { InternalAuthSettings } from '@/react/portainer/settings/types';
import { confirmDestructive } from '@@/modals/confirm'; import { confirmDestructive } from '@@/modals/confirm';
import { FormSectionTitle } from '@@/form-components/FormSectionTitle'; import { FormSectionTitle } from '@@/form-components/FormSectionTitle';
@ -10,7 +10,7 @@ import { SaveAuthSettingsButton } from './SaveAuthSettingsButton';
export interface Props { export interface Props {
onSaveSettings(): void; onSaveSettings(): void;
isLoading: boolean; isLoading: boolean;
value: Settings['InternalAuthSettings']; value: InternalAuthSettings;
onChange(value: number): void; onChange(value: number): void;
} }

View file

@ -44,9 +44,9 @@ export function DeploymentSyncOptions() {
const initialValues: FormValues = { const initialValues: FormValues = {
Edge: { Edge: {
CommandInterval: settingsQuery.data.Edge.CommandInterval, CommandInterval: settingsQuery.data.Edge?.CommandInterval || 0,
PingInterval: settingsQuery.data.Edge.PingInterval, PingInterval: settingsQuery.data.Edge?.PingInterval || 0,
SnapshotInterval: settingsQuery.data.Edge.SnapshotInterval, SnapshotInterval: settingsQuery.data.Edge?.SnapshotInterval || 0,
}, },
EdgeAgentCheckinInterval: settingsQuery.data.EdgeAgentCheckinInterval, EdgeAgentCheckinInterval: settingsQuery.data.EdgeAgentCheckinInterval,
}; };

View file

@ -29,7 +29,7 @@ export function EdgeComputeSettings({ settings, onSubmit }: Props) {
EnableEdgeComputeFeatures: settings.EnableEdgeComputeFeatures, EnableEdgeComputeFeatures: settings.EnableEdgeComputeFeatures,
EdgePortainerUrl: settings.EdgePortainerUrl, EdgePortainerUrl: settings.EdgePortainerUrl,
Edge: { Edge: {
TunnelServerAddress: settings.Edge?.TunnelServerAddress, TunnelServerAddress: settings.Edge?.TunnelServerAddress || '',
}, },
EnforceEdgeID: settings.EnforceEdgeID, EnforceEdgeID: settings.EnforceEdgeID,
}; };

View file

@ -5,10 +5,11 @@ import { isBE } from '../../feature-flags/feature-flags.service';
import { EdgeComputeSettings } from './EdgeComputeSettings'; import { EdgeComputeSettings } from './EdgeComputeSettings';
import { DeploymentSyncOptions } from './DeploymentSyncOptions/DeploymentSyncOptions'; import { DeploymentSyncOptions } from './DeploymentSyncOptions/DeploymentSyncOptions';
import { AutomaticEdgeEnvCreation } from './AutomaticEdgeEnvCreation'; import { AutomaticEdgeEnvCreation } from './AutomaticEdgeEnvCreation';
import { FormValues } from './EdgeComputeSettings/types';
interface Props { interface Props {
settings: Settings; settings: Settings;
onSubmit(values: Settings): void; onSubmit(values: FormValues): void;
} }
export function EdgeComputeSettingsView({ settings, onSubmit }: Props) { export function EdgeComputeSettingsView({ settings, onSubmit }: Props) {

View file

@ -40,7 +40,7 @@ interface AuthenticatedResponse extends PublicSettingsResponse {
} }
interface EdgeAdminResponse extends AuthenticatedResponse { interface EdgeAdminResponse extends AuthenticatedResponse {
Edge: EdgeSettings; Edge?: EdgeSettings;
/** TrustOnFirstConnect makes Portainer accepting edge agent connection by default */ /** TrustOnFirstConnect makes Portainer accepting edge agent connection by default */
TrustOnFirstConnect: boolean; TrustOnFirstConnect: boolean;
/** EnforceEdgeID makes Portainer store the Edge ID instead of accepting anyone */ /** EnforceEdgeID makes Portainer store the Edge ID instead of accepting anyone */
@ -53,12 +53,12 @@ interface EdgeAdminResponse extends AuthenticatedResponse {
interface AdminResponse extends EdgeAdminResponse { interface AdminResponse extends EdgeAdminResponse {
/** A list of label name & value that will be used to hide containers when querying containers */ /** A list of label name & value that will be used to hide containers when querying containers */
BlackListedLabels: Pair[]; BlackListedLabels?: Pair[];
LDAPSettings: LDAPSettings; LDAPSettings?: LDAPSettings;
OAuthSettings: OAuthSettings; OAuthSettings?: OAuthSettings;
InternalAuthSettings: InternalAuthSettings; InternalAuthSettings?: InternalAuthSettings;
openAMTConfiguration: OpenAMTConfiguration; openAMTConfiguration?: OpenAMTConfiguration;
fdoConfiguration: FDOConfiguration; fdoConfiguration?: FDOConfiguration;
/** The interval in which environment(endpoint) snapshots are created */ /** The interval in which environment(endpoint) snapshots are created */
SnapshotInterval: string; SnapshotInterval: string;
/** URL to the templates that will be displayed in the UI when navigating to App Templates */ /** URL to the templates that will be displayed in the UI when navigating to App Templates */

View file

@ -125,13 +125,13 @@ export interface EdgeSettings {
export interface Settings { export interface Settings {
LogoURL: string; LogoURL: string;
CustomLoginBanner: string; CustomLoginBanner: string;
BlackListedLabels: Pair[]; BlackListedLabels?: Pair[];
AuthenticationMethod: AuthenticationMethod; AuthenticationMethod: AuthenticationMethod;
InternalAuthSettings: InternalAuthSettings; InternalAuthSettings?: InternalAuthSettings;
LDAPSettings: LDAPSettings; LDAPSettings?: LDAPSettings;
OAuthSettings: OAuthSettings; OAuthSettings?: OAuthSettings;
openAMTConfiguration: OpenAMTConfiguration; openAMTConfiguration?: OpenAMTConfiguration;
fdoConfiguration: FDOConfiguration; fdoConfiguration?: FDOConfiguration;
Features: { [key: Feature]: boolean }; Features: { [key: Feature]: boolean };
SnapshotInterval: string; SnapshotInterval: string;
TemplatesURL: string; TemplatesURL: string;
@ -149,7 +149,7 @@ export interface Settings {
DefaultRegistry: DefaultRegistry; DefaultRegistry: DefaultRegistry;
ExperimentalFeatures?: ExperimentalFeatures; ExperimentalFeatures?: ExperimentalFeatures;
GlobalDeploymentOptions?: GlobalDeploymentOptions; GlobalDeploymentOptions?: GlobalDeploymentOptions;
Edge: EdgeSettings; Edge?: EdgeSettings;
} }
export interface GlobalDeploymentOptions { export interface GlobalDeploymentOptions {