Skip to content

Commit

Permalink
Merge pull request #83114 from cockroachdb/blathers/backport-release-…
Browse files Browse the repository at this point in the history
…22.1-83110

release-22.1: ui: fix last execution timestamp
  • Loading branch information
maryliag authored Jun 21, 2022
2 parents 35f2b32 + 312902e commit d9079c1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
longToInt,
TimestampToMoment,
RenderCount,
DATE_FORMAT_24_UTC,
} from "../../util";

export type PlanHashStats = cockroach.server.serverpb.StatementDetailsResponse.ICollectedStatementGroupedByPlanHash;
Expand Down Expand Up @@ -150,7 +151,7 @@ export function makeExplainPlanColumns(
title: planDetailsTableTitles.lastExecTime(),
cell: (item: PlanHashStats) =>
TimestampToMoment(item.stats.last_exec_timestamp).format(
"MMM DD, YYYY HH:MM",
DATE_FORMAT_24_UTC,
),
sort: (item: PlanHashStats) =>
TimestampToMoment(item.stats.last_exec_timestamp).unix(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ import {
appAttr,
appNamesAttr,
RenderCount,
TimestampToMoment,
DATE_FORMAT_24_UTC,
} from "src/util";
import { Loading } from "src/loading";
import { Button } from "src/button";
Expand All @@ -56,7 +58,6 @@ import styles from "./statementDetails.module.scss";
import { commonStyles } from "src/common";
import { NodeSummaryStats } from "../nodes";
import { UIConfigState } from "../store";
import moment from "moment";
import { StatementDetailsRequest } from "src/api/statementsApi";
import {
TimeScale,
Expand Down Expand Up @@ -609,9 +610,8 @@ export class StatementDetails extends React.Component<
const duration = (v: number) => Duration(v * 1e9);
const lastExec =
stats.last_exec_timestamp &&
moment(stats.last_exec_timestamp.seconds.low * 1e3).format(
"MMM DD, YYYY HH:MM",
);
TimestampToMoment(stats.last_exec_timestamp).format(DATE_FORMAT_24_UTC);

const statementSampled = stats.exec_stats.count > Long.fromNumber(0);
const unavailableTooltip = !statementSampled && (
<Tooltip
Expand Down
1 change: 1 addition & 0 deletions pkg/ui/workspaces/cluster-ui/src/util/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ export const DurationFitScale = (scale: string) => (
};

export const DATE_FORMAT = "MMM DD, YYYY [at] H:mm";
export const DATE_FORMAT_24_UTC = "MMM DD, YYYY [at] HH:mm UTC";

export function RenderCount(yesCount: Long, totalCount: Long): string {
if (longToInt(yesCount) == 0) {
Expand Down

0 comments on commit d9079c1

Please sign in to comment.