diff --git a/jupyter_drives/manager.py b/jupyter_drives/manager.py
index 705eba4..3d7a7c0 100644
--- a/jupyter_drives/manager.py
+++ b/jupyter_drives/manager.py
@@ -303,7 +303,7 @@ async def list_drives(self):
}
return response
- async def mount_drive(self, drive_name, provider):
+ async def mount_drive(self, drive_name, provider, location=''):
"""Mount a drive.
Args:
@@ -311,7 +311,9 @@ async def mount_drive(self, drive_name, provider):
"""
try:
if provider == 's3':
- if drive_name in self._external_drives and self._external_drives[drive_name]["is_public"] is False:
+ if location:
+ region = location
+ elif drive_name in self._external_drives and self._external_drives[drive_name]["is_public"] is False:
region = self._external_drives[drive_name]["location"]
else:
region = await self._get_drive_location(drive_name)
diff --git a/src/plugins/drivelistmanager.tsx b/src/plugins/drivelistmanager.tsx
index 5cc718a..662599b 100644
--- a/src/plugins/drivelistmanager.tsx
+++ b/src/plugins/drivelistmanager.tsx
@@ -68,7 +68,10 @@ export function DriveInputComponent({
setIsPublic(event.target.checked)}
+ onChange={event => {
+ setIsPublic(event.target.checked);
+ setRegion('');
+ }}
/>
{!isPublic && (
{
// Check if user has access to drive.
const result = await mountDrive(publicDrive, {
- provider: 's3'
+ provider: 's3',
+ location: driveRegion
});
if (result && result.error) {
// Show error in case of failure.
@@ -223,9 +227,10 @@ export function DriveListManagerComponent({ model }: IProps) {
await addPublicDrive(publicDrive);
} else {
await addExternalDrive(publicDrive, driveRegion);
- setDriveRegion('');
}
+ setPublicDrive('');
setDriveRegion('');
+ setIsPublic(false);
await model.refresh();
}
};
diff --git a/src/requests.ts b/src/requests.ts
index 8891eb5..d9c2ce0 100644
--- a/src/requests.ts
+++ b/src/requests.ts
@@ -67,11 +67,12 @@ export async function getDrivesList() {
*/
export async function mountDrive(
driveName: string,
- options: { provider: string }
+ options: { provider: string; location?: string }
) {
const body: ReadonlyJSONObject = {
drive_name: driveName,
- provider: options.provider
+ provider: options.provider,
+ location: options.location ?? ''
};
try {
await requestAPI('drives', 'POST', body);