mirror of
https://github.com/maelgangloff/domain-watchdog.git
synced 2025-12-29 16:15:04 +00:00
feat: color domain names about to expire
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import {Card, Divider, Space, Table, Tag, Tooltip} from "antd";
|
import {Card, Divider, Space, Table, Tag, Tooltip} from "antd";
|
||||||
import {DisconnectOutlined, LinkOutlined} from "@ant-design/icons";
|
import {ClockCircleOutlined, DeleteOutlined, DisconnectOutlined, LinkOutlined} from "@ant-design/icons";
|
||||||
import {t} from "ttag";
|
import {t} from "ttag";
|
||||||
import {ViewDiagramWatchlistButton} from "./diagram/ViewDiagramWatchlistButton";
|
import {ViewDiagramWatchlistButton} from "./diagram/ViewDiagramWatchlistButton";
|
||||||
import {UpdateWatchlistButton} from "./UpdateWatchlistButton";
|
import {UpdateWatchlistButton} from "./UpdateWatchlistButton";
|
||||||
@@ -78,7 +78,17 @@ export function WatchlistCard({watchlist, onUpdateWatchlist, connectors, onDelet
|
|||||||
pagination={false}
|
pagination={false}
|
||||||
style={{width: '100%'}}
|
style={{width: '100%'}}
|
||||||
dataSource={[{
|
dataSource={[{
|
||||||
domains: watchlist.domains.map(d => <Tag>{punycode.toUnicode(d.ldhName)}</Tag>),
|
domains: watchlist.domains.map(d => <Tag
|
||||||
|
color={
|
||||||
|
d.deleted ? 'red' : // If the domain is deleted
|
||||||
|
d.status.includes('redemption period') ? 'yellow' :
|
||||||
|
d.status.includes('pending delete') ? 'orange' : 'default'
|
||||||
|
}
|
||||||
|
icon={
|
||||||
|
d.deleted ? <DeleteOutlined/> : // If the domain is deleted
|
||||||
|
d.status.includes('redemption period') ? <ClockCircleOutlined/> :
|
||||||
|
d.status.includes('pending delete') ? <DeleteOutlined/> : null
|
||||||
|
}>{punycode.toUnicode(d.ldhName)}</Tag>),
|
||||||
events: watchlist.triggers?.filter(t => t.action === 'email')
|
events: watchlist.triggers?.filter(t => t.action === 'email')
|
||||||
.map(t => <Tooltip
|
.map(t => <Tooltip
|
||||||
title={t.event in rdapEventDetailTranslated ? rdapEventDetailTranslated[t.event as keyof typeof rdapEventDetailTranslated] : undefined}>
|
title={t.event in rdapEventDetailTranslated ? rdapEventDetailTranslated[t.event as keyof typeof rdapEventDetailTranslated] : undefined}>
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ import {AimOutlined} from "@ant-design/icons";
|
|||||||
export type Watchlist = {
|
export type Watchlist = {
|
||||||
name?: string
|
name?: string
|
||||||
token: string,
|
token: string,
|
||||||
domains: { ldhName: string }[],
|
domains: { ldhName: string, deleted: boolean, status: string[] }[],
|
||||||
triggers?: { event: EventAction, action: string }[],
|
triggers?: { event: EventAction, action: string }[],
|
||||||
dsn?: string[]
|
dsn?: string[]
|
||||||
connector?: {
|
connector?: {
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ class Domain
|
|||||||
private Collection $domainEntities;
|
private Collection $domainEntities;
|
||||||
|
|
||||||
#[ORM\Column(type: Types::SIMPLE_ARRAY, nullable: true)]
|
#[ORM\Column(type: Types::SIMPLE_ARRAY, nullable: true)]
|
||||||
#[Groups(['domain:item', 'domain:list'])]
|
#[Groups(['domain:item', 'domain:list', 'watchlist:item', 'watchlist:list'])]
|
||||||
private array $status = [];
|
private array $status = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -103,7 +103,7 @@ class Domain
|
|||||||
private ?Tld $tld = null;
|
private ?Tld $tld = null;
|
||||||
|
|
||||||
#[ORM\Column(nullable: false)]
|
#[ORM\Column(nullable: false)]
|
||||||
#[Groups(['domain:item', 'domain:list'])]
|
#[Groups(['domain:item', 'domain:list', 'watchlist:item', 'watchlist:list'])]
|
||||||
private ?bool $deleted;
|
private ?bool $deleted;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -375,8 +375,8 @@ class Domain
|
|||||||
return $this->getUpdatedAt()
|
return $this->getUpdatedAt()
|
||||||
->diff(new \DateTimeImmutable())->days >= 7
|
->diff(new \DateTimeImmutable())->days >= 7
|
||||||
|| (($fromUser || ($this->getUpdatedAt()
|
|| (($fromUser || ($this->getUpdatedAt()
|
||||||
->diff(new \DateTimeImmutable())->h * 60 + $this->getUpdatedAt()
|
->diff(new \DateTimeImmutable())->h * 60 + $this->getUpdatedAt()
|
||||||
->diff(new \DateTimeImmutable())->i) >= 50)
|
->diff(new \DateTimeImmutable())->i) >= 50)
|
||||||
&& $this->isToBeWatchClosely())
|
&& $this->isToBeWatchClosely())
|
||||||
|
|
||||||
|| (count(array_intersect($this->getStatus(), ['auto renew period', 'client hold', 'server hold'])) > 0
|
|| (count(array_intersect($this->getStatus(), ['auto renew period', 'client hold', 'server hold'])) > 0
|
||||||
|
|||||||
Reference in New Issue
Block a user