Skip to content

Commit

Permalink
Remoce create and delete options
Browse files Browse the repository at this point in the history
Signed-off-by: Derek Ho <dxho@amazon.com>
  • Loading branch information
derek-ho committed Oct 20, 2023
1 parent cccfebf commit ccd305c
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 51 deletions.
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
1 change: 0 additions & 1 deletion public/components/datasources/home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export const Home = (props: HomeProps) => {
path={['/', '/manage']}
render={(routerProps) => <ManageDataConnectionsTable {...commonProps} />}
/>
<Route exact path={['/new']} render={(routerProps) => <NewDatasource {...commonProps} />} />

<Route
exact
Expand Down

0 comments on commit ccd305c

Please sign in to comment.