Skip to content

Port server name fix to release #9970

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@
([#9701](https://github.com/Microsoft/vscode-python/issues/9701))

### Fixes

1. Correct the server and kernel text for when not connected to a server.
([#9933](https://github.com/Microsoft/vscode-python/issues/9933))
1. Make sure to clear variable list on restart kernel.
([#9740](https://github.com/Microsoft/vscode-python/issues/9740))
1. Use the autoStart server when available.
Expand Down
1 change: 1 addition & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@
"DataScience.noRowsInDataViewer": "No rows match current filter",
"DataScience.jupyterServer": "Jupyter Server",
"DataScience.noKernel": "No Kernel",
"DataScience.serverNotStarted": "Not Started",
"DataScience.localJupyterServer": "local",
"DataScience.pandasTooOldForViewingFormat": "Python package 'pandas' is version {0}. Version 0.20 or greater is required for viewing data.",
"DataScience.pandasRequiredForViewing": "Python package 'pandas' is required for viewing data.",
Expand Down
1 change: 1 addition & 0 deletions src/client/common/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@ export namespace DataScience {
export const noRowsInDataViewer = localize('DataScience.noRowsInDataViewer', 'No rows match current filter');
export const jupyterServer = localize('DataScience.jupyterServer', 'Jupyter Server');
export const noKernel = localize('DataScience.noKernel', 'No Kernel');
export const serverNotStarted = localize('DataScience.serverNotStarted', 'Not Started');
export const selectKernel = localize('DataScience.selectKernel', 'Select a Kernel');
export const selectDifferentKernel = localize('DataScience.selectDifferentKernel', 'Select a different Kernel');
export const selectDifferentJupyterInterpreter = localize('DataScience.selectDifferentJupyterInterpreter', 'Select a different Interpreter');
Expand Down
27 changes: 20 additions & 7 deletions src/datascience-ui/interactive-common/kernelSelection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ export class KernelSelection extends React.Component<IKernelSelectionProps> {
const displayNameTextWidth: React.CSSProperties = {
maxWidth: this.getMaxWidth(displayNameTextSize)
};
const kernelSelectionClass = this.isKernelSelectionAllowed
? 'kernel-status-section kernel-status-section-hoverable kernel-status-status'
: 'kernel-status-section kernel-status-status';

return (
<div className="kernel-status" style={dynamicFont}>
<div className="kernel-status-section kernel-status-server" style={serverTextWidth} role="button">
Expand All @@ -53,19 +51,34 @@ export class KernelSelection extends React.Component<IKernelSelectionProps> {
<Image baseTheme={this.props.baseTheme} class="image-button-image kernel-status-icon" image={this.getIcon()} />
</div>
<div className="kernel-status-divider" />
<div className={kernelSelectionClass} style={displayNameTextWidth} onClick={this.selectKernel} role="button">
{this.props.kernel.displayName}: {this.props.kernel.jupyterServerStatus}
</div>
{this.renderKernelStatus(displayNameTextWidth)}
</div>
);
}

private renderKernelStatus(displayNameTextWidth: React.CSSProperties) {
if (this.isKernelSelectionAllowed) {
return (
<div className="kernel-status-section kernel-status-section-hoverable kernel-status-status" style={displayNameTextWidth} onClick={this.selectKernel} role="button">
{this.props.kernel.displayName}: {this.props.kernel.jupyterServerStatus}
</div>
);
} else {
return (
<div className="kernel-status-section kernel-status-status" style={displayNameTextWidth}>
{getLocString('DataScience.noKernel', 'No Kernel')}
</div>
);
}
}

private selectKernel() {
if (this.isKernelSelectionAllowed) {
this.props.selectKernel();
}
}
private getIcon(): ImageName {
return this.props.kernel.localizedUri === getLocString('DataScience.noKernel', 'No Kernel') ? ImageName.JupyterServerDisconnected : ImageName.JupyterServerConnected;
return this.props.kernel.jupyterServerStatus === ServerStatus.NotStarted ? ImageName.JupyterServerDisconnected : ImageName.JupyterServerConnected;
}

private getMaxWidth(charLenght: number): string {
Expand Down
4 changes: 2 additions & 2 deletions src/datascience-ui/interactive-common/redux/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ function generateDefaultState(skipDefault: boolean, testMode: boolean, baseTheme
monacoReady: testMode, // When testing, monaco starts out ready
loaded: false,
kernel: {
displayName: 'Python',
localizedUri: getLocString('DataScience.noKernel', 'No Kernel'),
displayName: getLocString('DataScience.noKernel', 'No Kernel'),
localizedUri: getLocString('DataScience.serverNotStarted', 'Not Started'),
jupyterServerStatus: ServerStatus.NotStarted
},
settings: testMode ? getDefaultSettings() : undefined, // When testing, we don't send (or wait) for the real settings.
Expand Down