Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@jupyterlab/filebrowser

Package Overview
Dependencies
Maintainers
9
Versions
398
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jupyterlab/filebrowser - npm Package Compare versions

Comparing version 0.15.4 to 0.16.0

72

lib/listing.js

@@ -400,11 +400,8 @@ "use strict";

var model = this._model;
var promises = [];
var items = this._sortedItems;
var paths = items.map(function (item) { return item.path; });
algorithm_1.each(this._model.sessions(), function (session) {
var promises = algorithm_1.toArray(this._model.sessions()).filter(function (session) {
var index = algorithm_1.ArrayExt.firstIndexOf(paths, session.path);
if (_this._selection[items[index].name]) {
promises.push(model.manager.services.sessions.shutdown(session.id));
}
});
return _this._selection[items[index].name];
}).map(function (session) { return model.manager.services.sessions.shutdown(session.id); });
return Promise.all(promises).then(function () {

@@ -533,3 +530,3 @@ return undefined;

if (_this.isDisposed) {
return;
throw new Error('File browser is disposed.');
}

@@ -539,3 +536,3 @@ var items = _this._sortedItems;

if (index === -1) {
return;
throw new Error('Item does not exist.');
}

@@ -680,4 +677,3 @@ _this._selectItem(index, false);

while (nodes.length > items.length) {
var node = nodes.pop();
content.removeChild(node);
content.removeChild(nodes.pop());
}

@@ -692,3 +688,3 @@ // Add any missing item nodes.

// Remove extra classes from the nodes.
algorithm_1.each(nodes, function (item) {
nodes.forEach(function (item) {
item.classList.remove(SELECTED_CLASS);

@@ -699,30 +695,29 @@ item.classList.remove(RUNNING_CLASS);

// Add extra classes to item nodes based on widget state.
for (var i = 0, n = items.length; i < n; ++i) {
items.forEach(function (item, i) {
var node = nodes[i];
var item = items[i];
var ft = this._manager.registry.getFileTypeForModel(item);
var ft = _this._manager.registry.getFileTypeForModel(item);
renderer.updateItemNode(node, item, ft);
if (this._selection[item.name]) {
if (_this._selection[item.name]) {
node.classList.add(SELECTED_CLASS);
if (this._isCut && this._model.path === this._prevPath) {
if (_this._isCut && _this._model.path === _this._prevPath) {
node.classList.add(CUT_CLASS);
}
}
}
});
// Handle the selectors on the widget node.
var selectedNames = Object.keys(this._selection);
if (selectedNames.length > 1) {
this.addClass(MULTI_SELECTED_CLASS);
}
if (selectedNames.length) {
var selected = Object.keys(this._selection).length;
if (selected) {
this.addClass(SELECTED_CLASS);
if (selected > 1) {
this.addClass(MULTI_SELECTED_CLASS);
}
}
// Handle file session statuses.
var paths = algorithm_1.toArray(algorithm_1.map(items, function (item) { return item.path; }));
var paths = items.map(function (item) { return item.path; });
algorithm_1.each(this._model.sessions(), function (session) {
var index = algorithm_1.ArrayExt.firstIndexOf(paths, session.path);
var node = nodes[index];
node.classList.add(RUNNING_CLASS);
var name = session.kernel.name;
var specs = _this._model.specs;
node.classList.add(RUNNING_CLASS);
if (specs) {

@@ -1248,5 +1243,12 @@ name = specs.kernelspecs[name].display_name;

}
if (!docmanager_1.isValidFileName(newName)) {
apputils_1.showErrorMessage('Rename Error', Error("\"" + newName + "\" is not a valid name for a file. " +
"Names must have nonzero length, " +
"and cannot include \"/\", \"\\\", or \":\""));
_this._inRename = false;
return original;
}
if (_this.isDisposed) {
_this._inRename = false;
return Promise.reject('Disposed');
throw new Error('File browser is disposed.');
}

@@ -1266,5 +1268,6 @@ var manager = _this._manager;

_this._inRename = false;
return Promise.reject('Disposed');
throw new Error('File browser is disposed.');
}
if (_this._inRename) {
// No need to catch because `newName` will always exit.
_this.selectItemByName(newName);

@@ -1330,10 +1333,10 @@ }

}
var name = args.newValue.name;
if (args.type === 'new' && name) {
this.selectItemByName(name).then(function () {
if (!_this.isDisposed && newValue.type === 'directory') {
_this._doRename();
}
});
if (args.type !== 'new' || !name) {
return;
}
this.selectItemByName(name).then(function () {
if (!_this.isDisposed && newValue.type === 'directory') {
_this._doRename();
}
}).catch(function () { });
};

@@ -1349,3 +1352,4 @@ /**

var basename = coreutils_1.PathExt.basename(args);
this.selectItemByName(basename);
this.selectItemByName(basename)
.catch(function () { });
};

@@ -1352,0 +1356,0 @@ return DirListing;

@@ -133,2 +133,6 @@ import { IChangedArgs, IStateDB } from '@jupyterlab/coreutils';

/**
* Populate the model's sessions collection.
*/
private _populateSessions(models);
/**
* Start the internal refresh timer.

@@ -135,0 +139,0 @@ */

@@ -405,9 +405,3 @@ "use strict";

FileBrowserModel.prototype._onRunningChanged = function (sender, models) {
var _this = this;
this._sessions.length = 0;
algorithm_1.each(models, function (model) {
if (_this._paths.has(model.path)) {
_this._sessions.push(model);
}
});
this._populateSessions(models);
this._refreshed.emit(void 0);

@@ -420,12 +414,13 @@ };

var path = this._model.path;
var value = change.oldValue;
if (value && value.path && coreutils_1.PathExt.dirname(value.path) === path) {
this._fileChanged.emit(change);
var sessions = this.manager.services.sessions;
var oldValue = change.oldValue, newValue = change.newValue;
var value = oldValue && oldValue.path &&
coreutils_1.PathExt.dirname(oldValue.path) === path ? oldValue
: newValue && newValue.path && coreutils_1.PathExt.dirname(newValue.path) === path
? newValue : undefined;
// If either the old value or the new value is in the current path, update.
if (value) {
this._scheduleUpdate();
return;
}
value = change.newValue;
if (value && value.path && coreutils_1.PathExt.dirname(value.path) === path) {
this._populateSessions(sessions.running());
this._fileChanged.emit(change);
this._scheduleUpdate();
return;

@@ -435,2 +430,14 @@ }

/**
* Populate the model's sessions collection.
*/
FileBrowserModel.prototype._populateSessions = function (models) {
var _this = this;
this._sessions.length = 0;
algorithm_1.each(models, function (model) {
if (_this._paths.has(model.path)) {
_this._sessions.push(model);
}
});
};
/**
* Start the internal refresh timer.

@@ -445,2 +452,6 @@ */

}
if (document.hidden) {
// Don't poll when nobody's looking.
return;
}
var date = new Date().getTime();

@@ -447,0 +458,0 @@ if ((date - _this._lastRefresh) > _this._refreshDuration) {

{
"name": "@jupyterlab/filebrowser",
"version": "0.15.4",
"version": "0.16.0",
"description": "JupyterLab - FileBrowser Widget",

@@ -33,7 +33,7 @@ "homepage": "https://github.com/jupyterlab/jupyterlab",

"dependencies": {
"@jupyterlab/apputils": "^0.15.4",
"@jupyterlab/coreutils": "^1.0.6",
"@jupyterlab/docmanager": "^0.15.4",
"@jupyterlab/docregistry": "^0.15.4",
"@jupyterlab/services": "^1.1.4",
"@jupyterlab/apputils": "^0.16.0",
"@jupyterlab/coreutils": "^1.1.0",
"@jupyterlab/docmanager": "^0.16.0",
"@jupyterlab/docregistry": "^0.16.0",
"@jupyterlab/services": "^2.0.0",
"@phosphor/algorithm": "^1.1.2",

@@ -40,0 +40,0 @@ "@phosphor/commands": "^1.4.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc