diff --git a/config/opensearch_dashboards.yml b/config/opensearch_dashboards.yml index d79c0986de07..38ca2250736d 100644 --- a/config/opensearch_dashboards.yml +++ b/config/opensearch_dashboards.yml @@ -268,7 +268,7 @@ # vis_builder.enabled: false # Set the value of this setting to true to enable multiple data source feature. -#data_source.enabled: false +data_source.enabled: true # Set the value of this setting to true to hide local cluster in data source feature. #data_source.hideLocalCluster: false # Set the value of these settings to customize crypto materials to encryption saved credentials @@ -325,7 +325,7 @@ # "none": The data source is readonly for all users. # "dashboard_admin": The data source can only be managed by dashboard admin. # "all": The data source can be managed by all users. Default to "all". -# data_source.manageableBy: "all" +data_source.manageableBy: "none" # Set the value of this setting to false to hide the help menu link to the OpenSearch Dashboards user survey # opensearchDashboards.survey.url: "https://survey.opensearch.org" diff --git a/src/plugins/data_source_management/public/management_app/mount_management_section.test.tsx b/src/plugins/data_source_management/public/management_app/mount_management_section.test.tsx index 7c4e7d812c6d..c198ba523669 100644 --- a/src/plugins/data_source_management/public/management_app/mount_management_section.test.tsx +++ b/src/plugins/data_source_management/public/management_app/mount_management_section.test.tsx @@ -119,4 +119,43 @@ describe('mountManagementSection', () => { expect(route.prop('path')).not.toEqual(['/:id']); }); }); + + it('renders CreateDataSourcePanel when canManageDataSource is true', async () => { + const mockGetStartServices: StartServicesAccessor = jest + .fn() + .mockResolvedValue([ + { + chrome: { docTitle: { reset: jest.fn() } }, + application: { capabilities: { dataSource: { canManage: true } } }, + savedObjects: {}, + uiSettings: {}, + notifications: {}, + overlays: {}, + http: {}, + docLinks: {}, + }, + ]); + + await mountManagementSection(mockGetStartServices, mockParams, mockAuthMethodsRegistry, true); + const wrapper = shallow( + + + + + + + + + + + + + + ); + + expect(wrapper.find(Route)).toHaveLength(5); + }); }); diff --git a/src/plugins/data_source_management/public/management_app/mount_management_section.tsx b/src/plugins/data_source_management/public/management_app/mount_management_section.tsx index bd93edb53119..7b01fcced04a 100644 --- a/src/plugins/data_source_management/public/management_app/mount_management_section.tsx +++ b/src/plugins/data_source_management/public/management_app/mount_management_section.tsx @@ -48,17 +48,21 @@ export async function mountManagementSection( authenticationMethodRegistry: authMethodsRegistry, }; + const canManageDataSource = !!application.capabilities?.dataSource?.canManage; + ReactDOM.render( - + {canManageDataSource ? ( + + ) : null} {featureFlagStatus && ( - + {canManageDataSource ? : null} )}