mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Fix: proper sorting resources by age column (#2182)
* - fix: proper sorting for resource age column - use Date.now() instead of new Date().getTime() (#2141 follow-up) Signed-off-by: Roman <ixrock@gmail.com> * fix: proper bar-chart tooltip callback Signed-off-by: Roman <ixrock@gmail.com> * fix: sorting in cronjobs, more Date.now() replacements Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
1 parent
e87bb850fb
commit
82d8181938
31 files changed
+42
-40
No files matched your search
@@ -3,7 +3,7 @@ import merge from "lodash/merge";
|
||||
import moment from "moment";
|
||||
import Color from "color";
|
||||
import { observer } from "mobx-react";
|
||||
import { ChartData, ChartOptions, ChartPoint, Scriptable } from "chart.js";
|
||||
import { ChartData, ChartOptions, ChartPoint, ChartTooltipItem, Scriptable } from "chart.js";
|
||||
import { Chart, ChartKind, ChartProps } from "./chart";
|
||||
import { bytesToUnits, cssNames } from "../../utils";
|
||||
import { ZebraStripes } from "./zebra-stripes.plugin";
|
||||
@@ -115,12 +115,13 @@ export class BarChart extends React.Component<Props> {
|
||||
mode: "index",
|
||||
position: "cursor",
|
||||
callbacks: {
|
||||
title: tooltipItems => {
|
||||
const now = new Date().getTime();
|
||||
title([tooltip]: ChartTooltipItem[]) {
|
||||
const xLabel = tooltip?.xLabel;
|
||||
const skipLabel = xLabel == null || new Date(xLabel).getTime() > Date.now();
|
||||
|
||||
if (new Date(tooltipItems[0].xLabel).getTime() > now) return "";
|
||||
if (skipLabel) return "";
|
||||
|
||||
return `${tooltipItems[0].xLabel}`;
|
||||
return String(xLabel);
|
||||
},
|
||||
labelColor: ({ datasetIndex }) => {
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user