Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MD] Apply dataSource plugin as dependent for cm and dsm plugins #2150

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"version": "opensearchDashboards",
"server": false,
"ui": true,
"requiredPlugins": ["management"],
"requiredPlugins": ["management", "dataSource"],
"requiredBundles": ["opensearchDashboardsReact"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
EuiFieldPassword,
} from '@elastic/eui';
import { DocLinksStart } from 'src/core/public';
import { Credential } from '../../../../data_source/common';
import { Credential } from '../../../../data_source/public';

import { getCreateBreadcrumbs } from '../breadcrumbs';
import { CredentialManagmentContextValue } from '../../types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
EuiConfirmModal,
} from '@elastic/eui';
import { DocLinksStart } from 'src/core/public';
import { Credential } from '../../../../data_source/common';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we move Credential type from common to public ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Credential type is still defined in common path, but because the CM plugin now depends on the DS plugin, when importing a non-public component, it will report the following error.

 ERROR in ./public/components/create_credential_wizard/create_credential_wizard.tsx
       │          Module not found: Error: import [../../../../data_source/common] references a non-public export of the [dataSource] bundle and must point to one of the public directories: [public]
       │           @ ./public/components/create_credential_wizard/create_credential_wizard.tsx 11:0-60 89:13-23
       │           @ ./public/components/create_credential_wizard/index.tsx
       │           @ ./public/components/index.tsx
       │           @ ./public/management_app/mount_management_section.tsx
       │           @ ./public/management_app/index.tsx
       │           @ ./public/plugin.ts
       │           @ ./public/index.ts
       │           @ /Volumes/workplace/DEV/packages/osd-optimizer/target/worker/entry_point_creator.js

import { Credential } from '../../../../data_source/public';

import { getCreateBreadcrumbs } from '../breadcrumbs';
import { CredentialManagmentContextValue } from '../../types';
Expand Down
7 changes: 1 addition & 6 deletions src/plugins/credential_management/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@
import { i18n } from '@osd/i18n';

import { CoreSetup, CoreStart, Plugin } from '../../../core/public';

import { ManagementSetup } from '../../management/public';

export interface CredentialManagementSetupDependencies {
management: ManagementSetup;
}
import { CredentialManagementSetupDependencies } from './types';

const sectionsHeader = i18n.translate('credentialManagement.credential.sectionsHeader', {
defaultMessage: 'Credentials',
Expand Down
7 changes: 3 additions & 4 deletions src/plugins/credential_management/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ import {
NotificationsStart,
DocLinksStart,
} from 'src/core/public';
import { NavigationPublicPluginStart } from '../../navigation/public';
import { ManagementAppMountParams } from '../../management/public';
import { ManagementAppMountParams, ManagementSetup } from 'src/plugins/management/public';

import { OpenSearchDashboardsReactContextValue } from '../../opensearch_dashboards_react/public';

export interface AppPluginStartDependencies {
navigation: NavigationPublicPluginStart;
export interface CredentialManagementSetupDependencies {
management: ManagementSetup;
}

export interface CredentialManagementContext {
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/data_source/opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "opensearchDashboards",
"opensearchDashboardsVersion": "opensearchDashboards",
"server": true,
"ui": false,
"ui": true,
"requiredPlugins": [],
"optionalPlugins": []
}
16 changes: 16 additions & 0 deletions src/plugins/data_source/public/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { DataSourcePublicPlugin } from './plugin';

// This exports static code and TypeScript types,
// as well as, OpenSearch Dashboards Platform `plugin()` initializer.
export function plugin() {
return new DataSourcePublicPlugin();
}

export { DataSourcePublicPluginSetup, DataSourcePublicPluginStart } from './types';

export { Credential } from '../common';
20 changes: 20 additions & 0 deletions src/plugins/data_source/public/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import { CoreSetup, CoreStart, Plugin } from '../../../core/public';
import { DataSourcePublicPluginSetup, DataSourcePublicPluginStart } from './types';

export class DataSourcePublicPlugin
implements Plugin<DataSourcePublicPluginSetup, DataSourcePublicPluginStart> {
public setup(core: CoreSetup): DataSourcePublicPluginSetup {
return {};
}

public start(core: CoreStart): DataSourcePublicPluginStart {
return {};
}

public stop() {}
}
10 changes: 10 additions & 0 deletions src/plugins/data_source/public/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface DataSourcePublicPluginSetup {}

// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface DataSourcePublicPluginStart {}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "opensearchDashboards",
"server": false,
"ui": true,
"requiredPlugins": ["management", "credentialManagement"],
"requiredPlugins": ["management", "dataSource"],
"optionalPlugins": [],
"requiredBundles": ["opensearchDashboardsReact"]
}