-
+
+ Edge Compute settings
+ {settings.EnableEdgeComputeFeatures && }
+ >
+ }
+ />
+
({
+export function usePublicSettings({
enabled,
select,
onSuccess,
}: {
- select?: (settings: PublicSettingsViewModel) => T;
+ select?: (settings: PublicSettingsResponse) => T;
enabled?: boolean;
onSuccess?: (data: T) => void;
} = {}) {
- return useQuery(['settings', 'public'], () => getPublicSettings(), {
+ return useQuery(['settings', 'public'], getPublicSettings, {
select,
...withError('Unable to retrieve public settings'),
enabled,
diff --git a/app/react/portainer/settings/settings.service.ts b/app/react/portainer/settings/settings.service.ts
index 996133b56..4b10f1ee5 100644
--- a/app/react/portainer/settings/settings.service.ts
+++ b/app/react/portainer/settings/settings.service.ts
@@ -1,14 +1,13 @@
-import { PublicSettingsViewModel } from '@/portainer/models/settings';
import axios, { parseAxiosError } from '@/portainer/services/axios';
-import { DefaultRegistry, PublicSettingsResponse, Settings } from './types';
+import { PublicSettingsResponse, DefaultRegistry, Settings } from './types';
export async function getPublicSettings() {
try {
const { data } = await axios.get(
buildUrl('public')
);
- return new PublicSettingsViewModel(data);
+ return data;
} catch (e) {
throw parseAxiosError(
e as Error,
diff --git a/app/react/portainer/settings/types.ts b/app/react/portainer/settings/types.ts
index f054dab05..d73152a8d 100644
--- a/app/react/portainer/settings/types.ts
+++ b/app/react/portainer/settings/types.ts
@@ -137,23 +137,65 @@ export interface Settings {
};
}
-export interface PublicSettingsResponse {
- // URL to a logo that will be displayed on the login page as well as on top of the sidebar. Will use default Portainer logo when value is empty string
- LogoURL: string;
- // Active authentication method for the Portainer instance. Valid values are: 1 for internal, 2 for LDAP, or 3 for oauth
- AuthenticationMethod: AuthenticationMethod;
- // Whether edge compute features are enabled
- EnableEdgeComputeFeatures: boolean;
- // Supported feature flags
- Features: Record;
- // The URL used for oauth login
- OAuthLoginURI: string;
- // The URL used for oauth logout
- OAuthLogoutURI: string;
- // Whether portainer internal auth view will be hidden
- OAuthHideInternalAuth: boolean;
- // Whether telemetry is enabled
- EnableTelemetry: boolean;
- // The expiry of a Kubeconfig
- KubeconfigExpiry: string;
+interface GlobalDeploymentOptions {
+ /** Hide manual deploy forms in portainer */
+ hideAddWithForm: boolean;
+ /** Configure this per environment or globally */
+ perEnvOverride: boolean;
+ /** Hide the web editor in the remaining visible forms */
+ hideWebEditor: boolean;
+ /** Hide the file upload option in the remaining visible forms */
+ hideFileUpload: boolean;
+}
+
+export interface PublicSettingsResponse {
+ /** URL to a logo that will be displayed on the login page as well as on top of the sidebar. Will use default Portainer logo when value is empty string */
+ LogoURL: string;
+ /** The content in plaintext used to display in the login page. Will hide when value is empty string (only on BE) */
+ CustomLoginBanner: string;
+ /** Active authentication method for the Portainer instance. Valid values are: 1 for internal, 2 for LDAP, or 3 for oauth */
+ AuthenticationMethod: AuthenticationMethod;
+ /** The minimum required length for a password of any user when using internal auth mode */
+ RequiredPasswordLength: number;
+ /** Deployment options for encouraging deployment as code (only on BE) */
+ GlobalDeploymentOptions: GlobalDeploymentOptions;
+ /** Show the Kompose build option (discontinued in 2.18) */
+ ShowKomposeBuildOption: boolean;
+ /** Whether edge compute features are enabled */
+ EnableEdgeComputeFeatures: boolean;
+ /** Supported feature flags */
+ Features: { [key: Feature]: boolean };
+ /** The URL used for oauth login */
+ OAuthLoginURI: string;
+ /** The URL used for oauth logout */
+ OAuthLogoutURI: string;
+ /** Whether portainer internal auth view will be hidden (only on BE) */
+ OAuthHideInternalAuth: boolean;
+ /** Whether telemetry is enabled */
+ EnableTelemetry: boolean;
+ /** The expiry of a Kubeconfig */
+ KubeconfigExpiry: string;
+ /** Whether team sync is enabled */
+ TeamSync: boolean;
+ /** Whether FDO is enabled */
+ IsFDOEnabled: boolean;
+ /** Whether AMT is enabled */
+ IsAMTEnabled: boolean;
+
+ /** Whether to hide default registry (only on BE) */
+ DefaultRegistry: {
+ Hide: boolean;
+ };
+ Edge: {
+ /** Whether the device has been started in edge async mode */
+ AsyncMode: boolean;
+ /** The ping interval for edge agent - used in edge async mode [seconds] */
+ PingInterval: number;
+ /** The snapshot interval for edge agent - used in edge async mode [seconds] */
+ SnapshotInterval: number;
+ /** The command list interval for edge agent - used in edge async mode [seconds] */
+ CommandInterval: number;
+ /** The check in interval for edge agent (in seconds) - used in non async mode [seconds] */
+ CheckinInterval: number;
+ };
}
diff --git a/app/setup-tests/server-handlers.ts b/app/setup-tests/server-handlers.ts
index 2ab9ca295..922ce7b11 100644
--- a/app/setup-tests/server-handlers.ts
+++ b/app/setup-tests/server-handlers.ts
@@ -74,7 +74,18 @@ export const handlers = [
}),
rest.get>(
'/api/settings/public',
- (req, res, ctx) => res(ctx.json({}))
+ (req, res, ctx) =>
+ res(
+ ctx.json({
+ Edge: {
+ AsyncMode: false,
+ CheckinInterval: 60,
+ CommandInterval: 60,
+ PingInterval: 60,
+ SnapshotInterval: 60,
+ },
+ })
+ )
),
rest.get>(
'/api/status',