Skip to content

Commit cd676a9

Browse files
committed
add command and dialog window for public drives
1 parent f9bfcdc commit cd676a9

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

src/plugins/driveBrowserPlugin.ts

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,38 @@ namespace Private {
373373
rank: 105
374374
});
375375

376+
app.commands.addCommand(CommandIDs.addPublicDrive, {
377+
isEnabled: () => {
378+
return browser.model.path === 's3:';
379+
},
380+
execute: async () => {
381+
return showDialog({
382+
title: 'Add Public Drive',
383+
body: new Private.CreateDriveHandler(drive.name),
384+
focusNodeSelector: 'input',
385+
buttons: [
386+
Dialog.cancelButton(),
387+
Dialog.okButton({
388+
label: 'Add',
389+
ariaLabel: 'Add Drive'
390+
})
391+
]
392+
}).then(result => {
393+
if (result.value) {
394+
drive.addPublicDrive(result.value[0]);
395+
}
396+
});
397+
},
398+
label: 'Add Public Drive',
399+
icon: driveBrowserIcon.bindprops({ stylesheet: 'menuItem' })
400+
});
401+
402+
app.contextMenu.addItem({
403+
command: CommandIDs.addPublicDrive,
404+
selector: '#drive-file-browser.jp-SidePanel .jp-DirListing-content',
405+
rank: 110
406+
});
407+
376408
app.commands.addCommand(CommandIDs.toggleFileFilter, {
377409
execute: () => {
378410
// Update toggled state, then let the toolbar button update

src/token.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export namespace CommandIDs {
88
export const openPath = 'drives:open-path';
99
export const toggleBrowser = 'drives:toggle-main';
1010
export const createNewDrive = 'drives:create-new-drive';
11+
export const addPublicDrive = 'drives:add-public-drive';
1112
export const launcher = 'launcher:create';
1213
export const toggleFileFilter = 'drives:toggle-file-filter';
1314
export const createNewDirectory = 'drives:create-new-directory';

0 commit comments

Comments
 (0)