Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions labextension/src/widgets/LeftPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ export class KubeflowKaleLeftPanel extends React.Component<IProps, IState> {
<InlineCellsMetadata
onMetadataEnable={this.onMetadataEnable}
notebook={activeNotebook}
pipelineBaseImage={this.state.metadata.base_image}
/>
)}
</div>
Expand Down
30 changes: 23 additions & 7 deletions labextension/src/widgets/cell-metadata/CellMetadataEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export const RESERVED_CELL_NAMES_CHIP_COLOR: { [id: string]: string } = {
functions: 'a32626',
};

export const DEFAULT_BASE_IMAGE = 'python:3.12';

const STEP_NAME_ERROR_MSG = `Step name must consist of lower case alphanumeric
characters or '_', and can not start with a digit.`;

Expand All @@ -74,6 +76,7 @@ export interface IProps {
limits?: { [id: string]: string };
// Base image for this step
baseImage?: string;
pipelineBaseImage?: string;
}

// this stores the name of a block and its color (form the name hash)
Expand Down Expand Up @@ -459,14 +462,27 @@ export class CellMetadataEditor extends React.Component<IProps, IState> {
)}

{cellType === 'step' ? (
<Input
label={'Base Image'}
updateValue={this.updateBaseImage}
value={this.props.baseImage || ''}
placeholder="e.g., python:3.11"
<Button
variant="outlined"
style={{ width: '25%' }}
/>
size="small"
disabled
style={{
textTransform: 'none',
minWidth: '150px',
backgroundColor: '#f5f5f5',
borderColor: '#1976d2',
color: '#333',
opacity: 1,
marginRight: '8px',
}}
title="Base Image for this step"
>
Base Image: 🐳{' '}
{this.props.baseImage ||
this.props.pipelineBaseImage ||
DEFAULT_BASE_IMAGE}
{!this.props.baseImage ? ' (default)' : ''}
</Button>
) : (
''
)}
Expand Down
2 changes: 2 additions & 0 deletions labextension/src/widgets/cell-metadata/InlineCellMetadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { createPortal } from 'react-dom';
interface IProps {
notebook: NotebookPanel;
onMetadataEnable: (isEnabled: boolean) => void;
pipelineBaseImage?: string;
}

type Editors = { [index: string]: EditorProps };
Expand Down Expand Up @@ -280,6 +281,7 @@ export class InlineCellsMetadata extends React.Component<IProps, IState> {
baseImage={tags.baseImage}
previousBlockName={previousBlockName}
cellIndex={index}
pipelineBaseImage={this.props.pipelineBaseImage}
/>,
metadataParent,
);
Expand Down
17 changes: 12 additions & 5 deletions labextension/src/widgets/cell-metadata/InlineMetadata.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import ColorUtils from '../../lib/ColorUtils';
import {
RESERVED_CELL_NAMES,
RESERVED_CELL_NAMES_HELP_TEXT,
DEFAULT_BASE_IMAGE,
} from './CellMetadataEditor';
import EditIcon from '@mui/icons-material/Edit';
import { CellMetadataContext } from '../../lib/CellMetadataContext';
Expand All @@ -30,6 +31,7 @@ interface IProps {
baseImage?: string;
cellElement: any;
cellIndex: number;
pipelineBaseImage?: string;
}

interface IState {
Expand Down Expand Up @@ -228,12 +230,17 @@ export class InlineMetadata extends React.Component<IProps, IState> {
}

createBaseImageText() {
return this.props.baseImage ? (
const effectiveImage =
this.props.baseImage ||
this.props.pipelineBaseImage ||
DEFAULT_BASE_IMAGE;
const isDefault = !this.props.baseImage;

return (
<p style={{ fontStyle: 'italic', marginLeft: '10px' }}>
Base Image: {this.props.baseImage}
Base Image: {effectiveImage}
{isDefault ? ' (default)' : ''}
</p>
) : (
''
);
}

Expand Down Expand Up @@ -275,8 +282,8 @@ export class InlineMetadata extends React.Component<IProps, IState> {
) : null}
{this.state.dependencies}

{this.createBaseImageText()}
{this.createLimitsText()}
{this.createBaseImageText()}
</>
);

Expand Down