fix Canvas available in search in serverless (#163740)

Closes https://github.com/elastic/kibana/issues/163442

---------

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Nathan Reese 2023-08-14 10:43:15 -06:00 committed by GitHub
parent bc37dc2c5a
commit 78250515ff
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 67 deletions

View file

@ -43,7 +43,7 @@ dev_tools.deeplinks.navLinkStatus: visible
management.deeplinks.navLinkStatus: visible
# Other disabled plugins
#xpack.canvas.enabled: false #only disabable in dev-mode
xpack.canvas.enabled: false
xpack.cloud_integrations.data_migration.enabled: false
data.search.sessions.enabled: false
advanced_settings.enabled: false

View file

@ -1,53 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
jest.mock('crypto', () => ({
randomBytes: jest.fn(),
constants: jest.requireActual('crypto').constants,
}));
jest.mock('@kbn/utils', () => ({
getLogsPath: () => '/mock/kibana/logs/path',
}));
import { ConfigSchema } from './config';
describe('config schema', () => {
it('generates proper defaults', () => {
expect(ConfigSchema.validate({})).toMatchInlineSnapshot(`
Object {
"enabled": true,
}
`);
expect(ConfigSchema.validate({}, { dev: false })).toMatchInlineSnapshot(`
Object {
"enabled": true,
}
`);
expect(ConfigSchema.validate({}, { dev: true })).toMatchInlineSnapshot(`
Object {
"enabled": true,
}
`);
});
it('should throw error if spaces is disabled', () => {
expect(() => ConfigSchema.validate({ enabled: false })).toThrow(
'[enabled]: Canvas can only be disabled in development mode'
);
expect(() => ConfigSchema.validate({ enabled: false }, { dev: false })).toThrow(
'[enabled]: Canvas can only be disabled in development mode'
);
});
it('should not throw error if spaces is disabled in development mode', () => {
expect(() => ConfigSchema.validate({ enabled: false }, { dev: true })).not.toThrow();
});
});

View file

@ -8,17 +8,5 @@
import { schema } from '@kbn/config-schema';
export const ConfigSchema = schema.object({
enabled: schema.conditional(
schema.contextRef('dev'),
true,
schema.boolean({ defaultValue: true }),
schema.boolean({
validate: (rawValue) => {
if (rawValue === false) {
return 'Canvas can only be disabled in development mode';
}
},
defaultValue: true,
})
),
enabled: schema.boolean({ defaultValue: true }),
});