Skip to content

Commit 682502f

Browse files
feat: Failover History table (#1076)
* Add table to display failover history of a domain, with support for both active-passive and active-active domains Signed-off-by: Adhitya Mamallan <[email protected]> Co-authored-by: Copilot <[email protected]>
1 parent 7082c65 commit 682502f

15 files changed

+873
-2
lines changed

src/views/domain-page/__fixtures__/domain-page-query-params.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,6 @@ export const mockDomainPageQueryParamsValues = {
2323
sortColumnArchival: 'startTime',
2424
sortOrderArchival: 'DESC',
2525
queryArchival: '',
26+
clusterAttributeScope: undefined,
27+
clusterAttributeValue: undefined,
2628
} as const satisfies PageQueryParamValues<typeof domainPageQueryParamsConfig>;
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { createElement } from 'react';
2+
3+
import { type FailoverEvent } from '@/route-handlers/list-failover-history/list-failover-history.types';
4+
5+
import DomainPageFailoverActiveActive from '../domain-page-failover-active-active/domain-page-failover-active-active';
6+
7+
import domainPageFailoversTableConfig from './domain-page-failovers-table.config';
8+
9+
const domainPageFailoversTableActiveActiveConfig = [
10+
...domainPageFailoversTableConfig.slice(0, 3),
11+
{
12+
...domainPageFailoversTableConfig[3],
13+
renderCell: (event: FailoverEvent) =>
14+
createElement(DomainPageFailoverActiveActive, { failoverEvent: event }),
15+
},
16+
];
17+
18+
export default domainPageFailoversTableActiveActiveConfig;
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { createElement } from 'react';
2+
3+
import FormattedDate from '@/components/formatted-date/formatted-date';
4+
import { type TableConfig } from '@/components/table/table.types';
5+
import { type FailoverEvent } from '@/route-handlers/list-failover-history/list-failover-history.types';
6+
import parseGrpcTimestamp from '@/utils/datetime/parse-grpc-timestamp';
7+
8+
import DomainPageFailoverSingleCluster from '../domain-page-failover-single-cluster/domain-page-failover-single-cluster';
9+
import { FAILOVER_TYPE_LABEL_MAP } from '../domain-page-failovers/domain-page-failovers.constants';
10+
11+
const domainPageFailoversTableConfig = [
12+
{
13+
name: 'Failover ID',
14+
id: 'failoverId',
15+
width: '35%',
16+
renderCell: (event: FailoverEvent) => event.id,
17+
},
18+
{
19+
name: 'Time',
20+
id: 'time',
21+
width: '15%',
22+
renderCell: (event: FailoverEvent) =>
23+
createElement(FormattedDate, {
24+
timestampMs: event.createdTime
25+
? parseGrpcTimestamp(event.createdTime)
26+
: null,
27+
}),
28+
},
29+
{
30+
name: 'Type',
31+
id: 'type',
32+
width: '10%',
33+
renderCell: (event: FailoverEvent) =>
34+
FAILOVER_TYPE_LABEL_MAP[event.failoverType],
35+
},
36+
{
37+
name: 'Failover Information',
38+
id: 'failoverInfo',
39+
width: '40%',
40+
renderCell: (event: FailoverEvent) =>
41+
createElement(DomainPageFailoverSingleCluster, {
42+
fromCluster: event.clusterFailovers[0]?.fromCluster?.activeClusterName,
43+
toCluster: event.clusterFailovers[0]?.toCluster?.activeClusterName,
44+
}),
45+
},
46+
] as const satisfies TableConfig<FailoverEvent>;
47+
48+
export default domainPageFailoversTableConfig;

src/views/domain-page/config/domain-page-query-params.config.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ const domainPageQueryParamsConfig: [
4141
PageQueryParam<'sortColumnArchival', string>,
4242
PageQueryParam<'sortOrderArchival', SortOrder>,
4343
PageQueryParam<'queryArchival', string>,
44+
// Failovers Tab query params
45+
PageQueryParam<'clusterAttributeScope', string | undefined>,
46+
PageQueryParam<'clusterAttributeValue', string | undefined>,
4447
] = [
4548
{
4649
key: 'inputType',
@@ -163,6 +166,14 @@ const domainPageQueryParamsConfig: [
163166
queryParamKey: 'aquery',
164167
defaultValue: '',
165168
},
169+
{
170+
key: 'clusterAttributeScope',
171+
queryParamKey: 'cs',
172+
},
173+
{
174+
key: 'clusterAttributeValue',
175+
queryParamKey: 'cv',
176+
},
166177
] as const;
167178

168179
export default domainPageQueryParamsConfig;

0 commit comments

Comments
 (0)