-
Notifications
You must be signed in to change notification settings - Fork 124
feat: Failover History table #1076
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
adhityamamallan
merged 6 commits into
cadence-workflow:master
from
adhityamamallan:failover-table
Nov 14, 2025
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
256aea2
failover history table
adhityamamallan 18f01b3
Add more changes
adhityamamallan 3a34dd1
update fixtures
adhityamamallan 2dd7727
new changes
adhityamamallan 6f402ee
Update src/views/domain-page/config/domain-page-failovers-table.confi…
adhityamamallan 4bb7418
Merge branch 'master' into failover-table
adhityamamallan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add more changes
Signed-off-by: Adhitya Mamallan <adhitya.mamallan@uber.com>
- Loading branch information
commit 18f01b38ea09d104c78a2c9e56cc10baddc8daea
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
10 changes: 6 additions & 4 deletions
10
src/views/domain-page/config/domain-page-failovers-table-active-active.config.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...main-page/domain-page-failover-active-active/domain-page-failover-active-active.styles.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { styled as createStyled, type Theme } from 'baseui'; | ||
|
|
||
| export const styled = { | ||
| FailoverContainer: createStyled('div', ({ $theme }: { $theme: Theme }) => ({ | ||
| display: 'flex', | ||
| gap: $theme.sizing.scale600, | ||
| alignItems: 'baseline', | ||
| })), | ||
| ClusterFailoverContainer: createStyled( | ||
| 'div', | ||
| ({ $theme }: { $theme: Theme }) => ({ | ||
| display: 'flex', | ||
| alignItems: 'baseline', | ||
| gap: $theme.sizing.scale300, | ||
| }) | ||
| ), | ||
| ClusterAttributeLabel: createStyled( | ||
| 'div', | ||
| ({ $theme }: { $theme: Theme }) => ({ | ||
| ...$theme.typography.LabelSmall, | ||
| }) | ||
| ), | ||
| }; |
71 changes: 71 additions & 0 deletions
71
...ews/domain-page/domain-page-failover-active-active/domain-page-failover-active-active.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import { useMemo } from 'react'; | ||
|
|
||
| import { Button } from 'baseui/button'; | ||
| import { MdVisibility } from 'react-icons/md'; | ||
|
|
||
| import usePageQueryParams from '@/hooks/use-page-query-params/use-page-query-params'; | ||
|
|
||
| import domainPageQueryParamsConfig from '../config/domain-page-query-params.config'; | ||
| import DomainPageFailoverSingleCluster from '../domain-page-failover-single-cluster/domain-page-failover-single-cluster'; | ||
| import { PRIMARY_CLUSTER_SCOPE } from '../domain-page-failovers/domain-page-failovers.constants'; | ||
| import clusterFailoverMatchesAttribute from '../helpers/cluster-failover-matches-attribute'; | ||
|
|
||
| import { styled } from './domain-page-failover-active-active.styles'; | ||
| import { type Props } from './domain-page-failover-active-active.types'; | ||
|
|
||
| export default function DomainPageFailoverActiveActive({ | ||
| failoverEvent, | ||
| }: Props) { | ||
| const [{ clusterAttributeScope, clusterAttributeValue }] = usePageQueryParams( | ||
| domainPageQueryParamsConfig | ||
| ); | ||
|
|
||
| const clusterFailoverForMaybeSelectedAttribute = useMemo( | ||
| () => | ||
| failoverEvent.clusterFailovers.find((clusterFailover) => | ||
| clusterFailoverMatchesAttribute( | ||
| clusterFailover, | ||
| clusterAttributeScope, | ||
| clusterAttributeValue | ||
| ) | ||
| ), | ||
| [ | ||
| clusterAttributeScope, | ||
| clusterAttributeValue, | ||
| failoverEvent.clusterFailovers, | ||
| ] | ||
| ); | ||
|
|
||
| return ( | ||
| <styled.FailoverContainer> | ||
| {clusterFailoverForMaybeSelectedAttribute && ( | ||
| <styled.ClusterFailoverContainer> | ||
| <styled.ClusterAttributeLabel> | ||
| {clusterAttributeScope === PRIMARY_CLUSTER_SCOPE | ||
| ? 'Primary:' | ||
| : `${clusterAttributeScope} (${clusterAttributeValue}):`} | ||
| </styled.ClusterAttributeLabel> | ||
| <DomainPageFailoverSingleCluster | ||
| fromCluster={ | ||
| clusterFailoverForMaybeSelectedAttribute.fromCluster | ||
| ?.activeClusterName | ||
| } | ||
| toCluster={ | ||
| clusterFailoverForMaybeSelectedAttribute.toCluster | ||
| ?.activeClusterName | ||
| } | ||
| /> | ||
| </styled.ClusterFailoverContainer> | ||
| )} | ||
| <Button | ||
| size="mini" | ||
| kind="secondary" | ||
| shape="pill" | ||
| endEnhancer={<MdVisibility />} | ||
| // TODO: open the failover modal here on click | ||
| > | ||
| See more | ||
| </Button> | ||
| </styled.FailoverContainer> | ||
| ); | ||
| } |
5 changes: 5 additions & 0 deletions
5
...omain-page/domain-page-failover-active-active/domain-page-failover-active-active.types.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| import { type FailoverEvent } from '@/route-handlers/list-failover-history/list-failover-history.types'; | ||
|
|
||
| export type Props = { | ||
| failoverEvent: FailoverEvent; | ||
| }; |
17 changes: 17 additions & 0 deletions
17
...in-page/domain-page-failover-single-cluster/domain-page-failover-single-cluster.styles.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| import { type Theme } from 'baseui'; | ||
|
|
||
| import type { | ||
| StyletronCSSObject, | ||
| StyletronCSSObjectOf, | ||
| } from '@/hooks/use-styletron-classes'; | ||
|
|
||
| const cssStylesObj = { | ||
| failoverContainer: (theme: Theme) => ({ | ||
| display: 'flex', | ||
| gap: theme.sizing.scale400, | ||
| alignItems: 'center', | ||
| }), | ||
| } satisfies StyletronCSSObject; | ||
|
|
||
| export const cssStyles: StyletronCSSObjectOf<typeof cssStylesObj> = | ||
| cssStylesObj; |
23 changes: 23 additions & 0 deletions
23
...s/domain-page/domain-page-failover-single-cluster/domain-page-failover-single-cluster.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { MdArrowForward } from 'react-icons/md'; | ||
|
|
||
| import useStyletronClasses from '@/hooks/use-styletron-classes'; | ||
|
|
||
| import { cssStyles } from './domain-page-failover-single-cluster.styles'; | ||
| import { type Props } from './domain-page-failover-single-cluster.types'; | ||
|
|
||
| export default function DomainPageFailoverSingleCluster({ | ||
| fromCluster, | ||
| toCluster, | ||
| }: Props) { | ||
| const { cls, theme } = useStyletronClasses(cssStyles); | ||
|
|
||
| if (!fromCluster || !toCluster) return null; | ||
|
|
||
| return ( | ||
| <div className={cls.failoverContainer}> | ||
| {fromCluster} | ||
| <MdArrowForward color={theme.colors.contentSecondary} /> | ||
| {toCluster} | ||
| </div> | ||
| ); | ||
| } |
4 changes: 4 additions & 0 deletions
4
...ain-page/domain-page-failover-single-cluster/domain-page-failover-single-cluster.types.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| export type Props = { | ||
| fromCluster?: string; | ||
| toCluster?: string; | ||
| }; |
Empty file.
7 changes: 7 additions & 0 deletions
7
src/views/domain-page/domain-page-failovers/domain-page-failovers.styles.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| import { styled as createStyled, type Theme } from 'baseui'; | ||
|
|
||
| export const styled = { | ||
| FailoversContainer: createStyled('div', ({ $theme }: { $theme: Theme }) => ({ | ||
| paddingTop: $theme.sizing.scale950, | ||
| })), | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,14 +2,18 @@ | |
| import React from 'react'; | ||
|
|
||
| import Table from '@/components/table/table'; | ||
| import usePageQueryParams from '@/hooks/use-page-query-params/use-page-query-params'; | ||
| import isActiveActiveDomain from '@/views/shared/active-active/helpers/is-active-active-domain'; | ||
| import useSuspenseDomainDescription from '@/views/shared/hooks/use-domain-description/use-suspense-domain-description'; | ||
|
|
||
| import domainPageFailoversTableActiveActiveConfig from '../config/domain-page-failovers-table-active-active.config'; | ||
| import domainPageFailoversTableConfig from '../config/domain-page-failovers-table.config'; | ||
| import domainPageQueryParamsConfig from '../config/domain-page-query-params.config'; | ||
| import { type DomainPageTabContentProps } from '../domain-page-content/domain-page-content.types'; | ||
| import useDomainFailoverHistory from '../hooks/use-domain-failover-history/use-domain-failover-history'; | ||
|
|
||
| import { styled } from './domain-page-failovers.styles'; | ||
|
|
||
| export default function DomainPageFailovers({ | ||
| domain, | ||
| cluster, | ||
|
|
@@ -19,6 +23,12 @@ export default function DomainPageFailovers({ | |
| cluster, | ||
| }); | ||
|
|
||
| const isActiveActive = isActiveActiveDomain(domainDescription); | ||
|
|
||
| const [{ clusterAttributeScope, clusterAttributeValue }] = usePageQueryParams( | ||
| domainPageQueryParamsConfig | ||
| ); | ||
|
|
||
| const { | ||
| filteredFailoverEvents, | ||
| allFailoverEvents, | ||
|
|
@@ -31,26 +41,33 @@ export default function DomainPageFailovers({ | |
| domainName: domain, | ||
| domainId: domainDescription.id, | ||
| cluster, | ||
| // TODO: set and pass filters here, but only for AA domains | ||
| ...(isActiveActive | ||
| ? { | ||
| clusterAttributeScope, | ||
| clusterAttributeValue, | ||
| } | ||
| : {}), | ||
| }); | ||
|
|
||
| return ( | ||
| <Table | ||
| data={filteredFailoverEvents} | ||
| shouldShowResults={!isLoading && filteredFailoverEvents.length > 0} | ||
| endMessageProps={{ | ||
| kind: 'infinite-scroll', | ||
| hasData: allFailoverEvents.length > 0, | ||
| error, | ||
| fetchNextPage, | ||
| hasNextPage, | ||
| isFetchingNextPage, | ||
| }} | ||
| columns={ | ||
| isActiveActiveDomain(domainDescription) | ||
| ? domainPageFailoversTableActiveActiveConfig | ||
| : domainPageFailoversTableConfig | ||
| } | ||
| /> | ||
| <styled.FailoversContainer> | ||
| <Table | ||
| data={filteredFailoverEvents} | ||
| shouldShowResults={!isLoading && filteredFailoverEvents.length > 0} | ||
| endMessageProps={{ | ||
| kind: 'infinite-scroll', | ||
| hasData: allFailoverEvents.length > 0, | ||
| error, | ||
| fetchNextPage, | ||
| hasNextPage, | ||
| isFetchingNextPage, | ||
| }} | ||
| columns={ | ||
| isActiveActive | ||
| ? domainPageFailoversTableActiveActiveConfig | ||
| : domainPageFailoversTableConfig | ||
| } | ||
| /> | ||
| </styled.FailoversContainer> | ||
| ); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A few callouts.
|
||
| } | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.