-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
59 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
export enum Deployments { | ||
KUBEFLOW = 'KUBEFLOW', | ||
} | ||
|
||
export const KFP_FLAGS = { | ||
DEPLOYMENT: | ||
// tslint:disable-next-line:no-string-literal | ||
window && window['KFP_FLAGS'] && window['KFP_FLAGS']['DEPLOYMENT'] === Deployments.KUBEFLOW | ||
? Deployments.KUBEFLOW | ||
: undefined, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { KFP_FLAGS, Deployments } from './Flags'; | ||
import { logger } from './Utils'; | ||
|
||
declare global { | ||
interface Window { | ||
// Provided by: | ||
// 1. https://github.com/kubeflow/kubeflow/tree/master/components/centraldashboard#client-side-library | ||
// 2. /frontend/server/server.ts -> KUBEFLOW_CLIENT_PLACEHOLDER | ||
centraldashboard: any; | ||
} | ||
} | ||
|
||
export function init(): void { | ||
if (KFP_FLAGS.DEPLOYMENT !== Deployments.KUBEFLOW) { | ||
return; | ||
} | ||
|
||
try { | ||
// Init method will invoke the callback with the event handler instance | ||
// and a boolean indicating whether the page is iframed or not | ||
window.centraldashboard.CentralDashboardEventHandler.init((cdeh: any) => { | ||
// Binds a callback that gets invoked anytime the Dashboard's | ||
// namespace is changed | ||
cdeh.onNamespaceSelected = (namespace: string) => { | ||
// tslint:disable-next-line:no-console | ||
console.log('Namespace changed to', namespace); | ||
}; | ||
}); | ||
} catch (err) { | ||
logger.error('Failed to initialize central dashboard client', err); | ||
} | ||
} |