Skip to content

Commit eb8dfff

Browse files
authored
Merge pull request #86 from DenisaCG/disableRename
Disable `rename` functionality for drives
2 parents 9c7c3d5 + a6c2791 commit eb8dfff

File tree

3 files changed

+32
-1
lines changed

3 files changed

+32
-1
lines changed

schema/drives-file-browser.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,17 @@
7171
"command": "drives:create-new-notebook",
7272
"selector": ".jp-DirListing-content",
7373
"rank": 54
74+
},
75+
{
76+
"command": "filebrowser:rename",
77+
"selector": ".jp-DirListing-item[data-isdir]",
78+
"rank": 5,
79+
"disabled": true
80+
},
81+
{
82+
"command": "drives:rename",
83+
"selector": ".jp-DirListing-item[data-isdir]",
84+
"rank": 5
7485
}
7586
]
7687
},
@@ -95,6 +106,13 @@
95106
"default": []
96107
}
97108
},
109+
"jupyter.lab.shortcuts": [
110+
{
111+
"command": "drives:rename",
112+
"keys": ["F2"],
113+
"selector": ".jp-DirListing-content .jp-DirListing-itemText"
114+
}
115+
],
98116
"additionalProperties": false,
99117
"definitions": {
100118
"toolbarItem": {

src/plugins/driveBrowserPlugin.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ import {
2525
IScore,
2626
newFolderIcon,
2727
fileIcon,
28-
notebookIcon
28+
notebookIcon,
29+
editIcon
2930
} from '@jupyterlab/ui-components';
3031
import { CommandRegistry } from '@lumino/commands';
3132
import { Widget } from '@lumino/widgets';
@@ -413,5 +414,16 @@ namespace Private {
413414
icon: notebookIcon.bindprops({ stylesheet: 'menuItem' }),
414415
label: 'New Notebook'
415416
});
417+
418+
app.commands.addCommand(CommandIDs.rename, {
419+
isEnabled: () => {
420+
return browser.model.path !== 's3:';
421+
},
422+
execute: () => {
423+
app.commands.execute('filebrowser:rename');
424+
},
425+
icon: editIcon.bindprops({ stylesheet: 'menuItem' }),
426+
label: 'Rename'
427+
});
416428
}
417429
}

src/token.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export namespace CommandIDs {
1313
export const createNewDirectory = 'drives:create-new-directory';
1414
export const createNewFile = 'drives:create-new-file';
1515
export const createNewNotebook = 'drives:create-new-notebook';
16+
export const rename = 'drives:rename';
1617
}
1718

1819
/**

0 commit comments

Comments
 (0)