Skip to content

Commit

Permalink
Merge pull request #20 from DenisaCG/fixToolbar
Browse files Browse the repository at this point in the history
Fix `DriveBrowser` toolbar buttons
  • Loading branch information
DenisaCG authored Nov 5, 2024
2 parents 0467fb1 + d986533 commit 61c372d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
7 changes: 6 additions & 1 deletion schema/drives-file-browser.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,31 @@
{
"name": "new-launcher",
"command": "launcher:create",
"label": "",
"rank": 1
},
{
"name": "new-directory",
"command": "filebrowser:create-new-directory",
"label": "",
"rank": 10
},
{ "name": "uploader", "rank": 20 },
{ "name": "uploader", "label": "", "rank": 20 },
{
"name": "refresh",
"command": "filebrowser:refresh",
"label": "",
"rank": 30
},
{
"name": "toggle-file-filter",
"command": "filebrowser:toggle-file-filter",
"label": "",
"rank": 40
},
{
"name": "file-name-searcher",
"label": "",
"rank": 50
}
]
Expand Down
22 changes: 8 additions & 14 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
import { ISettingRegistry } from '@jupyterlab/settingregistry';
import { FilenameSearcher, IScore } from '@jupyterlab/ui-components';
import { CommandRegistry } from '@lumino/commands';
import { Panel } from '@lumino/widgets';

import { DriveListModel, DriveListView, IDrive } from './drivelistmanager';
import { DriveIcon, driveBrowserIcon } from './icons';
Expand Down Expand Up @@ -203,9 +202,17 @@ const driveFileBrowser: JupyterFrontEndPlugin<void> = {
// Set attributes when adding the browser to the UI
driveBrowser.node.setAttribute('role', 'region');
driveBrowser.node.setAttribute('aria-label', 'Drive Browser Section');
driveBrowser.title.icon = driveBrowserIcon;
driveBrowser.title.caption = 'Drive File Browser';
driveBrowser.id = 'Drive-File-Browser';

void Private.restoreBrowser(driveBrowser, commands, router, tree, labShell);

app.shell.add(driveBrowser, 'left', { rank: 102, type: 'File Browser' });
if (restorer) {
restorer.add(driveBrowser, 'drive-file-browser');
}

toolbarRegistry.addFactory(
FILE_BROWSER_FACTORY,
'uploader',
Expand Down Expand Up @@ -246,19 +253,6 @@ const driveFileBrowser: JupyterFrontEndPlugin<void> = {
translator
)
);

// instate Drive Browser Panel
const drivePanel = new Panel();
drivePanel.title.icon = driveBrowserIcon;
drivePanel.title.iconClass = 'jp-sideBar-tabIcon';
drivePanel.title.caption = 'Drive File Browser';
drivePanel.id = 'Drive-Browser-Panel';

app.shell.add(drivePanel, 'left', { rank: 102, type: 'File Browser' });
drivePanel.addWidget(driveBrowser);
if (restorer) {
restorer.add(drivePanel, 'drive-sidepanel');
}
}
};

Expand Down

0 comments on commit 61c372d

Please sign in to comment.