|
@@ -3,6 +3,7 @@ import { SchemaSubject } from 'generated-sources';
|
|
import { ClusterName, SchemaName } from 'redux/interfaces';
|
|
import { ClusterName, SchemaName } from 'redux/interfaces';
|
|
import { clusterSchemasPath } from 'lib/paths';
|
|
import { clusterSchemasPath } from 'lib/paths';
|
|
import ClusterContext from 'components/contexts/ClusterContext';
|
|
import ClusterContext from 'components/contexts/ClusterContext';
|
|
|
|
+import { useHistory } from 'react-router';
|
|
import Breadcrumb from '../../common/Breadcrumb/Breadcrumb';
|
|
import Breadcrumb from '../../common/Breadcrumb/Breadcrumb';
|
|
import SchemaVersion from './SchemaVersion';
|
|
import SchemaVersion from './SchemaVersion';
|
|
import LatestVersionItem from './LatestVersionItem';
|
|
import LatestVersionItem from './LatestVersionItem';
|
|
@@ -18,6 +19,7 @@ export interface DetailsProps {
|
|
clusterName: ClusterName,
|
|
clusterName: ClusterName,
|
|
schemaName: SchemaName
|
|
schemaName: SchemaName
|
|
) => void;
|
|
) => void;
|
|
|
|
+ deleteSchema: (clusterName: ClusterName, subject: string) => Promise<void>;
|
|
}
|
|
}
|
|
|
|
|
|
const Details: React.FC<DetailsProps> = ({
|
|
const Details: React.FC<DetailsProps> = ({
|
|
@@ -25,6 +27,7 @@ const Details: React.FC<DetailsProps> = ({
|
|
schema,
|
|
schema,
|
|
clusterName,
|
|
clusterName,
|
|
fetchSchemaVersions,
|
|
fetchSchemaVersions,
|
|
|
|
+ deleteSchema,
|
|
versions,
|
|
versions,
|
|
isFetched,
|
|
isFetched,
|
|
}) => {
|
|
}) => {
|
|
@@ -33,6 +36,12 @@ const Details: React.FC<DetailsProps> = ({
|
|
fetchSchemaVersions(clusterName, subject);
|
|
fetchSchemaVersions(clusterName, subject);
|
|
}, [fetchSchemaVersions, clusterName]);
|
|
}, [fetchSchemaVersions, clusterName]);
|
|
|
|
|
|
|
|
+ const history = useHistory();
|
|
|
|
+ const onDelete = async () => {
|
|
|
|
+ await deleteSchema(clusterName, subject);
|
|
|
|
+ history.push(clusterSchemasPath(clusterName));
|
|
|
|
+ };
|
|
|
|
+
|
|
return (
|
|
return (
|
|
<div className="section">
|
|
<div className="section">
|
|
<div className="level">
|
|
<div className="level">
|
|
@@ -75,7 +84,7 @@ const Details: React.FC<DetailsProps> = ({
|
|
className="button is-danger is-small level-item"
|
|
className="button is-danger is-small level-item"
|
|
type="button"
|
|
type="button"
|
|
title="in development"
|
|
title="in development"
|
|
- disabled
|
|
|
|
|
|
+ onClick={onDelete}
|
|
>
|
|
>
|
|
Delete
|
|
Delete
|
|
</button>
|
|
</button>
|