Skip to content

Commit bc83679

Browse files
authored
moved config option for allowing or disallowing by value embeddables to dashboard plugin (#73870) (#73961)
1 parent fefbbd5 commit bc83679

File tree

3 files changed

+41
-1
lines changed

3 files changed

+41
-1
lines changed

src/plugins/dashboard/config.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/*
2+
* Licensed to Elasticsearch B.V. under one or more contributor
3+
* license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright
5+
* ownership. Elasticsearch B.V. licenses this file to you under
6+
* the Apache License, Version 2.0 (the "License"); you may
7+
* not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing,
13+
* software distributed under the License is distributed on an
14+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15+
* KIND, either express or implied. See the License for the
16+
* specific language governing permissions and limitations
17+
* under the License.
18+
*/
19+
20+
import { schema, TypeOf } from '@kbn/config-schema';
21+
22+
export const configSchema = schema.object({
23+
allowByValueEmbeddables: schema.boolean({ defaultValue: false }),
24+
});
25+
26+
export type ConfigSchema = TypeOf<typeof configSchema>;

src/plugins/dashboard/public/plugin.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ declare module '../../share/public' {
9494

9595
export type DashboardUrlGenerator = UrlGeneratorContract<typeof DASHBOARD_APP_URL_GENERATOR>;
9696

97+
interface DashboardFeatureFlagConfig {
98+
allowByValueEmbeddables: boolean;
99+
}
100+
97101
interface SetupDependencies {
98102
data: DataPublicPluginSetup;
99103
embeddable: EmbeddableSetup;
@@ -125,6 +129,7 @@ export interface DashboardStart {
125129
embeddableType: string;
126130
}) => void | undefined;
127131
dashboardUrlGenerator?: DashboardUrlGenerator;
132+
dashboardFeatureFlagConfig: DashboardFeatureFlagConfig;
128133
DashboardContainerByValueRenderer: ReturnType<typeof createDashboardContainerByValueRenderer>;
129134
}
130135

@@ -411,6 +416,7 @@ export class DashboardPlugin
411416
getSavedDashboardLoader: () => savedDashboardLoader,
412417
addEmbeddableToDashboard: this.addEmbeddableToDashboard.bind(this, core),
413418
dashboardUrlGenerator: this.dashboardUrlGenerator,
419+
dashboardFeatureFlagConfig: this.initializerContext.config.get<DashboardFeatureFlagConfig>(),
414420
DashboardContainerByValueRenderer: createDashboardContainerByValueRenderer({
415421
factory: dashboardContainerFactory,
416422
}),

src/plugins/dashboard/server/index.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,16 @@
1717
* under the License.
1818
*/
1919

20-
import { PluginInitializerContext } from '../../../core/server';
20+
import { PluginInitializerContext, PluginConfigDescriptor } from '../../../core/server';
2121
import { DashboardPlugin } from './plugin';
22+
import { configSchema, ConfigSchema } from '../config';
23+
24+
export const config: PluginConfigDescriptor<ConfigSchema> = {
25+
exposeToBrowser: {
26+
allowByValueEmbeddables: true,
27+
},
28+
schema: configSchema,
29+
};
2230

2331
// This exports static code and TypeScript types,
2432
// as well as, Kibana Platform `plugin()` initializer.

0 commit comments

Comments
 (0)