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", "name": "@enki-portal/gitlab",
"version": "0.2.0", "version": "0.2.1",
"description": "A JupyterLab extension to access GitLab repositories", "description": "A JupyterLab extension to access GitLab repositories",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"author": "Mark Ghiorso", "author": "Mark Ghiorso",
......
...@@ -6,9 +6,10 @@ import { ...@@ -6,9 +6,10 @@ import {
PathExt, URLExt PathExt, URLExt
} from '@jupyterlab/coreutils'; } from '@jupyterlab/coreutils';
//import { import {
// ObservableValue showErrorMessage
//} from '@jupyterlab/observables'; } from '@jupyterlab/apputils';
import { import {
DocumentRegistry DocumentRegistry
...@@ -218,6 +219,8 @@ class GitLabDrive implements Contents.IDrive { ...@@ -218,6 +219,8 @@ class GitLabDrive implements Contents.IDrive {
* file is created. * file is created.
*/ */
newUntitled(options: Contents.ICreateOptions = {}): Promise<Contents.IModel> { 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'); return Promise.reject('Repository is read only');
} }
...@@ -229,6 +232,8 @@ class GitLabDrive implements Contents.IDrive { ...@@ -229,6 +232,8 @@ class GitLabDrive implements Contents.IDrive {
* @returns A promise which resolves when the file is deleted. * @returns A promise which resolves when the file is deleted.
*/ */
delete(path: string): Promise<void> { 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'); return Promise.reject('Repository is read only');
} }
...@@ -243,6 +248,8 @@ class GitLabDrive implements Contents.IDrive { ...@@ -243,6 +248,8 @@ class GitLabDrive implements Contents.IDrive {
* the file is renamed. * the file is renamed.
*/ */
rename(path: string, newPath: string): Promise<Contents.IModel> { 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'); return Promise.reject('Repository is read only');
} }
...@@ -257,6 +264,8 @@ class GitLabDrive implements Contents.IDrive { ...@@ -257,6 +264,8 @@ class GitLabDrive implements Contents.IDrive {
* file is saved. * file is saved.
*/ */
save(path: string, options: Partial<Contents.IModel>): Promise<Contents.IModel> { 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'); return Promise.reject('Repository is read only');
} }
...@@ -271,6 +280,8 @@ class GitLabDrive implements Contents.IDrive { ...@@ -271,6 +280,8 @@ class GitLabDrive implements Contents.IDrive {
* file is copied. * file is copied.
*/ */
copy(fromFile: string, toDir: string): Promise<Contents.IModel> { 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'); return Promise.reject('Repository is read only');
} }
...@@ -283,6 +294,8 @@ class GitLabDrive implements Contents.IDrive { ...@@ -283,6 +294,8 @@ class GitLabDrive implements Contents.IDrive {
* checkpoint is created. * checkpoint is created.
*/ */
createCheckpoint(path: string): Promise<Contents.ICheckpointModel> { 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'); return Promise.reject('Repository is read only');
} }
...@@ -308,6 +321,8 @@ class GitLabDrive implements Contents.IDrive { ...@@ -308,6 +321,8 @@ class GitLabDrive implements Contents.IDrive {
* @returns A promise which resolves when the checkpoint is restored. * @returns A promise which resolves when the checkpoint is restored.
*/ */
restoreCheckpoint(path: string, checkpointID: string): Promise<void> { 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'); return Promise.reject('Repository is read only');
} }
...@@ -321,6 +336,8 @@ class GitLabDrive implements Contents.IDrive { ...@@ -321,6 +336,8 @@ class GitLabDrive implements Contents.IDrive {
* @returns A promise which resolves when the checkpoint is deleted. * @returns A promise which resolves when the checkpoint is deleted.
*/ */
deleteCheckpoint(path: string, checkpointID: string): Promise<void> { 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'); return Promise.reject('Read only');
} }
......
...@@ -52,7 +52,8 @@ function activateFileBrowser(app: JupyterLab, manager: IDocumentManager, factory ...@@ -52,7 +52,8 @@ function activateFileBrowser(app: JupyterLab, manager: IDocumentManager, factory
const browser = factory.createFileBrowser(NAMESPACE, { const browser = factory.createFileBrowser(NAMESPACE, {
commands, commands,
driveName: drive.name driveName: drive.name,
state: null
}); });
browser.model.cd('/'); 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