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

Remove create and delete options for datasources #1146

Closed
wants to merge 3 commits into from
Closed
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 @@ -47,19 +47,7 @@ exports[`Manage Data Connections Description test Renders manage data connection
<div
className="euiTextColor euiTextColor--subdued"
>
Manage existing data sources or

<EuiLink
href="#/new"
>
<a
className="euiLink euiLink--primary"
href="#/new"
rel="noreferrer"
>
create a new data source
</a>
</EuiLink>
Manage existing data sources
</div>
</EuiTextColor>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,6 @@ exports[`Manage Data Connections Table test Renders manage data connections tabl
Manage data sources
</span>
</button>
<button
aria-selected="false"
class="euiTab"
data-test-subj="new"
role="tab"
type="button"
>
<span
class="euiTab__content"
>
New data source
</span>
</button>
</div>
<div
class="euiSpacer euiSpacer--s"
Expand Down Expand Up @@ -119,15 +106,7 @@ exports[`Manage Data Connections Table test Renders manage data connections tabl
<div
class="euiTextColor euiTextColor--subdued"
>
Manage existing data sources or

<a
class="euiLink euiLink--primary"
href="#/new"
rel="noreferrer"
>
create a new data source
</a>
Manage existing data sources
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ const tabs = [
name: 'Manage data sources',
disabled: false,
},
{
id: 'new',
name: 'New data source',
disabled: false,
},
];

export const DataConnectionsHeader = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ export const DataConnectionsDescription = (props: DataConnectionsDescriptionProp

<EuiSpacer size="s" />
<EuiText size="s" color="subdued">
Manage existing data sources or{' '}
<EuiLink href="#/new">create a new data source</EuiLink>
Manage existing data sources
</EuiText>
</>
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,6 @@ export const ManageDataConnectionsTable = (props: HomeProps) => {
const [isModalVisible, setIsModalVisible] = useState(false);
const [modalLayout, setModalLayout] = useState(<EuiOverlayMask />);

const deleteConnection = (connectionName: string) => {
http!
.delete(`${DATACONNECTIONS_BASE}/${connectionName}`)
.then(() => {
setToast(`Data connection ${connectionName} deleted successfully`);
setData(
data.filter((connection) => {
return !(connection.name === connectionName);
})
);
})
.catch((err) => {
setToast(`Data connection $${connectionName} not deleted. See output for more details.`);
});
};

useEffect(() => {
chrome.setBreadcrumbs([
{
Expand All @@ -83,23 +67,6 @@ export const ManageDataConnectionsTable = (props: HomeProps) => {
);
}

const displayDeleteModal = (connectionName: string) => {
setModalLayout(
<DeleteModal
onConfirm={() => {
setIsModalVisible(false);
deleteConnection(connectionName);
}}
onCancel={() => {
setIsModalVisible(false);
}}
title={`Delete ${connectionName}`}
message={`Are you sure you want to delete ${connectionName}?`}
/>
);
setIsModalVisible(true);
};

const actions = [
{
name: 'Edit',
Expand Down Expand Up @@ -137,16 +104,6 @@ export const ManageDataConnectionsTable = (props: HomeProps) => {
},
'data-test-subj': 'action-accelerate',
},
{
name: 'Delete',
description: 'Delete this data source',
icon: 'trash',
color: 'danger',
type: 'icon',
onClick: (datasource: DataConnection) => displayDeleteModal(datasource.name),
isPrimary: false,
'data-test-subj': 'action-delete',
},
];

const icon = (record: DataConnection) => {
Expand Down
9 changes: 0 additions & 9 deletions public/components/datasources/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@ export const Home = (props: HomeProps) => {
path={['/', '/manage']}
render={(routerProps) => <ManageDataConnectionsTable {...commonProps} />}
/>
<Route exact path={['/new']} render={(routerProps) => <NewDatasource {...commonProps} />} />

<Route
exact
path={['/configure/:id+']}
render={(routerProps) => (
<Configure {...commonProps} type={decodeURIComponent(routerProps.match.params.id)} />
)}
/>
</Switch>
</HashRouter>
);
Expand Down