Skip to content

Instantly share code, notes, and snippets.

@jesuino
Created October 22, 2025 18:59
Show Gist options
  • Select an option

  • Save jesuino/0c8bcdcd07a89845ef5c4912aadb6f63 to your computer and use it in GitHub Desktop.

Select an option

Save jesuino/0c8bcdcd07a89845ef5c4912aadb6f63 to your computer and use it in GitHub Desktop.

Revisions

  1. jesuino created this gist Oct 22, 2025.
    63 changes: 63 additions & 0 deletions fix_default_experiment.diff
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,63 @@
    diff --git a/labextension/src/widgets/LeftPanel.tsx b/labextension/src/widgets/LeftPanel.tsx
    index 27e55be..fcf3145 100644
    --- a/labextension/src/widgets/LeftPanel.tsx
    +++ b/labextension/src/widgets/LeftPanel.tsx
    @@ -34,6 +34,7 @@ import Commands from '../lib/Commands';
    import { PageConfig } from '@jupyterlab/coreutils';

    const KALE_NOTEBOOK_METADATA_KEY = 'kubeflow_notebook';
    +const DEFAULT_EXPERIMENT_NAME = 'Default';

    export interface IExperiment {
    id: string;
    @@ -80,8 +81,8 @@ export interface IKaleNotebookMetadata {

    export const DefaultState: IState = {
    metadata: {
    - experiment: { id: '', name: '' },
    - experiment_name: '',
    + experiment: { id: '', name: DEFAULT_EXPERIMENT_NAME },
    + experiment_name: DEFAULT_EXPERIMENT_NAME,
    pipeline_name: '',
    pipeline_description: '',
    docker_image: '',
    @@ -265,7 +266,7 @@ export class KubeflowKaleLeftPanel extends React.Component<IProps, IState> {

    // if the key exists in the notebook's metadata
    if (notebookMetadata) {
    - let experiment: IExperiment = { id: '', name: '' };
    + let experiment: IExperiment = { id: '', name: DEFAULT_EXPERIMENT_NAME };
    let experiment_name: string = '';
    if (notebookMetadata['experiment']) {
    experiment = {
    @@ -290,11 +291,19 @@ export class KubeflowKaleLeftPanel extends React.Component<IProps, IState> {
    this.resetState();
    }

    + if(experiment_name === '') {
    + experiment_name = DEFAULT_EXPERIMENT_NAME;
    + }
    +
    + if(experiment.name === '') {
    + experiment.name = DEFAULT_EXPERIMENT_NAME;
    + }
    +
    const metadata: IKaleNotebookMetadata = {
    ...notebookMetadata,
    experiment: experiment,
    experiment_name: experiment_name,
    - pipeline_name: notebookMetadata['pipeline_name'] || '',
    + pipeline_name: notebookMetadata['pipeline_name'] || notebook.title.label,
    pipeline_description: notebookMetadata['pipeline_description'] || '',
    docker_image:
    notebookMetadata['docker_image'] ||
    @@ -307,7 +316,8 @@ export class KubeflowKaleLeftPanel extends React.Component<IProps, IState> {
    } else {
    this.setState((prevState, props) => ({
    metadata: {
    - ...DefaultState.metadata
    + ...DefaultState.metadata,
    + pipeline_name: notebook.title.label.split(".")[0].toLowerCase()
    }
    }));
    }