Skip to content

Commit a19127b

Browse files
authored
Merge pull request #84 from DenisaCG/newDriveCommand
Create new drive command visibility
2 parents f68b161 + e306031 commit a19127b

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

schema/drives-file-browser.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@
2727
"command": "drives:toggle-file-filter",
2828
"label": "",
2929
"rank": 40
30+
},
31+
{
32+
"name": "new-drive",
33+
"command": "drives:create-new-drive",
34+
"label": "",
35+
"rank": 50
3036
}
3137
]
3238
},

src/plugins/driveBrowserPlugin.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,14 @@ export const driveFileBrowser: JupyterFrontEndPlugin<void> = {
147147
}
148148
);
149149

150+
const updateVisibility = () => {
151+
// Visibility of command changed.
152+
app.commands.notifyCommandChanged(CommandIDs.createNewDrive);
153+
};
154+
155+
// Listen for path changes.
156+
driveBrowser.model.pathChanged.connect(updateVisibility);
157+
150158
// Add commands
151159
Private.addCommands(app, drive, driveBrowser);
152160

@@ -318,6 +326,9 @@ namespace Private {
318326
browser: FileBrowser
319327
): void {
320328
app.commands.addCommand(CommandIDs.createNewDrive, {
329+
isVisible: () => {
330+
return browser.model.path === 's3:';
331+
},
321332
execute: async () => {
322333
return showDialog({
323334
title: 'New Drive',

0 commit comments

Comments
 (0)