diff --git a/frontend/src/pages/projects/notebook/utils.ts b/frontend/src/pages/projects/notebook/utils.ts index 4619b959f7..5a361cbe20 100644 --- a/frontend/src/pages/projects/notebook/utils.ts +++ b/frontend/src/pages/projects/notebook/utils.ts @@ -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 diff --git a/frontend/src/types.ts b/frontend/src/types.ts index 75e6d1177a..4781bc9072 100644 --- a/frontend/src/types.ts +++ b/frontend/src/types.ts @@ -284,6 +284,7 @@ type K8sMetadata = { uid?: string; labels?: { [key: string]: string }; annotations?: { [key: string]: string }; + creationTimestamp?: string; }; /** diff --git a/frontend/src/utilities/notebookControllerUtils.ts b/frontend/src/utilities/notebookControllerUtils.ts index 00cf4976c3..98ad8aa954 100644 --- a/frontend/src/utilities/notebookControllerUtils.ts +++ b/frontend/src/utilities/notebookControllerUtils.ts @@ -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, []];