Skip to content

Commit

Permalink
Merge pull request #1608 from christianvogt/server-events
Browse files Browse the repository at this point in the history
show event details when starting a new notebook server
  • Loading branch information
openshift-merge-robot authored Aug 17, 2023
2 parents c555422 + f699dce commit 0b041ae
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
6 changes: 5 additions & 1 deletion frontend/src/pages/projects/notebook/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ export const useNotebookStatus = (
const events = useWatchNotebookEvents(notebook.metadata.namespace, podUid, spawnInProgress);

const annotationTime = notebook?.metadata.annotations?.['notebooks.kubeflow.org/last-activity'];
const lastActivity = annotationTime ? new Date(annotationTime) : null;
const lastActivity = annotationTime
? new Date(annotationTime)
: spawnInProgress || podUid
? new Date(notebook.metadata.creationTimestamp ?? 0)
: null;

if (!lastActivity) {
// Notebook not started, we don't have a filter time, ignore
Expand Down
1 change: 1 addition & 0 deletions frontend/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ type K8sMetadata = {
uid?: string;
labels?: { [key: string]: string };
annotations?: { [key: string]: string };
creationTimestamp?: string;
};

/**
Expand Down
13 changes: 9 additions & 4 deletions frontend/src/utilities/notebookControllerUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,15 @@ export const useNotebookStatus = (
evt.involvedObject.uid === currentUserNotebookPodUID,
);

const lastActivity = useLastActivity(
open,
notebook?.metadata.annotations?.['notebooks.kubeflow.org/last-activity'],
);
const lastActivity =
useLastActivity(
open,
notebook?.metadata.annotations?.['notebooks.kubeflow.org/last-activity'],
) ||
(notebook && (spawnInProgress || isNotebookRunning)
? new Date(notebook.metadata.creationTimestamp ?? 0)
: null);

if (!lastActivity) {
// Notebook not started, we don't have a filter time, ignore
return [null, []];
Expand Down

0 comments on commit 0b041ae

Please sign in to comment.