diff --git a/kbase-extension/static/kbase/config/feature-config.json b/kbase-extension/static/kbase/config/feature-config.json index dd0b13f836..8de4a0ea0a 100644 --- a/kbase-extension/static/kbase/config/feature-config.json +++ b/kbase-extension/static/kbase/config/feature-config.json @@ -2,5 +2,6 @@ "stagingDataViewer": true, "jgiPublicStaging": true, "advanced": false, - "developer": false + "developer": false, + "lazyWidgetRender": true } diff --git a/kbase-extension/static/kbase/css/kbaseNarrative.css b/kbase-extension/static/kbase/css/kbaseNarrative.css index 35018675eb..991a65f093 100644 --- a/kbase-extension/static/kbase/css/kbaseNarrative.css +++ b/kbase-extension/static/kbase/css/kbaseNarrative.css @@ -1430,14 +1430,6 @@ div#notebook_panel { cursor: pointer; } -.kb-cell-toolbar { - xborder-bottom: 1px silver solid; -} - -.kb-cell-toolbar.collapsed { - xborder-bottom: none; -} - .kb-cell-toolbar .buttons { font-weight: bold; color: #CECECE !important; @@ -1452,7 +1444,7 @@ div#notebook_panel { height: 56px; width: 56px; padding: 0; - margin: 0 4px 0 4px; + margin-right: 4px; vertical-align: top; border: 0px red solid; line-height: 56px; @@ -1652,12 +1644,6 @@ div#notebook_panel { border-bottom-color: #bce8f1; } -.kb-func-panel .panel-footer { - /*background-color: #fff; - border-top: none; */ - /*padding: 2px 15px;*/ -} - /** output cell styling */ .kb-cell-output .panel { border-radius: 0px; diff --git a/kbase-extension/static/kbase/js/api/upa.js b/kbase-extension/static/kbase/js/api/upa.js index 45c4a039e4..bfe3768075 100644 --- a/kbase-extension/static/kbase/js/api/upa.js +++ b/kbase-extension/static/kbase/js/api/upa.js @@ -108,13 +108,64 @@ define([ return deserial; }; + var changeUpaVersion = function(upa, newVersion) { + if (!isUpa(upa)) { + throw { + error: upa + ' is not a valid upa, so its version cannot be changed!' + }; + } + if ((!(/^\d+$/.test(newVersion)) || newVersion <= 0)) { + throw { + error: newVersion + ' is not a valid version number!' + }; + } + var newUpa = upa.replace(/^(.+\/)(\d+)$/, '$1' + newVersion); + return newUpa; + }; + + var serializeAll = function(upas) { + if (typeof upas === 'string') { + return serialize(upas); + } + else if (Array.isArray(upas)) { + return upas.map(function(upa) { + return serialize(upa); + }); + } + else { + return Object.keys(upas).reduce(function(acc, key) { + acc[key] = serializeAll(upas[key]); + return acc; + }, {}); + } + }; + + var deserializeAll = function(upas) { + if (typeof upas === 'string') { + return deserialize(upas); + } + else if (Array.isArray(upas)) { + return upas.map(function(upa) { + return deserialize(upa); + }); + } + else { + return Object.keys(upas).reduce(function(acc, key) { + acc[key] = deserializeAll(upas[key]); + return acc; + }, {}); + } + }; return { serialize: serialize, deserialize: deserialize, serializeExternal: serializeExternal, externalTag: externalTag, - isUpa: isUpa + isUpa: isUpa, + changeUpaVersion: changeUpaVersion, + serializeAll: serializeAll, + deserializeAll: deserializeAll }; }; diff --git a/kbase-extension/static/kbase/js/kbaseNarrative.js b/kbase-extension/static/kbase/js/kbaseNarrative.js index 43fb5fd894..f219342618 100644 --- a/kbase-extension/static/kbase/js/kbaseNarrative.js +++ b/kbase-extension/static/kbase/js/kbaseNarrative.js @@ -30,7 +30,6 @@ define([ 'notebook/js/notebook', 'util/display', 'util/bootstrapDialog', - 'util/bootstrapAlert', 'util/timeFormat', 'text!kbase/templates/update_dialog_body.html', 'text!kbase/templates/document_version_change.html', @@ -65,7 +64,6 @@ define([ Notebook, DisplayUtil, BootstrapDialog, - BootstrapAlert, TimeFormat, UpdateDialogBodyTemplate, DocumentVersionDialogBodyTemplate, @@ -379,7 +377,7 @@ define([ Narrative.prototype.showDocumentVersionDialog = function (newVerInfo) { var bodyTemplate = Handlebars.compile(DocumentVersionDialogBodyTemplate); - var versionDialog = new BootstrapAlert({ + var versionDialog = new BootstrapDialog({ title: 'Showing an older Narrative document', body: bodyTemplate({ currentVer: this.documentVersionInfo, @@ -388,7 +386,8 @@ define([ newDate: TimeFormat.readableTimestamp(newVerInfo[3]), sameUser: this.documentVersionInfo[5] === newVerInfo[5], readOnly: this.readonly - }) + }), + alertOnly: true }); versionDialog.show(); @@ -833,10 +832,11 @@ define([ */ Narrative.prototype.addViewerCell = function(obj) { if (Jupyter.narrative.readonly) { - new BootstrapAlert({ + new BootstrapDialog({ type: 'warning', title: 'Warning', - body: 'Read-only Narrative -- may not add a data viewer to this Narrative' + body: 'Read-only Narrative -- may not add a data viewer to this Narrative', + alertOnly: true }); return; } @@ -938,6 +938,9 @@ define([ * get_cell_elements, which does this searching). */ Narrative.prototype.getCellIndexByKbaseId = function (id) { + if (!Jupyter.notebook) { + return null; + } var cells = Jupyter.notebook.get_cells(); for (var i = 0; i < cells.length; i++) { var c = cells[i]; diff --git a/kbase-extension/static/kbase/js/util/bootstrapAlert.js b/kbase-extension/static/kbase/js/util/bootstrapAlert.js deleted file mode 100644 index 797d8a2c0d..0000000000 --- a/kbase-extension/static/kbase/js/util/bootstrapAlert.js +++ /dev/null @@ -1,91 +0,0 @@ -/*global define*/ -/*jslint white: true*/ -define([ - 'bootstrap', - 'jquery' -], function( - bootstrap, - $ -) { - 'use strict'; - - /** - * options: - * { - * title: string, - * body: jquery node - * } - */ - var BootstrapAlert = function(options) { - this.$modal = $('