import { IContentsManager, IContentsModel, INotebookSessionManager, INotebookSession, ISessionId, IKernelSpecId } from 'jupyter-js-services'; import { IDisposable } from 'phosphor-disposable'; import { IChangedArgs } from 'phosphor-properties'; import { ISignal } from 'phosphor-signaling'; /** * An implementation of a file browser view model. * * #### Notes * All paths parameters without a leading `'/'` are interpreted as relative to * the current directory. Supports `'../'` syntax. */ export declare class FileBrowserModel implements IDisposable { /** * Construct a new file browser view model. */ constructor(contentsManager: IContentsManager, sessionManager: INotebookSessionManager); /** * Get the refreshed signal. */ refreshed: ISignal; /** * Get the file open requested signal. */ openRequested: ISignal; /** * Get the file path changed signal. */ fileChanged: ISignal>; /** * Get the current path. * * #### Notes * This is a read-only property. */ path: string; /** * Get the selection changed signal. */ selectionChanged: ISignal; /** * Get whether the view model is disposed. */ isDisposed: boolean; /** * Get the session ids for active notebooks. * * #### Notes * This is a read-only property. */ sessionIds: ISessionId[]; /** * Get a the list of available kernel specs. * * #### Notes * This is a read-only property. */ kernelSpecs: IKernelSpecId[]; /** * Get whether the items are sorted in ascending order. */ /** * Set whether the items are sorted in ascending order. */ sortAscending: boolean; /** * Get which key the items are sorted on. */ /** * Set which key the items are sorted on. */ sortKey: string; /** * Get the sorted list of items. * * #### Notes * This is a read-only property and should be treated as immutable. */ sortedItems: IContentsModel[]; /** * Select an item by name. * * #### Notes * This is a no-op if the name is not valid or already selected. */ select(name: string): void; /** * De-select an item by name. * * #### Notes * This is a no-op if the name is not valid or not selected. */ deselect(name: string): void; /** * Check whether an item is selected. * * #### Notes * Returns `true` for a valid name that is selected, `false` otherwise. */ isSelected(name: string): boolean; /** * Get the list of selected names. */ getSelected(): string[]; /** * Clear the selected items. */ clearSelected(): void; /** * Dispose of the resources held by the view model. */ dispose(): void; /** * Change directory. * * @param path - The path to the file or directory. * * @returns A promise with the contents of the directory. */ cd(path?: string): Promise; /** * Refresh the current directory. */ refresh(): Promise; /** * Copy a file. * * @param fromFile - The path of the original file. * * @param toDir - The path to the target directory. * * @returns A promise which resolves to the contents of the file. */ copy(fromFile: string, toDir: string): Promise; /** * Delete a file. * * @param: path - The path to the file to be deleted. * * @returns A promise which resolves when the file is deleted. */ delete(path: string): Promise; /** * Download a file. * * @param - path - The path of the file to be downloaded. * * @returns - A promise which resolves to the file contents. */ download(path: string): Promise; /** * Create a new untitled file or directory in the current directory. * * @param type - The type of file object to create. One of * `['file', 'notebook', 'directory']`. * * @param ext - Optional extension for `'file'` types (defaults to `'.txt'`). * * @returns A promise containing the new file contents model. */ newUntitled(type: string, ext?: string): Promise; /** * Open a file in the current by name. */ open(name: string): Promise; /** * Rename a file or directory. * * @param path - The path to the original file. * * @param newPath - The path to the new file. * * @returns A promise containing the new file contents model. */ rename(path: string, newPath: string): Promise; /** * Upload a `File` object. * * @param file - The `File` object to upload. * * @param overwrite - Whether to overwrite an existing file. * * @returns A promise containing the new file contents model. * * #### Notes * This will fail to upload files that are too big to be sent in one * request to the server. */ upload(file: File, overwrite?: boolean): Promise; /** * Shut down a notebook session by session id. */ shutdown(sessionId: ISessionId): Promise; /** * Start a new session on a notebook. */ startSession(path: string, kernel: string): Promise; /** * Sort the model items. */ private _sort(); /** * Perform the actual upload. */ private _upload(file); /** * Get the notebook sessions for the current directory. */ private _findSessions(); /** * Load the list of kernel specs. */ private _getKernelSpecs(); private _max_upload_size_mb; private _contentsManager; private _sessionIds; private _sessionManager; private _model; private _kernelSpecs; private _selection; private _sortKey; private _ascending; private _unsortedNames; }