diff --git a/IPython/html/services/contents/contentmanager.py b/IPython/html/services/contents/contentmanager.py
index 0dc55fe..6618497 100644
--- a/IPython/html/services/contents/contentmanager.py
+++ b/IPython/html/services/contents/contentmanager.py
@@ -94,7 +94,7 @@ class ContentManager(LoggingConfigurable):
"path": content_path,
"type": type,
"MIME-type": "",
- "last_modified": last_modified.ctime(),
+ "last_modified (UTC)": last_modified.ctime(),
"size": size}
return model
diff --git a/IPython/html/services/contents/handlers.py b/IPython/html/services/contents/handlers.py
index 274fde9..8f444cd 100644
--- a/IPython/html/services/contents/handlers.py
+++ b/IPython/html/services/contents/handlers.py
@@ -53,6 +53,20 @@ class ContentHandler(IPythonHandler):
self.set_status(204)
self.finish()
+class ServicesRedirectHandler(IPythonHandler):
+
+ @web.authenticated
+ def get(self):
+ url = self.base_project_url + 'api'
+ self.redirect(url)
+
+class ServicesHandler(IPythonHandler):
+
+ @web.authenticated
+ def get(self):
+ services = ['contents', 'notebooks', 'sessions', 'kernels', 'clusters']
+ self.finish(jsonapi.dumps(services))
+
#-----------------------------------------------------------------------------
# URL to handler mappings
@@ -62,7 +76,10 @@ _content_path_regex = r"(?P.+)"
default_handlers = [
(r"api/contents/%s" % _content_path_regex, ContentHandler),
- (r"api/contents", ContentRootHandler)
+ (r"api/contents", ContentRootHandler),
+ (r"api/", ServicesRedirectHandler),
+ (r"api", ServicesHandler)
+
]
diff --git a/IPython/html/services/kernels/kernelmanager.py b/IPython/html/services/kernels/kernelmanager.py
index a797a98..aa668bd 100644
--- a/IPython/html/services/kernels/kernelmanager.py
+++ b/IPython/html/services/kernels/kernelmanager.py
@@ -76,13 +76,13 @@ class MappingKernelManager(MultiKernelManager):
"""Shutdown a kernel by kernel_id"""
i = 0
for kernel in self.kernels:
- if kernel['kernel_id'] == kernel_id:
+ if kernel['id'] == kernel_id:
del self.kernels[i]
i = i+1
super(MappingKernelManager, self).shutdown_kernel(kernel_id, now=now)
def kernel_model(self, kernel_id, ws_url):
- model = {"kernel_id":kernel_id, "ws_url": ws_url}
+ model = {"id":kernel_id, "ws_url": ws_url}
self.kernels.append(model)
return model
diff --git a/IPython/html/services/notebooks/nbmanager.py b/IPython/html/services/notebooks/nbmanager.py
index 439c614..b8adfcd 100644
--- a/IPython/html/services/notebooks/nbmanager.py
+++ b/IPython/html/services/notebooks/nbmanager.py
@@ -135,9 +135,9 @@ class NotebookManager(LoggingConfigurable):
def notebook_model(self, notebook_name, notebook_path=None, content=True):
""" Creates the standard notebook model """
last_modified, contents = self.read_notebook_object(notebook_name, notebook_path)
- model = {"notebook_name": notebook_name,
- "notebook_path": notebook_path,
- "last_modified": last_modified.ctime()}
+ model = {"name": notebook_name,
+ "path": notebook_path,
+ "last_modified (UTC)": last_modified.ctime()}
if content == True:
model['content'] = contents
return model
diff --git a/IPython/html/services/sessions/sessionmanager.py b/IPython/html/services/sessions/sessionmanager.py
index 0f55793..21cad3e 100644
--- a/IPython/html/services/sessions/sessionmanager.py
+++ b/IPython/html/services/sessions/sessionmanager.py
@@ -38,8 +38,8 @@ class SessionManager(LoggingConfigurable):
"""Get an existing session or create a new one"""
model = None
for session in self.sessions:
- if session['notebook_name'] == nb_name and session['notebook_path'] == nb_path:
- session_id = session['session_id']
+ if session['name'] == nb_name and session['path'] == nb_path:
+ session_id = session['id']
model = session
if model != None:
return session_id, model
@@ -49,12 +49,12 @@ class SessionManager(LoggingConfigurable):
def session_model(self, session_id, notebook_name=None, notebook_path=None, kernel=None):
""" Create a session that links notebooks with kernels """
- model = dict(session_id=session_id,
- notebook_name=notebook_name,
- notebook_path=notebook_path,
+ model = dict(id=session_id,
+ name=notebook_name,
+ path=notebook_path,
kernel=kernel)
if notebook_path == None:
- model['notebook_path']=""
+ model['path']=""
self.sessions.append(model)
return model
@@ -65,33 +65,33 @@ class SessionManager(LoggingConfigurable):
def set_kernel_for_sessions(self, session_id, kernel_id):
"""Maps the kernel_ids to the session_id in session_mapping"""
for session in self.sessions:
- if session['session_id'] == session_id:
- session['kernel_id'] = kernel_id
+ if session['id'] == session_id:
+ session['kernel']['id'] = kernel_id
return self.sessions
def delete_mapping_for_session(self, session_id):
"""Delete the session from session_mapping with the given session_id"""
i = 0
for session in self.sessions:
- if session['session_id'] == session_id:
+ if session['id'] == session_id:
del self.sessions[i]
i = i + 1
return self.sessions
def get_session_from_id(self, session_id):
for session in self.sessions:
- if session['session_id'] == session_id:
+ if session['id'] == session_id:
return session
def get_notebook_from_session(self, session_id):
"""Returns the notebook_path for the given session_id"""
for session in self.sessions:
- if session['session_id'] == session_id:
- return session['notebook_name']
+ if session['id'] == session_id:
+ return session['name']
def get_kernel_from_session(self, session_id):
"""Returns the kernel_id for the given session_id"""
for session in self.sessions:
- if session['session_id'] == session_id:
- return session['kernel']['kernel_id']
+ if session['id'] == session_id:
+ return session['kernel']['id']
diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js
index dde4d93..dc24aca 100644
--- a/IPython/html/static/notebook/js/notebook.js
+++ b/IPython/html/static/notebook/js/notebook.js
@@ -1520,16 +1520,6 @@ var IPython = (function (IPython) {
// Persistance and loading
/**
- * Getter method for this notebook's ID.
- *
- * @method get_notebook_id
- * @return {String} This notebook's ID
- */
- Notebook.prototype.get_notebook_id = function () {
- return this.notebook_id;
- };
-
- /**
* Getter method for this notebook's name.
*
* @method get_notebook_name
@@ -1757,7 +1747,7 @@ var IPython = (function (IPython) {
Notebook.prototype.notebook_rename = function (nbname) {
var that = this;
var new_name = nbname + '.ipynb'
- var name = {'notebook_name': new_name};
+ var name = {'name': new_name};
var settings = {
processData : false,
cache : false,
@@ -1774,7 +1764,7 @@ var IPython = (function (IPython) {
Notebook.prototype.rename_success = function (json, status, xhr) {
- this.notebook_name = json.notebook_name
+ this.notebook_name = json.name
var notebook_path = this.notebookPath() + this.notebook_name;
this.session.notebook_rename(notebook_path);
$([IPython.events]).trigger('notebook_renamed.Notebook');
diff --git a/IPython/html/static/services/kernels/js/kernel.js b/IPython/html/static/services/kernels/js/kernel.js
index ec77726..16b8344 100644
--- a/IPython/html/static/services/kernels/js/kernel.js
+++ b/IPython/html/static/services/kernels/js/kernel.js
@@ -110,9 +110,9 @@ var IPython = (function (IPython) {
Kernel.prototype._kernel_started = function (json) {
- console.log("Kernel started: ", json.kernel_id);
+ console.log("Kernel started: ", json.id);
this.running = true;
- this.kernel_id = json.kernel_id;
+ this.kernel_id = json.id;
var ws_url = json.ws_url;
if (ws_url.match(/wss?:\/\//) == null) {
// trailing 's' in https will become wss for secure web sockets
diff --git a/IPython/html/static/services/sessions/js/session.js b/IPython/html/static/services/sessions/js/session.js
index 839504f..0635fc5 100644
--- a/IPython/html/static/services/sessions/js/session.js
+++ b/IPython/html/static/services/sessions/js/session.js
@@ -62,7 +62,7 @@ var IPython = (function (IPython) {
* @method start_kernel
*/
Session.prototype.start_kernel = function (json) {
- this.session_id = json.session_id;
+ this.session_id = json.id;
this.kernel_content = json.kernel;
var base_url = $('body').data('baseKernelUrl') + "api/kernels";
this.kernel = new IPython.Kernel(base_url, this.session_id);
diff --git a/IPython/html/static/tree/js/notebooklist.js b/IPython/html/static/tree/js/notebooklist.js
index d95cc30..e825949 100644
--- a/IPython/html/static/tree/js/notebooklist.js
+++ b/IPython/html/static/tree/js/notebooklist.js
@@ -122,13 +122,13 @@ var IPython = (function (IPython) {
var len = data.length;
if (len != 0) {
for (var i=0; i