Skip to content

Commit

Permalink
Merge pull request #416 from Kitware/rename-reslab
Browse files Browse the repository at this point in the history
Renames Resonant Laboratory to Resonant Lab
  • Loading branch information
Roni Choudhury committed Sep 29, 2016
2 parents 60c60f5 + 94b9a2c commit d2a5882
Show file tree
Hide file tree
Showing 248 changed files with 116 additions and 116 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ npm-debug.log
*-diff.png
*-test.png
.ipynb_checkpoints
app/resonant-laboratory/scripts/core/*
app/resonant-laboratory/querylang/query.js
app/resonantlab/scripts/core/*
app/resonantlab/querylang/query.js
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ npm install
npm run build
```

# [Resonant Laboratory application](https://github.com/Kitware/candela/blob/master/app/resonant-laboratory/README.md)
# [Resonant Lab application](https://github.com/Kitware/candela/blob/master/app/resonantlab/README.md)

# Release Process

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ module.exports = function (grunt) {
// Fail if grunt is executed here.
if (path.resolve(__dirname) === path.resolve(process.cwd())) {
grunt.fail.fatal(
"To build Resonant Laboratory, run grunt from Girder's root directory");
"To build Resonant Lab, run grunt from Girder's root directory");
}

var pluginPath = path.resolve(grunt.config.get('pluginDir'), 'resonant-laboratory');
var pluginPath = path.resolve(grunt.config.get('pluginDir'), 'resonantlab');
var packageJson = path.resolve(pluginPath, 'package.json');

grunt.config.merge({
shell: {
'resonant-laboratory-npm': {
'resonantlab-npm': {
/*
* TODO(opadron): remove the true part once webpack 2 finally
* comes out of beta
Expand All @@ -30,14 +30,14 @@ module.exports = function (grunt) {
},

watch: {
'plugin-resonant-laboratory-npm': {
'plugin-resonantlab-npm': {
files: [packageJson],
tasks: ['shell:resonant-laboratory-npm']
tasks: ['shell:resonantlab-npm']
}
},

init: {
'shell:resonant-laboratory-npm': { dependencies: [] }
'shell:resonantlab-npm': { dependencies: [] }
}
});

Expand All @@ -54,7 +54,7 @@ module.exports = function (grunt) {

grunt.config.merge({
shell: {
'resonant-laboratory-webpack': {
'resonantlab-webpack': {
command: ['../../node_modules/webpack/bin/webpack.js',
'--bail',
'--display-error-details'].join(' '),
Expand All @@ -65,17 +65,17 @@ module.exports = function (grunt) {
},

watch: {
'plugin-resonant-laboratory-webpack': {
'plugin-resonantlab-webpack': {
files: [path.join(pluginPath, 'web-external', 'src', '**', '*'),
path.join(pluginPath, 'Gruntfile.js'),
path.join(pluginPath, 'webpack.config.js')],
tasks: ['shell:resonant-laboratory-webpack'],
tasks: ['shell:resonantlab-webpack'],
options: { spawn: false }
}
},

default: {
'shell:resonant-laboratory-webpack': { dependencies: [] }
'shell:resonantlab-webpack': { dependencies: [] }
}
});
};
50 changes: 25 additions & 25 deletions app/resonant-laboratory/README.md → app/resonantlab/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Resonant Laboratory
# Resonant Lab

Choose your own visualization adventure.

Expand Down Expand Up @@ -29,13 +29,13 @@ using the `virtualenv` described in the girder setup instructions.
cd candela
npm install
npm run build
npm run build:laboratory
npm run build:lab
```

5. Install the plugin using `girder-install`:

```bash
girder-install plugin -s app/resonant-laboratory
girder-install plugin -s app/resonantlab
```

### Setup: First Run
Expand All @@ -48,11 +48,11 @@ using the `virtualenv` described in the girder setup instructions.

2. Register an admin account at [localhost:8080](http://localhost:8080)

3. Go to Admin console -> Plugins to enable the Resonant Laboratory plugin
3. Go to Admin console -> Plugins to enable the Resonant Lab plugin

4. Restart Girder

Resonant Laboratory will replace the Girder interface at [localhost:8080](http://localhost:8080). It should give you an
Resonant Lab will replace the Girder interface at [localhost:8080](http://localhost:8080). It should give you an
error telling you that no assetstores have been configured.

5. Access the girder interface again, this time at [localhost:8080/girder](http://localhost:8080/girder). Navigate to
Expand All @@ -73,9 +73,9 @@ Admin console -> Assetstores

### Adding datasets

For now, `.csv` and `.json` files can to be uploaded via girder's interface to the user's public or private directories. Once a file has been uploaded, you should issue a `POST` request to `/item/{id}/dataset` so that Resonant Laboratory will know that it's a dataset.
For now, `.csv` and `.json` files can to be uploaded via girder's interface to the user's public or private directories. Once a file has been uploaded, you should issue a `POST` request to `/item/{id}/dataset` so that Resonant Lab will know that it's a dataset.

In addition to flat files, Resonant Laboratory also supports connecting to mongo databases. For example, a mongo collection could be added from a `json` file this way:
In addition to flat files, Resonant Lab also supports connecting to mongo databases. For example, a mongo collection could be added from a `json` file this way:

```bash
mongoimport --db test --collection gapminder --drop --file gapminder.json --jsonArray
Expand All @@ -93,7 +93,7 @@ Then an item should be created in the user's public or private directory to repr
{"url":"localhost:27017","database":"test","collection":"gapminder","type":"mongo"}
```

Of course, after connecting the girder item to the database, you also still need to hit the `/item/{id}/dataset` endpoint to indicate that it is also a dataset intended for Resonant Laboratory.
Of course, after connecting the girder item to the database, you also still need to hit the `/item/{id}/dataset` endpoint to indicate that it is also a dataset intended for Resonant Lab.

### Development

Expand All @@ -106,18 +106,18 @@ girder-server --testing
```

We've also augmented webpack's `--watch` mode, so that it automatically triggers
girder's grunt build step when you change code in resonant-laboratory. To
girder's grunt build step when you change code in resonantlab. To
use it:

```bash
export GIRDER_PATH=path/to/girder
cd path/to/candela/app/resonant-laboratory
cd path/to/candela/app/resonantlab
webpack --watch
```

## Installation via Ansible

Resonant Laboratory comes with an Ansible deployment strategy as well. To use
Resonant Lab comes with an Ansible deployment strategy as well. To use
it, you will need Ansible 2.0:

```shell
Expand All @@ -130,17 +130,17 @@ Next, clone this repository:
git clone https://github.com/Kitware/candela
```

Move into the `candela/app/resonant-laboratory` directory, and then create the
Move into the `candela/app/resonantlab` directory, and then create the
Vagrant box with

```shell
vagrant up
```

This will configure, provision, and launch a virtual machine, which will set up
Girder, the example datasets, and Resonant Laboratory itself, and forward
Resonant Laboratory to port 8080 on your local machine. Then you can use
Resonant Laboratory by visiting http://localhost:8080.
Girder, the example datasets, and Resonant Lab itself, and forward
Resonant Lab to port 8080 on your local machine. Then you can use
Resonant Lab by visiting http://localhost:8080.

If port 8080 is being used for another purpose on your local machine already,
you can use the `RESLAB_HOST_PORT` environment variable to set a different one:
Expand Down Expand Up @@ -178,7 +178,7 @@ during the provisioning process:
assetstore Girder plugin (default:
**a530c9546d3ac4f50ec4519ef6c7bb348e2b4bc7**)
- `candela_revision` - the git checkout hash to use to build Candela and
Resonant Laboratory (default: **5c17f10d754778e7ea291f1f24c290d997e4dec8**)
Resonant Lab (default: **5c17f10d754778e7ea291f1f24c290d997e4dec8**)

The most important of these may be `adminuser_password`; changing this option at
provisioning time allows you to keep administrator access to the underlying
Expand All @@ -187,8 +187,8 @@ Girder instance secure.
## Guide to the server-side code

### Endpoints
Resonant Laboratory introduces several endpoints for:
- supporting anonymous access to items (largely abstracted away from Resonant Laboratory; it shouldn't be hard to roll this into its own Girder plugin)
Resonant Lab introduces several endpoints for:
- supporting anonymous access to items (largely abstracted away from Resonant Lab; it shouldn't be hard to roll this into its own Girder plugin)
- setting up datasets and projects
- inferring the schema of a dataset
- calculating a histogram of all the attributes in a dataset in one pass
Expand All @@ -210,16 +210,16 @@ Some of the javascript is a little messy to make it compatible with mongodb's `i
In addition to cleaning the code, there are many potential optimizations, and possible places for improvements are flagged inline with `TODO` comments. For debugging convenience, we've disabled all the caching of mapreduce results, but this can be enabled with a single flag in the client side REST calls.

## Guide to the client-side model code
With the exception of `User.js`, each model in Resonant Laboratory corresponds to an item in Girder, but they don't follow Girder's client-side pattern for models. Instead, they try to behave like real Backbone models that support things like `.save()`.
With the exception of `User.js`, each model in Resonant Lab corresponds to an item in Girder, but they don't follow Girder's client-side pattern for models. Instead, they try to behave like real Backbone models that support things like `.save()`.

Because Girder breaks saving metadata, and also because we namespace all Resonant Laboratory metadata under a `rlab` metadata key, there are `setMeta()` and `getMeta()` convenience functions on each of these models that behave like Backbone's `get()` and `set()`.
Because Girder breaks saving metadata, and also because we namespace all Resonant Lab metadata under a `rlab` metadata key, there are `setMeta()` and `getMeta()` convenience functions on each of these models that behave like Backbone's `get()` and `set()`.

### Datasets and Projects
The two most important models are `Dataset.js` and `Project.js`. These are documented in README.json files that detail how the metadata is structured and what each piece does.

One of the big complications in Resonant Laboratory's code has to do with the fact that projects and datasets may not always exist—consequently, all the views have to listen to the `mainPage.js` for changes in whatever project is open, and when that happens, reattach listeners to the new project. Dataset-specific views sometimes do a second round of this for individual datasets; they also have to listen for changes in what datasets have been added to projects, and reattach listeners to the datasets when they're added.
One of the big complications in Resonant Lab's code has to do with the fact that projects and datasets may not always exist—consequently, all the views have to listen to the `mainPage.js` for changes in whatever project is open, and when that happens, reattach listeners to the new project. Dataset-specific views sometimes do a second round of this for individual datasets; they also have to listen for changes in what datasets have been added to projects, and reattach listeners to the datasets when they're added.

It might make more sense to give projects a Backbone Collection of datasets (early versions of Resonant Laboratory tried this, but it proved unwieldy). Currently, changes in datasets are generalized under a `rl:changeDatasets` event that the project model forwards to all views—it's kind of inefficient, but this cleans up the code a bit.
It might make more sense to give projects a Backbone Collection of datasets (early versions of Resonant Lab tried this, but it proved unwieldy). Currently, changes in datasets are generalized under a `rl:changeDatasets` event that the project model forwards to all views—it's kind of inefficient, but this cleans up the code a bit.

### UserPreferences
Rather than store user-specific information right in the User model, we decided early on to store user preferences as a distinct item in the User's private directory. This should have a lot of benefits, like letting the user know (and change/delete!) exactly what information we are storing about them.
Expand Down Expand Up @@ -266,18 +266,18 @@ Each of these are named views in `views/layout/overlay`; you can show one simply
The VisualizationLibrary doesn't yet fit in this structure, but it shouldn't be hard to imagine how it could.

### `views/widgets`
These draw the contents of the panels, and inherit from `Widget/index.js`. They're each kind of bulky, and could probably use breaking the contents up into subviews (e.g., in porting the DatasetView to MSKCC, I broke the histograms up into separate views—but I haven't gotten around to this in Resonant Laboratory yet).
These draw the contents of the panels, and inherit from `Widget/index.js`. They're each kind of bulky, and could probably use breaking the contents up into subviews (e.g., in porting the DatasetView to MSKCC, I broke the histograms up into separate views—but I haven't gotten around to this in Resonant Lab yet).

To understand what's going on in each `initialize()` function, it's probably worth looking at the `Widget/index.js` code—`this.icons` and `this.statusText` are special variables that the views can use to control what gets displayed in their header bar.

## Oddities to watch out for

### Broken Backbone Models, Anonymous Access
Because Girder breaks Backbone model syncing (especially for metadata), Resonant Laboratory attempts to patch Backbone's native `save()`-style behavior. For specifics, see the comments in `models/MetadataItem.js`.
Because Girder breaks Backbone model syncing (especially for metadata), Resonant Lab attempts to patch Backbone's native `save()`-style behavior. For specifics, see the comments in `models/MetadataItem.js`.

The only thing that anonymous access introduces on the client side that is a little weird is when the user tries to `save()` an item, but doesn’t have write access (e.g. they’re logged out). The server honors the `save()` request, but saves to a copy... meaning that, from the client’s perspective, the item model’s ID will get swapped out from underneath it. `MetadataItem.js` tries to make this ID swap seamless as far as Backbone is concerned, but it also emits a special `‘rl:swappedId’` event because other parts of the client code likely use IDs for things.

### Events and Promises
Perhaps the most confusing / hard-to-debug parts of the code will involve the way we use Backbone events and promises. Generally speaking, the code uses Backbone events for client-side-only signaling. All Resonant Laboratory backbone events are prefixed with `rl:`.
Perhaps the most confusing / hard-to-debug parts of the code will involve the way we use Backbone events and promises. Generally speaking, the code uses Backbone events for client-side-only signaling. All Resonant Lab backbone events are prefixed with `rl:`.

Data that is dependent on server communication is usually accessed via a combination of ES6 promises and getters / setters. The two main places this happens are `models/Dataset.js` and `models/Project.js`—each has a `cache` object, independent from the Backbone model, with properties that are lazily evaluated (e.g. `window.mainPage.project.status.then(...)` will either resolve immediately, or send the request to the server if necessary). Indicating the need for an update is then as simple as invalidating the cache, and emitting the appropriate Backbone signals (ideally, we should refactor this so that `change:value` signals get emitted automatically).
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

girder_revision: 12e12f17a7a8ec99330c16234e19a14435b1a034
database_assetstore_revision: a530c9546d3ac4f50ec4519ef6c7bb348e2b4bc7
candela_revision: fdc03d3a0fc24b0b2828b474cd9474856d8f0fae
candela_revision: e1988c2391cf3da9b54812149976bf1b2629cac3
girder_client_revision: 6bda1a7b65bea1c11187cdeb136877739693f466

tasks:
Expand Down Expand Up @@ -91,18 +91,18 @@
become: yes
command: pip install -r requirements.txt
args:
chdir: "{{ storage }}/candela/app/resonant-laboratory"
chdir: "{{ storage }}/candela/app/resonantlab"

- name: Build Candela
command: npm run build
args:
chdir: "{{ storage }}/candela"
creates: build/candela/candela.js

- name: Link Resonant Laboratory into Girder plugin directory
- name: Link Resonant Lab into Girder plugin directory
file:
src: "{{ storage }}/candela/app/resonant-laboratory"
dest: "{{ storage }}/girder/plugins/resonant-laboratory"
src: "{{ storage }}/candela/app/resonantlab"
dest: "{{ storage }}/girder/plugins/resonantlab"
state: link

- name: Install Girder node requirements
Expand Down Expand Up @@ -182,7 +182,7 @@
username: "{{ adminuser_login }}"
password: "{{ adminuser_password }}"
plugins:
- resonant-laboratory
- resonantlab
- database_assetstore
state: present

Expand Down Expand Up @@ -217,7 +217,7 @@
username: "{{ adminuser_login }}"
password: "{{ adminuser_password }}"
assetstore:
name: Resonant Laboratory Database Assetstore
name: Resonant Lab Database Assetstore
type: database
dbtype: mongo
dburi: mongodb://localhost:27017/reslab
Expand All @@ -230,4 +230,4 @@
- name: Upload example data to Girder
command: python populateGirder.py -p {{ adminuser_password }}
args:
chdir: "{{ storage }}/candela/app/resonant-laboratory/scripts"
chdir: "{{ storage }}/candela/app/resonantlab/scripts"
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

girder_revision: 6bda1a7b65bea1c11187cdeb136877739693f466
database_assetstore_revision: a530c9546d3ac4f50ec4519ef6c7bb348e2b4bc7
candela_revision: 5c17f10d754778e7ea291f1f24c290d997e4dec8
candela_revision: e1988c2391cf3da9b54812149976bf1b2629cac3
girder_client_revision: 6bda1a7b65bea1c11187cdeb136877739693f466

pre_tasks:
Expand Down Expand Up @@ -96,7 +96,7 @@
become: yes
command: pip install -r requirements.txt
args:
chdir: "{{ storage }}/candela/app/resonant-laboratory"
chdir: "{{ storage }}/candela/app/resonantlab"

- name: Install girder-client
become: yes
Expand All @@ -108,10 +108,10 @@
chdir: "{{ storage }}/candela"
creates: build/candela/candela.js

- name: Link Resonant Laboratory into Girder plugin directory
- name: Link Resonant Lab into Girder plugin directory
file:
src: "{{ storage }}/candela/app/resonant-laboratory"
dest: "{{ storage }}/girder/plugins/resonant-laboratory"
src: "{{ storage }}/candela/app/resonantlab"
dest: "{{ storage }}/girder/plugins/resonantlab"
state: link

- name: Install Girder node requirements
Expand Down Expand Up @@ -190,7 +190,7 @@
username: "{{ adminuser_login }}"
password: "{{ adminuser_password }}"
plugins:
- resonant-laboratory
- resonantlab
- database_assetstore
state: present

Expand Down Expand Up @@ -225,7 +225,7 @@
username: "{{ adminuser_login }}"
password: "{{ adminuser_password }}"
assetstore:
name: Resonant Laboratory Database Assetstore
name: Resonant Lab Database Assetstore
type: database
dbtype: mongo
dburi: mongodb://localhost:27017/reslab
Expand All @@ -234,4 +234,4 @@
- name: Upload example data to Girder
command: python populateGirder.py -p {{ adminuser_password }}
args:
chdir: "{{ storage }}/candela/app/resonant-laboratory/scripts"
chdir: "{{ storage }}/candela/app/resonantlab/scripts"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ let MainPage = Backbone.View.extend({
initialize: function () {
// Get the current app version
this.versionNumber = this.girderRequest({
path: 'system/resonantLaboratoryVersion',
path: 'system/resonantLabVersion',
type: 'GET'
});

Expand Down
File renamed without changes.

0 comments on commit d2a5882

Please sign in to comment.