Skip to content

Commit

Permalink
Grouped features for space management
Browse files Browse the repository at this point in the history
  • Loading branch information
legrego committed Sep 14, 2020
1 parent dcd119c commit 856ef22
Show file tree
Hide file tree
Showing 61 changed files with 753 additions and 243 deletions.
2 changes: 2 additions & 0 deletions examples/alerting_example/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import { Plugin, CoreSetup } from 'kibana/server';
import { i18n } from '@kbn/i18n';
import { DEFAULT_APP_CATEGORIES } from '../../../src/core/server';
import { PluginSetupContract as AlertingSetup } from '../../../x-pack/plugins/alerts/server';
import { PluginSetupContract as FeaturesPluginSetup } from '../../../x-pack/plugins/features/server';

Expand Down Expand Up @@ -47,6 +48,7 @@ export class AlertingExamplePlugin implements Plugin<void, void, AlertingExample
management: {
insightsAndAlerting: ['triggersActions'],
},
category: DEFAULT_APP_CATEGORIES.management,
alerting: [alwaysFiringAlert.id, peopleInSpaceAlert.id, INDEX_THRESHOLD_ID],
privileges: {
all: {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ export const DEFAULT_APP_CATEGORIES: Readonly<{
id: string;
label: string;
order: number;
euiIconType: string;
};
}>;

Expand Down
1 change: 1 addition & 0 deletions src/core/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ export const DEFAULT_APP_CATEGORIES: Readonly<{
id: string;
label: string;
order: number;
euiIconType: string;
};
}>;

Expand Down
1 change: 1 addition & 0 deletions src/core/utils/default_app_categories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,6 @@ export const DEFAULT_APP_CATEGORIES = Object.freeze({
defaultMessage: 'Management',
}),
order: 5000,
euiIconType: 'managementApp',
},
});
2 changes: 2 additions & 0 deletions x-pack/plugins/actions/server/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import { i18n } from '@kbn/i18n';
import { ACTION_SAVED_OBJECT_TYPE, ACTION_TASK_PARAMS_SAVED_OBJECT_TYPE } from './saved_objects';
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server';

export const ACTIONS_FEATURE = {
id: 'actions',
Expand All @@ -14,6 +15,7 @@ export const ACTIONS_FEATURE = {
}),
icon: 'bell',
navLinkId: 'actions',
category: DEFAULT_APP_CATEGORIES.management,
app: [],
management: {
insightsAndAlerting: ['triggersActions'],
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/alerting_builtins/server/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import { i18n } from '@kbn/i18n';
import { ID as IndexThreshold } from './alert_types/index_threshold/alert_type';
import { BUILT_IN_ALERTS_FEATURE_ID } from '../common';
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server';

export const BUILT_IN_ALERTS_FEATURE = {
id: BUILT_IN_ALERTS_FEATURE_ID,
Expand All @@ -15,6 +16,7 @@ export const BUILT_IN_ALERTS_FEATURE = {
}),
icon: 'bell',
app: [],
category: DEFAULT_APP_CATEGORIES.management,
management: {
insightsAndAlerting: ['triggersActions'],
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function mockFeature(appName: string, typeName?: string) {
id: appName,
name: appName,
app: [],
category: { id: 'foo', label: 'foo' },
...(typeName
? {
alerting: [typeName],
Expand Down Expand Up @@ -91,6 +92,7 @@ function mockFeatureWithSubFeature(appName: string, typeName: string) {
id: appName,
name: appName,
app: [],
category: { id: 'foo', label: 'foo' },
...(typeName
? {
alerting: [typeName],
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/alerts/server/plugin.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ function mockFeatures() {
id: 'appName',
name: 'appName',
app: [],
category: { id: 'foo', label: 'foo' },
privileges: {
all: {
savedObject: {
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/apm/server/feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@

import { i18n } from '@kbn/i18n';
import { AlertType } from '../common/alert_types';
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server';

export const APM_FEATURE = {
id: 'apm',
name: i18n.translate('xpack.apm.featureRegistry.apmFeatureName', {
defaultMessage: 'APM',
}),
order: 900,
category: DEFAULT_APP_CATEGORIES.observability,
icon: 'apmApp',
navLinkId: 'apm',
app: ['apm', 'csm', 'kibana'],
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/canvas/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ExpressionsServerSetup } from 'src/plugins/expressions/server';
import { BfetchServerSetup } from 'src/plugins/bfetch/server';
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import { HomeServerPluginSetup } from 'src/plugins/home/server';
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server';
import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server';
import { initRoutes } from './routes';
import { registerCanvasUsageCollector } from './collectors';
Expand Down Expand Up @@ -41,6 +42,7 @@ export class CanvasPlugin implements Plugin {
id: 'canvas',
name: 'Canvas',
order: 400,
category: DEFAULT_APP_CATEGORIES.kibana,
icon: 'canvasApp',
navLinkId: 'canvas',
app: ['canvas', 'kibana'],
Expand Down
2 changes: 2 additions & 0 deletions x-pack/plugins/enterprise_search/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {
KibanaRequest,
} from 'src/core/server';
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import { DEFAULT_APP_CATEGORIES } from '../../../../src/core/server';
import { SecurityPluginSetup } from '../../security/server';
import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server';

Expand Down Expand Up @@ -82,6 +83,7 @@ export class EnterpriseSearchPlugin implements Plugin {
id: ENTERPRISE_SEARCH_PLUGIN.ID,
name: ENTERPRISE_SEARCH_PLUGIN.NAME,
order: 0,
category: DEFAULT_APP_CATEGORIES.enterpriseSearch,
icon: 'logoEnterpriseSearch',
app: [
'kibana',
Expand Down
12 changes: 12 additions & 0 deletions x-pack/plugins/features/common/kibana_feature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
*/

import { RecursiveReadonly } from '@kbn/utility-types';
import { AppCategory } from 'src/core/types';
import { FeatureKibanaPrivileges } from './feature_kibana_privileges';
import { SubFeatureConfig, SubFeature as KibanaSubFeature } from './sub_feature';
import { ReservedKibanaPrivilege } from './reserved_kibana_privilege';
Expand All @@ -29,6 +30,13 @@ export interface KibanaFeatureConfig {
*/
name: string;

/**
* The category for this feature.
* This will be used to organize the list of features for display within the
* Spaces and Roles management screens.
*/
category: AppCategory;

/**
* An ordinal used to sort features relative to one another for display.
*/
Expand Down Expand Up @@ -158,6 +166,10 @@ export class KibanaFeature {
return this.config.order;
}

public get category() {
return this.config.category;
}

public get navLinkId() {
return this.config.navLinkId;
}
Expand Down
Loading

0 comments on commit 856ef22

Please sign in to comment.