Skip to content

Commit

Permalink
Merge a9d3f58 into 3fb2d29
Browse files Browse the repository at this point in the history
  • Loading branch information
briehl committed May 3, 2018
2 parents 3fb2d29 + a9d3f58 commit e356fab
Show file tree
Hide file tree
Showing 1,032 changed files with 32,088 additions and 5,607 deletions.
3 changes: 3 additions & 0 deletions .eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ extends: 'eslint:recommended'
parserOptions:
ecmaVersion: 5
rules:
strict:
- error
- function
indent:
- error
- 4
Expand Down
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This is the repository for the KBase Narrative Interface.

The KBase Narrative Interface builds on the [Jupyter Notebook](http://jupyter.org) and contains elements to interact with various KBase tools and data stores.

This document contains links to various documentation in the [docs](/docs) directory, with a brief description of each.
This document contains links to various documentation in the [docs](docs) directory, with a brief description of each.

## Local Installation (for developers)
Short version:
Expand All @@ -32,24 +32,24 @@ kbase-narrative

Long version:

[Local Narrative setup/deployment](/docs/install/local_install.md)
[Local Narrative setup/deployment](docs/install/local_install.md)

## Server installation (for administrators)

If you want to set up your own Narrative server that uses the Docker framework, the below document will walk you through it. Once the server is set up, you only need to pull new code and build a new Docker image from it. You can also pull Narrative images directly from Dockerhub in the KBase namespace.

The document specifically describes how you would build the system on a [Vagrant](https://www.vagrantup.com) image, but is applicable to any Ubuntu-based system.

[Production Narrative setup/deployment](/docs/install/deployment.md)
[Dockerhub Narrative builds](/docs/install/dockerhub_builds.md)
[Production Narrative setup/deployment](docs/install/deployment.md)
[Dockerhub Narrative builds](docs/install/dockerhub_builds.md)

## Architecture

### In progress!

The Narrative sits on top of the Jupyter Notebook, so most of its architecture is a mirror of that. However, the Narrative's interaction with other KBase elements - namely the data stores and job running services - merits its own description. This will be ongoing (and evolving!), but a brief description of how a job gets run and registered is available here:

[Narrative App/Method Running](/docs/developer/narrative_app_error_states.md)
[Narrative App/Method Running](docs/developer/narrative_app_error_states.md)

When deployed in production, the Narrative Interface is compiled into a [Docker](https://www.docker.com) container. When a user logs in, they have their own instance provisioned for them through an [Nginx](http://nginx.org) proxy, which provides a temporary server-side Narrative environment only for that user. Any changes made to a Narrative get saved as part of KBase data stores, but any changes to the file system or the Narrative kernel (e.g. local variables) are lost when the user logs out and their Docker instance gets shut down.

Expand All @@ -61,13 +61,18 @@ Testing is composed of three components:
- a `travis.yml` file for Travis-CI testing
- a set of Selenium-based end-to-end tests that simulate browser interactions

Testing locally (i.e. not through Travis-CI) requires a local Narrative installation, with active virtualenv (if installed that way). Then just run `make test` or `make test-frontend-unit` or `make test-backend`
Testing locally (i.e. not through Travis-CI) requires a local Narrative installation, with active virtualenv (if installed that way). Then just run `make test` or `make test-frontend-unit` or `make test-backend`. If you haven't changed any configuration, this will run unauthenticated tests and skip any tests that require authentication.

To run authenticated tests, you'll need to get an auth token from KBase servers, drop it in a file in the test directory (as the only line in that file), then modify two config files. These are `test/unit/testConfig.json` for frontend tests, and `src/biokbase/narrative/tests/test.cfg` for backend tests [TODO: merge those, or move them somewhere sensible]. The frontend test file should have the "token" block modified to include your username and the path to the token file. The backend test file should be updated so that the `test_user` and/or `private_user` keys in the `[users]` and `[token_files]` block are aligned (e.g. users.test_user is the user for the token in token_files.test_user).

Note: **DO NOT CHECK YOUR TOKEN FILE IN TO GITHUB**. You'll be shamed mercilessly.


## Submitting code

We currently use a modified version of the famous [Git flow](http://drewfradette.ca/a-simpler-successful-git-branching-model/) workflow, described below:

[Narrative Git Workflow](/docs/git-workflow.md)
[Narrative Git Workflow](docs/git-workflow.md)

The short version is this - all development work is done on the `develop` branch. After some stability occurs, this gets merged to `staging` for internal testing, then to `master` where it is tagged and released to production.

Expand Down
16 changes: 15 additions & 1 deletion RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,28 @@ The Narrative Interface allows users to craft KBase Narratives using a combinati

This is built on the Jupyter Notebook v5.4.1 (more notes will follow).

### Version 3.7.2
- SCT-908 - Fix formatting issues with heatmaps.
- SCT-875 - Accept poorly formatted input data into the RNA-Seq data heatmap viewers.
- SCT-878 - Deal with very large heatmaps so that they get downloaded instead of displayed inline, otherwise allow it to grow to some proper size and embed it in a scroll panel.
- SCT-875 - Fix labels on heatmaps under certain data conditions.
- SCT-809 - Fix configuration view mode when there are deeply nested parameters, especially lists of grouped parameters containing a subdata param.
- SCT-866 - Improve side panel behavior in view-only mode; stretch data panel to full height.
- SCT-821 - Add "info" item to view cell menu, also some other cleanup for viewer cells.
- SCT-762 - Convert the Feature set viewer to use a dynamic service to fetch feature data.
- SCT-657 - Narrative Public Data search now uses new Search API to find KBase data.
- Due to the nature of the Search API, this also changes the interface to require the user to press "enter" to do a search, instead of as-you-type.
- Changes the layout of the retrieved items from searching.
- SCT-804 - General updates to fix a compilation problem with FeatureValues data widgets.

### Version 3.7.1
- SCT-793 - Fix version of upstream dependency "file-saver" to 1.3.4; an upstream update had broken and taken down the Pangenome viewer and others.

### Version 3.7.0
- Update Jupyter Notebook to 5.4.1 with a few KBase adjustments
- Prevent Jupyter favicon from overriding ours at various points.
- Use local version of Font Awesome.
- Use local version of Glyphicons font pack (for Datatables-based widgets)
- Use local version of Glyphicons font pack (for Datatables-based widgets).
- Use Bootstrap version 3.3.7
- Update ipywidgets to 7.2.1
- SCT-559 - Fix ugly race condition that could prevent app cells from being properly rendered when loading an existing Narrative.
Expand Down
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kbase-narrative",
"version": "3.7.1",
"version": "3.7.2",
"homepage": "https://kbase.us",
"dependencies": {
"bluebird": "3.4.7",
Expand All @@ -15,7 +15,7 @@
"handlebars": "^4.0.5",
"jquery-nearest": "~1.3.1",
"jquery.tipsy": "*",
"kbase-common-js": "2.5.0",
"kbase-common-js": "2.16.0",
"kbase-service-clients-js": "3.3.4",
"kbase-sdk-clients-js": "0.5.1",
"numeral": "~1.5.0",
Expand Down
74 changes: 74 additions & 0 deletions docs/developer/local-docker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Running Narrative in local Docker

It is useful to run the Narrative within a local docker container. E.g. this makes it easy to work on Narrative ui locally integrated with a local instance of kbase-ui.



## Narrative

The following changes are required:

- omit the line `RUN grunt minify` from /Dockerfile

- build the image manually.

The makefile has a tag of 1.0.3, we don't need that, so just use a more convenient "dev" tag for local usage.

```bash
docker build -t kbase/narrative:dev .
```

- start the container using the `scripts/local-dev-run.sh` script.

This script starts the narrative image using features to integrate it with local kbase-ui.

```bash
env=ci bash scripts/local-dev-run.sh
```

where env sets the ENVIRON environment variable for the Docker container; ci is the environment in which you are working (needs to be same as the ui is running on.)

- uses the config set $env; makes it easy to test different environments alongside ui
- uses kbase-dev network; allows interoperation with the kbase-ui proxier
- uses name "narrative"; same
- mounts kbase static directory inside container; allows editing files on host and having changes reflected with a Narrative reload
- removes container when done; easy cleanup
- uses "dev" tagged container; matches the docker build task above

## Notes

The container can't be killed with Ctrl-C; you'll need to stop it using Docker or another tool like Kitematic.

If you need to update or change dependencies (bower.json), you'll need to rebuild the image.

### config.json changes

The Dockerfile runs 'src/scripts/kb-update-config' to generate '/kb/deployment/ui-common/narrative_version'. This script has the unfortunate side effect of overwriting the config file source in /src/config.json.
This is a little frustrating because it means that a committer has to be very careful to omit this file when building the image for development or testing.


## kbase-ui

The kbase-ui proxier needs to route narrative requests. In order to enable this, the proxier's nginx config needs to be modified:

- in your kbase-ui repo

- edit tools/proxier/docker/src/conf/nginx.conf.tmpl

- comment out the line `proxy_pass https://{{ .Env.deploy_ui_hostname }}/narrative;` and uncomment the line below it

- comment out the line `proxy_pass https://{{ .Env.deploy_hostname }}/narrative;` and uncomment the line below it.

- rebuild the proxier image: make proxier-image

- launch the proxier image: make run-proxier-image env=ci

## Done?

You should now be able to navigate to https://ci.kbase.us, log in, and pull a Narrative from the Dashboard.

## Full Recipe

TODO: all steps to from zero to hero.

TODO: copy version of this doc into kbase-ui docs.
11 changes: 11 additions & 0 deletions kbase-extension/static/ext_packages/igv/d/.lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@root

module

tabs
indent 2
maxlen 100

ass
nomen
plusplus
4 changes: 4 additions & 0 deletions kbase-extension/static/ext_packages/igv/d/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.DS_Store
/node_modules
/npm-debug.log
/.lintcache
15 changes: 15 additions & 0 deletions kbase-extension/static/ext_packages/igv/d/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
sudo: false # http://docs.travis-ci.com/user/workers/container-based-infrastructure/
language: node_js
node_js:
- 0.12
- 4
- 5

before_install:
- mkdir node_modules; ln -s ../ node_modules/d

notifications:
email:
- medikoo+d@medikoo.com

script: "npm test && npm run lint"
13 changes: 13 additions & 0 deletions kbase-extension/static/ext_packages/igv/d/CHANGES
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
v1.0.0 -- 2015.12.04
- autoBind changes:
- replace `bindTo` argument with options and `resolveContext` option
- Add support `overwriteDefinition`
- Introduce IE11 bug workaround in `lazy` handler

v0.1.1 -- 2014.04.24
- Add `autoBind` and `lazy` utilities
- Allow to pass other options to be merged onto created descriptor.
Useful when used with other custom utilties

v0.1.0 -- 2013.06.20
Initial (derived from es5-ext project)
19 changes: 19 additions & 0 deletions kbase-extension/static/ext_packages/igv/d/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (C) 2013 Mariusz Nowak (www.medikoo.com)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
104 changes: 104 additions & 0 deletions kbase-extension/static/ext_packages/igv/d/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
# D
## Property descriptor factory

_Originally derived from [es5-ext](https://github.com/medikoo/es5-ext) package._

Defining properties with descriptors is very verbose:

```javascript
var Account = function () {};
Object.defineProperties(Account.prototype, {
deposit: { value: function () {
/* ... */
}, configurable: true, enumerable: false, writable: true },
withdraw: { value: function () {
/* ... */
}, configurable: true, enumerable: false, writable: true },
balance: { get: function () {
/* ... */
}, configurable: true, enumerable: false }
});
```

D cuts that to:

```javascript
var d = require('d');

var Account = function () {};
Object.defineProperties(Account.prototype, {
deposit: d(function () {
/* ... */
}),
withdraw: d(function () {
/* ... */
}),
balance: d.gs(function () {
/* ... */
})
});
```

By default, created descriptor follow characteristics of native ES5 properties, and defines values as:

```javascript
{ configurable: true, enumerable: false, writable: true }
```

You can overwrite it by preceding _value_ argument with instruction:
```javascript
d('c', value); // { configurable: true, enumerable: false, writable: false }
d('ce', value); // { configurable: true, enumerable: true, writable: false }
d('e', value); // { configurable: false, enumerable: true, writable: false }

// Same way for get/set:
d.gs('e', value); // { configurable: false, enumerable: true }
```

### Installation

$ npm install d

To port it to Browser or any other (non CJS) environment, use your favorite CJS bundler. No favorite yet? Try: [Browserify](http://browserify.org/), [Webmake](https://github.com/medikoo/modules-webmake) or [Webpack](http://webpack.github.io/)

### Other utilities

#### autoBind(obj, props) _(d/auto-bind)_

Define methods which will be automatically bound to its instances

```javascript
var d = require('d');
var autoBind = require('d/auto-bind');

var Foo = function () { this._count = 0; };
Object.defineProperties(Foo.prototype, autoBind({
increment: d(function () { ++this._count; });
}));

var foo = new Foo();

// Increment foo counter on each domEl click
domEl.addEventListener('click', foo.increment, false);
```

#### lazy(obj, props) _(d/lazy)_

Define lazy properties, which will be resolved on first access

```javascript
var d = require('d');
var lazy = require('d/lazy');

var Foo = function () {};
Object.defineProperties(Foo.prototype, lazy({
items: d(function () { return []; })
}));

var foo = new Foo();
foo.items.push(1, 2); // foo.items array created and defined directly on foo
```

## Tests [![Build Status](https://travis-ci.org/medikoo/d.png)](https://travis-ci.org/medikoo/d)

$ npm test
32 changes: 32 additions & 0 deletions kbase-extension/static/ext_packages/igv/d/auto-bind.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
'use strict';

var copy = require('es5-ext/object/copy')
, normalizeOptions = require('es5-ext/object/normalize-options')
, ensureCallable = require('es5-ext/object/valid-callable')
, map = require('es5-ext/object/map')
, callable = require('es5-ext/object/valid-callable')
, validValue = require('es5-ext/object/valid-value')

, bind = Function.prototype.bind, defineProperty = Object.defineProperty
, hasOwnProperty = Object.prototype.hasOwnProperty
, define;

define = function (name, desc, options) {
var value = validValue(desc) && callable(desc.value), dgs;
dgs = copy(desc);
delete dgs.writable;
delete dgs.value;
dgs.get = function () {
if (!options.overwriteDefinition && hasOwnProperty.call(this, name)) return value;
desc.value = bind.call(value, options.resolveContext ? options.resolveContext(this) : this);
defineProperty(this, name, desc);
return this[name];
};
return dgs;
};

module.exports = function (props/*, options*/) {
var options = normalizeOptions(arguments[1]);
if (options.resolveContext != null) ensureCallable(options.resolveContext);
return map(props, function (desc, name) { return define(name, desc, options); });
};
Loading

0 comments on commit e356fab

Please sign in to comment.