Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/candidate-9.4.x' into candidate-…
Browse files Browse the repository at this point in the history
…9.6.x
  • Loading branch information
GordonSmith committed Oct 18, 2024
2 parents ff40b3c + 0dcdd6f commit 51dbbb7
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
14 changes: 12 additions & 2 deletions esp/src/src-react/components/Logs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CommandBar, ContextualMenuItemType, ICommandBarItemProps } from "@fluen
import { GetLogsExRequest, LogaccessService, LogType, TargetAudience, WsLogaccess } from "@hpcc-js/comms";
import { Level, scopedLogger } from "@hpcc-js/util";
import nlsHPCC from "src/nlsHPCC";
import { logColor, removeAllExcept, wuidToDate, wuidToTime } from "src/Utility";
import { formatDateString, logColor, removeAllExcept, timestampToDate, wuidToDate, wuidToTime } from "src/Utility";
import { useLogAccessInfo } from "../hooks/platform";
import { HolyGrail } from "../layouts/HolyGrail";
import { pushParams } from "../util/history";
Expand Down Expand Up @@ -133,7 +133,17 @@ export const Logs: React.FunctionComponent<LogsProps> = ({
}
});
const retVal = {
timestamp: { label: nlsHPCC.TimeStamp, width: 140, sortable: false, },
timestamp: {
label: nlsHPCC.TimeStamp, width: 140, sortable: false,
formatter: ts => {
if (ts) {
if (ts.indexOf(":") < 0) {
return timestampToDate(ts).toISOString();
}
return formatDateString(ts);
}
},
},
message: { label: nlsHPCC.Message, width: 600, sortable: false, },
components: { label: nlsHPCC.ContainerName, width: 150, sortable: false },
instance: { label: nlsHPCC.PodName, width: 150, sortable: false },
Expand Down
8 changes: 8 additions & 0 deletions esp/src/src/Utility.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1257,6 +1257,14 @@ export function timestampToDate(timestamp: number): Date {
return new Date(millis);
}

export function formatDateString(dateStr: string): string {
const matches = dateStr.match(/([0-9]{4}(?:-[0-9]{1,2})+)([T\s])((?:[0-9]{1,2}:)+[0-9]{1,2}\.[0-9]{1,3})(Z*)/);
if (matches) {
return `${matches[1]}T${matches[3]}${matches[4] ? matches[4] : "Z"}`;
}
return dateStr;
}

const theme = getTheme();
const { semanticColors } = theme;

Expand Down

0 comments on commit 51dbbb7

Please sign in to comment.