forked from microsoft/vscode
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix issue where progress bar doesn't appear when collapsing input while cell is running. Also small cleanup to cell dnd in renderer microsoft#131808
- Loading branch information
1 parent
8cb22ea
commit 333a215
Showing
4 changed files
with
81 additions
and
41 deletions.
There are no files selected for viewing
This file contains 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
56 changes: 56 additions & 0 deletions
56
src/vs/workbench/contrib/notebook/browser/view/cellParts/cellProgressBar.ts
This file contains 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,56 @@ | ||
/*--------------------------------------------------------------------------------------------- | ||
* Copyright (c) Microsoft Corporation. All rights reserved. | ||
* Licensed under the MIT License. See License.txt in the project root for license information. | ||
*--------------------------------------------------------------------------------------------*/ | ||
|
||
import { ProgressBar } from 'vs/base/browser/ui/progressbar/progressbar'; | ||
import { Disposable } from 'vs/base/common/lifecycle'; | ||
import { CellViewModelStateChangeEvent } from 'vs/workbench/contrib/notebook/browser/notebookBrowser'; | ||
import { CodeCellViewModel } from 'vs/workbench/contrib/notebook/browser/viewModel/codeCellViewModel'; | ||
import { NotebookCellExecutionState, NotebookCellInternalMetadata } from 'vs/workbench/contrib/notebook/common/notebookCommon'; | ||
|
||
export class CellProgressBar extends Disposable { | ||
private readonly _progressBar: ProgressBar; | ||
private readonly _collapsedProgressBar: ProgressBar; | ||
|
||
constructor( | ||
editorContainer: HTMLElement, | ||
collapsedInputContainer: HTMLElement) { | ||
super(); | ||
|
||
this._progressBar = this._register(new ProgressBar(editorContainer)); | ||
this._progressBar.hide(); | ||
|
||
this._collapsedProgressBar = this._register(new ProgressBar(collapsedInputContainer)); | ||
this._collapsedProgressBar.hide(); | ||
} | ||
|
||
updateForInternalMetadata(element: CodeCellViewModel, internalMetadata: NotebookCellInternalMetadata): void { | ||
const progressBar = element.isInputCollapsed ? this._collapsedProgressBar : this._progressBar; | ||
if (internalMetadata.runState === NotebookCellExecutionState.Executing && !internalMetadata.isPaused) { | ||
showProgressBar(progressBar); | ||
} else { | ||
progressBar.hide(); | ||
} | ||
} | ||
|
||
updateForCellState(e: CellViewModelStateChangeEvent, element: CodeCellViewModel): void { | ||
if (e.inputCollapsedChanged) { | ||
if (element.isInputCollapsed) { | ||
this._progressBar.hide(); | ||
if (element.internalMetadata.runState === NotebookCellExecutionState.Executing) { | ||
showProgressBar(this._collapsedProgressBar); | ||
} | ||
} else { | ||
this._collapsedProgressBar.hide(); | ||
if (element.internalMetadata.runState === NotebookCellExecutionState.Executing) { | ||
showProgressBar(this._progressBar); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
function showProgressBar(progressBar: ProgressBar): void { | ||
progressBar.infinite().show(500); | ||
} |
This file contains 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 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