Skip to content

Commit

Permalink
add second to Date for Alerts, improve sorting for Pods tabs by forma…
Browse files Browse the repository at this point in the history
…tting directly in Cell
  • Loading branch information
JeanMarcMilletScality committed Apr 9, 2024
1 parent ced71e6 commit 460e699
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
7 changes: 6 additions & 1 deletion ui/src/components/AlertsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ const AlertsTab = ({
width: '7rem',
},
Cell: ({ value }) => {
return <FormattedDateTime value={new Date(value)} format="date-time" />;
return (
<FormattedDateTime
value={new Date(value)}
format="date-time-second"
/>
);
},
},
];
Expand Down
6 changes: 5 additions & 1 deletion ui/src/components/NodePagePodsTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { Table } from '@scality/core-ui/dist/next';
import { padding, spacing } from '@scality/core-ui/dist/style/theme';
import { NodeTab } from './style/CommonLayoutStyle';
import { TooltipContent } from './TableRow';
import { fromMilliSectoAge } from '../services/utils';
import {
STATUS_RUNNING,
STATUS_PENDING,
Expand Down Expand Up @@ -45,7 +46,7 @@ const StatusText = styled.div`
} else if (status === STATUS_FAILED || status === STATUS_UNKNOWN) {
return props.theme.statusCritical;
}
}}};
}};
`;
const ExternalLink = styled.a`
color: ${(props) => props.theme.textSecondary};
Expand Down Expand Up @@ -112,6 +113,9 @@ const NodePagePodsTab = React.memo((props) => {
maxWidth: '5rem',
marginRight: spacing.sp8,
},
Cell: ({ value }) => {
return fromMilliSectoAge(Date.now() - value);
},
},
{
Header: 'Namespace',
Expand Down
5 changes: 4 additions & 1 deletion ui/src/containers/AlertPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,10 @@ export default function AlertPage() {
marginRight: spacing.sp12,
},
Cell: (cell) => (
<FormattedDateTime value={new Date(cell.value)} format="date-time" />
<FormattedDateTime
value={new Date(cell.value)}
format="date-time-second"
/>
),
},
],
Expand Down
3 changes: 1 addition & 2 deletions ui/src/services/PodUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ export const getPodsListData = (nodeName, pods) => {
const podsList = pods?.filter((pod) => pod.nodeName === nodeName);
return (
podsList?.map((pod) => {
// @ts-expect-error - FIXME when you are working on it
const age = fromMilliSectoAge(new Date() - pod.startTime);
const age = new Date(pod.startTime).getTime();
const numContainer = pod?.containerStatuses?.length ?? 0;
const numContainerRunning =
pod?.containerStatuses?.filter((container) => container.ready === true)
Expand Down

0 comments on commit 460e699

Please sign in to comment.