-
Notifications
You must be signed in to change notification settings - Fork 915
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Signed-off-by: Kristen Tian <[email protected]>
- Loading branch information
1 parent
b288a12
commit f7a3a54
Showing
12 changed files
with
290 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# dataSourceManagement | ||
|
||
A OpenSearch Dashboards plugin | ||
|
||
--- | ||
|
||
## Development | ||
|
||
See the [OpenSearch Dashboards contributing | ||
guide](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/CONTRIBUTING.md) for instructions | ||
setting up your development environment. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Any modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
export const PLUGIN_ID = 'dataSourceManagement'; | ||
export const PLUGIN_NAME = 'Data Sources'; |
10 changes: 10 additions & 0 deletions
10
src/plugins/data_source_management/opensearch_dashboards.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"id": "dataSourceManagement", | ||
"version": "1.0.0", | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
"opensearchDashboardsVersion": "opensearchDashboards", | ||
"server": false, | ||
"ui": true, | ||
"requiredPlugins": ["management"], | ||
"optionalPlugins": [], | ||
"requiredBundles": ["opensearchDashboardsReact"] | ||
} |
24 changes: 24 additions & 0 deletions
24
...urce_management/public/components/create_data_source_wizard/create_data_source_wizard.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Any modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
import { EuiTitle } from '@elastic/eui'; | ||
import React from 'react'; | ||
import { withRouter } from 'react-router-dom'; | ||
|
||
export const CreateDataSourceWizard = () => { | ||
return ( | ||
<EuiTitle> | ||
<h2>{'This is the data source creation page'}</h2> | ||
</EuiTitle> | ||
); | ||
}; | ||
|
||
export const CreateDataSourceWizardWithRouter = withRouter(CreateDataSourceWizard); |
12 changes: 12 additions & 0 deletions
12
src/plugins/data_source_management/public/components/create_data_source_wizard/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Any modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
export { CreateDataSourceWizardWithRouter } from './create_data_source_wizard'; |
24 changes: 24 additions & 0 deletions
24
src/plugins/data_source_management/public/components/data_source_table/data_source_table.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Any modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
import { EuiTitle } from '@elastic/eui'; | ||
import React from 'react'; | ||
import { withRouter } from 'react-router-dom'; | ||
|
||
export const DataSourceTable = () => { | ||
return ( | ||
<EuiTitle> | ||
<h2>{'This is the landing page, going to list data sources here...'}</h2> | ||
</EuiTitle> | ||
); | ||
}; | ||
|
||
export const DataSourceTableWithRouter = withRouter(DataSourceTable); |
12 changes: 12 additions & 0 deletions
12
src/plugins/data_source_management/public/components/data_source_table/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Any modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
export { DataSourceTableWithRouter } from './data_source_table'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Any modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
import { DataSourceManagementPlugin } from './plugin'; | ||
|
||
// This exports static code and TypeScript types, | ||
// as well as, OpenSearch Dashboards Platform `plugin()` initializer. | ||
export function plugin() { | ||
return new DataSourceManagementPlugin(); | ||
} | ||
export { DataSourceManagementPluginStart } from './types'; |
12 changes: 12 additions & 0 deletions
12
src/plugins/data_source_management/public/management_app/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Any modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
export { mountManagementSection } from './mount_management_section'; |
67 changes: 67 additions & 0 deletions
67
src/plugins/data_source_management/public/management_app/mount_management_section.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Any modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
import { StartServicesAccessor } from 'src/core/public'; | ||
|
||
import { I18nProvider } from '@osd/i18n/react'; | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
import { Route, Router, Switch } from 'react-router-dom'; | ||
import { ManagementAppMountParams } from '../../../management/public'; | ||
|
||
import { OpenSearchDashboardsContextProvider } from '../../../opensearch_dashboards_react/public'; | ||
import { CreateDataSourceWizardWithRouter } from '../components/create_data_source_wizard'; | ||
import { DataSourceTableWithRouter } from '../components/data_source_table'; | ||
import { DataSourceManagmentContext } from '../types'; | ||
|
||
export async function mountManagementSection( | ||
getStartServices: StartServicesAccessor, | ||
params: ManagementAppMountParams | ||
) { | ||
const [ | ||
{ chrome, application, savedObjects, uiSettings, notifications, overlays, http, docLinks }, | ||
] = await getStartServices(); | ||
|
||
const deps: DataSourceManagmentContext = { | ||
chrome, | ||
application, | ||
savedObjects, | ||
uiSettings, | ||
notifications, | ||
overlays, | ||
http, | ||
docLinks, | ||
setBreadcrumbs: params.setBreadcrumbs, | ||
}; | ||
|
||
ReactDOM.render( | ||
<OpenSearchDashboardsContextProvider services={deps}> | ||
<I18nProvider> | ||
<Router history={params.history}> | ||
<Switch> | ||
<Route path={['/create']}> | ||
<CreateDataSourceWizardWithRouter /> | ||
</Route> | ||
<Route path={['/']}> | ||
<DataSourceTableWithRouter /> | ||
</Route> | ||
</Switch> | ||
</Router> | ||
</I18nProvider> | ||
</OpenSearchDashboardsContextProvider>, | ||
params.element | ||
); | ||
|
||
return () => { | ||
chrome.docTitle.reset(); | ||
ReactDOM.unmountComponentAtNode(params.element); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Any modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
import { CoreSetup, CoreStart, Plugin } from '../../../core/public'; | ||
import { DataSourceManagementPluginStart, DataSourceManagementSetupDependencies } from './types'; | ||
|
||
import { PLUGIN_NAME } from '../common'; | ||
|
||
const IPM_APP_ID = 'dataSources'; | ||
|
||
export class DataSourceManagementPlugin | ||
implements Plugin<void, DataSourceManagementPluginStart, DataSourceManagementSetupDependencies> { | ||
public setup(core: CoreSetup, { management }: DataSourceManagementSetupDependencies) { | ||
const opensearchDashboardsSection = management.sections.section.opensearchDashboards; | ||
|
||
if (!opensearchDashboardsSection) { | ||
throw new Error('`opensearchDashboards` management section not found.'); | ||
} | ||
|
||
opensearchDashboardsSection.registerApp({ | ||
id: IPM_APP_ID, | ||
title: PLUGIN_NAME, | ||
order: 0, | ||
This comment has been minimized.
Sorry, something went wrong.
noCharger
Contributor
|
||
mount: async (params) => { | ||
const { mountManagementSection } = await import('./management_app'); | ||
|
||
return mountManagementSection(core.getStartServices, params); | ||
}, | ||
}); | ||
} | ||
|
||
public start(core: CoreStart): DataSourceManagementPluginStart { | ||
return {}; | ||
} | ||
|
||
public stop() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
* | ||
* Any modifications Copyright OpenSearch Contributors. See | ||
* GitHub history for details. | ||
*/ | ||
|
||
import { | ||
ChromeStart, | ||
ApplicationStart, | ||
IUiSettingsClient, | ||
OverlayStart, | ||
SavedObjectsStart, | ||
NotificationsStart, | ||
DocLinksStart, | ||
HttpSetup, | ||
} from 'src/core/public'; | ||
import { ManagementAppMountParams, ManagementSetup } from 'src/plugins/management/public'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-interface | ||
export interface DataSourceManagementPluginStart {} | ||
|
||
export interface DataSourceManagementSetupDependencies { | ||
management: ManagementSetup; | ||
} | ||
|
||
export interface DataSourceManagmentContext { | ||
chrome: ChromeStart; | ||
application: ApplicationStart; | ||
savedObjects: SavedObjectsStart; | ||
uiSettings: IUiSettingsClient; | ||
notifications: NotificationsStart; | ||
overlays: OverlayStart; | ||
http: HttpSetup; | ||
docLinks: DocLinksStart; | ||
setBreadcrumbs: ManagementAppMountParams['setBreadcrumbs']; | ||
} |
shall we use 'openSearchDashboards?'