Skip to content

Commit bf0f8bb

Browse files
authored
Cleanup feature registration (#80909)
1 parent b7ffefb commit bf0f8bb

File tree

35 files changed

+19
-178
lines changed

35 files changed

+19
-178
lines changed

docs/api/features.asciidoc

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,6 @@ The API returns the following:
2828
{
2929
"id": "discover",
3030
"name": "Discover",
31-
"icon": "discoverApp",
32-
"navLinkId": "discover",
3331
"app": [
3432
"kibana"
3533
],
@@ -73,8 +71,6 @@ The API returns the following:
7371
{
7472
"id": "visualize",
7573
"name": "Visualize",
76-
"icon": "visualizeApp",
77-
"navLinkId": "visualize",
7874
"app": [
7975
"kibana"
8076
],
@@ -120,8 +116,6 @@ The API returns the following:
120116
{
121117
"id": "dashboard",
122118
"name": "Dashboard",
123-
"icon": "dashboardApp",
124-
"navLinkId": "dashboards",
125119
"app": [
126120
"kibana"
127121
],
@@ -172,8 +166,6 @@ The API returns the following:
172166
{
173167
"id": "dev_tools",
174168
"name": "Dev Tools",
175-
"icon": "devToolsApp",
176-
"navLinkId": "dev_tools",
177169
"app": [
178170
"kibana"
179171
],

docs/developer/architecture/security/feature-registration.asciidoc

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,6 @@ of features within the management screens.
5959
|See <<example-3-discover,Example 3>>
6060
|The set of subfeatures that enables finer access control than the `all` and `read` feature privileges. These options are only available in the Gold subscription level and higher.
6161

62-
|`icon`
63-
|`string`
64-
|"discoverApp"
65-
|An https://elastic.github.io/eui/#/display/icons[EUI Icon] to use for this feature.
66-
67-
|`navLinkId`
68-
|`string`
69-
|"sample_app"
70-
|The ID of the navigation link associated with your feature.
7162
|===
7263

7364
==== Privilege definition
@@ -100,8 +91,6 @@ public setup(core, { features }) {
10091
features.registerKibanaFeature({
10192
id: 'canvas',
10293
name: 'Canvas',
103-
icon: 'canvasApp',
104-
navLinkId: 'canvas',
10594
category: DEFAULT_APP_CATEGORIES.kibana,
10695
app: ['canvas', 'kibana'],
10796
catalogue: ['canvas'],
@@ -160,8 +149,6 @@ public setup(core, { features }) {
160149
name: i18n.translate('xpack.features.devToolsFeatureName', {
161150
defaultMessage: 'Dev Tools',
162151
}),
163-
icon: 'devToolsApp',
164-
navLinkId: 'dev_tools',
165152
category: DEFAULT_APP_CATEGORIES.management,
166153
app: ['kibana'],
167154
catalogue: ['console', 'searchprofiler', 'grokdebugger'],
@@ -223,8 +210,6 @@ public setup(core, { features }) {
223210
defaultMessage: 'Discover',
224211
}),
225212
order: 100,
226-
icon: 'discoverApp',
227-
navLinkId: 'discover',
228213
category: DEFAULT_APP_CATEGORIES.kibana,
229214
app: ['kibana'],
230215
catalogue: ['discover'],

x-pack/plugins/actions/server/feature.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@ export const ACTIONS_FEATURE = {
1313
name: i18n.translate('xpack.actions.featureRegistry.actionsFeatureName', {
1414
defaultMessage: 'Actions and Connectors',
1515
}),
16-
icon: 'bell',
17-
navLinkId: 'actions',
1816
category: DEFAULT_APP_CATEGORIES.management,
1917
app: [],
2018
management: {

x-pack/plugins/apm/server/feature.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ export const APM_FEATURE = {
2020
}),
2121
order: 900,
2222
category: DEFAULT_APP_CATEGORIES.observability,
23-
icon: 'apmApp',
24-
navLinkId: 'apm',
2523
app: ['apm', 'ux', 'kibana'],
2624
catalogue: ['apm'],
2725
management: {

x-pack/plugins/canvas/server/plugin.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,6 @@ export class CanvasPlugin implements Plugin {
4343
name: 'Canvas',
4444
order: 300,
4545
category: DEFAULT_APP_CATEGORIES.kibana,
46-
icon: 'canvasApp',
47-
navLinkId: 'canvas',
4846
app: ['canvas', 'kibana'],
4947
catalogue: ['canvas'],
5048
privileges: {

x-pack/plugins/enterprise_search/server/plugin.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ export class EnterpriseSearchPlugin implements Plugin {
8585
name: ENTERPRISE_SEARCH_PLUGIN.NAME,
8686
order: 0,
8787
category: DEFAULT_APP_CATEGORIES.enterpriseSearch,
88-
icon: 'logoEnterpriseSearch',
8988
app: [
9089
'kibana',
9190
ENTERPRISE_SEARCH_PLUGIN.ID,

x-pack/plugins/features/common/kibana_feature.ts

Lines changed: 5 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import { RecursiveReadonly } from '@kbn/utility-types';
88
import { AppCategory } from 'src/core/types';
9+
import { LicenseType } from '../../licensing/common/types';
910
import { FeatureKibanaPrivileges } from './feature_kibana_privileges';
1011
import { SubFeatureConfig, SubFeature as KibanaSubFeature } from './sub_feature';
1112
import { ReservedKibanaPrivilege } from './reserved_kibana_privilege';
@@ -52,25 +53,12 @@ export interface KibanaFeatureConfig {
5253
excludeFromBasePrivileges?: boolean;
5354

5455
/**
55-
* Optional array of supported licenses.
56+
* Optional minimum supported license.
5657
* If omitted, all licenses are allowed.
5758
* This does not restrict access to your feature based on license.
5859
* Its only purpose is to inform the space and roles UIs on which features to display.
5960
*/
60-
validLicenses?: ReadonlyArray<
61-
'basic' | 'standard' | 'gold' | 'platinum' | 'enterprise' | 'trial'
62-
>;
63-
64-
/**
65-
* An optional EUI Icon to be used when displaying your feature.
66-
*/
67-
icon?: string;
68-
69-
/**
70-
* The optional Nav Link ID for feature.
71-
* If specified, your link will be automatically hidden if needed based on the current space and user permissions.
72-
*/
73-
navLinkId?: string;
61+
minimumLicense?: LicenseType;
7462

7563
/**
7664
* An array of app ids that are enabled when this feature is enabled.
@@ -170,10 +158,6 @@ export class KibanaFeature {
170158
return this.config.category;
171159
}
172160

173-
public get navLinkId() {
174-
return this.config.navLinkId;
175-
}
176-
177161
public get app() {
178162
return this.config.app;
179163
}
@@ -186,12 +170,8 @@ export class KibanaFeature {
186170
return this.config.management;
187171
}
188172

189-
public get icon() {
190-
return this.config.icon;
191-
}
192-
193-
public get validLicenses() {
194-
return this.config.validLicenses;
173+
public get minimumLicense() {
174+
return this.config.minimumLicense;
195175
}
196176

197177
public get privileges() {

x-pack/plugins/features/server/__snapshots__/feature_registry.test.ts.snap

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/plugins/features/server/feature_registry.test.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,9 @@ describe('FeatureRegistry', () => {
3333
id: 'test-feature',
3434
name: 'Test Feature',
3535
excludeFromBasePrivileges: true,
36-
icon: 'addDataApp',
37-
navLinkId: 'someNavLink',
3836
app: ['app1'],
3937
category: { id: 'foo', label: 'foo' },
40-
validLicenses: ['standard', 'basic', 'gold', 'platinum'],
38+
minimumLicense: 'platinum',
4139
catalogue: ['foo'],
4240
management: {
4341
foo: ['bar'],
@@ -421,20 +419,6 @@ describe('FeatureRegistry', () => {
421419
});
422420

423421
['contains space', 'contains_invalid()_chars', ''].forEach((prohibitedChars) => {
424-
it(`prevents features from being registered with a navLinkId of "${prohibitedChars}"`, () => {
425-
const featureRegistry = new FeatureRegistry();
426-
expect(() =>
427-
featureRegistry.registerKibanaFeature({
428-
id: 'foo',
429-
name: 'some feature',
430-
navLinkId: prohibitedChars,
431-
app: [],
432-
category: { id: 'foo', label: 'foo' },
433-
privileges: null,
434-
})
435-
).toThrowErrorMatchingSnapshot();
436-
});
437-
438422
it(`prevents features from being registered with a management id of "${prohibitedChars}"`, () => {
439423
const featureRegistry = new FeatureRegistry();
440424
expect(() =>

x-pack/plugins/features/server/feature_schema.ts

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,14 @@ const kibanaFeatureSchema = Joi.object({
9191
category: appCategorySchema,
9292
order: Joi.number(),
9393
excludeFromBasePrivileges: Joi.boolean(),
94-
validLicenses: Joi.array().items(
95-
Joi.string().valid('basic', 'standard', 'gold', 'platinum', 'enterprise', 'trial')
94+
minimumLicense: Joi.string().valid(
95+
'basic',
96+
'standard',
97+
'gold',
98+
'platinum',
99+
'enterprise',
100+
'trial'
96101
),
97-
icon: Joi.string(),
98-
description: Joi.string(),
99-
navLinkId: Joi.string().regex(uiCapabilitiesRegex),
100102
app: Joi.array().items(Joi.string()).required(),
101103
management: managementSchema,
102104
catalogue: catalogueSchema,

0 commit comments

Comments
 (0)