How to use the @jupyterlab/coreutils.PageConfig.setOption function in @jupyterlab/coreutils

To help you get started, we’ve selected a few @jupyterlab/coreutils 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 jupyterlab / jupyterlab / packages / application / src / index.ts View on Github external
constructor(options: JupyterLab.IOptions = {}) {
    super({ shell: new ApplicationShell() });
    this._busySignal = new Signal(this);
    this._dirtySignal = new Signal(this);

    // Construct the default workspace name.
    const defaultWorkspace = URLExt.join(
      PageConfig.getOption('baseUrl'),
      PageConfig.getOption('pageUrl')
    );

    // Set default workspace in page config.
    PageConfig.setOption('defaultWorkspace', defaultWorkspace);

    // Instantiate public resources.
    this.serviceManager = options.serviceManager || new ServiceManager();
    this.commandLinker =
      options.commandLinker || new CommandLinker({ commands: this.commands });
    this.docRegistry = options.docRegistry || new DocumentRegistry();

    // Remove extra resources (non-IInfo) from options object.
    delete options.serviceManager;
    delete options.commandLinker;
    delete options.docRegistry;

    // Populate application info.
    this._info = {
      ...JupyterLab.defaultInfo,
      ...(options as Partial),
github jupyterlab / jupyterlab-data-explorer / tests / test-coreutils / src / pageconfig.spec.ts View on Github external
it('should add a new option', () => {
        expect(PageConfig.setOption('bar', 'foo')).to.equal('');
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-filebrowser / src / model.spec.ts View on Github external
after(() => {
          PageConfig.setOption('notebookVersion', prevNotebookVersion);
        });
      });
github jupyterlab / jupyterlab / tests / test-filebrowser / src / model.spec.ts View on Github external
after(() => {
          PageConfig.setOption('notebookVersion', prevNotebookVersion);
        });
      });
github jupyterlab / jupyterlab-data-explorer / tests / test-filebrowser / src / model.spec.ts View on Github external
before(() => {
          prevNotebookVersion = PageConfig.setOption(
            'notebookVersion',
            JSON.stringify([5, 0, 0])
          );
        });
github jupyterlab / jupyterlab_app / src / browser / app.tsx View on Github external
private _connectionAdded(server: JupyterServer.IServer) {
        PageConfig.setOption('baseUrl', server.url);
        PageConfig.setOption('token', server.token);

        try {
            this._lab.start({'ignorePlugins': this._ignorePlugins});
        } catch (e) {
            log.log(e);
        }

        let rServer: Application.IRemoteServer = {...server, id: this._nextRemoteId++};
        this.setState((prevState: ServerManager.State) => {
            server.id = this._nextRemoteId++;
            let remotes = this.state.remotes.concat(rServer);
            this._saveState();
            return({
                renderState: this._renderEmpty,
                remotes: remotes
github jupyterlab / jupyterlab_app / src / browser / app.tsx View on Github external
private _connectionAdded(server: JupyterServer.IServer) {
        PageConfig.setOption('baseUrl', server.url);
        PageConfig.setOption('token', server.token);

        try {
            this._lab.start({'ignorePlugins': this._ignorePlugins});
        } catch (e) {
            log.log(e);
        }

        let rServer: Application.IRemoteServer = {...server, id: this._nextRemoteId++};
        this.setState((prevState: ServerManager.State) => {
            server.id = this._nextRemoteId++;
            let remotes = this.state.remotes.concat(rServer);
            this._saveState();
            return({
                renderState: this._renderEmpty,
                remotes: remotes
            });
github jupyterlab / jupyterlab_app / src / browser / app.tsx View on Github external
private _setupLab() {
        let version : string = PageConfig.getOption('appVersion') || 'unknown';
        if (version[0] === 'v') {
            version = version.slice(1);
        }

        if (this.props.options.platform === 'win32') {
            PageConfig.setOption('terminalsAvailable', 'false');
        }

        this._lab = new ElectronJupyterLab({
            version: version,
            mimeExtensions: extensions.mime,
            disabled: extensions.disabled,
            deferred: extensions.deferred,
            platform: this.props.options.platform,
            uiState: this.props.options.uiState
        });
        this._ignorePlugins.push(...extensions.ignored);

        try {
            this._lab.registerPluginModules(extensions.jupyterlab);
        } catch (e) {
            log.error(e);
github jupyterlab / jupyterlab_app / src / browser / app.tsx View on Github external
this._registerFileHandler();
        window.addEventListener('beforeunload', () => {
            asyncRemoteRenderer.runRemoteMethod(IServerFactory.requestServerStop, {
                factoryId: data.factoryId
            });
        });

        this._server = {
            token: data.token,
            url: data.url,
            name: 'Local',
            type: 'local',
        };

        PageConfig.setOption('token', this._server.token);
        PageConfig.setOption('baseUrl', this._server.url);

        this._setupLab();

        try {
            this._lab.start({'ignorePlugins': this._ignorePlugins});
        } catch (e) {
            log.log(e);
        }
        this._lab.restored.then( () => {
            ipcRenderer.send('lab-ready');
            (this.refs.splash as SplashScreen).fadeSplashScreen();
        });
    }
github jupyterlab / jupyterlab_app / src / browser / app.tsx View on Github external
}
        this._registerFileHandler();
        window.addEventListener('beforeunload', () => {
            asyncRemoteRenderer.runRemoteMethod(IServerFactory.requestServerStop, {
                factoryId: data.factoryId
            });
        });

        this._server = {
            token: data.token,
            url: data.url,
            name: 'Local',
            type: 'local',
        };

        PageConfig.setOption('token', this._server.token);
        PageConfig.setOption('baseUrl', this._server.url);

        this._setupLab();

        try {
            this._lab.start({'ignorePlugins': this._ignorePlugins});
        } catch (e) {
            log.log(e);
        }
        this._lab.restored.then( () => {
            ipcRenderer.send('lab-ready');
            (this.refs.splash as SplashScreen).fadeSplashScreen();
        });
    }