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

Configure S3 datasource flow #1049

Merged
merged 24 commits into from
Sep 27, 2023
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
73becc4
Manage datasources (#967)
derek-ho Sep 7, 2023
6e42a2b
Add acceleration management UI (#989)
ps48 Sep 11, 2023
24cdd19
Rename data sources to data connections (#1004)
derek-ho Sep 15, 2023
dfd5bd8
Add fallback to show if user does not have datasource API permissions…
derek-ho Sep 15, 2023
28201e9
Add access control tab content (#992)
derek-ho Sep 18, 2023
89eafa2
Delete datasource and Connection Configuration Tab (#1024)
derek-ho Sep 20, 2023
1efd191
Get most of the workflow working for configure datasource
derek-ho Sep 22, 2023
ad153ed
remove acceleration components
ps48 Sep 22, 2023
93ad0dd
Update data connection to datasources in a few more places and update…
derek-ho Sep 22, 2023
d98cd8d
Merge branch 'feature/flint-UI' of github.com:opensearch-project/dash…
derek-ho Sep 22, 2023
2bd8c27
Rename and re-organize in folders
derek-ho Sep 22, 2023
cc7b1a2
Fix import path in testing file
derek-ho Sep 22, 2023
ed8cfc1
Get Initial S3 configuration working
derek-ho Sep 25, 2023
0b84fab
Configure S3 Data Source Working
derek-ho Sep 25, 2023
6d8a98f
Fix query permissions display
derek-ho Sep 25, 2023
e8b831f
Merge branch 'main' of github.com:opensearch-project/dashboards-obser…
derek-ho Sep 25, 2023
7a3f085
Fix merge conflict
derek-ho Sep 25, 2023
1ffdfb0
Clean up PR
derek-ho Sep 25, 2023
7a333bf
Add s3 logo in manage table
derek-ho Sep 25, 2023
c5f1eae
Fix up PR according to UX feedback
derek-ho Sep 25, 2023
23699bc
Remove successfully
derek-ho Sep 25, 2023
51bb5d4
Update test
derek-ho Sep 25, 2023
680763b
Address PR comments
derek-ho Sep 27, 2023
4d19eb4
Update test in accordance to useLocation
derek-ho Sep 27, 2023
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
4 changes: 2 additions & 2 deletions common/constants/shared.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ export const observabilityIntegrationsID = 'integrations';
export const observabilityIntegrationsTitle = 'Integrations';
export const observabilityIntegrationsPluginOrder = 9020;

export const observabilityDataConnectionsID = 'dataconnections';
export const observabilityDataConnectionsTitle = 'Data Connections';
export const observabilityDataConnectionsID = 'datasources';
export const observabilityDataConnectionsTitle = 'Data sources';
export const observabilityDataConnectionsPluginOrder = 9030;

// Shared Constants
Expand Down
2 changes: 1 addition & 1 deletion public/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { EventAnalytics } from './event_analytics';
import { Home as MetricsHome } from './metrics/index';
import { Main as NotebooksHome } from './notebooks/components/main';
import { Home as TraceAnalyticsHome } from './trace_analytics/home';
import { Home as DataConnectionsHome } from './data_connections/home';
import { Home as DataConnectionsHome } from './datasources/home';

interface ObservabilityAppDeps {
CoreStartProp: CoreStart;
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ exports[`Manage Data Connections Description test Renders manage data connection
<h2
className="euiTitle euiTitle--small"
>
Manage existing data connections
Manage existing data sources
</h2>
</EuiTitle>
<EuiSpacer
Expand All @@ -33,7 +33,7 @@ exports[`Manage Data Connections Description test Renders manage data connection
<div
className="euiTextColor euiTextColor--subdued"
>
Manage already created data connections.
Manage already created data sources.
</div>
</EuiTextColor>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ exports[`Manage Data Connections Table test Renders manage data connections tabl
class="euiTitle euiTitle--large"
data-test-subj="dataconnections-header"
>
Data connections
Data sources
</h1>
</div>
</header>
Expand All @@ -32,7 +32,7 @@ exports[`Manage Data Connections Table test Renders manage data connections tabl
<div
class="euiTextColor euiTextColor--subdued"
>
Connect and manage compatible OpenSearch and OpenSearch Dashboard data connections.
Connect and manage compatible OpenSearch and OpenSearch Dashboard data sources.

<a
class="euiLink euiLink--primary"
Expand All @@ -58,6 +58,38 @@ exports[`Manage Data Connections Table test Renders manage data connections tabl
<div
class="euiSpacer euiSpacer--l"
/>
<div
class="euiTabs euiTabs--condensed"
role="tablist"
>
<button
aria-selected="true"
class="euiTab euiTab-isSelected"
role="tab"
type="button"
>
<span
class="euiTab__content"
>
Manage data source
</span>
</button>
<button
aria-selected="false"
class="euiTab"
role="tab"
type="button"
>
<span
class="euiTab__content"
>
New data source
</span>
</button>
</div>
<div
class="euiSpacer euiSpacer--s"
/>
</div>
<div
class="euiPanel euiPanel--paddingLarge euiPanel--borderRadiusMedium euiPanel--plain euiPanel--hasShadow euiPageContent"
Expand All @@ -68,7 +100,7 @@ exports[`Manage Data Connections Table test Renders manage data connections tabl
<h2
class="euiTitle euiTitle--small"
>
Manage existing data connections
Manage existing data sources
</h2>
<div
class="euiSpacer euiSpacer--s"
Expand All @@ -79,7 +111,7 @@ exports[`Manage Data Connections Table test Renders manage data connections tabl
<div
class="euiTextColor euiTextColor--subdued"
>
Manage already created data connections.
Manage already created data sources.
</div>
</div>
<hr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Adapter from 'enzyme-adapter-react-16';
import { act } from '@testing-library/react';
import React from 'react';
import { describeDataConnection, mockRoleData } from '../../../../../test/datasources';
import { DataConnection } from '../data_connection';
import { DataConnection } from '../manage/data_connection';
import ReactDOM from 'react-dom';

jest.mock('../../../../../public/framework/core_refs', () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { configure, mount } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { waitFor } from '@testing-library/react';
import React from 'react';
import { DataConnectionsDescription } from '../manage_data_connections_description';
import { DataConnectionsDescription } from '../manage/manage_data_connections_description';

describe('Manage Data Connections Description test', () => {
configure({ adapter: new Adapter() });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';
import { act } from '@testing-library/react';
import React from 'react';
import { ManageDataConnectionsTable } from '../manage_data_connections_table';
import { ManageDataConnectionsTable } from '../manage/manage_data_connections_table';
import { showDataConnectionsData } from '../../../../../test/datasources';
import ReactDOM from 'react-dom';

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import {
EuiLink,
EuiPageHeader,
EuiPageHeaderSection,
EuiSpacer,
EuiTab,
EuiTabs,
EuiText,
EuiTitle,
} from '@elastic/eui';
import _ from 'lodash';
import React, { useState } from 'react';
import { OPENSEARCH_DOCUMENTATION_URL } from '../../../../common/constants/data_connections';

export const DataConnectionsHeader = () => {
const tabs = [
{
id: 'manage',
name: 'Manage data source',
disabled: false,
},
{
id: 'new',
name: 'New data source',
disabled: false,
},
];

const [selectedTabId, setSelectedTabId] = useState(
window.location.hash.substring(2) ? window.location.hash.substring(2) : 'manage'
derek-ho marked this conversation as resolved.
Show resolved Hide resolved
);

const onSelectedTabChanged = (id) => {
setSelectedTabId(id);
window.location.hash = id;
};

const renderTabs = () => {
return tabs.map((tab, index) => (
<EuiTab
onClick={() => onSelectedTabChanged(tab.id)}
isSelected={tab.id === selectedTabId}
disabled={tab.disabled}
key={index}
>
{tab.name}
</EuiTab>
));
};

return (
<div>
<EuiPageHeader>
<EuiPageHeaderSection>
<EuiTitle size="l" data-test-subj="dataconnections-header">
<h1>Data sources</h1>
</EuiTitle>
</EuiPageHeaderSection>
</EuiPageHeader>
<EuiSpacer size="s" />
<EuiText size="s" color="subdued">
Connect and manage compatible OpenSearch and OpenSearch Dashboard data sources.{' '}
<EuiLink external={true} href={OPENSEARCH_DOCUMENTATION_URL} target="blank">
Learn more
</EuiLink>
</EuiText>
<EuiSpacer size="l" />
<EuiTabs display="condensed">{renderTabs()}</EuiTabs>
<EuiSpacer size="s" />
</div>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,28 @@ import {
import React, { useEffect, useState } from 'react';
import { EuiPanel } from '@elastic/eui';
import { ConnectionManagementCallout } from './connection_management_callout';
import { coreRefs } from '../../../../public/framework/core_refs';
import { coreRefs } from '../../../../framework/core_refs';
import { QueryPermissionsConfiguration } from './query_permissions';
import { DATACONNECTIONS_BASE } from '../../../../common/constants/shared';
import { SaveOrCancel } from './save_or_cancel';
import { DATACONNECTIONS_BASE } from '../../../../../common/constants/shared';
import { SaveOrCancel } from '../save_or_cancel';

interface AccessControlTabProps {
dataConnection: string;
connector: string;
properties: unknown;
allowedRoles: string[];
}

export const AccessControlTab = (props: AccessControlTabProps) => {
const [mode, setMode] = useState<'view' | 'edit'>('view');
const [roles, setRoles] = useState<Array<{ label: string }>>([]);
const [selectedQueryPermissionRoles, setSelectedQueryPermissionRoles] = useState<
Array<{ label: string }>
>([]);
>(
props.allowedRoles.map((role) => {
return { label: role };
})
);
const { http } = coreRefs;

useEffect(() => {
Expand All @@ -51,7 +56,7 @@ export const AccessControlTab = (props: AccessControlTabProps) => {
<EuiFlexItem grow={false}>
<EuiText className="overview-title">Query access</EuiText>
<EuiText size="s" className="overview-content">
{[].length ? `Restricted` : '-'}
{selectedQueryPermissionRoles.length ? `Restricted` : '-'}
</EuiText>
</EuiFlexItem>
</EuiFlexGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import {
import React, { useState } from 'react';
import { EuiPanel } from '@elastic/eui';
import { ConnectionManagementCallout } from './connection_management_callout';
import { coreRefs } from '../../../../public/framework/core_refs';
import { DATACONNECTIONS_BASE } from '../../../../common/constants/shared';
import { SaveOrCancel } from './save_or_cancel';
import { coreRefs } from '../../../../framework/core_refs';
import { DATACONNECTIONS_BASE } from '../../../../../common/constants/shared';
import { SaveOrCancel } from '../save_or_cancel';
import { ConnectionConfiguration } from './connection_configuration';

interface ConnectionDetailProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import {
} from '@elastic/eui';
import React, { useEffect, useState } from 'react';
import { AccessControlTab } from './access_control_tab';
import { NoAccess } from './no_access';
import { DATACONNECTIONS_BASE } from '../../../../common/constants/shared';
import { coreRefs } from '../../../../public/framework/core_refs';
import { NoAccess } from '../no_access';
import { DATACONNECTIONS_BASE } from '../../../../../common/constants/shared';
import { coreRefs } from '../../../../framework/core_refs';
import { ConnectionDetails } from './connection_details';

interface DatasourceDetails {
Expand All @@ -49,7 +49,7 @@ export const DataConnection = (props: any) => {
useEffect(() => {
chrome!.setBreadcrumbs([
{
text: 'Data Connections',
text: 'Data sources',
href: '#/',
},
{
Expand All @@ -59,15 +59,15 @@ export const DataConnection = (props: any) => {
]);
http!
.get(`${DATACONNECTIONS_BASE}/${dataSource}`)
.then((data) =>
.then((data) => {
setDatasourceDetails({
allowedRoles: data.allowedRoles,
name: data.name,
cluster: data.properties['emr.cluster'],
connector: data.connector,
properties: data.properties,
})
)
});
})
.catch((err) => {
setHasAccess(false);
});
Expand All @@ -80,9 +80,11 @@ export const DataConnection = (props: any) => {
disabled: false,
content: (
<AccessControlTab
allowedRoles={datasourceDetails.allowedRoles}
dataConnection={dataSource}
connector={datasourceDetails.connector}
properties={datasourceDetails.properties}
key={JSON.stringify(datasourceDetails.allowedRoles)}
derek-ho marked this conversation as resolved.
Show resolved Hide resolved
/>
),
},
Expand Down Expand Up @@ -200,7 +202,7 @@ export const DataConnection = (props: any) => {
</EuiFlexItem>
</EuiFlexGroup>
</EuiAccordion>
<EuiTabbedContent tabs={tabs} initialSelectedTab={tabs[0]} autoFocus="selected" />
<EuiTabbedContent tabs={tabs} />

<EuiSpacer />
</EuiPageBody>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ export const DataConnectionsDescription = () => {
return (
<div>
<EuiTitle size="s">
<h2>Manage existing data connections</h2>
<h2>Manage existing data sources</h2>
</EuiTitle>

<EuiSpacer size="s" />
<EuiText size="s" color="subdued">
Manage already created data connections.
Manage already created data sources.
</EuiText>
<EuiHorizontalRule size="full" />
</div>
Expand Down
Loading
Loading