How to use the @jupyterlab/apputils.ClientSession.populateKernelSelect function in @jupyterlab/apputils

To help you get started, we’ve selected a few @jupyterlab/apputils examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github yuvipanda / simplest-notebook / packages / docmanager / src / dialogs.ts View on Github external
type = fType.contentType || 'file';
    }
    if (!widgetName || widgetName === 'default') {
      this._widgetName = widgetName = registry.defaultWidgetFactory(ext).name;
    }

    // Handle the kernel preferences.
    let preference = registry.getKernelPreference(
      ext, widgetName, { name: kernelName }
    );
    if (!preference.canStart) {
      this.node.removeChild(this.kernelDropdownNode.previousSibling);
      this.node.removeChild(this.kernelDropdownNode);
    } else {
      let services = this._manager.services;
      ClientSession.populateKernelSelect(this.kernelDropdownNode, {
        specs: services.specs,
        sessions: services.sessions.running(),
        preference
      });
    }

    let path = container.path;
    return manager.newUntitled({ ext, path, type }).then(contents => {
      let value = this.inputNode.value = contents.name;
      this.inputNode.setSelectionRange(0, value.length - ext.length);
      this._orig = contents;
    });
  }
github jupyterlab / jupyterlab / packages / filebrowser / src / dialogs.ts View on Github external
type = fType.contentType || 'file';
    }
    if (!widgetName || widgetName === 'default') {
      this._widgetName = widgetName = registry.defaultWidgetFactory(ext).name;
    }

    // Handle the kernel preferences.
    let preference = registry.getKernelPreference(
      ext, widgetName, { name: kernelName }
    );
    if (!preference.canStart) {
      this.node.removeChild(this.kernelDropdownNode.previousSibling);
      this.node.removeChild(this.kernelDropdownNode);
    } else {
      let services = this._manager.services;
      ClientSession.populateKernelSelect(this.kernelDropdownNode, {
        specs: services.specs,
        sessions: services.sessions.running(),
        preference
      });
    }

    return model.newUntitled({ ext, type }).then(contents => {
      let value = this.inputNode.value = contents.name;
      this.inputNode.setSelectionRange(0, value.length - ext.length);
      this._orig = contents;
    });
  }
github jupyterlab / jupyterlab-data-explorer / tests / test-apputils / src / clientsession.spec.ts View on Github external
it('should populate the select div', () => {
        const div = document.createElement('select');

        ClientSession.populateKernelSelect(div, {
          specs: manager.specs,
          preference: {}
        });
        expect(div.firstChild).to.be.ok;
        expect(div.value).to.not.equal('null');
      });
github jupyterlab / jupyterlab / tests / test-apputils / src / clientsession.spec.ts View on Github external
it('should select the null option', () => {
        const div = document.createElement('select');

        ClientSession.populateKernelSelect(div, {
          specs: manager.specs,
          preference: { shouldStart: false }
        });
        expect(div.firstChild).to.be.ok;
        expect(div.value).to.equal('null');
      });
github jupyterlab / jupyterlab / packages / filebrowser / src / dialogs.ts View on Github external
protected widgetChanged(): void {
    let widgetName = this.widgetDropdown.value;
    let preference = this._manager.registry.getKernelPreference(
      this._ext, widgetName
    );
    let services = this._manager.services;
    ClientSession.populateKernelSelect(this.kernelDropdownNode, {
      specs: services.specs,
      sessions: services.sessions.running(),
      preference
    });
  }
github jupyterlab / jupyterlab / packages / filebrowser / src / dialogs.ts View on Github external
protected widgetDropdownChanged(): void {
    let ext = this.ext;
    let widgetName = this.widgetDropdown.value;
    let manager = this._manager;
    let preference = manager.registry.getKernelPreference(ext, widgetName);
    let services = this._manager.services;
    ClientSession.populateKernelSelect(this.kernelDropdownNode, {
      specs: services.specs,
      sessions: services.sessions.running(),
      preference
    });
  }