-
Notifications
You must be signed in to change notification settings - Fork 122
PositroNB: Restart kernel button #9898
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
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
5f55d86
add restart kernel button to positron notebooks
seeM f461b5f
ui changes as discussed
seeM 60d665a
check if uri instead
seeM 41d82b7
extract runtime status icon component
seeM 5ab527a
avoid initial run
seeM 342dcf4
wip checkpoint
seeM 783930a
wip: try custom modal
seeM 9e63471
helper notebook session type
seeM 6d1005a
refactor restart action, preparing for shutdown action
seeM f3236fb
add shutdown action
seeM 0b9873c
fix args for runtime notebook kernel commands
seeM 408f4b5
fix runtime kernel actions; add restart keybinding
seeM f4fd178
cleaning up
seeM cd60517
fix actions from kernel menu
seeM bedc6a9
Apply suggestions from code review
seeM 693a187
register status icons
seeM de82498
address review
seeM 6a71619
revert unused changes
seeM 8ab40eb
reuse func
seeM bc74bf4
use codicon themeicon
seeM f80bc81
fix colors
seeM 9c1e367
fix e2e tests
seeM 2d8a4e5
update e2e test to use context menu
midleman ed9c333
try native menu always
midleman 9704d61
Revert "try native menu always"
midleman File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
4 changes: 4 additions & 0 deletions
4
src/vs/workbench/contrib/positronConsole/browser/components/runtimeIcon.css
This file contains hidden or 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,4 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (C) 2025 Posit Software, PBC. All rights reserved. | ||
| * Licensed under the Elastic License 2.0. See LICENSE.txt for license information. | ||
| *--------------------------------------------------------------------------------------------*/ |
36 changes: 36 additions & 0 deletions
36
src/vs/workbench/contrib/positronConsole/browser/components/runtimeIcon.tsx
This file contains hidden or 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,36 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (C) 2025 Posit Software, PBC. All rights reserved. | ||
| * Licensed under the Elastic License 2.0. See LICENSE.txt for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| // CSS. | ||
| import './runtimeStatus.css'; | ||
|
|
||
| // React. | ||
| import React from 'react'; | ||
|
|
||
| // Other dependencies. | ||
| import { LanguageRuntimeSessionMode } from '../../../../services/languageRuntime/common/languageRuntimeService.js'; | ||
| import { Codicon } from '../../../../../base/common/codicons.js'; | ||
| import { ThemeIcon } from '../../../../../base/common/themables.js'; | ||
| import { positronClassNames } from '../../../../../base/common/positronUtilities.js'; | ||
|
|
||
| export interface RuntimeIconProps { | ||
| base64EncodedIconSvg: string | undefined; | ||
| sessionMode: LanguageRuntimeSessionMode; | ||
| } | ||
|
|
||
| export const RuntimeIcon = ({ base64EncodedIconSvg, sessionMode }: RuntimeIconProps) => { | ||
| const classNames = ['icon'] | ||
| if (sessionMode === LanguageRuntimeSessionMode.Notebook) { | ||
| classNames.push(...ThemeIcon.asClassNameArray(Codicon.notebook)); | ||
| return <span className={positronClassNames(...classNames)}></span>; | ||
| } | ||
| if (base64EncodedIconSvg === undefined) { | ||
| return null; | ||
| } | ||
| return <img | ||
| className={positronClassNames(...classNames)} | ||
| src={`data:image/svg+xml;base64,${base64EncodedIconSvg}`} | ||
| />; | ||
| }; |
4 changes: 4 additions & 0 deletions
4
src/vs/workbench/contrib/positronConsole/browser/components/runtimeStatus.css
This file contains hidden or 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,4 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (C) 2025 Posit Software, PBC. All rights reserved. | ||
| * Licensed under the Elastic License 2.0. See LICENSE.txt for license information. | ||
| *--------------------------------------------------------------------------------------------*/ |
71 changes: 71 additions & 0 deletions
71
src/vs/workbench/contrib/positronConsole/browser/components/runtimeStatus.tsx
This file contains hidden or 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,71 @@ | ||
| /*--------------------------------------------------------------------------------------------- | ||
| * Copyright (C) 2025 Posit Software, PBC. All rights reserved. | ||
| * Licensed under the Elastic License 2.0. See LICENSE.txt for license information. | ||
| *--------------------------------------------------------------------------------------------*/ | ||
|
|
||
| // CSS. | ||
| import './runtimeStatus.css'; | ||
|
|
||
| // React. | ||
| import React from 'react'; | ||
|
|
||
| // Other dependencies. | ||
| import { POSITRON_CONSOLE_STATE_ICON_ACTIVE, POSITRON_CONSOLE_STATE_ICON_DISCONNECTED, POSITRON_CONSOLE_STATE_ICON_IDLE } from '../../../../common/theme.js'; | ||
| import { ThemeIcon } from '../../../../../base/common/themables.js'; | ||
| import { Codicon } from '../../../../../base/common/codicons.js'; | ||
| import { registerIcon } from '../../../../../platform/theme/common/iconRegistry.js'; | ||
| import { localize } from '../../../../../nls.js'; | ||
| import { asCssVariable, ColorIdentifier } from '../../../../../platform/theme/common/colorUtils.js'; | ||
|
|
||
| export const enum RuntimeStatus { | ||
| Active = 'Active', | ||
| Disconnected = 'Disconnected', | ||
| Idle = 'Idle' | ||
| } | ||
|
|
||
| const positronRuntimeStatusActiveIcon = registerIcon( | ||
| 'positron-runtime-status-active', | ||
| Codicon.positronStatusActive, | ||
| localize('positronRuntimeStatusActiveIcon', 'Icon to indicate the \'active\' status of an interpreter session.') | ||
| ); | ||
|
|
||
| const positronRuntimeStatusDisconnectedIcon = registerIcon( | ||
| 'positron-runtime-status-disconnected', | ||
| Codicon.positronStatusDisconnected, | ||
| localize('positronRuntimeStatusDisconnectedIcon', 'Icon to indicate the \'disconnected\' status of an interpreter session.') | ||
| ); | ||
|
|
||
| const positronRuntimeStatusIdleIcon = registerIcon( | ||
| 'positron-runtime-status-idle', | ||
| Codicon.positronStatusIdle, | ||
| localize('positronRuntimeStatusIdleIcon', 'Icon to indicate the \'idle\' status of an interpreter session.') | ||
| ); | ||
|
|
||
| const statusToIcon: Record<RuntimeStatus, ThemeIcon> = { | ||
| [RuntimeStatus.Active]: positronRuntimeStatusActiveIcon, | ||
| [RuntimeStatus.Disconnected]: positronRuntimeStatusDisconnectedIcon, | ||
| [RuntimeStatus.Idle]: positronRuntimeStatusIdleIcon, | ||
| }; | ||
|
|
||
| const statusToIconColor: Record<RuntimeStatus, ColorIdentifier> = { | ||
| [RuntimeStatus.Active]: POSITRON_CONSOLE_STATE_ICON_ACTIVE, | ||
| [RuntimeStatus.Disconnected]: POSITRON_CONSOLE_STATE_ICON_DISCONNECTED, | ||
| [RuntimeStatus.Idle]: POSITRON_CONSOLE_STATE_ICON_IDLE, | ||
| }; | ||
|
|
||
| export interface RuntimeStatusIconProps { | ||
| status: RuntimeStatus; | ||
| } | ||
|
|
||
| export const RuntimeStatusIcon = ({ status }: RuntimeStatusIconProps) => { | ||
| const icon = statusToIcon[status]; | ||
| const className = ThemeIcon.asClassName(icon); | ||
| const color = statusToIconColor[status]; | ||
| const colorCss = asCssVariable(color); | ||
| return ( | ||
| <span | ||
| className={className} | ||
| style={{ color: colorCss }} | ||
| /> | ||
| ); | ||
| }; |
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.