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

[Workspace] Integrate workspace front end with data connection type saved object #8013

Merged
merged 12 commits into from
Sep 20, 2024

Conversation

raintygao
Copy link
Contributor

@raintygao raintygao commented Sep 5, 2024

Description

Integrate workspace with data connection type saved object in frontend

Screenshot

image
image

Testing the changes

Use APIs in #7925 to create data connection object, then goes to workspace create page to assign/unassign data connection objects.

Changelog

  • feat: Integrate workspace with data connections in front end

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

opensearch-changeset-bot bot added a commit to raintygao/OpenSearch-Dashboards that referenced this pull request Sep 5, 2024
opensearch-changeset-bot bot added a commit to raintygao/OpenSearch-Dashboards that referenced this pull request Sep 13, 2024
Copy link

codecov bot commented Sep 13, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 3 lines in your changes missing coverage. Please review.

Project coverage is 64.11%. Comparing base (2213b57) to head (c87b2d8).
Report is 25 commits behind head on main.

Files with missing lines Patch % Lines
src/plugins/workspace/public/utils.ts 87.50% 2 Missing ⚠️
...components/workspace_form/connection_type_icon.tsx 85.71% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8013      +/-   ##
==========================================
+ Coverage   64.09%   64.11%   +0.01%     
==========================================
  Files        3744     3744              
  Lines       88822    88842      +20     
  Branches    13841    13847       +6     
==========================================
+ Hits        56931    56958      +27     
+ Misses      31277    31270       -7     
  Partials      614      614              
Flag Coverage Δ
Linux_1 30.07% <91.66%> (+0.03%) ⬆️
Linux_2 58.85% <ø> (ø)
Linux_3 40.33% <ø> (ø)
Linux_4 31.57% <ø> (ø)
Windows_1 30.09% <91.66%> (+0.03%) ⬆️
Windows_2 58.80% <ø> (ø)
Windows_3 40.33% <ø> (ø)
Windows_4 31.57% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -158,3 +160,9 @@ export enum AssociationDataSourceModalMode {
DirectQueryConnections = 'direction-query-connections',
}
export const USE_CASE_PREFIX = 'use-case-';

// Workspace will handle both data source and data connection type saved object.
export const WORKSPACE_DATA_SOURCE_AND_CONNECTION_OBJECT_TYPES = [
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks good, will take a look on whether we could use this.

Copy link
Contributor Author

@raintygao raintygao Sep 18, 2024

Choose a reason for hiding this comment

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

  1. Why isn't type in https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/plugins/data/common/datasets/types.ts#L41 data-source which is a type for data source object?
  2. Is there an example for data-connection type object?
  3. Im thinking whether data structure type would be a little complex for workspace, because workspace may don't need dataset, column, table related info.

@@ -31,6 +31,9 @@ import { HttpStart, NotificationsStart, SavedObjectsStart } from '../../../../..
import { AssociationDataSourceModalMode } from '../../../common/constants';
import { Logos } from '../../../../../core/common';
import { DirectQueryConnectionIcon } from '../workspace_form';
import { DataConnectionIcon } from '../workspace_form';
Copy link
Member

Choose a reason for hiding this comment

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

import this from line 33. also do we have multiple cases of defining icon throughout the app?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this is still pending as I'm finding a better way to maintain different state between data-source, query connection, data-connection.

@@ -31,6 +31,9 @@ import { HttpStart, NotificationsStart, SavedObjectsStart } from '../../../../..
import { AssociationDataSourceModalMode } from '../../../common/constants';
import { Logos } from '../../../../../core/common';
import { DirectQueryConnectionIcon } from '../workspace_form';
import { DataConnectionIcon } from '../workspace_form';

import { DATA_CONNECTION_SAVED_OBJECT_TYPE } from '../../../../data_source/common/data_connections';

const ConnectionIcon = ({
Copy link
Member

Choose a reason for hiding this comment

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

imo this could be cleaned up with using the data structures https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/src/plugins/data/common/datasets/types.ts#L75.

where we have the information about the icon and type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, will take a look.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I checked the interface of this data structure and haven't seen any related integration with data-connection type object. I suppose this is still in progress?

@raintygao
Copy link
Contributor Author

raintygao commented Sep 14, 2024

Server side changes are extracted in (#8200) in order to start testing as soon as possible.

return [
const dataConnections = dataSources
.filter((ds) => ds.type === DATA_CONNECTION_SAVED_OBJECT_TYPE)
.map((ds) => ({ ...ds, name: ds.id }));
Copy link
Contributor

@wanglam wanglam Sep 14, 2024

Choose a reason for hiding this comment

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

The type of data source connection will be displayed in the data source connection table. There will be a type filter at the top right of the data source connection table. There is a type property in the definition of data connection saved object. Will it been displayed in the data source connection table? If yes, i'm prefer using DataSourceConnectionType.DataConnection to indicate the new data-connection;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

raintygao pushed a commit to raintygao/OpenSearch-Dashboards that referenced this pull request Sep 18, 2024
opensearch-changeset-bot bot added a commit to raintygao/OpenSearch-Dashboards that referenced this pull request Sep 18, 2024
raintygao pushed a commit to raintygao/OpenSearch-Dashboards that referenced this pull request Sep 18, 2024
raintygao pushed a commit to raintygao/OpenSearch-Dashboards that referenced this pull request Sep 18, 2024
@raintygao raintygao changed the title [Workspace] Integrate workspace with data connection type saved object [Workspace] Integrate workspace front end with data connection type saved object Sep 18, 2024
@raintygao raintygao marked this pull request as ready for review September 18, 2024 08:07
SuZhou-Joe
SuZhou-Joe previously approved these changes Sep 20, 2024
ruanyl
ruanyl previously approved these changes Sep 20, 2024
@@ -9,7 +9,6 @@ import { i18n } from '@osd/i18n';
import { DataSourceConnection, DataSourceConnectionType } from '../../../common/types';
import { AssociationDataSourceModalMode } from '../../../common/constants';
import { DataSourceConnectionTable } from '../workspace_form';

Copy link
Member

Choose a reason for hiding this comment

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

Nit: this empty line should be kept

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

const workspaces = source.workspaces ?? [];
const auth = source.get('auth');
const description = source.get('description');
const dataSourceEngineType = source.get('dataSourceEngineType');
const type = source.type;
// This is a field only for detail type of data connection in order not to mix saved object type.
Copy link
Member

Choose a reason for hiding this comment

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

Nit:

Suggested change
// This is a field only for detail type of data connection in order not to mix saved object type.
// This is a field only for detail type of data connection in order not to mix with saved object type.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

};
});

export const convertDataSourcesToDataConnections = (
Copy link
Member

Choose a reason for hiding this comment

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

Nit: maybe can consider to combine convertDataSourcesToOpenSearchConnections and convertDataSourcesToDataConnections

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

...fulfillRelatedConnections(openSearchConnections, directQueryConnections),
...directQueryConnections,
].sort((a, b) => a.name.localeCompare(b.name));
...dataConnections,
].sort((a, b) => a?.name?.localeCompare(b?.name));
Copy link
Member

Choose a reason for hiding this comment

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

It doesn't seem optional chain is needed here since the type definition shows name is mandatory.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.

raintygao and others added 12 commits September 20, 2024 16:23
Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: tygao <tygao@amazon.com>
Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: Tianyu Gao <tygao@amazon.com>
Signed-off-by: tygao <tygao@amazon.com>
@SuZhou-Joe SuZhou-Joe merged commit c894584 into opensearch-project:main Sep 20, 2024
67 checks passed
opensearch-trigger-bot bot pushed a commit that referenced this pull request Sep 20, 2024
…aved object (#8013)

* feat: integrate workspace with data connections

Signed-off-by: tygao <tygao@amazon.com>

* update workspace pages and hooks to integrate with data connection

Signed-off-by: tygao <tygao@amazon.com>

* Changeset file for PR #8013 created/updated

* remove extra comments

Signed-off-by: tygao <tygao@amazon.com>

* update data source import

Signed-off-by: tygao <tygao@amazon.com>

* test: update tests

Signed-off-by: tygao <tygao@amazon.com>

* Changeset file for PR #8013 created/updated

* unify connection type icon and connectionType

Signed-off-by: tygao <tygao@amazon.com>

* test: add tests

Signed-off-by: tygao <tygao@amazon.com>

* display text directly instead of link for data connection in table

Signed-off-by: tygao <tygao@amazon.com>

* Apply suggestions from code review

Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: Tianyu Gao <tygao@amazon.com>

* update

Signed-off-by: tygao <tygao@amazon.com>

---------

Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: Tianyu Gao <tygao@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
(cherry picked from commit c894584)
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
ruanyl pushed a commit that referenced this pull request Sep 24, 2024
…aved object (#8013) (#8269)

* feat: integrate workspace with data connections



* update workspace pages and hooks to integrate with data connection



* Changeset file for PR #8013 created/updated

* remove extra comments



* update data source import



* test: update tests



* Changeset file for PR #8013 created/updated

* unify connection type icon and connectionType



* test: add tests



* display text directly instead of link for data connection in table



* Apply suggestions from code review




* update



---------





(cherry picked from commit c894584)

Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: Tianyu Gao <tygao@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
virajsanghvi pushed a commit to virajsanghvi/OpenSearch-Dashboards that referenced this pull request Sep 24, 2024
…aved object (opensearch-project#8013)

* feat: integrate workspace with data connections

Signed-off-by: tygao <tygao@amazon.com>

* update workspace pages and hooks to integrate with data connection

Signed-off-by: tygao <tygao@amazon.com>

* Changeset file for PR opensearch-project#8013 created/updated

* remove extra comments

Signed-off-by: tygao <tygao@amazon.com>

* update data source import

Signed-off-by: tygao <tygao@amazon.com>

* test: update tests

Signed-off-by: tygao <tygao@amazon.com>

* Changeset file for PR opensearch-project#8013 created/updated

* unify connection type icon and connectionType

Signed-off-by: tygao <tygao@amazon.com>

* test: add tests

Signed-off-by: tygao <tygao@amazon.com>

* display text directly instead of link for data connection in table

Signed-off-by: tygao <tygao@amazon.com>

* Apply suggestions from code review

Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
Signed-off-by: Tianyu Gao <tygao@amazon.com>

* update

Signed-off-by: tygao <tygao@amazon.com>

---------

Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: Tianyu Gao <tygao@amazon.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
yubonluo pushed a commit to yubonluo/OpenSearch-Dashboards that referenced this pull request Sep 25, 2024
…aved object (opensearch-project#8013) (opensearch-project#8269)

* feat: integrate workspace with data connections



* update workspace pages and hooks to integrate with data connection



* Changeset file for PR opensearch-project#8013 created/updated

* remove extra comments



* update data source import



* test: update tests



* Changeset file for PR opensearch-project#8013 created/updated

* unify connection type icon and connectionType



* test: add tests



* display text directly instead of link for data connection in table



* Apply suggestions from code review




* update



---------





(cherry picked from commit c894584)

Signed-off-by: tygao <tygao@amazon.com>
Signed-off-by: Tianyu Gao <tygao@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: opensearch-changeset-bot[bot] <154024398+opensearch-changeset-bot[bot]@users.noreply.github.com>
Co-authored-by: SuZhou-Joe <suzhou@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants