Commit 989bfb63 authored by Mark Ghiorso's avatar Mark Ghiorso

Upgrades to user interface

- Changed restore options so that repository initialization is restored correctly at startup
- Added eror messages for save, copy, delete, etc to inform users of the read-only nature of a GitLab repository, directling them to use the Save As… command with a path to a local disk
- upped release to 0.2.1
parent cf937deb
{
"name": "@enki-portal/gitlab",
"version": "0.2.0",
"version": "0.2.1",
"description": "A JupyterLab extension to access GitLab repositories",
"license": "BSD-3-Clause",
"author": "Mark Ghiorso",
......
......@@ -6,9 +6,10 @@ import {
PathExt, URLExt
} from '@jupyterlab/coreutils';
//import {
// ObservableValue
//} from '@jupyterlab/observables';
import {
showErrorMessage
} from '@jupyterlab/apputils';
import {
DocumentRegistry
......@@ -218,6 +219,8 @@ class GitLabDrive implements Contents.IDrive {
* file is created.
*/
newUntitled(options: Contents.ICreateOptions = {}): Promise<Contents.IModel> {
const e = new EvalError('The repository is read-only. Please use the file tab to create a new local file.');
showErrorMessage('File save error', e);
return Promise.reject('Repository is read only');
}
......@@ -229,6 +232,8 @@ class GitLabDrive implements Contents.IDrive {
* @returns A promise which resolves when the file is deleted.
*/
delete(path: string): Promise<void> {
const e = new EvalError('The repository is read-only. A file in a GitLab repository cannot be deleted from the ENKI server.');
showErrorMessage('File save error', e);
return Promise.reject('Repository is read only');
}
......@@ -243,6 +248,8 @@ class GitLabDrive implements Contents.IDrive {
* the file is renamed.
*/
rename(path: string, newPath: string): Promise<Contents.IModel> {
const e = new EvalError('The repository is read-only. Please use the save-as command to save a copy of this file in a local directory.');
showErrorMessage('File save error', e);
return Promise.reject('Repository is read only');
}
......@@ -257,6 +264,8 @@ class GitLabDrive implements Contents.IDrive {
* file is saved.
*/
save(path: string, options: Partial<Contents.IModel>): Promise<Contents.IModel> {
const e = new EvalError('The repository is read-only. Please use the save-as command and specify a local directory.');
showErrorMessage('File save error', e);
return Promise.reject('Repository is read only');
}
......@@ -271,6 +280,8 @@ class GitLabDrive implements Contents.IDrive {
* file is copied.
*/
copy(fromFile: string, toDir: string): Promise<Contents.IModel> {
const e = new EvalError('The repository is read-only. Please use the save-as command and specify a local directory.');
showErrorMessage('File save error', e);
return Promise.reject('Repository is read only');
}
......@@ -283,6 +294,8 @@ class GitLabDrive implements Contents.IDrive {
* checkpoint is created.
*/
createCheckpoint(path: string): Promise<Contents.ICheckpointModel> {
const e = new EvalError('The repository is read-only. A checkpoint cannot be created for this remote access file.');
showErrorMessage('File save error', e);
return Promise.reject('Repository is read only');
}
......@@ -308,6 +321,8 @@ class GitLabDrive implements Contents.IDrive {
* @returns A promise which resolves when the checkpoint is restored.
*/
restoreCheckpoint(path: string, checkpointID: string): Promise<void> {
const e = new EvalError('The repository is read-only. Checkpoints cannot be restored for this remote file.');
showErrorMessage('File save error', e);
return Promise.reject('Repository is read only');
}
......@@ -321,6 +336,8 @@ class GitLabDrive implements Contents.IDrive {
* @returns A promise which resolves when the checkpoint is deleted.
*/
deleteCheckpoint(path: string, checkpointID: string): Promise<void> {
const e = new EvalError('The repository is read-only. Checkpoints cannot be deleted for this remote file.');
showErrorMessage('File save error', e);
return Promise.reject('Read only');
}
......
......@@ -52,7 +52,8 @@ function activateFileBrowser(app: JupyterLab, manager: IDocumentManager, factory
const browser = factory.createFileBrowser(NAMESPACE, {
commands,
driveName: drive.name
driveName: drive.name,
state: null
});
browser.model.cd('/');
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment