mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-17 17:55:42 +00:00
fix: explicit error message on connector delete
This commit is contained in:
parent
d7232dad62
commit
92106a15a2
@ -1,4 +1,4 @@
|
||||
import {Card, Divider, Popconfirm, theme, Typography} from "antd";
|
||||
import {Card, Divider, message, Popconfirm, theme, Typography} from "antd";
|
||||
import {t} from "ttag";
|
||||
import {DeleteFilled} from "@ant-design/icons";
|
||||
import React from "react";
|
||||
@ -11,17 +11,23 @@ export type ConnectorElement = Connector & { id: string, createdAt: string }
|
||||
|
||||
export function ConnectorsList({connectors, onDelete}: { connectors: ConnectorElement[], onDelete: () => void }) {
|
||||
const {token} = useToken()
|
||||
const [messageApi, contextHolder] = message.useMessage()
|
||||
|
||||
const onConnectorDelete = (connector: ConnectorElement) => deleteConnector(connector.id)
|
||||
.then(onDelete)
|
||||
.catch(() => messageApi.error(t`An error occurred while deleting the Connector. Make sure it is not used in any Watchlist`))
|
||||
|
||||
return <>
|
||||
{connectors.map(connector =>
|
||||
<>
|
||||
{contextHolder}
|
||||
<Card hoverable title={<Typography.Text
|
||||
title={new Date(connector.createdAt).toLocaleString()}>{t`Connector ${connector.provider}`}</Typography.Text>}
|
||||
size='small'
|
||||
style={{width: '100%'}}
|
||||
extra={<Popconfirm title={t`Delete the Connector`}
|
||||
description={t`Are you sure to delete this Connector?`}
|
||||
onConfirm={() => deleteConnector(connector.id).then(onDelete)}
|
||||
onConfirm={() => onConnectorDelete(connector)}
|
||||
okText={t`Yes`}
|
||||
cancelText={t`No`}
|
||||
><DeleteFilled style={{color: token.colorError}}/></Popconfirm>}>
|
||||
|
||||
@ -213,25 +213,31 @@ msgstr ""
|
||||
msgid "Reset"
|
||||
msgstr ""
|
||||
|
||||
#: assets/components/tracking/connector/ConnectorsList.tsx:19
|
||||
#: assets/components/tracking/connector/ConnectorsList.tsx:18
|
||||
msgid ""
|
||||
"An error occurred while deleting the Connector. Make sure it is not used in "
|
||||
"any Watchlist"
|
||||
msgstr ""
|
||||
|
||||
#: assets/components/tracking/connector/ConnectorsList.tsx:25
|
||||
#, javascript-format
|
||||
msgid "Connector ${ connector.provider }"
|
||||
msgstr ""
|
||||
|
||||
#: assets/components/tracking/connector/ConnectorsList.tsx:22
|
||||
#: assets/components/tracking/connector/ConnectorsList.tsx:28
|
||||
msgid "Delete the Connector"
|
||||
msgstr ""
|
||||
|
||||
#: assets/components/tracking/connector/ConnectorsList.tsx:23
|
||||
#: assets/components/tracking/connector/ConnectorsList.tsx:29
|
||||
msgid "Are you sure to delete this Connector?"
|
||||
msgstr ""
|
||||
|
||||
#: assets/components/tracking/connector/ConnectorsList.tsx:25
|
||||
#: assets/components/tracking/connector/ConnectorsList.tsx:31
|
||||
#: assets/components/tracking/watchlist/DeleteWatchlistButton.tsx:15
|
||||
msgid "Yes"
|
||||
msgstr ""
|
||||
|
||||
#: assets/components/tracking/connector/ConnectorsList.tsx:26
|
||||
#: assets/components/tracking/connector/ConnectorsList.tsx:32
|
||||
#: assets/components/tracking/watchlist/DeleteWatchlistButton.tsx:16
|
||||
msgid "No"
|
||||
msgstr ""
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user