Skip to content

Commit 565f46a

Browse files
committed
add frontend functionality to include drive in listing
1 parent c6b4ac1 commit 565f46a

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

src/contents.ts

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ export class Drive implements Contents.IDrive {
688688
* Exclude drive from browser.
689689
*
690690
* @param driveName: The name of drive to exclude.
691-
*
691+
*
692692
* @returns A promise which resolves with the contents model.
693693
*/
694694
async excludeDrive(driveName: string): Promise<Contents.IModel> {
@@ -704,6 +704,26 @@ export class Drive implements Contents.IDrive {
704704
return data;
705705
}
706706

707+
/**
708+
* Include drive in browser listing.
709+
*
710+
* @param driveName: The name of drive to include.
711+
*
712+
* @returns A promise which resolves with the contents model.
713+
*/
714+
async includeDrive(driveName: string): Promise<Contents.IModel> {
715+
data = await this.includeDrive(driveName);
716+
717+
Contents.validateContentsModel(data);
718+
this._fileChanged.emit({
719+
type: 'new',
720+
oldValue: null,
721+
newValue: data
722+
});
723+
724+
return data;
725+
}
726+
707727
/**
708728
* Create a checkpoint for a file.
709729
*

src/requests.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,31 @@ export async function excludeDrive(driveName: string) {
6262
return data;
6363
}
6464

65+
/**
66+
* Include drive in DriveBrowser listing.
67+
*
68+
* @returns
69+
*/
70+
export async function includeDrive(driveName: string) {
71+
await requestAPI<any>('drives/config', 'POST', {
72+
include_drive_name: driveName
73+
});
74+
75+
data = {
76+
name: driveName,
77+
path: driveName,
78+
last_modified: '',
79+
created: '',
80+
content: [],
81+
format: 'json',
82+
mimetype: '',
83+
size: 0,
84+
writable: true,
85+
type: 'directory'
86+
};
87+
return data;
88+
}
89+
6590
/**
6691
* Fetch the list of available drives.
6792
* @returns The list of available drives.

0 commit comments

Comments
 (0)