Skip to content

Commit b5cc12e

Browse files
Implement a method getDriveContent to get the content of the drives.
1 parent a90e0bb commit b5cc12e

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

jupyter_drives/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class DrivesConfig(Configurable):
3939
config = True,
4040
help = "Region name.",
4141
)
42-
42+
4343
api_base_url = Unicode(
4444
config=True,
4545
help="Base URL of the provider service REST API.",

src/index.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { IBucket } from './s3requests';
2222
import { Dialog, ICommandPalette, showDialog } from '@jupyterlab/apputils';
2323
import { DriveListModel, DriveListView } from './drivelistmanager';
2424
import { addJupyterLabThemeChangeListener } from '@jupyter/web-components';
25+
import { getDriveContent, getDrivesList } from './s3requests';
2526

2627
/**
2728
* The class name added to the filebrowser filterbox node.
@@ -39,7 +40,13 @@ function buildMountedDriveNameList(driveList: Drive[]): string[] {
3940
return driveNameList;
4041
}
4142

42-
const s3AvailableBuckets: IBucket[] = [
43+
const s3AvailableBuckets2 = await getDrivesList();
44+
console.log('List of buckets is:', s3AvailableBuckets2);
45+
const driveName = 'jupyter-drive-bucket1';
46+
const path = 'examples';
47+
const driveContent = await getDriveContent(driveName, path);
48+
console.log('driveContent:', driveContent);
49+
const s3AvailableBuckets1: IBucket[] = [
4350
{
4451
creation_date: '2023-12-15T13:27:57.000Z',
4552
name: 'jupyterDriveBucket1',
@@ -175,7 +182,7 @@ export /*async */ function activateAddDrivesPlugin(
175182
addJupyterLabThemeChangeListener();
176183
const selectedDrivesModelMap = new Map<Drive[], DriveListModel>();
177184
let selectedDrives: Drive[] = [];
178-
const availableDrives = createDrivesList(s3AvailableBuckets);
185+
const availableDrives = createDrivesList(s3AvailableBuckets1);
179186
let driveListModel = selectedDrivesModelMap.get(selectedDrives);
180187
const mountedDriveNameList: string[] =
181188
buildMountedDriveNameList(selectedDrives);

src/s3requests.ts

+6
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,9 @@ export async function getDrivesList() {
1313
method: 'GET'
1414
});
1515
}
16+
17+
export async function getDriveContent(driveName: string, path: string) {
18+
return await requestAPI<Array<IBucket>>('drives/' + driveName + '/' + path, {
19+
method: 'GET'
20+
});
21+
}

0 commit comments

Comments
 (0)