Skip to content

Commit

Permalink
Register feature control
Browse files Browse the repository at this point in the history
  • Loading branch information
cee-chen committed Jul 1, 2020
1 parent 98ddbd3 commit adfa213
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion x-pack/plugins/enterprise_search/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"id": "enterpriseSearch",
"version": "1.0.0",
"kibanaVersion": "kibana",
"requiredPlugins": ["home", "licensing"],
"requiredPlugins": ["home", "features", "licensing"],
"configPath": ["enterpriseSearch"],
"optionalPlugins": ["usageCollection", "security"],
"server": true,
Expand Down
18 changes: 17 additions & 1 deletion x-pack/plugins/enterprise_search/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
import { UsageCollectionSetup } from 'src/plugins/usage_collection/server';
import { UICapabilities } from 'ui/capabilities';
import { SecurityPluginSetup } from '../../security/server';
import { PluginSetupContract as FeaturesPluginSetup } from '../../features/server';

import { checkAccess } from './lib/check_access';
import { registerEnginesRoute } from './routes/app_search/engines';
Expand All @@ -28,6 +29,7 @@ import { appSearchTelemetryType } from './saved_objects/app_search/telemetry';
export interface PluginsSetup {
usageCollection?: UsageCollectionSetup;
security?: SecurityPluginSetup;
features: FeaturesPluginSetup;
}

export interface ServerConfigType {
Expand Down Expand Up @@ -55,10 +57,24 @@ export class EnterpriseSearchPlugin implements Plugin {

public async setup(
{ capabilities, http, savedObjects, getStartServices }: CoreSetup,
{ usageCollection, security }: PluginsSetup
{ usageCollection, security, features }: PluginsSetup
) {
const config = await this.config.pipe(first()).toPromise();

/**
* Register space/feature control
*/
features.registerFeature({
id: 'enterprise_search',
name: 'Enterprise Search',
order: 0,
icon: 'logoEnterpriseSearch',
navLinkId: 'app_search', // TODO: We need to get this working with multiple plugins :(
app: ['enterprise_search', 'app_search', 'workplace_search'],
catalogue: ['enterprise_search', 'app_search', 'workplace_search'],
privileges: null,
});

/**
* Register user access to the Enterprise Search plugins
*/
Expand Down

0 comments on commit adfa213

Please sign in to comment.