[Upgrade Assistant] Use config for readonly mode (#101296)
This commit is contained in:
parent
b130edfdb4
commit
03bc6bfe31
|
@ -17,7 +17,7 @@ import {
|
|||
} from 'src/core/public/mocks';
|
||||
import { HttpSetup } from 'src/core/public';
|
||||
|
||||
import { mockKibanaSemverVersion, UA_READONLY_MODE } from '../../../common/constants';
|
||||
import { mockKibanaSemverVersion } from '../../../common/constants';
|
||||
import { AppContextProvider } from '../../../public/application/app_context';
|
||||
import { apiService } from '../../../public/application/lib/api';
|
||||
import { breadcrumbService } from '../../../public/application/lib/breadcrumbs';
|
||||
|
@ -40,7 +40,7 @@ export const WithAppDependencies = (Comp: any, overrides: Record<string, unknown
|
|||
prevMajor: mockKibanaSemverVersion.major - 1,
|
||||
nextMajor: mockKibanaSemverVersion.major + 1,
|
||||
},
|
||||
isReadOnlyMode: UA_READONLY_MODE,
|
||||
isReadOnlyMode: false,
|
||||
notifications: notificationServiceMock.createStartContract(),
|
||||
api: apiService,
|
||||
breadcrumbs: breadcrumbService,
|
||||
|
|
|
@ -9,6 +9,12 @@ import { schema, TypeOf } from '@kbn/config-schema';
|
|||
|
||||
export const configSchema = schema.object({
|
||||
enabled: schema.boolean({ defaultValue: true }),
|
||||
/*
|
||||
* This will default to true up until the last minor before the next major.
|
||||
* In readonly mode, the user will not be able to perform any actions in the UI
|
||||
* and will be presented with a message indicating as such.
|
||||
*/
|
||||
readonly: schema.boolean({ defaultValue: true }),
|
||||
});
|
||||
|
||||
export type Config = TypeOf<typeof configSchema>;
|
||||
|
|
|
@ -14,13 +14,6 @@ import SemVer from 'semver/classes/semver';
|
|||
export const mockKibanaVersion = '8.0.0';
|
||||
export const mockKibanaSemverVersion = new SemVer(mockKibanaVersion);
|
||||
|
||||
/*
|
||||
* This will be set to true up until the last minor before the next major.
|
||||
* In readonly mode, the user will not be able to perform any actions in the UI
|
||||
* and will be presented with a message indicating as such.
|
||||
*/
|
||||
export const UA_READONLY_MODE = true;
|
||||
|
||||
/*
|
||||
* Map of 7.0 --> 8.0 index setting deprecation log messages and associated settings
|
||||
* We currently only support one setting deprecation (translog retention), but the code is written
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
import { CoreSetup } from 'src/core/public';
|
||||
import { ManagementAppMountParams } from '../../../../../src/plugins/management/public';
|
||||
import { UA_READONLY_MODE } from '../../common/constants';
|
||||
import { renderApp } from './render_app';
|
||||
import { KibanaVersionContext } from './app_context';
|
||||
import { apiService } from './lib/api';
|
||||
|
@ -17,7 +16,8 @@ export async function mountManagementSection(
|
|||
coreSetup: CoreSetup,
|
||||
isCloudEnabled: boolean,
|
||||
params: ManagementAppMountParams,
|
||||
kibanaVersionInfo: KibanaVersionContext
|
||||
kibanaVersionInfo: KibanaVersionContext,
|
||||
readonly: boolean
|
||||
) {
|
||||
const [
|
||||
{ i18n, docLinks, notifications, application, deprecations },
|
||||
|
@ -37,7 +37,7 @@ export async function mountManagementSection(
|
|||
docLinks,
|
||||
kibanaVersionInfo,
|
||||
notifications,
|
||||
isReadOnlyMode: UA_READONLY_MODE,
|
||||
isReadOnlyMode: readonly,
|
||||
history,
|
||||
api: apiService,
|
||||
breadcrumbs: breadcrumbService,
|
||||
|
|
|
@ -22,7 +22,7 @@ interface Dependencies {
|
|||
export class UpgradeAssistantUIPlugin implements Plugin {
|
||||
constructor(private ctx: PluginInitializerContext) {}
|
||||
setup(coreSetup: CoreSetup, { cloud, management }: Dependencies) {
|
||||
const { enabled } = this.ctx.config.get<Config>();
|
||||
const { enabled, readonly } = this.ctx.config.get<Config>();
|
||||
|
||||
if (!enabled) {
|
||||
return;
|
||||
|
@ -61,7 +61,8 @@ export class UpgradeAssistantUIPlugin implements Plugin {
|
|||
coreSetup,
|
||||
isCloudEnabled,
|
||||
params,
|
||||
kibanaVersionInfo
|
||||
kibanaVersionInfo,
|
||||
readonly
|
||||
);
|
||||
|
||||
return () => {
|
||||
|
|
|
@ -7,15 +7,16 @@
|
|||
|
||||
import { PluginInitializerContext, PluginConfigDescriptor } from 'src/core/server';
|
||||
import { UpgradeAssistantServerPlugin } from './plugin';
|
||||
import { configSchema } from '../common/config';
|
||||
import { configSchema, Config } from '../common/config';
|
||||
|
||||
export const plugin = (ctx: PluginInitializerContext) => {
|
||||
return new UpgradeAssistantServerPlugin(ctx);
|
||||
};
|
||||
|
||||
export const config: PluginConfigDescriptor = {
|
||||
export const config: PluginConfigDescriptor<Config> = {
|
||||
schema: configSchema,
|
||||
exposeToBrowser: {
|
||||
enabled: true,
|
||||
readonly: true,
|
||||
},
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue