1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-08-09 07:45:22 +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.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');

View file

@ -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) {

View file

@ -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
);
}
}

View file

@ -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,

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 { 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;
}

View file

@ -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,
};

View file

@ -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,
};

View file

@ -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) {

View file

@ -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 */

View file

@ -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 {