Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 2 additions & 48 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { ILabShell, JupyterFrontEnd, JupyterFrontEndPlugin } from '@jupyterlab/application';
import { IDocumentManager } from '@jupyterlab/docmanager';
import { IDefaultFileBrowser } from '@jupyterlab/filebrowser';
import { spacesIcon, shareIcon, cernboxIcon } from './icons';
import { SpacesWidget } from './spaces-widget';
import { shareIcon, cernboxIcon } from './icons';
import { SharesWidget } from './shares-widget';
import { openEditShareModal } from './share-edit-modal';
import { attachQuotaIndicator } from './quota-widget';

/**
* The Shares plugin.
Expand Down Expand Up @@ -59,48 +57,4 @@ const sharesPlugin: JupyterFrontEndPlugin<void> = {
}
};

/**
* The Spaces plugin.
*
* Adds a sidebar panel that lists CERNBox Spaces (projects) the user
* has access to. Clicking a space navigates the default file browser
* to the corresponding EOS path.
*/
const spacesPlugin: JupyterFrontEndPlugin<void> = {
id: '@cs3org/cs3-jupyter-client:spaces',
description: 'Navigate CERNBox Spaces from the JupyterLab sidebar',
autoStart: true,
requires: [IDefaultFileBrowser],
optional: [ILabShell],
activate: (app: JupyterFrontEnd, fileBrowser: IDefaultFileBrowser, labShell: ILabShell | null) => {
console.log('[cs3org/cs3-jupyter-client] Activating spaces plugin');

const widget = new SpacesWidget(fileBrowser, app.shell);
widget.title.icon = spacesIcon;

if (labShell) {
labShell.add(widget, 'left', { rank: 121 });
} else {
app.shell.add(widget, 'left');
}
}
};

/**
* The Storage Quota plugin.
*
* Attaches a progress bar to the bottom of the default file browser
* showing the user's CERNBox storage usage.
*/
const quotaPlugin: JupyterFrontEndPlugin<void> = {
id: '@cs3org/cs3-jupyter-client:quota',
description: 'CERNBox storage quota indicator in the file browser',
autoStart: true,
requires: [IDefaultFileBrowser],
activate: (app: JupyterFrontEnd, fileBrowser: IDefaultFileBrowser) => {
console.log('[cs3org/cs3-jupyter-client] Activating quota plugin');
attachQuotaIndicator(fileBrowser);
}
};

export default [sharesPlugin, spacesPlugin, quotaPlugin];
export default [sharesPlugin];