-
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.
Merge pull request #133351 from cockroachdb/blathers/backport-release…
…-24.3-133188 release-24.3: cluster-ui: misc v2 db pages styling adjustments
- Loading branch information
Showing
24 changed files
with
432 additions
and
250 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,10 @@ | |
.container { | ||
margin: 0.5rem; | ||
width: fit-content; | ||
min-width: 100px; | ||
&:hover { | ||
cursor: pointer; | ||
} | ||
} | ||
|
||
|
||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,7 +17,7 @@ | |
|
||
.title { | ||
a { | ||
font-size: inherit; | ||
font: inherit; | ||
color: inherit; | ||
} | ||
} |
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.