Skip to content

Commit

Permalink
register workbench to dev-tools
Browse files Browse the repository at this point in the history
Signed-off-by: Shenoy Pratik <[email protected]>
  • Loading branch information
ps48 committed Jul 1, 2024
1 parent 2bb8eb0 commit 7763715
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 30 deletions.
13 changes: 9 additions & 4 deletions opensearch_dashboards.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{
"id": "queryWorkbenchDashboards",
"version": "3.0.0.0",
"opensearchDashboardsVersion": "3.0.0",
"version": "2.14.0.0",
"opensearchDashboardsVersion": "2.14.0",
"server": true,
"ui": true,
"requiredPlugins": ["navigation", "opensearchDashboardsReact", "opensearchDashboardsUtils"],
"requiredPlugins": [
"devTools",
"navigation",
"opensearchDashboardsReact",
"opensearchDashboardsUtils"
],
"optionalPlugins": ["observabilityDashboards", "dataSource", "dataSourceManagement"]
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "opensearch-query-workbench",
"version": "3.0.0.0",
"version": "2.14.0.0",
"description": "Query Workbench",
"main": "index.js",
"license": "Apache-2.0",
Expand Down
22 changes: 9 additions & 13 deletions public/components/Main/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export class Main extends React.Component<MainProps, MainState> {
dataSourceOptions: [],
selectedMDSDataConnectionId: '',
mdsClusterName: '',
flintDataConnections: false
flintDataConnections: false,
};
this.httpClient = this.props.httpClient;
this.updateSQLQueries = _.debounce(this.updateSQLQueries, 250).bind(this);
Expand All @@ -297,12 +297,6 @@ export class Main extends React.Component<MainProps, MainState> {
}

componentDidMount() {
this.props.setBreadcrumbs([
{
text: 'Query Workbench',
href: '#',
},
]);
this.fetchFlintDataSources();
}

Expand Down Expand Up @@ -900,7 +894,7 @@ export class Main extends React.Component<MainProps, MainState> {
mdsClusterName: clusterName,
cluster: 'Indexes',
selectedDatasource: [{ label: 'OpenSearch', key: '' }],
isAccelerationFlyoutOpened: false
isAccelerationFlyoutOpened: false,
});
this.fetchFlintDataSources();
};
Expand Down Expand Up @@ -1018,18 +1012,20 @@ export class Main extends React.Component<MainProps, MainState> {
/>
)}
<EuiPage paddingSize="none">
<EuiPanel grow={true} style={{marginRight: '10px'}}>
<EuiPanel grow={true} style={{ marginRight: '10px' }}>
<EuiPageSideBar
style={{
maxWidth: '400px',
width: '400px',
height: 'calc(100vh - 254px)',
}}
>
<EuiTitle size='xs'>
<p><b>{this.state.mdsClusterName}</b></p>
</EuiTitle>
<EuiSpacer size='s'/>
<EuiTitle size="xs">
<p>
<b>{this.state.mdsClusterName}</b>
</p>
</EuiTitle>
<EuiSpacer size="s" />
{this.state.flintDataConnections && (
<EuiFlexGroup direction="row" gutterSize="s">
<EuiFlexItem grow={false}>
Expand Down
32 changes: 20 additions & 12 deletions public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,47 @@
*/

import { AppMountParameters, CoreSetup, CoreStart, Plugin } from '../../../src/core/public';
import { DataSourcePluginSetup, DataSourcePluginStart } from '../../../src/plugins/data_source/public';
import {
DataSourcePluginSetup,
DataSourcePluginStart,
} from '../../../src/plugins/data_source/public';
import { DataSourceManagementPluginSetup } from '../../../src/plugins/data_source_management/public';
import { DevToolsSetup } from '../../../src/plugins/dev_tools/public';
import { PLUGIN_NAME } from '../common/constants';
import { registerObservabilityDependencies } from './dependencies/register_observability_dependencies';
import { coreRefs } from './framework/core_refs';
import { AppPluginStartDependencies, WorkbenchPluginSetup, WorkbenchPluginStart } from './types';
export interface WorkbenchPluginSetupDependencies {
dataSource: DataSourcePluginSetup;
dataSourceManagement: DataSourceManagementPluginSetup
dataSourceManagement: DataSourceManagementPluginSetup;
devTools: DevToolsSetup;
}

export interface WorkbenchPluginStartDependencies {
dataSource: DataSourcePluginStart;
}
export class WorkbenchPlugin implements Plugin<WorkbenchPluginSetup, WorkbenchPluginStart> {
public setup(core: CoreSetup, {dataSource, dataSourceManagement} : WorkbenchPluginSetupDependencies): WorkbenchPluginSetup {
// Register an application into the side navigation menu
core.application.register({
public setup(
core: CoreSetup,
{ dataSource, dataSourceManagement, devTools }: WorkbenchPluginSetupDependencies
): WorkbenchPluginSetup {
devTools.register({
id: 'opensearch-query-workbench',
title: PLUGIN_NAME,
category: {
id: 'opensearch',
label: 'OpenSearch Plugins',
order: 2000,
},
order: 1000,
enableRouting: true,
order: 2,
async mount(params: AppMountParameters) {
// Load application bundle
const { renderApp } = await import('./application');
// Get start services as specified in opensearch_dashboards.json
const [coreStart, depsStart] = await core.getStartServices();
// Render the application
return renderApp(coreStart, depsStart as AppPluginStartDependencies, params, dataSourceManagement);
return renderApp(
coreStart,
depsStart as AppPluginStartDependencies,
params,
dataSourceManagement
);
},
});

Expand Down

0 comments on commit 7763715

Please sign in to comment.