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 all 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
13 changes: 10 additions & 3 deletions common/types/data_connections.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { EuiComboBoxOptionOption } from '@elastic/eui';

export interface PermissionsConfigurationProps {
roles: Array<{ label: string }>;
selectedRoles: Array<{ label: string }>;
setSelectedRoles: React.Dispatch<React.SetStateAction<Array<{ label: string }>>>;
roles: Role[];
selectedRoles: Role[];
setSelectedRoles: React.Dispatch<React.SetStateAction<Role[]>>;
layout: 'horizontal' | 'vertical';
}

export type Role = EuiComboBoxOptionOption;

export type DatasourceType = 'SPARK' | 'S3GLUE' | 'OPENSEARCH';
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,10 +7,17 @@ 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';

jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
useLocation: () => ({
pathname: '/manage',
}),
}));

describe('Manage Data Connections Table test', () => {
configure({ adapter: new Adapter() });

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 React, { useState } from 'react';
import { useLocation } from 'react-router-dom';
import { OPENSEARCH_DOCUMENTATION_URL } from '../../../../common/constants/data_connections';

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

export const DataConnectionsHeader = () => {
const location = useLocation().pathname.substring(1);

const [selectedTabId, setSelectedTabId] = useState(location ? location : 'manage');

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,27 @@ 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';
import { Role } from '../../../../../common/types/data_connections';

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 }>
>([]);
const [roles, setRoles] = useState<Role[]>([]);
const [selectedQueryPermissionRoles, setSelectedQueryPermissionRoles] = useState<Role[]>(
props.allowedRoles.map((role) => {
return { label: role };
})
);
const { http } = coreRefs;

useEffect(() => {
Expand All @@ -51,7 +55,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 All @@ -67,6 +71,7 @@ export const AccessControlTab = (props: AccessControlTabProps) => {
roles={roles}
selectedRoles={selectedQueryPermissionRoles}
setSelectedRoles={setSelectedQueryPermissionRoles}
layout={'vertical'}
/>
</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
Loading
Loading