Skip to content

Commit 3dc1c2b

Browse files
Take comments into account concerning adding the toolbar of the browser.
Add logics to add the content of the drive to the filebrowser when adding a drive in the dialog.
1 parent 1f51bce commit 3dc1c2b

File tree

5 files changed

+129
-281
lines changed

5 files changed

+129
-281
lines changed

schema/browser.json

Lines changed: 0 additions & 237 deletions
This file was deleted.

schema/widget.json

Lines changed: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,67 @@
1919
"title": "'@jupyter/drives",
2020
"description": "jupyter-drives settings.",
2121
"type": "object",
22-
"properties": {},
23-
"additionalProperties": false
22+
"jupyter.lab.transform": true,
23+
"properties": {
24+
"toolbar": {
25+
"title": "File browser toolbar items",
26+
"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:",
27+
"items": {
28+
"$ref": "#/definitions/toolbarItem"
29+
},
30+
"type": "array",
31+
"default": []
32+
}
33+
},
34+
"additionalProperties": false,
35+
"definitions": {
36+
"toolbarItem": {
37+
"properties": {
38+
"name": {
39+
"title": "Unique name",
40+
"type": "string"
41+
},
42+
"args": {
43+
"title": "Command arguments",
44+
"type": "object"
45+
},
46+
"command": {
47+
"title": "Command id",
48+
"type": "string",
49+
"default": ""
50+
},
51+
"disabled": {
52+
"title": "Whether the item is ignored or not",
53+
"type": "boolean",
54+
"default": false
55+
},
56+
"icon": {
57+
"title": "Item icon id",
58+
"description": "If defined, it will override the command icon",
59+
"type": "string"
60+
},
61+
"label": {
62+
"title": "Item label",
63+
"description": "If defined, it will override the command label",
64+
"type": "string"
65+
},
66+
"caption": {
67+
"title": "Item caption",
68+
"description": "If defined, it will override the command caption",
69+
"type": "string"
70+
},
71+
"type": {
72+
"title": "Item type",
73+
"type": "string",
74+
"enum": ["command", "spacer"]
75+
},
76+
"rank": {
77+
"title": "Item rank",
78+
"type": "number",
79+
"minimum": 0,
80+
"default": 50
81+
}
82+
}
83+
}
84+
}
2485
}

src/drivelistmanager.tsx

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as React from 'react';
2+
//import { requestAPI } from './handler';
23
import { VDomModel, VDomRenderer } from '@jupyterlab/ui-components';
34
import {
45
Button,
@@ -43,6 +44,7 @@ export function DriveInputComponent(props: IDriveInputProps) {
4344
</div>
4445
);
4546
}
47+
4648
interface ISearchListProps {
4749
isName: boolean;
4850
value: string;
@@ -177,9 +179,7 @@ export function DriveListManagerComponent(props: IProps) {
177179

178180
setSelectedDrives(updatedSelectedDrives);
179181
props.model.setSelectedDrives(updatedSelectedDrives);
180-
props.model.stateChanged.connect(() =>
181-
console.log('selectedDrive has been changed')
182-
);
182+
props.model.stateChanged.emit();
183183
};
184184

185185
const getValue = (event: any) => {
@@ -257,6 +257,23 @@ export class DriveListModel extends VDomModel {
257257
setSelectedDrives(selectedDrives: IDrive[]) {
258258
this.selectedDrives = selectedDrives;
259259
}
260+
async sendConnectionRequest(): Promise<boolean> {
261+
const response = true;
262+
/*requestAPI('send_connectionRequest', {
263+
method: 'POST'
264+
})
265+
.then(data => {
266+
console.log('data:', data);
267+
return data;
268+
})
269+
.catch(reason => {
270+
console.error(
271+
`The jupyter_drive server extension appears to be missing.\n${reason}`
272+
);
273+
return;
274+
});*/
275+
return response;
276+
}
260277
}
261278

262279
export class DriveListView extends VDomRenderer<DriveListModel> {

0 commit comments

Comments
 (0)