mirror of
https://github.com/portainer/portainer.git
synced 2025-08-05 13:55:21 +02:00
feat(demo): remove demo mode EE-6769 (#11841)
Some checks failed
Test / test-server (map[arch:arm64 platform:linux]) (push) Has been cancelled
Test / test-client (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:linux]) (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Has been cancelled
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Has been cancelled
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Has been cancelled
ci / build_images (map[arch:arm platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:s390x platform:linux version:]) (push) Has been cancelled
/ triage (push) Has been cancelled
Lint / Run linters (push) Has been cancelled
ci / build_manifests (push) Has been cancelled
Some checks failed
Test / test-server (map[arch:arm64 platform:linux]) (push) Has been cancelled
Test / test-client (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:linux]) (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:1809]) (push) Has been cancelled
Test / test-server (map[arch:amd64 platform:windows version:ltsc2022]) (push) Has been cancelled
ci / build_images (map[arch:amd64 platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:amd64 platform:windows version:1809]) (push) Has been cancelled
ci / build_images (map[arch:amd64 platform:windows version:ltsc2022]) (push) Has been cancelled
ci / build_images (map[arch:arm platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:arm64 platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:ppc64le platform:linux version:]) (push) Has been cancelled
ci / build_images (map[arch:s390x platform:linux version:]) (push) Has been cancelled
/ triage (push) Has been cancelled
Lint / Run linters (push) Has been cancelled
ci / build_manifests (push) Has been cancelled
This commit is contained in:
parent
fbbf550730
commit
2b01136d03
45 changed files with 27 additions and 481 deletions
|
@ -1,16 +0,0 @@
|
|||
import { useIsDemo } from '@/react/portainer/system/useSystemStatus';
|
||||
|
||||
export function DemoAlert() {
|
||||
const isDemoQuery = useIsDemo();
|
||||
if (!isDemoQuery.data) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="col-sm-12 mt-2">
|
||||
<span className="small text-muted">
|
||||
You cannot use this feature in the demo version of Portainer.
|
||||
</span>
|
||||
</div>
|
||||
);
|
||||
}
|
|
@ -1,13 +1,8 @@
|
|||
import { useField } from 'formik';
|
||||
|
||||
import { useIsDemo } from '@/react/portainer/system/useSystemStatus';
|
||||
|
||||
import { SwitchField } from '@@/form-components/SwitchField';
|
||||
|
||||
import { DemoAlert } from './DemoAlert';
|
||||
|
||||
export function EnableTelemetryField() {
|
||||
const isDemoQuery = useIsDemo();
|
||||
const [{ value }, , { setValue }] = useField<boolean>('enableTelemetry');
|
||||
|
||||
return (
|
||||
|
@ -20,12 +15,9 @@ export function EnableTelemetryField() {
|
|||
checked={value}
|
||||
name="toggle_enableTelemetry"
|
||||
onChange={(checked) => setValue(checked)}
|
||||
disabled={isDemoQuery.data}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<DemoAlert />
|
||||
|
||||
<div className="col-sm-12 text-muted small mt-2">
|
||||
You can find more information about this in our{' '}
|
||||
<a
|
||||
|
|
|
@ -1,18 +1,13 @@
|
|||
import { useField, Field } from 'formik';
|
||||
|
||||
import { useIsDemo } from '@/react/portainer/system/useSystemStatus';
|
||||
|
||||
import { FormControl } from '@@/form-components/FormControl';
|
||||
import { Input } from '@@/form-components/Input';
|
||||
import { SwitchField } from '@@/form-components/SwitchField';
|
||||
|
||||
import { useToggledValue } from '../useToggledValue';
|
||||
|
||||
import { DemoAlert } from './DemoAlert';
|
||||
|
||||
export function LogoFieldset() {
|
||||
const [{ name }, { error }] = useField<string>('logo');
|
||||
const isDemoQuery = useIsDemo();
|
||||
|
||||
const [isEnabled, setIsEnabled] = useToggledValue('logo');
|
||||
|
||||
|
@ -26,12 +21,9 @@ export function LogoFieldset() {
|
|||
checked={isEnabled}
|
||||
name="toggle_logo"
|
||||
labelClass="col-sm-3 col-lg-2"
|
||||
disabled={isDemoQuery.data}
|
||||
onChange={(checked) => setIsEnabled(checked)}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<DemoAlert />
|
||||
</div>
|
||||
|
||||
{isEnabled && (
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import { useField, Field } from 'formik';
|
||||
|
||||
import { FeatureId } from '@/react/portainer/feature-flags/enums';
|
||||
import { useIsDemo } from '@/react/portainer/system/useSystemStatus';
|
||||
|
||||
import { FormControl } from '@@/form-components/FormControl';
|
||||
import { TextArea } from '@@/form-components/Input/Textarea';
|
||||
|
@ -9,10 +8,7 @@ import { SwitchField } from '@@/form-components/SwitchField';
|
|||
|
||||
import { useToggledValue } from '../useToggledValue';
|
||||
|
||||
import { DemoAlert } from './DemoAlert';
|
||||
|
||||
export function ScreenBannerFieldset() {
|
||||
const isDemoQuery = useIsDemo();
|
||||
const [{ name }, { error }] = useField<string>('loginBanner');
|
||||
const [isEnabled, setIsEnabled] = useToggledValue('loginBanner');
|
||||
|
||||
|
@ -26,14 +22,11 @@ export function ScreenBannerFieldset() {
|
|||
label="Login screen banner"
|
||||
checked={isEnabled}
|
||||
name="toggle_login_banner"
|
||||
disabled={isDemoQuery.data}
|
||||
onChange={(checked) => setIsEnabled(checked)}
|
||||
featureId={FeatureId.CUSTOM_LOGIN_BANNER}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<DemoAlert />
|
||||
|
||||
<div className="col-sm-12 text-muted small mt-2">
|
||||
You can set a custom banner that will be shown to all users during
|
||||
login.
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
import { UseQueryOptions, useQuery } from '@tanstack/react-query';
|
||||
|
||||
import axios, { parseAxiosError } from '@/portainer/services/axios';
|
||||
import { UserId } from '@/portainer/users/types';
|
||||
|
||||
import { isBE } from '../feature-flags/feature-flags.service';
|
||||
import { EnvironmentId } from '../environments/types';
|
||||
|
||||
import { buildUrl } from './build-url';
|
||||
import { queryKeys } from './query-keys';
|
||||
|
@ -15,11 +13,6 @@ export interface StatusResponse {
|
|||
Edition: string;
|
||||
Version: string;
|
||||
InstanceID: string;
|
||||
DemoEnvironment: {
|
||||
Enabled: boolean;
|
||||
Users: Array<UserId>;
|
||||
Environments: Array<EnvironmentId>;
|
||||
};
|
||||
}
|
||||
|
||||
export async function getSystemStatus() {
|
||||
|
@ -53,9 +46,3 @@ export function useSystemStatus<T = StatusResponse>({
|
|||
onSuccess,
|
||||
});
|
||||
}
|
||||
|
||||
export function useIsDemo() {
|
||||
return useSystemStatus({
|
||||
select: (status) => status.DemoEnvironment.Enabled,
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue