Skip to content

Commit

Permalink
Merge branch 'main' into readonly-logic
Browse files Browse the repository at this point in the history
  • Loading branch information
zhyuanqi authored Apr 15, 2024
2 parents b33d06f + e785fd3 commit 540c353
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 40 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Remove unused Sass in `tile_map` plugin ([#4110](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4110))
- [Multiple Datasource] Move data source selectable to its own folder, fix test and a few type errors for data source selectable component ([#6287](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6287))
- Remove KUI usage in `disabled_lab_visualization` ([#5462](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5462))
- [Multiple Datasource] Remove duplicate data source attribute interface from `data_source_management` ([#6437](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/6437))

### 🔩 Tests

Expand Down
5 changes: 3 additions & 2 deletions src/plugins/data_source/common/data_sources/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@ export interface DataSourceAttributes extends SavedObjectAttributes {
title: string;
description?: string;
endpoint: string;
dataSourceVersion?: string;
installedPlugins?: string[];
auth: {
type: AuthType;
type: AuthType | string;
credentials: UsernamePasswordTypedContent | SigV4Content | undefined | AuthTypeContent;
};
lastUpdatedTime?: string;
name: AuthType | string;
}

export interface AuthTypeContent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,5 @@ export const getAuthenticationMethod = (
dataSourceAttr: DataSourceAttributes,
authRegistry?: IAuthenticationMethodRegistry
): AuthenticationMethod => {
const name = dataSourceAttr.name ?? dataSourceAttr.auth.type;
return authRegistry?.getAuthenticationMethod(name) as AuthenticationMethod;
return authRegistry?.getAuthenticationMethod(dataSourceAttr.auth.type) as AuthenticationMethod;
};
44 changes: 8 additions & 36 deletions src/plugins/data_source_management/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
HttpSetup,
} from 'src/core/public';
import { ManagementAppMountParams } from 'src/plugins/management/public';
import { SavedObjectAttributes } from 'src/core/types';
import { i18n } from '@osd/i18n';
import { AuthType } from '../../data_source/common/data_sources';
import { SigV4ServiceName } from '../../data_source/common/data_sources';
import { OpenSearchDashboardsReactContextValue } from '../../opensearch_dashboards_react/public';
import { AuthenticationMethodRegistry } from './auth_registry';
Expand Down Expand Up @@ -53,13 +53,6 @@ export type DataSourceManagementContextValue = OpenSearchDashboardsReactContextV
DataSourceManagementContext
>;

/* Datasource types */
export enum AuthType {
NoAuth = 'no_auth',
UsernamePasswordType = 'username_password',
SigV4 = 'sigv4',
}

export const defaultAuthType = AuthType.UsernamePasswordType;

export const noAuthCredentialOption = {
Expand Down Expand Up @@ -136,35 +129,14 @@ export const credentialSourceOptions = [
sigV4CredentialOption,
];

export interface DataSourceAttributes extends SavedObjectAttributes {
title: string;
description?: string;
endpoint?: string;
dataSourceVersion?: string;
installedPlugins?: string[];
auth: {
type: AuthType | string;
credentials:
| UsernamePasswordTypedContent
| SigV4Content
| { [key: string]: string }
| undefined;
};
}

export interface UsernamePasswordTypedContent extends SavedObjectAttributes {
username: string;
password?: string;
}

export interface SigV4Content extends SavedObjectAttributes {
accessKey: string;
secretKey: string;
region: string;
service?: SigV4ServiceName;
}

export interface MenuPanelItem {
name?: string;
disabled: boolean;
}

export {
AuthType,
UsernamePasswordTypedContent,
SigV4Content,
DataSourceAttributes,
} from '../../data_source/common/data_sources';

0 comments on commit 540c353

Please sign in to comment.