Skip to content

Commit

Permalink
Events are in correct order in workbench status progress (#3253)
Browse files Browse the repository at this point in the history
  • Loading branch information
pnaik1 authored Sep 26, 2024
1 parent 063d974 commit 3ec224f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,10 @@ const StartServerModal: React.FC<StartServerModalProps> = ({ open, spawnInProgre
<List isPlain isBordered tabIndex={0}>
{events
.slice()
.reverse()
.toSorted(
(a, b) =>
new Date(getEventTimestamp(b)).getTime() - new Date(getEventTimestamp(a)).getTime(),
)
.map((event, index) => (
<ListItem key={`notebook-event-${event.metadata.uid ?? index}`}>
{`${getEventTimestamp(event)} [${event.type}] ${event.message}`}
Expand Down
8 changes: 6 additions & 2 deletions frontend/src/pages/projects/notebook/StartNotebookModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { EventStatus, NotebookStatus } from '~/types';
import { EventKind } from '~/k8sTypes';
import NotebookRouteLink from './NotebookRouteLink';
import { NotebookState } from './types';
import { getEventFullMessage } from './utils';
import { getEventFullMessage, getEventTimestamp } from './utils';

type StartNotebookModalProps = {
isOpen: boolean;
Expand Down Expand Up @@ -164,7 +164,11 @@ const StartNotebookModal: React.FC<StartNotebookModalProps> = ({
<List isPlain isBordered data-id="event-logs">
{events
.slice()
.reverse()
.toSorted(
(a, b) =>
new Date(getEventTimestamp(b)).getTime() -
new Date(getEventTimestamp(a)).getTime(),
)
.map((event, index) => (
<ListItem key={`notebook-event-${event.metadata.uid ?? index}`}>
{getEventFullMessage(event)}
Expand Down

0 comments on commit 3ec224f

Please sign in to comment.