Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this._activeCluster = cluster;
this._activeClusterChanged.emit({
name: 'cluster',
oldValue: old,
newValue: cluster
});
this.update();
};
const layout = (this.layout = new PanelLayout());
this._clusterListing = new Widget();
this._clusterListing.addClass('dask-ClusterListing');
// Create the toolbar.
const toolbar = new Toolbar();
// Make a label widget for the toolbar.
const toolbarLabel = new Widget();
toolbarLabel.node.textContent = 'CLUSTERS';
toolbarLabel.addClass('dask-DaskClusterManager-label');
toolbar.addItem('label', toolbarLabel);
// Make a refresh button for the toolbar.
toolbar.addItem(
'refresh',
new ToolbarButton({
iconClassName: 'jp-RefreshIcon jp-Icon jp-Icon-16',
onClick: () => {
this._updateClusterList();
},
tooltip: 'Refresh Cluster List'
// Set up a completer.
const editor = cellWidget.editor;
const model = new CompleterModel();
const completer = new Completer({ editor, model });
const connector = new KernelConnector({ session });
const handler = new CompletionHandler({ completer, connector });
// Set the handler's editor.
handler.editor = editor;
// Hide the widget when it first loads.
completer.hide();
// Create a toolbar for the cell.
const toolbar = new Toolbar();
toolbar.addItem('spacer', Toolbar.createSpacerItem());
toolbar.addItem('interrupt', Toolbar.createInterruptButton(session));
toolbar.addItem('restart', Toolbar.createRestartButton(session));
toolbar.addItem('name', Toolbar.createKernelNameItem(session));
toolbar.addItem('status', Toolbar.createKernelStatusItem(session));
// Lay out the widgets.
const panel = new BoxPanel();
panel.id = 'main';
panel.direction = 'top-to-bottom';
panel.spacing = 0;
panel.addWidget(completer);
panel.addWidget(toolbar);
panel.addWidget(cellWidget);
BoxPanel.setStretch(toolbar, 0);
BoxPanel.setStretch(cellWidget, 1);
constructor(options: NotebookPanel.IOptions) {
super();
this.addClass(NOTEBOOK_PANEL_CLASS);
this.rendermime = options.rendermime;
let contentFactory = this.contentFactory = (
options.contentFactory || NotebookPanel.defaultContentFactory
);
let layout = this.layout = new BoxLayout();
// Toolbar
let toolbar = new Toolbar();
toolbar.addClass(NOTEBOOK_PANEL_TOOLBAR_CLASS);
// Notebook
let nbOptions: Notebook.IOptions = {
rendermime: this.rendermime,
languagePreference: options.languagePreference,
contentFactory: contentFactory,
mimeTypeService: options.mimeTypeService,
editorConfig: options.editorConfig,
};
let notebook = this.notebook = contentFactory.createNotebook(nbOptions);
notebook.addClass(NOTEBOOK_PANEL_NOTEBOOK_CLASS);
layout.addWidget(toolbar);
layout.addWidget(this.notebook);
it('should construct a new toolbar widget', () => {
const widget = new Toolbar();
expect(widget).to.be.an.instanceof(Toolbar);
});
beforeEach(async () => {
widget = new Toolbar();
});
beforeEach(async () => {
widget = new Toolbar();
});
export function defaultsEditor(editor: Widget): Widget {
const widget = new Widget();
const layout = (widget.layout = new BoxLayout({ spacing: 0 }));
const banner = new Widget();
const bar = new Toolbar();
banner.node.innerText = DEFAULT_TITLE;
bar.insertItem(0, 'banner', banner);
layout.addWidget(bar);
layout.addWidget(editor);
return widget;
}
constructor(options: FileBrowser.IOptions) {
super();
this.addClass(FILE_BROWSER_CLASS);
this.id = options.id;
const model = (this.model = options.model);
const renderer = options.renderer;
model.connectionFailure.connect(
this._onConnectionFailure,
this
);
this._manager = model.manager;
this._crumbs = new BreadCrumbs({ model });
this.toolbar = new Toolbar();
this._directoryPending = false;
let newFolder = new ToolbarButton({
iconClassName: 'jp-NewFolderIcon',
onClick: () => {
this.createNewDirectory();
},
tooltip: 'New Folder'
});
let uploader = new Uploader({ model });
let refresher = new ToolbarButton({
iconClassName: 'jp-RefreshIcon',
onClick: () => {
void model.refresh();
constructor(options: FileBrowser.IOptions) {
super();
this.addClass(FILE_BROWSER_CLASS);
this.id = options.id;
const model = (this.model = options.model);
const renderer = options.renderer;
model.connectionFailure.connect(this._onConnectionFailure, this);
this._manager = model.manager;
this._crumbs = new BreadCrumbs({ model });
this.toolbar = new Toolbar();
this._directoryPending = false;
const newFolder = new ToolbarButton({
iconClassName: 'jp-NewFolderIcon',
onClick: () => {
this.createNewDirectory();
},
tooltip: 'New Folder'
});
const uploader = new Uploader({ model });
const refresher = new ToolbarButton({
iconClassName: 'jp-RefreshIcon',
onClick: () => {
void model.refresh();
},
tooltip: 'Refresh File List'
const getToolbar = (): Toolbar => {
if (!(widget instanceof ConsolePanel)) {
return widget.toolbar;
}
const toolbar = widget.widgets.find(w => w instanceof Toolbar) as Toolbar;
return toolbar ?? new Toolbar();
};