diff --git a/ui/package.json b/ui/package.json index 0e4e626b2..eeb591172 100644 --- a/ui/package.json +++ b/ui/package.json @@ -20,6 +20,7 @@ "react-infinite-scroll-component": "^6.1.0", "react-router-dom": "^5.2.0", "react-scripts": "4.0.3", + "react-scroll": "^1.8.2", "reactstrap": "^8.9.0", "sass": "^1.32.11", "use-http": "^1.0.20", diff --git a/ui/src/app/dashboard/container/SourcesTab.js b/ui/src/app/dashboard/container/SourcesTab.js index 073aeaa86..94305795b 100644 --- a/ui/src/app/dashboard/container/SourcesTab.js +++ b/ui/src/app/dashboard/container/SourcesTab.js @@ -11,21 +11,18 @@ export function SourcesTab () { const [sources, setSources] = React.useState([]); - const { get, del, response } = useMetadataEntities('source'); + const { get, response } = useMetadataEntities('source', { + cachePolicy: 'no-cache' + }); async function loadSources() { - const sources = await get('/') + const sources = await get('/'); if (response.ok) { setSources(sources); } } - async function deleteSource(id) { - await del(`/${id}`); - if (response.ok) { - loadSources(); - } - } + const updateSources = () => loadSources(); /*eslint-disable react-hooks/exhaustive-deps*/ React.useEffect(() => { loadSources() }, []); @@ -40,7 +37,7 @@ export function SourcesTab () {
diff --git a/ui/src/app/metadata/component/MetadataOptions.js b/ui/src/app/metadata/component/MetadataOptions.js index 374713f12..13ce53b00 100644 --- a/ui/src/app/metadata/component/MetadataOptions.js +++ b/ui/src/app/metadata/component/MetadataOptions.js @@ -1,7 +1,9 @@ -import { faArrowDown, faHistory } from '@fortawesome/free-solid-svg-icons'; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import React from 'react'; -import { Link, useParams } from 'react-router-dom'; +import { faArrowDown, faHistory, faTrash } from '@fortawesome/free-solid-svg-icons'; +import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { Link, useHistory, useParams } from 'react-router-dom'; + +import { scroller } from 'react-scroll'; import Translate from '../../i18n/components/translate'; @@ -12,25 +14,48 @@ import { MetadataConfiguration } from './MetadataConfiguration'; import { useMetadataConfiguration } from '../hooks/configuration'; import { MetadataViewToggle } from './MetadataViewToggle'; +import { DeleteSourceConfirmation } from '../domain/source/component/DeleteSourceConfirmation'; export function MetadataOptions () { const metadata = React.useContext(MetadataObjectContext); + const history = useHistory(); const { type, id } = useParams(); const configuration = useMetadataConfiguration([metadata]); + const onScrollTo = (element, offset = 0) => { + scroller.scrollTo(element, { + duration: 500, + smooth: true, + offset + }); + }; + + const redirectOnDelete = () => history.push('/dashboard'); + return ( - <> -
+
| - | |||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| - {source.serviceProviderName} - | -- {source.entityId} - | -- {source.createdBy} - | -
- {onEnable ?
- |
-
- |
+
-