Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement/artesca 6720 format change #4305

Merged
merged 2 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
4 changes: 2 additions & 2 deletions ui/src/components/NodePagePodsTab.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const mockUseSelector = useSelector as jest.Mock;

const mockResult = (numContainerRunning: number, status = 'Running') => ({
name: 'test-pod',
age: '4d2h',
age: Date.now() - 4 * 60 * 60 * 1000,
namespace: 'xcore',
status: {
status,
Expand All @@ -29,7 +29,7 @@ const statusCriticalRGB = 'rgb(232, 72, 85)';

const selectors = {
podName: () => screen.getByText('test-pod'),
podAge: () => screen.getByText('4d2h'),
podAge: () => screen.getByText('4h'),
podNamespace: () => screen.getByText('xcore'),
podStatus: (status: string) => screen.getByText(status),
};
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