diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f45282c..534d1d80 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), If the resulting list for that interval is empty, it will try to infer the closest interval with visits, based on the latest visit's date, and reload visits for that interval. +* [#547](https://github.com/shlinkio/shlink-web-client/pull/547) Improved domains page, to tell which of the domains are not properly configured. + + Now, when this section is loaded, it tries to call the `GET /rest/health` endpoint for each one of the domains, and displays a warning icon on each one that failed. + + The warning includes a link to the documentation, explaining what are the steps to get it fixed. + * [#535](https://github.com/shlinkio/shlink-web-client/pull/535) Allowed editing default domain redirects when consuming Shlink 2.10 or newer. * [#531](https://github.com/shlinkio/shlink-web-client/pull/531) Added custom slug field to the basic creation form in the Overview page. * [#537](https://github.com/shlinkio/shlink-web-client/pull/537) Allowed to customize the ordering for every list in the app that supports it, being currently tags and short URLs. diff --git a/src/domains/DomainRow.tsx b/src/domains/DomainRow.tsx index 1a2f67ea..db35cdaa 100644 --- a/src/domains/DomainRow.tsx +++ b/src/domains/DomainRow.tsx @@ -1,22 +1,25 @@ -import { FC } from 'react'; +import { FC, useEffect } from 'react'; import { Button, UncontrolledTooltip } from 'reactstrap'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faBan as forbiddenIcon, - faCheck as defaultDomainIcon, + faDotCircle as defaultDomainIcon, faEdit as editIcon, } from '@fortawesome/free-solid-svg-icons'; -import { ShlinkDomain, ShlinkDomainRedirects } from '../api/types'; +import { ShlinkDomainRedirects } from '../api/types'; import { useToggle } from '../utils/helpers/hooks'; import { OptionalString } from '../utils/utils'; import { SelectedServer } from '../servers/data'; import { supportsDefaultDomainRedirectsEdition } from '../utils/helpers/features'; import { EditDomainRedirectsModal } from './helpers/EditDomainRedirectsModal'; +import { Domain } from './data'; +import { DomainStatusIcon } from './helpers/DomainStatusIcon'; interface DomainRowProps { - domain: ShlinkDomain; + domain: Domain; defaultRedirects?: ShlinkDomainRedirects; editDomainRedirects: (domain: string, redirects: Partial) => Promise; + checkDomainHealth: (domain: string) => void; selectedServer: SelectedServer; } @@ -33,14 +36,20 @@ const DefaultDomain: FC = () => ( ); -export const DomainRow: FC = ({ domain, editDomainRedirects, defaultRedirects, selectedServer }) => { +export const DomainRow: FC = ( + { domain, editDomainRedirects, checkDomainHealth, defaultRedirects, selectedServer }, +) => { const [ isOpen, toggle ] = useToggle(); - const { domain: authority, isDefault, redirects } = domain; + const { domain: authority, isDefault, redirects, status } = domain; const canEditDomain = !isDefault || supportsDefaultDomainRedirectsEdition(selectedServer); + useEffect(() => { + checkDomainHealth(domain.domain); + }, []); + return ( - {isDefault ? : ''} + {isDefault && } {authority} {redirects?.baseUrlRedirect ?? } @@ -51,6 +60,9 @@ export const DomainRow: FC = ({ domain, editDomainRedirects, def {redirects?.invalidShortUrlRedirect ?? } + + +