Skip to content

Commit

Permalink
Merge fd4bda4 into d15c17a
Browse files Browse the repository at this point in the history
  • Loading branch information
briehl committed Dec 22, 2017
2 parents d15c17a + fd4bda4 commit 3ba1407
Show file tree
Hide file tree
Showing 21 changed files with 1,342 additions and 424 deletions.
3 changes: 2 additions & 1 deletion kbase-extension/static/kbase/config/feature-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
"stagingDataViewer": true,
"jgiPublicStaging": true,
"advanced": false,
"developer": false
"developer": false,
"lazyWidgetRender": true
}
16 changes: 1 addition & 15 deletions kbase-extension/static/kbase/css/kbaseNarrative.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
54 changes: 53 additions & 1 deletion kbase-extension/static/kbase/js/api/upa.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,65 @@ 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!'
};
}
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)) {
var serialArr = [];
upas.forEach(function(upa) {
serialArr.push(serialize(upa));
});
return serialArr;
}
else {
var serialSt = {};
Object.keys(upas).forEach(function(key) {
serialSt[key] = serializeAll(upas[key]);
});
return serialSt;
}
};

var deserializeAll = function(upas) {
if (typeof upas === 'string') {
return deserialize(upas);
}
else if (Array.isArray(upas)) {
var deserialArr = [];
upas.forEach(function(upa) {
deserialArr.push(deserialize(upa));
});
return deserialArr;
}
else {
var deserialSt = {};
Object.keys(upas).forEach(function(key) {
deserialSt[key] = deserializeAll(upas[key]);
});
return deserialSt;
}
};

return {
serialize: serialize,
deserialize: deserialize,
serializeExternal: serializeExternal,
externalTag: externalTag,
isUpa: isUpa
isUpa: isUpa,
changeUpaVersion: changeUpaVersion,
serializeAll: serializeAll,
deserializeAll: deserializeAll
};
};

Expand Down
3 changes: 3 additions & 0 deletions kbase-extension/static/kbase/js/kbaseNarrative.js
Original file line number Diff line number Diff line change
Expand Up @@ -931,6 +931,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];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* A simple widget intended to format and display errors that come from
* the narrative kernel (these are typically back-end errors that
* occur while running the function). The cause of these errors will
* probably be either errors with user inputs, or errors while
* probably be either errors with user inputs, or errors while
* communicating with the KBase API.
*
* @author Bill Riehl <wjriehl@lbl.gov>
Expand All @@ -18,32 +18,12 @@ define([
bootstrap,
$,
kbaseAccordion
) {
) {
'use strict';

return KBWidget({
/*
* (required) Your widget should be named in CamelCase.
*/
name: 'kbaseNarrativeError',
/*
* Extending kbaseAuthenticatedWidget lets you use auth tokens
* semi-automatically, assuming the page this is used in fires
* the loggedIn.kbase, loggedOut.kbase, and loggedInQuery events.
* These are usually fired by the kbaseLogin widget.
*
* this.user_id() = the logged in user id
* this.authToken() = the current authentication token
*/


/*
* (optional) Widgets should be semantically versioned.
* See http://semver.org
*/
version: '1.0.0',
/*
* (optional) Widgets are implied to include an options structure.
* It's useful to put default values here.
*/
options: {
error: {
'msg': 'An error occurred',
Expand All @@ -54,13 +34,13 @@ define([
},
/**
* (required) This is the only required function for a KBase Widget.
* @param {object} options - a structure containing the set of
* @param {object} options - a structure containing the set of
* options to be passed to this widget.
* @private
*/

init: function (options) {
this._super(options);

return this.render();
},
render: function () {
Expand Down Expand Up @@ -128,19 +108,16 @@ define([
.append($stackTraceAccordion);

new kbaseAccordion($stackTraceAccordion, {
elements: [
{
title: 'Detailed Error Message',
body: $('<pre>')
.addClass('kb-err-msg')
.append(esc(this.options.error.msg))
.append(format_tb(this.options.error)),
}
]
elements: [{
title: 'Detailed Error Message',
body: $('<pre>')
.addClass('kb-err-msg')
.append(esc(this.options.error.msg))
.append(format_tb(this.options.error)),
}]
}
);

return this;
},
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ define (
],
magicPieSize : 425,
methodName : 'KBaseRNASeq/view_alignment_statistics',
upa: null,
},

value_for_wedge : function(val) {
Expand Down Expand Up @@ -328,6 +329,10 @@ define (
ws_params = { ref : this.options.ws_sample_id };
}

if (this.options.upas.output) {
ws_params = { ref: this.options.upas.output };
}

ws.get_objects2({objects : [ws_params]}).then(function (d) {
$pie.options.output = d.data[0].data;

Expand Down Expand Up @@ -372,16 +377,16 @@ define (

loadAlignment : function(ref) {

this.data('container').removeTab('Overview');
//this.data('container').removeTab('Pie chart');
this.data('container').removeTab('Overview');
//this.data('container').removeTab('Pie chart');
this.data('container').addTab(
{
tab : 'Overview',
content : 'Loading...',
}
);

var $pie = this;
var $pie = this;
var ws = new Workspace(window.kbconfig.urls.workspace, {token : $pie.authToken()});

var ws_params = {
Expand Down Expand Up @@ -489,7 +494,7 @@ define (
}*/
]
}
)
);

this._rewireIds($containerElem, this);
this.data('container', $container);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,14 @@ define([

if (url) {
return a({
href: url,
target: '_blank',
id: events.addEvent({
type: 'click',
handler: doShowInfoModal
})
},
label || 'ref');
href: url,
target: '_blank',
id: events.addEvent({
type: 'click',
handler: doShowInfoModal
})
},
label || 'ref');
}
return '';
}
Expand Down Expand Up @@ -372,19 +372,6 @@ define([
span({ class: 'fa fa-arrow-down fa-lg', style: 'xfont-size: 18px' })
])),
renderOptions(cell, events),
// button({
// type: 'button',
// class: 'btn btn-default btn-xs',
// dataToggle: 'tooltip',
// dataPlacement: 'left',
// title: true,
// dataOriginalTitle: 'Delete Cell',
// id: events.addEvent({type: 'click', handler: doDeleteCell})
// }, [
// span({class: 'fa fa-times-circle', style: {fontSize: '14pt', color: 'red'}})
// ]),
// enable the following
// function to add the min / max button
(function() {
var toggleMinMax = utils.getCellMeta(cell, 'kbase.cellState.toggleMinMax', 'maximized'),
toggleIcon = (toggleMinMax === 'maximized' ? 'minus' : 'plus'),
Expand Down Expand Up @@ -426,10 +413,6 @@ define([
dataElement: 'icon',
class: 'icon',
style: {
xposition: 'relative',
xtop: '0',
xleft: '0',
xdisplay: 'inline-block',
flexShrink: '0',
width: '56px',
height: '56px',
Expand All @@ -441,7 +424,6 @@ define([
div({ style: { flexGrow: '1' } }, [
div({ dataElement: 'title', class: 'title', style: { lineHeight: '20px', height: '20px', marginTop: '8px', overflow: 'hidden' } }, [getCellTitle(cell)]),
div({ dataElement: 'subtitle', class: 'subtitle', style: { lineHeight: '20px', height: '20px', overflow: 'hidden' } }, [getCellSubtitle(cell)])
// div({dataElement: 'info-link', class: 'info-link'}, [getCellInfoLink(cell, events)])
])
])
]),
Expand All @@ -451,10 +433,6 @@ define([
])
])
]);
// if (Jupyter.narrative.readonly) {
// $(content).find('.buttons-container').hide();
// }

return {
events: events,
content: content
Expand Down Expand Up @@ -489,4 +467,4 @@ define([
return factory(config);
}
};
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,25 @@
*/
/*global define*/
/*jslint white:true,browser:true*/
define (
[
'kbwidget',
'bootstrap',
'jquery',
'underscore',
'narrativeConfig',
'narrativeViewers',
'kbaseNarrativeCell',
'kb_service/utils'
], function(
KBWidget,
bootstrap,
$,
_,
Config,
Viewers,
kbaseNarrativeCell,
ServiceUtils
) {
define ([
'kbwidget',
'bootstrap',
'jquery',
'underscore',
'narrativeConfig',
'narrativeViewers',
'kbaseNarrativeCell',
'kb_service/utils'
], function(
KBWidget,
bootstrap,
$,
_,
Config,
Viewers,
kbaseNarrativeCell,
ServiceUtils
) {
'use strict';

/**
Expand Down Expand Up @@ -111,7 +110,7 @@ define (
.append('&nbsp;<a href="' + self.shortMarkdownDesc(self.obj_info,
self.options.lp_url) + '" target="_blank">' + self.obj_info.name + '</a>');

// self.metadataRender(self.$elem);
self.metadataRender(self.$elem);
self.$elem.append(widget.widget);
self.$elem.closest('.cell').trigger('set-title', [self.obj_info.name]);
};
Expand Down
Loading

0 comments on commit 3ba1407

Please sign in to comment.