Skip to content

Commit 0b041ae

Browse files
Merge pull request opendatahub-io#1608 from christianvogt/server-events
show event details when starting a new notebook server
2 parents c555422 + f699dce commit 0b041ae

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

Diff for: frontend/src/pages/projects/notebook/utils.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,11 @@ export const useNotebookStatus = (
124124
const events = useWatchNotebookEvents(notebook.metadata.namespace, podUid, spawnInProgress);
125125

126126
const annotationTime = notebook?.metadata.annotations?.['notebooks.kubeflow.org/last-activity'];
127-
const lastActivity = annotationTime ? new Date(annotationTime) : null;
127+
const lastActivity = annotationTime
128+
? new Date(annotationTime)
129+
: spawnInProgress || podUid
130+
? new Date(notebook.metadata.creationTimestamp ?? 0)
131+
: null;
128132

129133
if (!lastActivity) {
130134
// Notebook not started, we don't have a filter time, ignore

Diff for: frontend/src/types.ts

+1
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ type K8sMetadata = {
284284
uid?: string;
285285
labels?: { [key: string]: string };
286286
annotations?: { [key: string]: string };
287+
creationTimestamp?: string;
287288
};
288289

289290
/**

Diff for: frontend/src/utilities/notebookControllerUtils.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -330,10 +330,15 @@ export const useNotebookStatus = (
330330
evt.involvedObject.uid === currentUserNotebookPodUID,
331331
);
332332

333-
const lastActivity = useLastActivity(
334-
open,
335-
notebook?.metadata.annotations?.['notebooks.kubeflow.org/last-activity'],
336-
);
333+
const lastActivity =
334+
useLastActivity(
335+
open,
336+
notebook?.metadata.annotations?.['notebooks.kubeflow.org/last-activity'],
337+
) ||
338+
(notebook && (spawnInProgress || isNotebookRunning)
339+
? new Date(notebook.metadata.creationTimestamp ?? 0)
340+
: null);
341+
337342
if (!lastActivity) {
338343
// Notebook not started, we don't have a filter time, ignore
339344
return [null, []];

0 commit comments

Comments
 (0)