Skip to content

Commit

Permalink
Take comments into account concerning adding the toolbar of the browser.
Browse files Browse the repository at this point in the history
Add logics to add the content of the drive to the filebrowser when adding a drive in the dialog.
  • Loading branch information
HaudinFlorence committed Nov 15, 2023
1 parent 1f51bce commit 0654a2c
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 280 deletions.
237 changes: 0 additions & 237 deletions schema/browser.json

This file was deleted.

65 changes: 63 additions & 2 deletions schema/widget.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,67 @@
"title": "'@jupyter/drives",
"description": "jupyter-drives settings.",
"type": "object",
"properties": {},
"additionalProperties": false
"jupyter.lab.transform": true,
"properties": {
"toolbar": {
"title": "File browser toolbar items",
"description": "Note: To disable a toolbar item,\ncopy it to User Preferences and add the\n\"disabled\" key. The following example will disable the uploader button:\n{\n \"toolbar\": [\n {\n \"name\": \"uploader\",\n \"disabled\": true\n }\n ]\n}\n\nToolbar description:",
"items": {
"$ref": "#/definitions/toolbarItem"
},
"type": "array",
"default": []
}
},
"additionalProperties": false,
"definitions": {
"toolbarItem": {
"properties": {
"name": {
"title": "Unique name",
"type": "string"
},
"args": {
"title": "Command arguments",
"type": "object"
},
"command": {
"title": "Command id",
"type": "string",
"default": ""
},
"disabled": {
"title": "Whether the item is ignored or not",
"type": "boolean",
"default": false
},
"icon": {
"title": "Item icon id",
"description": "If defined, it will override the command icon",
"type": "string"
},
"label": {
"title": "Item label",
"description": "If defined, it will override the command label",
"type": "string"
},
"caption": {
"title": "Item caption",
"description": "If defined, it will override the command caption",
"type": "string"
},
"type": {
"title": "Item type",
"type": "string",
"enum": ["command", "spacer"]
},
"rank": {
"title": "Item rank",
"type": "number",
"minimum": 0,
"default": 50
}
}
}
}
}
27 changes: 24 additions & 3 deletions src/drivelistmanager.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as React from 'react';
//import { requestAPI } from './handler';
import { VDomModel, VDomRenderer } from '@jupyterlab/ui-components';
import {
Button,
Expand Down Expand Up @@ -43,6 +44,7 @@ export function DriveInputComponent(props: IDriveInputProps) {
</div>
);
}

interface ISearchListProps {
isName: boolean;
value: string;
Expand Down Expand Up @@ -177,9 +179,7 @@ export function DriveListManagerComponent(props: IProps) {

setSelectedDrives(updatedSelectedDrives);
props.model.setSelectedDrives(updatedSelectedDrives);
props.model.stateChanged.connect(() =>
console.log('selectedDrive has been changed')
);
props.model.stateChanged.emit();
};

const getValue = (event: any) => {
Expand Down Expand Up @@ -257,6 +257,27 @@ export class DriveListModel extends VDomModel {
setSelectedDrives(selectedDrives: IDrive[]) {
this.selectedDrives = selectedDrives;
}
async sendConnectionRequest(selectedDrives: IDrive[]): Promise<boolean> {
console.log(
'Sending a request to connect to drive ',
selectedDrives[selectedDrives.length - 1].name
);
const response = true;
/*requestAPI('send_connectionRequest', {
method: 'POST'
})
.then(data => {
console.log('data:', data);
return data;
})
.catch(reason => {
console.error(
`The jupyter_drive server extension appears to be missing.\n${reason}`
);
return;
});*/
return response;
}
}

export class DriveListView extends VDomRenderer<DriveListModel> {
Expand Down
Loading

0 comments on commit 0654a2c

Please sign in to comment.