[NP] Migrate ui capabilities (#64185)
* Migrate ui capabilities * Add capabilities for dashboard
This commit is contained in:
parent
a6fff8b298
commit
5f13ad107f
25 changed files with 504 additions and 60 deletions
|
@ -152,61 +152,6 @@ export default function(kibana) {
|
||||||
uiSettingDefaults: getUiSettingDefaults(),
|
uiSettingDefaults: getUiSettingDefaults(),
|
||||||
},
|
},
|
||||||
|
|
||||||
uiCapabilities: async function() {
|
|
||||||
return {
|
|
||||||
discover: {
|
|
||||||
show: true,
|
|
||||||
createShortUrl: true,
|
|
||||||
save: true,
|
|
||||||
saveQuery: true,
|
|
||||||
},
|
|
||||||
visualize: {
|
|
||||||
show: true,
|
|
||||||
createShortUrl: true,
|
|
||||||
delete: true,
|
|
||||||
save: true,
|
|
||||||
saveQuery: true,
|
|
||||||
},
|
|
||||||
dashboard: {
|
|
||||||
createNew: true,
|
|
||||||
show: true,
|
|
||||||
showWriteControls: true,
|
|
||||||
saveQuery: true,
|
|
||||||
},
|
|
||||||
catalogue: {
|
|
||||||
discover: true,
|
|
||||||
dashboard: true,
|
|
||||||
visualize: true,
|
|
||||||
console: true,
|
|
||||||
advanced_settings: true,
|
|
||||||
index_patterns: true,
|
|
||||||
},
|
|
||||||
advancedSettings: {
|
|
||||||
show: true,
|
|
||||||
save: true,
|
|
||||||
},
|
|
||||||
indexPatterns: {
|
|
||||||
save: true,
|
|
||||||
},
|
|
||||||
savedObjectsManagement: {
|
|
||||||
delete: true,
|
|
||||||
edit: true,
|
|
||||||
read: true,
|
|
||||||
},
|
|
||||||
management: {
|
|
||||||
/*
|
|
||||||
* Management settings correspond to management section/link ids, and should not be changed
|
|
||||||
* without also updating those definitions.
|
|
||||||
*/
|
|
||||||
kibana: {
|
|
||||||
settings: true,
|
|
||||||
index_patterns: true,
|
|
||||||
objects: true,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
preInit: async function(server) {
|
preInit: async function(server) {
|
||||||
try {
|
try {
|
||||||
// Create the data directory (recursively, if the a parent dir doesn't exist).
|
// Create the data directory (recursively, if the a parent dir doesn't exist).
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "advancedSettings",
|
"id": "advancedSettings",
|
||||||
"version": "kibana",
|
"version": "kibana",
|
||||||
"server": false,
|
"server": true,
|
||||||
"ui": true,
|
"ui": true,
|
||||||
"requiredPlugins": ["management"]
|
"requiredPlugins": ["management"]
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const capabilitiesProvider = () => ({
|
||||||
|
advancedSettings: {
|
||||||
|
show: true,
|
||||||
|
save: true,
|
||||||
|
},
|
||||||
|
});
|
24
src/plugins/advanced_settings/server/index.ts
Normal file
24
src/plugins/advanced_settings/server/index.ts
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { PluginInitializerContext } from 'kibana/server';
|
||||||
|
import { AdvancedSettingsServerPlugin } from './plugin';
|
||||||
|
|
||||||
|
export const plugin = (initContext: PluginInitializerContext) =>
|
||||||
|
new AdvancedSettingsServerPlugin(initContext);
|
44
src/plugins/advanced_settings/server/plugin.ts
Normal file
44
src/plugins/advanced_settings/server/plugin.ts
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { PluginInitializerContext, CoreSetup, CoreStart, Plugin, Logger } from 'kibana/server';
|
||||||
|
import { capabilitiesProvider } from './capabilities_provider';
|
||||||
|
|
||||||
|
export class AdvancedSettingsServerPlugin implements Plugin<object, object> {
|
||||||
|
private readonly logger: Logger;
|
||||||
|
|
||||||
|
constructor(initializerContext: PluginInitializerContext) {
|
||||||
|
this.logger = initializerContext.logger.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public setup(core: CoreSetup) {
|
||||||
|
this.logger.debug('advancedSettings: Setup');
|
||||||
|
|
||||||
|
core.capabilities.registerProvider(capabilitiesProvider);
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
public start(core: CoreStart) {
|
||||||
|
this.logger.debug('advancedSettings: Started');
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
public stop() {}
|
||||||
|
}
|
27
src/plugins/dashboard/server/capabilities_provider.ts
Normal file
27
src/plugins/dashboard/server/capabilities_provider.ts
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const capabilitiesProvider = () => ({
|
||||||
|
dashboard: {
|
||||||
|
createNew: true,
|
||||||
|
show: true,
|
||||||
|
showWriteControls: true,
|
||||||
|
saveQuery: true,
|
||||||
|
},
|
||||||
|
});
|
|
@ -26,6 +26,7 @@ import {
|
||||||
} from '../../../core/server';
|
} from '../../../core/server';
|
||||||
|
|
||||||
import { dashboardSavedObjectType } from './saved_objects';
|
import { dashboardSavedObjectType } from './saved_objects';
|
||||||
|
import { capabilitiesProvider } from './capabilities_provider';
|
||||||
|
|
||||||
import { DashboardPluginSetup, DashboardPluginStart } from './types';
|
import { DashboardPluginSetup, DashboardPluginStart } from './types';
|
||||||
|
|
||||||
|
@ -40,6 +41,7 @@ export class DashboardPlugin implements Plugin<DashboardPluginSetup, DashboardPl
|
||||||
this.logger.debug('dashboard: Setup');
|
this.logger.debug('dashboard: Setup');
|
||||||
|
|
||||||
core.savedObjects.registerType(dashboardSavedObjectType);
|
core.savedObjects.registerType(dashboardSavedObjectType);
|
||||||
|
core.capabilities.registerProvider(capabilitiesProvider);
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const capabilitiesProvider = () => ({
|
||||||
|
indexPatterns: {
|
||||||
|
save: true,
|
||||||
|
},
|
||||||
|
});
|
|
@ -20,10 +20,12 @@
|
||||||
import { CoreSetup, Plugin } from 'kibana/server';
|
import { CoreSetup, Plugin } from 'kibana/server';
|
||||||
import { registerRoutes } from './routes';
|
import { registerRoutes } from './routes';
|
||||||
import { indexPatternSavedObjectType } from '../saved_objects';
|
import { indexPatternSavedObjectType } from '../saved_objects';
|
||||||
|
import { capabilitiesProvider } from './capabilities_provider';
|
||||||
|
|
||||||
export class IndexPatternsService implements Plugin<void> {
|
export class IndexPatternsService implements Plugin<void> {
|
||||||
public setup(core: CoreSetup) {
|
public setup(core: CoreSetup) {
|
||||||
core.savedObjects.registerType(indexPatternSavedObjectType);
|
core.savedObjects.registerType(indexPatternSavedObjectType);
|
||||||
|
core.capabilities.registerProvider(capabilitiesProvider);
|
||||||
|
|
||||||
registerRoutes(core.http);
|
registerRoutes(core.http);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"id": "discover",
|
"id": "discover",
|
||||||
"version": "kibana",
|
"version": "kibana",
|
||||||
"server": false,
|
"server": true,
|
||||||
"ui": true
|
"ui": true
|
||||||
}
|
}
|
||||||
|
|
27
src/plugins/discover/server/capabilities_provider.ts
Normal file
27
src/plugins/discover/server/capabilities_provider.ts
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const capabilitiesProvider = () => ({
|
||||||
|
discover: {
|
||||||
|
show: true,
|
||||||
|
createShortUrl: true,
|
||||||
|
save: true,
|
||||||
|
saveQuery: true,
|
||||||
|
},
|
||||||
|
});
|
24
src/plugins/discover/server/index.ts
Normal file
24
src/plugins/discover/server/index.ts
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { PluginInitializerContext } from 'kibana/server';
|
||||||
|
import { DiscoverServerPlugin } from './plugin';
|
||||||
|
|
||||||
|
export const plugin = (initContext: PluginInitializerContext) =>
|
||||||
|
new DiscoverServerPlugin(initContext);
|
44
src/plugins/discover/server/plugin.ts
Normal file
44
src/plugins/discover/server/plugin.ts
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { PluginInitializerContext, CoreSetup, CoreStart, Plugin, Logger } from 'kibana/server';
|
||||||
|
import { capabilitiesProvider } from './capabilities_provider';
|
||||||
|
|
||||||
|
export class DiscoverServerPlugin implements Plugin<object, object> {
|
||||||
|
private readonly logger: Logger;
|
||||||
|
|
||||||
|
constructor(initializerContext: PluginInitializerContext) {
|
||||||
|
this.logger = initializerContext.logger.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public setup(core: CoreSetup) {
|
||||||
|
this.logger.debug('discover: Setup');
|
||||||
|
|
||||||
|
core.capabilities.registerProvider(capabilitiesProvider);
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
public start(core: CoreStart) {
|
||||||
|
this.logger.debug('discover: Started');
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
public stop() {}
|
||||||
|
}
|
29
src/plugins/home/server/capabilities_provider.ts
Normal file
29
src/plugins/home/server/capabilities_provider.ts
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const capabilitiesProvider = () => ({
|
||||||
|
catalogue: {
|
||||||
|
discover: true,
|
||||||
|
dashboard: true,
|
||||||
|
visualize: true,
|
||||||
|
console: true,
|
||||||
|
advanced_settings: true,
|
||||||
|
index_patterns: true,
|
||||||
|
},
|
||||||
|
});
|
|
@ -26,6 +26,7 @@ import {
|
||||||
SampleDataRegistryStart,
|
SampleDataRegistryStart,
|
||||||
} from './services';
|
} from './services';
|
||||||
import { UsageCollectionSetup } from '../../usage_collection/server';
|
import { UsageCollectionSetup } from '../../usage_collection/server';
|
||||||
|
import { capabilitiesProvider } from './capabilities_provider';
|
||||||
import { sampleDataTelemetry } from './saved_objects';
|
import { sampleDataTelemetry } from './saved_objects';
|
||||||
|
|
||||||
interface HomeServerPluginSetupDependencies {
|
interface HomeServerPluginSetupDependencies {
|
||||||
|
@ -38,6 +39,7 @@ export class HomeServerPlugin implements Plugin<HomeServerPluginSetup, HomeServe
|
||||||
private readonly sampleDataRegistry = new SampleDataRegistry(this.initContext);
|
private readonly sampleDataRegistry = new SampleDataRegistry(this.initContext);
|
||||||
|
|
||||||
public setup(core: CoreSetup, plugins: HomeServerPluginSetupDependencies): HomeServerPluginSetup {
|
public setup(core: CoreSetup, plugins: HomeServerPluginSetupDependencies): HomeServerPluginSetup {
|
||||||
|
core.capabilities.registerProvider(capabilitiesProvider);
|
||||||
core.savedObjects.registerType(sampleDataTelemetry);
|
core.savedObjects.registerType(sampleDataTelemetry);
|
||||||
return {
|
return {
|
||||||
tutorials: { ...this.tutorialsRegistry.setup(core) },
|
tutorials: { ...this.tutorialsRegistry.setup(core) },
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "management",
|
"id": "management",
|
||||||
"version": "kibana",
|
"version": "kibana",
|
||||||
"server": false,
|
"server": true,
|
||||||
"ui": true,
|
"ui": true,
|
||||||
"requiredPlugins": ["kibanaLegacy", "home"]
|
"requiredPlugins": ["kibanaLegacy", "home"]
|
||||||
}
|
}
|
||||||
|
|
32
src/plugins/management/server/capabilities_provider.ts
Normal file
32
src/plugins/management/server/capabilities_provider.ts
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const capabilitiesProvider = () => ({
|
||||||
|
management: {
|
||||||
|
/*
|
||||||
|
* Management settings correspond to management section/link ids, and should not be changed
|
||||||
|
* without also updating those definitions.
|
||||||
|
*/
|
||||||
|
kibana: {
|
||||||
|
settings: true,
|
||||||
|
index_patterns: true,
|
||||||
|
objects: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
});
|
24
src/plugins/management/server/index.ts
Normal file
24
src/plugins/management/server/index.ts
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { PluginInitializerContext } from 'kibana/server';
|
||||||
|
import { ManagementServerPlugin } from './plugin';
|
||||||
|
|
||||||
|
export const plugin = (initContext: PluginInitializerContext) =>
|
||||||
|
new ManagementServerPlugin(initContext);
|
44
src/plugins/management/server/plugin.ts
Normal file
44
src/plugins/management/server/plugin.ts
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { PluginInitializerContext, CoreSetup, CoreStart, Plugin, Logger } from 'kibana/server';
|
||||||
|
import { capabilitiesProvider } from './capabilities_provider';
|
||||||
|
|
||||||
|
export class ManagementServerPlugin implements Plugin<object, object> {
|
||||||
|
private readonly logger: Logger;
|
||||||
|
|
||||||
|
constructor(initializerContext: PluginInitializerContext) {
|
||||||
|
this.logger = initializerContext.logger.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public setup(core: CoreSetup) {
|
||||||
|
this.logger.debug('management: Setup');
|
||||||
|
|
||||||
|
core.capabilities.registerProvider(capabilitiesProvider);
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
public start(core: CoreStart) {
|
||||||
|
this.logger.debug('management: Started');
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
public stop() {}
|
||||||
|
}
|
|
@ -0,0 +1,26 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const capabilitiesProvider = () => ({
|
||||||
|
savedObjectsManagement: {
|
||||||
|
delete: true,
|
||||||
|
edit: true,
|
||||||
|
read: true,
|
||||||
|
},
|
||||||
|
});
|
|
@ -23,6 +23,7 @@ import { CoreSetup, CoreStart, Logger, Plugin, PluginInitializerContext } from '
|
||||||
import { SavedObjectsManagementPluginSetup, SavedObjectsManagementPluginStart } from './types';
|
import { SavedObjectsManagementPluginSetup, SavedObjectsManagementPluginStart } from './types';
|
||||||
import { SavedObjectsManagement } from './services';
|
import { SavedObjectsManagement } from './services';
|
||||||
import { registerRoutes } from './routes';
|
import { registerRoutes } from './routes';
|
||||||
|
import { capabilitiesProvider } from './capabilities_provider';
|
||||||
|
|
||||||
export class SavedObjectsManagementPlugin
|
export class SavedObjectsManagementPlugin
|
||||||
implements Plugin<SavedObjectsManagementPluginSetup, SavedObjectsManagementPluginStart, {}, {}> {
|
implements Plugin<SavedObjectsManagementPluginSetup, SavedObjectsManagementPluginStart, {}, {}> {
|
||||||
|
@ -33,13 +34,15 @@ export class SavedObjectsManagementPlugin
|
||||||
this.logger = this.context.logger.get();
|
this.logger = this.context.logger.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public async setup({ http }: CoreSetup) {
|
public async setup({ http, capabilities }: CoreSetup) {
|
||||||
this.logger.debug('Setting up SavedObjectsManagement plugin');
|
this.logger.debug('Setting up SavedObjectsManagement plugin');
|
||||||
registerRoutes({
|
registerRoutes({
|
||||||
http,
|
http,
|
||||||
managementServicePromise: this.managementService$.pipe(first()).toPromise(),
|
managementServicePromise: this.managementService$.pipe(first()).toPromise(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
capabilities.registerProvider(capabilitiesProvider);
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"id": "visualize",
|
"id": "visualize",
|
||||||
"version": "kibana",
|
"version": "kibana",
|
||||||
"server": false,
|
"server": true,
|
||||||
"ui": true,
|
"ui": true,
|
||||||
"requiredPlugins": [
|
"requiredPlugins": [
|
||||||
"data",
|
"data",
|
||||||
|
|
28
src/plugins/visualize/server/capabilities_provider.ts
Normal file
28
src/plugins/visualize/server/capabilities_provider.ts
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export const capabilitiesProvider = () => ({
|
||||||
|
visualize: {
|
||||||
|
show: true,
|
||||||
|
createShortUrl: true,
|
||||||
|
delete: true,
|
||||||
|
save: true,
|
||||||
|
saveQuery: true,
|
||||||
|
},
|
||||||
|
});
|
24
src/plugins/visualize/server/index.ts
Normal file
24
src/plugins/visualize/server/index.ts
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { PluginInitializerContext } from 'kibana/server';
|
||||||
|
import { VisualizeServerPlugin } from './plugin';
|
||||||
|
|
||||||
|
export const plugin = (initContext: PluginInitializerContext) =>
|
||||||
|
new VisualizeServerPlugin(initContext);
|
44
src/plugins/visualize/server/plugin.ts
Normal file
44
src/plugins/visualize/server/plugin.ts
Normal file
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* Licensed to Elasticsearch B.V. under one or more contributor
|
||||||
|
* license agreements. See the NOTICE file distributed with
|
||||||
|
* this work for additional information regarding copyright
|
||||||
|
* ownership. Elasticsearch B.V. licenses this file to you under
|
||||||
|
* the Apache License, Version 2.0 (the "License"); you may
|
||||||
|
* not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { PluginInitializerContext, CoreSetup, CoreStart, Plugin, Logger } from 'kibana/server';
|
||||||
|
import { capabilitiesProvider } from './capabilities_provider';
|
||||||
|
|
||||||
|
export class VisualizeServerPlugin implements Plugin<object, object> {
|
||||||
|
private readonly logger: Logger;
|
||||||
|
|
||||||
|
constructor(initializerContext: PluginInitializerContext) {
|
||||||
|
this.logger = initializerContext.logger.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public setup(core: CoreSetup) {
|
||||||
|
this.logger.debug('visualize: Setup');
|
||||||
|
|
||||||
|
core.capabilities.registerProvider(capabilitiesProvider);
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
public start(core: CoreStart) {
|
||||||
|
this.logger.debug('visualize: Started');
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
public stop() {}
|
||||||
|
}
|
Loading…
Reference in a new issue