Skip to content

Commit

Permalink
Minor kernel picker fixes (for #13424)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne committed May 15, 2023
1 parent e0ff042 commit b2415bb
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/kernels/jupyter/finder/remoteKernelFinderController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import { KernelFinder } from '../../kernelFinder';
import { IExtensionSyncActivationService } from '../../../platform/activation/types';
import { RemoteKernelFinder } from './remoteKernelFinder';
import { ContributedKernelFinderKind } from '../../internalTypes';
import * as localize from '../../../platform/common/utils/localize';
import { RemoteKernelSpecsCacheKey } from '../../common/commonFinder';
import { Settings } from '../../../platform/common/constants';
import { JupyterConnection } from '../connection/jupyterConnection';
Expand Down Expand Up @@ -73,7 +72,7 @@ export class RemoteKernelFinderController implements IExtensionSyncActivationSer
if (!this.serverFinderMapping.has(serverUri.serverId)) {
const finder = new RemoteKernelFinder(
`${ContributedKernelFinderKind.Remote}-${serverUri.serverId}`,
localize.DataScience.universalRemoteKernelFinderDisplayName(serverUri.displayName || serverUri.uri),
serverUri.displayName || serverUri.uri,
`${RemoteKernelSpecsCacheKey}-${serverUri.serverId}`,
this.jupyterSessionManagerFactory,
this.extensionChecker,
Expand Down
5 changes: 4 additions & 1 deletion src/kernels/jupyter/jupyterUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,10 @@ export function createRemoteConnectionInfo(
workingDirectory: serverUri?.workingDirectory,
// For remote jupyter servers that are managed by us, we can provide the auth header.
// Its crucial this is set to undefined, else password retrieval will not be attempted.
getAuthHeader: serverUri && !serverId.startsWith('_builtin') ? () => serverUri?.authorizationHeader : undefined,
getAuthHeader:
serverUri && !serverId.startsWith('_builtin') && !serverUri?.authorizationHeader
? () => serverUri?.authorizationHeader
: undefined,
getWebsocketProtocols:
serverUri && !serverId.startsWith('_builtin') ? () => serverUri?.webSocketProtocols || [] : () => [],
url: uri
Expand Down
4 changes: 3 additions & 1 deletion src/kernels/jupyter/session/jupyterRequestCreator.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ export class JupyterRequestCreator implements IJupyterRequestCreator {
}
}

return (getAuthHeader ? AuthorizingRequest : nodeFetch.Request) as any;
return (
getAuthHeader && Object.keys(getAuthHeader() || {}).length ? AuthorizingRequest : nodeFetch.Request
) as any;
}

public getWebsocketCtor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,7 @@ export class NotebookKernelSourceSelector implements INotebookKernelSourceSelect
provider: provider,
type: KernelFinderEntityQuickPickType.UriProviderQuickPick,
description: undefined,
originalItem: i,
detail: provider.displayName
originalItem: i
};
}
);
Expand Down
1 change: 0 additions & 1 deletion src/platform/common/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,6 @@ export namespace DataScience {
export const UserJupyterServerUrlProviderDisplayName = l10n.t('Existing Jupyter Server...');
export const UserJupyterServerUrlProviderDetail = l10n.t('Connect to an existing Jupyter Server');
export const UserJupyterServerUrlAlreadyExistError = l10n.t('A Jupyter Server with this URL already exists');
export const universalRemoteKernelFinderDisplayName = (serverName: string) => l10n.t('Remote - {0}', serverName);
export const remoteKernelFinderDisplayName = l10n.t('Current Remote');
export const kernelPickerSelectKernelTitle = l10n.t('Select Kernel');
export const kernelPickerSelectLocalKernelSpecTitle = l10n.t('Select a Jupyter Kernel');
Expand Down

0 comments on commit b2415bb

Please sign in to comment.