-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cluster-ui: misc v2 db pages styling adjustments
Misc formatting - Fix page heading font styling - Fix search bar on focus border being cut off - Add `database` suffix to breadcrumb for db details page - Format live data percentage by adding `live data` and `total` as suffixes to numerator / denom respectively - Don't show db and table breadcrumb as not found when data is still being loaded - Put reset index action in row outside / on top of table - Add spinner state to refresh button when cached data is refreshing - Disable drop index action on cloud Table last updated/refreshed message & tooltip: - Align data last refreshed time with page count - Move full timestamp in table metadata tooltip - Better error message formatting - Show job progress when running Grants - Remove "Grants" header Epic: CRDB-37558 Closes: #132595 Release note (ui change): In the v2 database and db details pages, the refresh button tooltip will now include the cache refresh progress when the job is running as well as when the update started.
- Loading branch information
Showing
21 changed files
with
426 additions
and
239 deletions.
There are no files selected for viewing
This file contains 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
28 changes: 28 additions & 0 deletions
28
pkg/ui/workspaces/cluster-ui/src/components/liveDataPercent/liveDataPercent.tsx
This file contains 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,28 @@ | ||
// Copyright 2024 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the CockroachDB Software License | ||
// included in the /LICENSE file. | ||
|
||
import { Row } from "antd"; | ||
import React from "react"; | ||
|
||
import { Bytes, Percentage } from "src/util"; | ||
|
||
type Props = { | ||
// Float between 0-1. | ||
liveBytes: number; | ||
totalBytes: number; | ||
}; | ||
|
||
export const LiveDataPercent: React.FC<Props> = ({ liveBytes, totalBytes }) => { | ||
return ( | ||
<div> | ||
<Row justify={"end"}> | ||
{totalBytes ? Percentage(liveBytes, totalBytes, 1) : "0.0%"} | ||
</Row> | ||
<Row justify={"end"}> | ||
{Bytes(liveBytes)} live data / {Bytes(totalBytes)} total | ||
</Row> | ||
</div> | ||
); | ||
}; |
This file contains 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 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
8 changes: 8 additions & 0 deletions
8
...s/cluster-ui/src/components/tableMetadataLastUpdated/tableMetadataJobProgress.module.scss
This file contains 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,8 @@ | ||
// Copyright 2024 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the CockroachDB Software License | ||
// included in the /LICENSE file. | ||
|
||
.progress-list { | ||
list-style-position: inside; | ||
} |
40 changes: 40 additions & 0 deletions
40
...orkspaces/cluster-ui/src/components/tableMetadataLastUpdated/tableMetadataJobProgress.tsx
This file contains 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,40 @@ | ||
// Copyright 2024 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the CockroachDB Software License | ||
// included in the /LICENSE file. | ||
|
||
import moment from "moment-timezone"; | ||
import React from "react"; | ||
|
||
import { Timestamp } from "src/timestamp"; | ||
import { DATE_WITH_SECONDS_FORMAT_24_TZ } from "src/util"; | ||
|
||
import styles from "./tableMetadataJobProgress.module.scss"; | ||
|
||
type Props = { | ||
jobStartedTime: moment.Moment; | ||
jobProgressFraction: number; // Between 0 and 1. | ||
}; | ||
|
||
// This message is meant to be displayed when the job is running. | ||
export const TableMetadataJobProgress: React.FC<Props> = ({ | ||
jobStartedTime, | ||
jobProgressFraction, | ||
}) => { | ||
const percentDone = Math.round(jobProgressFraction * 100); | ||
return ( | ||
<div> | ||
Refreshing data | ||
<ul className={styles["progress-list"]}> | ||
<li>{percentDone}% done</li> | ||
<li> | ||
Started at{" "} | ||
<Timestamp | ||
time={jobStartedTime} | ||
format={DATE_WITH_SECONDS_FORMAT_24_TZ} | ||
/> | ||
</li> | ||
</ul> | ||
</div> | ||
); | ||
}; |
This file contains 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
8 changes: 8 additions & 0 deletions
8
...ces/cluster-ui/src/components/tooltipMessages/tableMetadataLastUpdatedTooltip.module.scss
This file contains 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,8 @@ | ||
// Copyright 2024 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the CockroachDB Software License | ||
// included in the /LICENSE file. | ||
|
||
.table-metadata-tooltip-content { | ||
column-gap: 8px; | ||
} |
90 changes: 90 additions & 0 deletions
90
.../workspaces/cluster-ui/src/components/tooltipMessages/tableMetadataLastUpdatedTooltip.tsx
This file contains 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,90 @@ | ||
// Copyright 2024 The Cockroach Authors. | ||
// | ||
// Use of this software is governed by the CockroachDB Software License | ||
// included in the /LICENSE file. | ||
import { Icon } from "@cockroachlabs/ui-components"; | ||
import { Row } from "antd"; | ||
import moment from "moment-timezone"; | ||
import React from "react"; | ||
|
||
import { Timestamp } from "../../timestamp"; | ||
import { DATE_WITH_SECONDS_FORMAT_24_TZ } from "../../util"; | ||
import { Tooltip } from "../tooltip"; | ||
|
||
import styles from "./tableMetadataLastUpdatedTooltip.module.scss"; | ||
|
||
const TABLE_METADATA_LAST_UPDATED_HELP = | ||
"Data was last refreshed automatically (per cluster setting) or manually."; | ||
|
||
type Props = { | ||
timestamp?: moment.Moment | null; | ||
children: ( | ||
formattedRelativeTime: string, | ||
icon?: JSX.Element, | ||
) => React.ReactNode; | ||
errorMessage?: string; | ||
}; | ||
|
||
const formatErrorMessage = ( | ||
errorMessage: string | null, | ||
lastUpdatedTime: moment.Moment | null, | ||
) => { | ||
if (!errorMessage) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<> | ||
Last refresh failed to retrieve data about this table. The data shown is | ||
as of{" "} | ||
<Timestamp | ||
format={DATE_WITH_SECONDS_FORMAT_24_TZ} | ||
time={lastUpdatedTime} | ||
fallback={"Never"} | ||
/> | ||
. | ||
<br /> | ||
Last refresh error: {errorMessage} | ||
</> | ||
); | ||
}; | ||
|
||
export const TableMetadataLastUpdatedTooltip = ({ | ||
timestamp, | ||
errorMessage, | ||
children, | ||
}: Props) => { | ||
const durationText = timestamp?.fromNow() ?? "Never"; | ||
const icon = errorMessage ? ( | ||
<Icon fill={"warning"} iconName={"Caution"} /> | ||
) : ( | ||
<Icon fill="info" iconName={"InfoCircle"} /> | ||
); | ||
|
||
const formattedErr = formatErrorMessage(errorMessage, timestamp); | ||
return ( | ||
<Tooltip | ||
title={ | ||
<div> | ||
{formattedErr ?? ( | ||
<> | ||
{timestamp && ( | ||
<Timestamp | ||
format={DATE_WITH_SECONDS_FORMAT_24_TZ} | ||
time={timestamp} | ||
fallback={"Never"} | ||
/> | ||
)} | ||
<br /> | ||
{TABLE_METADATA_LAST_UPDATED_HELP} | ||
</> | ||
)} | ||
</div> | ||
} | ||
> | ||
<Row className={styles["table-metadata-tooltip-content"]} align="middle"> | ||
{children(durationText, icon)} | ||
</Row> | ||
</Tooltip> | ||
); | ||
}; |
This file contains 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 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
Oops, something went wrong.