Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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),
it('should add a new option', () => {
expect(PageConfig.setOption('bar', 'foo')).to.equal('');
});
after(() => {
PageConfig.setOption('notebookVersion', prevNotebookVersion);
});
});
after(() => {
PageConfig.setOption('notebookVersion', prevNotebookVersion);
});
});
before(() => {
prevNotebookVersion = PageConfig.setOption(
'notebookVersion',
JSON.stringify([5, 0, 0])
);
});
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
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
});
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);
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();
});
}
}
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();
});
}