Skip to content

Commit

Permalink
Merge pull request #66 from DenisaCG/refreshDrivesList
Browse files Browse the repository at this point in the history
Remove drives list provider plugin
  • Loading branch information
DenisaCG authored Jan 13, 2025
2 parents 811c12c + 7583a9b commit 46817de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 37 deletions.
2 changes: 0 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { JupyterFrontEndPlugin } from '@jupyterlab/application';
import {
driveFileBrowser,
drivesListProvider,
openDriveDialogPlugin,
launcherPlugin
} from './plugins';

const plugins: JupyterFrontEndPlugin<any>[] = [
driveFileBrowser,
drivesListProvider,
openDriveDialogPlugin,
launcherPlugin
];
Expand Down
33 changes: 6 additions & 27 deletions src/plugins/driveBrowserPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import { Widget } from '@lumino/widgets';

import { driveBrowserIcon } from '../icons';
import { Drive } from '../contents';
import { getDrivesList, setListingLimit } from '../requests';
import { IDriveInfo, IDrivesList, CommandIDs } from '../token';
import { setListingLimit } from '../requests';
import { CommandIDs } from '../token';

/**
* The file browser factory ID.
Expand All @@ -48,24 +48,6 @@ const FILE_DIALOG_CLASS = 'jp-FileDialog';
*/
const CREATE_DRIVE_TITLE_CLASS = 'jp-new-drive-title';

/**
* The drives list provider.
*/
export const drivesListProvider: JupyterFrontEndPlugin<IDriveInfo[]> = {
id: 'jupyter-drives:drives-list',
description: 'The drives list provider.',
provides: IDrivesList,
activate: async (_: JupyterFrontEnd): Promise<IDriveInfo[]> => {
let drives: IDriveInfo[] = [];
try {
drives = await getDrivesList();
} catch (error) {
console.log('Failed loading available drives list, with error: ', error);
}
return drives;
}
};

/**
* The drive file browser factory provider.
*/
Expand All @@ -77,8 +59,7 @@ export const driveFileBrowser: JupyterFrontEndPlugin<void> = {
IFileBrowserFactory,
IToolbarWidgetRegistry,
ISettingRegistry,
ITranslator,
IDrivesList
ITranslator
],
optional: [
IRouter,
Expand All @@ -92,7 +73,6 @@ export const driveFileBrowser: JupyterFrontEndPlugin<void> = {
toolbarRegistry: IToolbarWidgetRegistry,
settingsRegistry: ISettingRegistry,
translator: ITranslator,
drivesList: IDriveInfo[],
router: IRouter | null,
tree: JupyterFrontEnd.ITreeResolver | null,
labShell: ILabShell | null,
Expand All @@ -105,8 +85,7 @@ export const driveFileBrowser: JupyterFrontEndPlugin<void> = {

// create drive for drive file browser
const drive = new Drive({
name: 's3',
drivesList: drivesList
name: 's3'
});

app.serviceManager.contents.addDrive(drive);
Expand Down Expand Up @@ -266,7 +245,7 @@ namespace Private {
/**
* Create the node for a creating a new drive handler.
*/
const createNewDriveNode = (newDriveName: string): HTMLElement => {
const createNewDriveNode = (): HTMLElement => {
const body = document.createElement('div');

const drive = document.createElement('label');
Expand Down Expand Up @@ -295,7 +274,7 @@ namespace Private {
* Construct a new "create-drive" dialog.
*/
constructor(newDriveName: string) {
super({ node: createNewDriveNode(newDriveName) });
super({ node: createNewDriveNode() });
this.onAfterAttach();
}

Expand Down
8 changes: 0 additions & 8 deletions src/token.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { Token } from '@lumino/coreutils';
import { Contents } from '@jupyterlab/services';

/**
Expand All @@ -12,13 +11,6 @@ export namespace CommandIDs {
export const launcher = 'launcher:create';
}

/**
* A token for the plugin that provides the list of drives.
*/
export const IDrivesList = new Token<IDriveInfo[]>(
'jupyter-drives:drives-list-provider'
);

/**
* An interface that stores the drive information.
*/
Expand Down

0 comments on commit 46817de

Please sign in to comment.