Skip to content

Commit

Permalink
show progress when cell input is collapsed re #130611.
Browse files Browse the repository at this point in the history
  • Loading branch information
rebornix committed Aug 11, 2021
1 parent 0dd8b8c commit 9430366
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -775,6 +775,7 @@ export interface CodeCellRenderTemplate extends BaseCellRenderTemplate {
focusSinkElement: HTMLElement;
editor: ICodeEditor;
progressBar: ProgressBar;
collapsedProgressBar: ProgressBar;
focusIndicatorRight: HTMLElement;
focusIndicatorBottom: HTMLElement;
dragHandle: HTMLElement;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,10 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
progressBar.hide();
disposables.add(progressBar);

const collapsedProgressBar = new ProgressBar(cellInputCollapsedContainer);
collapsedProgressBar.hide();
disposables.add(collapsedProgressBar);

const statusBar = disposables.add(this.instantiationService.createInstance(CellEditorStatusBar, editorPart));

const outputContainer = DOM.append(container, $('.output'));
Expand All @@ -673,6 +677,7 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
decorationContainer,
cellContainer,
progressBar,
collapsedProgressBar,
statusBar,
focusIndicatorLeft: focusIndicator,
focusIndicatorRight,
Expand Down Expand Up @@ -887,10 +892,18 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
const internalMetadata = element.internalMetadata;
this.updateExecutionOrder(internalMetadata, templateData);

if (element.metadata.inputCollapsed) {
templateData.progressBar.hide();
} else {
templateData.collapsedProgressBar.hide();
}

const progressBar = element.metadata.inputCollapsed ? templateData.collapsedProgressBar : templateData.progressBar;

if (internalMetadata.runState === NotebookCellExecutionState.Executing && !internalMetadata.isPaused) {
templateData.progressBar.infinite().show(500);
progressBar.infinite().show(500);
} else {
templateData.progressBar.hide();
progressBar.hide();
}
}

Expand Down Expand Up @@ -999,7 +1012,7 @@ export class CodeCellRenderer extends AbstractCellRenderer implements IListRende
this.updateForFocus(element, templateData);
cellEditorOptions.setLineNumbers(element.lineNumbers);
elementDisposables.add(element.onDidChangeState((e) => {
if (e.internalMetadataChanged) {
if (e.metadataChanged || e.internalMetadataChanged) {
this.updateForInternalMetadata(element, templateData);
this.updateForLayout(element, templateData);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,17 @@ export class CodeCell extends Disposable {
}

private _removeInputCollapsePreview() {
DOM.clearNode(this.templateData.cellInputCollapsedContainer);
const children = this.templateData.cellInputCollapsedContainer.children;
const elements = [];
for (let i = 0; i < children.length; i++) {
if (children[i].classList.contains('cell-collapse-preview')) {
elements.push(children[i]);
}
}

elements.forEach(element => {
element.parentElement?.removeChild(element);
});
}

private _updateOutputInnertContainer(hide: boolean) {
Expand Down

0 comments on commit 9430366

Please sign in to comment.