Compare commits

..

11 Commits

Author SHA1 Message Date
f198f0f178 [Tests] Test OK/Cancel part of Create flow 2016-03-02 15:28:43 -08:00
d54ad1a726 [Tests] Move to single Create spec 2016-03-02 12:19:05 -08:00
1614412b17 [Tests] Check for dialog 2016-03-02 12:17:44 -08:00
22ce35b98b [Tests] Add template for Create specs 2016-03-02 11:59:28 -08:00
47fc3af5f2 [Tests] Fix Create choose-and-click 2016-03-01 16:28:47 -08:00
57f462b98a [Tests] Begin updating specs 2016-03-01 16:21:44 -08:00
d45f52bdb9 [Tests] Remove obsolete protractor scripts
...as responsibility for running protractor has been moved
to gulp tasks.
2016-03-01 15:50:19 -08:00
4eaedcba2f [Tests] Run web server for tests 2016-03-01 15:48:54 -08:00
fd45e4e895 [Tests] Add task for protractor 2016-03-01 15:32:14 -08:00
c0e758ac76 [Tests] Use 1.0.0 of gulp-protractor
...to avoid forcing upgrade to node 4
2016-03-01 15:13:14 -08:00
282058f4c2 [Tests] Add gulp-protractor dependency
...to begin integrating functional test suite into the
build, #348.
2016-03-01 15:03:40 -08:00
996 changed files with 27127 additions and 21143 deletions

View File

@ -1,5 +1,3 @@
{
"preset": "crockford",
"requireMultipleVarDecl": false,
"requireVarDeclFirst": false
"preset": "crockford"
}

View File

@ -1,23 +1,4 @@
{
"bitwise": true,
"browser": true,
"curly": true,
"eqeqeq": true,
"forin": true,
"freeze": true,
"funcscope": false,
"futurehostile": true,
"latedef": true,
"noarg": true,
"nocomma": true,
"nonbsp": true,
"nonew": true,
"predef": [
"define",
"Promise"
],
"shadow": "outer",
"strict": "implied",
"undef": true,
"unused": "vars"
"validthis": true,
"laxbreak": true
}

114
API.md
View File

@ -1,114 +0,0 @@
# Open MCT API
The Open MCT framework public api can be utilized by building the application (`gulp install`) and then copying the file from `dist/main.js` to your directory
of choice.
Open MCT supports AMD, CommonJS, and standard browser loading; it's easy to use
in your project.
## Overview
Open MCT's goal is to allow you to browse, create, edit, and visualize all of the domain knowledge you need on a daily basis.
To do this, the main building block provided by Open MCT is the domain object-- the temperature sensor on the starboard solar panel, an overlay plot comparing the results of all temperature sensor, the command dictionary for a spacecraft, the individual commands in that dictionary, your "my documents" folder: all of these things are domain objects.
Domain objects have Types-- so a specific instrument temperature sensor is a "Telemetry Point," and turning on a drill for a certain duration of time is an "Activity". Types allow you to form an ontology of knowledge and provide an abstraction for grouping, visualizing, and interpreting data.
And then we have Views. Views allow you to visualize a domain object. Views can apply to specific domain objects; they may also apply to certain types of domain objects, or they may apply to everything. Views are simply a method of visualizing domain objects.
Regions allow you to specify what views are displayed for specific types of domain objects in response to different user actions-- for instance, you may want to display a different view while editing, or you may want to update the toolbar display when objects are selected. Regions allow you to map views to specific user actions.
Domain objects can be mutated and persisted, developers can create custom actions and apply them to domain objects, and many more things can be done. For more information, read on.
## The API
### `MCT.Type(options)`
Status: First Draft
Returns a `typeInstance`. `options` is an object supporting the following properties:
* `metadata`: `object` defining metadata used in displaying the object; has the following properties:
* `label`: `string`, the human-readible name of the type. used in menus and inspector.
* `glyph`: `string`, the name of the icon to display for this type, used in labels.
* `description`: `string`, a human readible description of the object and what it is for.
* `initialize`: `function` which initializes new instances of this type. it is called with an object, should add any default properties to that object.
* `creatable`: `boolean`, if true, this object will be visible in the create menu.
* `form`: `Array` an array of form fields, as defined... somewhere! Generates a property sheet that is visible while editing this object.
### `MCT.type(typeKey, typeInstance)`
Status: First Draft
Register a `typeInstance` with a given Type `key` (a `string`). There can only be one `typeInstance` registered per type `key`. typeInstances must be registered before they can be utilized.
### `MCT.Objects`
Status: First Draft
Allows you to register object providers, which allows you to integrate domain objects from various different sources. Also implements methods for mutation and persistence of objects. See [Object API](src/api/objects/README.md) for more details.
### `MCT.Composition`
Status: First Draft
Objects can contain other objects, and the Composition API allows you to fetch the composition of any given domain object, or implement custom methods for defining composition as necessary.
### `MCT.view(region, definition)`
Status: First Draft
Register a view factory for a specific region. View factories receive an instance of a domain object and return a `View` for that object, or return undefined if they do not know how to generate a view for that object.
* `ViewDefinition`: an object with the following properties:
* `canView(domainObject)`: should return truthy if the view is valid for a given domain object, falsy if it is not capable of generating a view for that object.
* `view(domainObject)`: should instantate and return a `View` for the given object.
* `metadata()`: a function that returns metadata about this view. Optional.
* `View`: an object containing a number of lifecycle methods:
* `view.show(container)`: instantiate a view (a set of dom elements) and attach it to the container.
* `view.destroy(container)`: remove any listeners and expect your dom elements to be destroyed.
For a basic introduction to views & types, check out these tutorials:
* [custom-view](custom-view.html) -- Implementing a custom view with vanilla javascript.
* [custom-view-react](custom-view-react.html) -- Implementing a custom view with React.
### `MCT.conductor`
Status: First Draft
The time conductor is an API that facilitates time synchronization across multiple components. Components that would like to be "time aware" may attach listeners to the time conductor API to allow them to remain synchronized with other components. For more information ont he time conductor API, please look at the API draft here: https://github.com/nasa/openmct/blob/66220b89ca568075f107505ba414de9457dc0427/platform/features/conductor-redux/src/README.md
### `MCT.selection`
Status: First Draft
Tracks the application's selection state (which elements of a view has a user selected?)
One or more JavaScript objects may be selected at any given time. User code is responsible for any necessary type-checking.
The following methods are exposed from this object:
* `select(value)`: Add `value` to the current selection.
* `deselect(value)`: Remove `value` from the current selection.
* `selected()`: Get array of all selected objects.
* `clear()`: Deselect all selected objects.
MCT.selection is an EventEmitter; a `change` event is emitted whenever the selection changes.
### `MCT.systems`
Status: Not Implemented, Needs to be ported from old system.
A registry for different time system definitions. Based upon the previous time format system which utilized the "formats" extension category.
### `MCT.run([container])`
Status: Stable Draft
Run the MCT application, loading the application into the `container`, a DOM element. If a container is not specified, the application is injected into the body of the page.
### `MCT.install(plugin)`
Status: Stable Draft
Install a plugin in MCT. Must be called before calling `run`. Plugins are functions which are invoked with the `MCT` instance as their first argument, and are expected to use the MCT public API to add functionality.
For an example of writing a plugin, check out [plugin-example.html](plugin-example.html)
### `MCT.setAssetPath(path)`
Sets the path (absolute or relative) at which the Open MCT static files are being hosted. The default value is '.'.
Note that this API is transitional and will be removed in a future version.

View File

@ -1,6 +1,6 @@
# Contributing to Open MCT
# Contributing to Open MCT Web
This document describes the process of contributing to Open MCT as well
This document describes the process of contributing to Open MCT Web as well
as the standards that will be applied when evaluating contributions.
Please be aware that additional agreements will be necessary before we can
@ -21,9 +21,9 @@ The short version:
## Contribution Process
Open MCT uses git for software version control, and for branching and
Open MCT Web uses git for software version control, and for branching and
merging. The central repository is at
https://github.com/nasa/openmct.git.
https://github.com/nasa/openmctweb.git.
### Roles
@ -116,18 +116,18 @@ the merge back to the master branch.
## Standards
Contributions to Open MCT are expected to meet the following standards.
Contributions to Open MCT Web are expected to meet the following standards.
In addition, reviewers should use general discretion before accepting
changes.
### Code Standards
JavaScript sources in Open MCT must satisfy JSLint under its default
JavaScript sources in Open MCT Web must satisfy JSLint under its default
settings. This is verified by the command line build.
#### Code Guidelines
JavaScript sources in Open MCT should:
JavaScript sources in Open MCT Web should:
* Use four spaces for indentation. Tabs should not be used.
* Include JSDoc for any exposed API (e.g. public methods, constructors.)
@ -159,7 +159,7 @@ JavaScript sources in Open MCT should:
* Third, imperative statements.
* Finally, the returned value.
Deviations from Open MCT code style guidelines require two-party agreement,
Deviations from Open MCT Web code style guidelines require two-party agreement,
typically from the author of the change and its reviewer.
#### Code Example
@ -260,7 +260,7 @@ these standards.
## Issue Reporting
Issues are tracked at https://github.com/nasa/openmct/issues
Issues are tracked at https://github.com/nasa/openmctweb/issues
Issues should include:

View File

@ -309,6 +309,30 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
---
### Modernizr
#### Info
* Link: http://modernizr.com
* Version: 2.6.2
* Author: Faruk Ateş
* Description: Browser/device capability finding
#### License
Copyright (c) 20092015
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.
---
### Normalize.css
#### Info
@ -452,44 +476,6 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
---
### Zepto
#### Info
* Link: http://zeptojs.com/
* Version: 1.1.6
* Authors: Thomas Fuchs
* Description: DOM manipulation
#### License
Copyright (c) 2010-2016 Thomas Fuchs
http://zeptojs.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.
---
### Json.NET
#### Info

View File

@ -1,6 +1,6 @@
# Open MCT
# Open MCT Web
Open MCT is a web-based platform for mission operations user interface
Open MCT Web is a web-based platform for mission operations user interface
software.
## Bundles
@ -8,7 +8,7 @@ software.
A bundle is a group of software components (including source code, declared
as AMD modules, as well as resources such as images and HTML templates)
that are intended to be added or removed as a single unit. A plug-in for
Open MCT will be expressed as a bundle; platform components are also
Open MCT Web will be expressed as a bundle; platform components are also
expressed as bundles.
A bundle is also just a directory which contains a file `bundle.json`,
@ -16,7 +16,7 @@ which declares its contents.
The file `bundles.json` (note the plural), at the top level of the
repository, is a JSON file containing an array of all bundles (expressed as
directory names) to include in a running instance of Open MCT. Adding or
directory names) to include in a running instance of Open MCT Web. Adding or
removing paths from this list will add or remove bundles from the running
application.
@ -56,7 +56,7 @@ To run:
## Build
Open MCT is built using [`npm`](http://npmjs.com/)
Open MCT Web is built using [`npm`](http://npmjs.com/)
and [`gulp`](http://gulpjs.com/).
To build:
@ -64,18 +64,18 @@ To build:
`npm run prepublish`
This will compile and minify JavaScript sources, as well as copy over assets.
The contents of the `dist` folder will contain a runnable Open MCT
The contents of the `dist` folder will contain a runnable Open MCT Web
instance (e.g. by starting an HTTP server in that directory), including:
* A `main.js` file containing Open MCT source code.
* A `main.js` file containing Open MCT Web source code.
* Various assets in the `example` and `platform` directories.
* An `index.html` that runs Open MCT in its default configuration.
* An `index.html` that runs Open MCT Web in its default configuration.
Additional `gulp` tasks are defined in [the gulpfile](gulpfile.js).
### Building Documentation
Open MCT's documentation is generated by an
Open MCT Web's documentation is generated by an
[npm](https://www.npmjs.com/)-based build. It has additional dependencies that
may not be available on every platform and thus is not covered in the standard
npm install. Ensure your system has [libcairo](http://cairographics.org/)
@ -89,7 +89,7 @@ Documentation will be generated in `target/docs`.
# Glossary
Certain terms are used throughout Open MCT with consistent meanings
Certain terms are used throughout Open MCT Web with consistent meanings
or conventions. Any deviations from the below are issues and should be
addressed (either by updating this glossary or changing code to reflect
correct usage.) Other developer documentation, particularly in-line
@ -112,7 +112,7 @@ documentation, may presume an understanding of these terms.
(Most often used in the context of extensions, domain
object models, or other similar application-specific objects.)
* _domain object_: A meaningful object to the user; a distinct thing in
the work support by Open MCT. Anything that appears in the left-hand
the work support by Open MCT Web. Anything that appears in the left-hand
tree is a domain object.
* _extension_: An extension is a unit of functionality exposed to the
platform in a declarative fashion by a bundle. For more

4
app.js
View File

@ -19,7 +19,6 @@
// Defaults
options.port = options.port || options.p || 8080;
options.directory = options.directory || options.D || '.';
['include', 'exclude', 'i', 'x'].forEach(function (opt) {
options[opt] = options[opt] || [];
// Make sure includes/excludes always end up as arrays
@ -37,7 +36,6 @@
console.log(" --port, -p <number> Specify port.");
console.log(" --include, -i <bundle> Include the specified bundle.");
console.log(" --exclude, -x <bundle> Exclude the specified bundle.");
console.log(" --directory, -D <bundle> Serve files from specified directory.");
console.log("");
process.exit(0);
}
@ -73,7 +71,7 @@
});
// Expose everything else as static files
app.use(express['static'](options.directory));
app.use(express['static']('.'));
// Finally, open the HTTP server
app.listen(options.port);

View File

@ -1,10 +1,10 @@
{
"name": "openmct",
"description": "The Open MCT core platform",
"name": "openmctweb",
"description": "The OpenMCTWeb core platform",
"main": "",
"license": "Apache-2.0",
"moduleType": [],
"homepage": "http://nasa.github.io/openmct/",
"homepage": "http://nasa.github.io/openmctweb/",
"private": true,
"dependencies": {
"angular": "1.4.4",
@ -17,10 +17,6 @@
"screenfull": "^3.0.0",
"node-uuid": "^1.4.7",
"comma-separated-values": "^3.6.4",
"FileSaver.js": "^0.0.2",
"zepto": "^1.1.6",
"eventemitter3": "^1.2.0",
"lodash": "3.10.1",
"almond": "~0.3.2"
"FileSaver.js": "^0.0.2"
}
}

View File

@ -22,19 +22,17 @@
#* at runtime from the About dialog for additional information.
#*****************************************************************************
# Script to build and deploy docs.
# Script to build and deploy docs to github pages.
OUTPUT_DIRECTORY="target/docs"
# Docs, once built, are pushed to the private website repo
REPOSITORY_URL="git@github.com:nasa/openmct-website.git"
WEBSITE_DIRECTORY="website"
REPOSITORY_URL="git@github.com:nasa/openmctweb.git"
BUILD_SHA=`git rev-parse HEAD`
BUILD_SHA=`git rev-parse head`
# A remote will be created for the git repository we are pushing to.
# Don't worry, as this entire directory will get trashed inbetween builds.
REMOTE_NAME="documentation"
WEBSITE_BRANCH="master"
WEBSITE_BRANCH="gh-pages"
# Clean output directory, JSDOC will recreate
if [ -d $OUTPUT_DIRECTORY ]; then
@ -42,21 +40,23 @@ if [ -d $OUTPUT_DIRECTORY ]; then
fi
npm run docs
cd $OUTPUT_DIRECTORY || exit 1
echo "git clone $REPOSITORY_URL website"
git clone $REPOSITORY_URL website || exit 1
echo "cp -r $OUTPUT_DIRECTORY $WEBSITE_DIRECTORY/docs"
cp -r $OUTPUT_DIRECTORY $WEBSITE_DIRECTORY/docs
echo "cd $WEBSITE_DIRECTORY"
cd $WEBSITE_DIRECTORY || exit 1
echo "git init"
git init
# Configure github for CircleCI user.
git config user.email "buildbot@circleci.com"
git config user.name "BuildBot"
echo "git remote add $REMOTE_NAME $REPOSITORY_URL"
git remote add $REMOTE_NAME $REPOSITORY_URL
echo "git add ."
git add .
echo "git commit -m \"Docs updated from build $BUILD_SHA\""
git commit -m "Docs updated from build $BUILD_SHA"
# Push to the website repo
git push
echo "git commit -m \"Generate docs from build $BUILD_SHA\""
git commit -m "Generate docs from build $BUILD_SHA"
echo "git push $REMOTE_NAME HEAD:$WEBSITE_BRANCH -f"
git push $REMOTE_NAME HEAD:$WEBSITE_BRANCH -f
echo "Documentation pushed to gh-pages branch."

View File

@ -2,24 +2,14 @@ deployment:
production:
branch: master
commands:
- npm install canvas nomnoml
- ./build-docs.sh
- git fetch --unshallow
- git push git@heroku.com:openmctweb-demo.git $CIRCLE_SHA1:refs/heads/master
openmct-demo:
branch: live_demo
- npm install canvas nomnoml
- ./build-docs.sh
- git push git@heroku.com:openmctweb-demo.git $CIRCLE_SHA1:refs/heads/master
openmctweb-staging-un:
branch: nem_prototype
heroku:
appname: openmct-demo
appname: openmctweb-staging-un
openmctweb-staging-deux:
branch: mobile
heroku:
appname: openmctweb-staging-deux
test:
post:
- gulp lint
- gulp checkstyle
general:
branches:
ignore:
- gh-pages

View File

@ -1,65 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Implementing a composition provider</title>
<script src="dist/main.js"></script>
</head>
<body>
<script>
var widgetParts = ['foo', 'bar', 'baz', 'bing', 'frobnak']
function fabricateName() {
return [
widgetParts[Math.floor(Math.random() * widgetParts.length)],
widgetParts[Math.floor(Math.random() * widgetParts.length)],
Math.floor(Math.random() * 1000)
].join('_');
}
MCT.type('example.widget-factory', new MCT.Type({
metadata: {
label: "Widget Factory",
glyph: "s",
description: "A factory for making widgets"
},
initialize: function (object) {
object.widgetCount = 5;
object.composition = [];
},
creatable: true,
form: [
{
name: "Widget Count",
control: "textfield",
key: "widgetCount",
property: "widgetCount",
required: true
}
]
}));
MCT.Composition.addProvider({
appliesTo: function (domainObject) {
return domainObject.type === 'example.widget-factory';
},
load: function (domainObject) {
var widgets = [];
while (widgets.length < domainObject.widgetCount) {
widgets.push({
name: fabricateName(),
key: {
namespace: 'widget-factory',
identifier: '' + widgets.length
}
});
}
return Promise.resolve(widgets);
}
});
MCT.run();
</script>
</body>
</html>

View File

@ -1,144 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Implementing a Custom Type and View </title>
<script src="dist/main.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.2.1/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.2.1/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.34/browser.min.js"></script>
</head>
<body>
<script type="text/babel">
// First, we're going to create the Todo List type, so that users can create
// todo lists.
MCT.type('example.todo', new MCT.Type({
metadata: {
label: "To-Do List",
glyph: "2",
description: "A list of things that need to be done."
},
initialize: function (object) {
object.tasks = [
{ description: "This is a task." }
];
},
creatable: true
}));
/*
Refresh the page, and you should be able to create new Todo Lists.
unfortunately, when you navigate to a Todo list, you see a blank page. let's
fix that by adding a main view for that todo list.
If you're wondering why this is commented out, well, it's because we'll
write a new version later.
*/
var Task = React.createClass({
render: function() {
return (
<li>
<input type="checkbox"
checked={this.props.checked}/>
<span>{this.props.description}</span>
</li>
);
}
});
var TaskList = React.createClass({
render: function () {
var taskNodes = this.props.tasks.map(function(task) {
return (
<Task checked={task.checked}
description={task.description}/>
);
});
return (
<ul>
{taskNodes}
</ul>
);
}
});
MCT.view(MCT.regions.main, {
canView: function (domainObject) {
return domainObject.type === 'example.todo';
},
view: function (domainObject) {
var mutableObject = MCT.Objects.getMutable(domainObject);
return {
show: function (container) {
ReactDOM.render(
<TaskList tasks={domainObject.tasks}/>,
container
);
mutableObject.on('tasks', function (tasks) {
ReactDOM.render(
<TaskList tasks={tasks}/>,
container
);
});
}
};
}
});
/*
Refresh the page and you should see a todo list with checkboxes! Now let's
Allow you to add tasks by mutating the object. We'll add a toolbar view to
do this.
*/
var TaskToolbar = React.createClass({
render: function () {
return (
<button onClick={this.props.addTask}>Add Task</button>
);
}
});
MCT.view(MCT.regions.toolbar, {
canView: function (domainObject) {
return domainObject.type === 'example.todo';
},
view: function (domainObject) {
var mutableObject = MCT.Objects.getMutable(domainObject);
function addTask(event) {
var description = prompt('Task description');
var tasks = mutableObject.get('tasks');
tasks.push({
description: description,
complete: false
});
mutableObject.set('tasks', tasks);
}
return {
show: function (container) {
ReactDOM.render(
<TaskToolbar addTask={addTask}/>,
container
);
},
}
}
});
/*
Refresh the page, edit the todo list, and you'll have a button that allows
you to add tasks! Unfortunately, new tasks don't show in the list. Why?
Well, if your view should update on mutation, you need to set up the correct
listeners. Let's update the TodoView we made earlier:
*/
MCT.run();
</script>
</body>
</html>

View File

@ -1,160 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Implementing a Custom Type and View </title>
<script src="dist/main.js"></script>
</head>
<body>
<script>
// First, we're going to create the Todo List type, so that users can create
// todo lists.
MCT.type('example.todo', new MCT.Type({
metadata: {
label: "To-Do List",
glyph: "2",
description: "A list of things that need to be done."
},
initialize: function (object) {
object.tasks = [
{ description: "This is a task." }
];
},
creatable: true
}));
/*
Refresh the page, and you should be able to create new Todo Lists.
unfortunately, when you navigate to a Todo list, you see a blank page. let's
fix that by adding a main view for that todo list.
If you're wondering why this is commented out, well, it's because we'll
write a new version later.
*/
// MCT.view(MCT.regions.main, {
// canView: function (domainObject) {
// return domainObject.type === 'example.todo';
// },
// view: function (domainObject) {
// function renderTask(task) {
// return [
// '<li>',
// '<input type="checkbox"' + (task.complete ? ' checked="true"' : '') + '>',
// '<span>' + task.description + '</span>',
// '</li>'
// ].join('');
// };
//
// function renderTaskList() {
// return [
// '<ul>',
// domainObject.tasks.map(renderTask).join(''),
// '</ul>'
// ].join('');
// };
//
// return {
// show: function (container) {
// container.innerHTML = renderTaskList();
// }
// };
// }
// });
/*
Refresh the page and you should see a todo list with checkboxes! Now let's
Allow you to add tasks by mutating the object. We'll add a toolbar view to
do this.
*/
MCT.view(MCT.regions.toolbar, {
canView: function (domainObject) {
return domainObject.type === 'example.todo';
},
view: function (domainObject) {
var mutableObject = MCT.Objects.getMutable(domainObject);
function addTask(event) {
var description = prompt('Task description');
var tasks = mutableObject.get('tasks');
tasks.push({
description: description,
complete: false
});
mutableObject.set('tasks', tasks);
}
return {
show: function (container) {
container.addEventListener('click', addTask);
container.innerHTML = '<button>Add Task</button>';
},
destroy: function (container) {
container.removeEventListener('click', addTask);
}
}
}
});
/*
Refresh the page, edit the todo list, and you'll have a button that allows
you to add tasks! Unfortunately, new tasks don't show in the list. Why?
Well, if your view should update on mutation, you need to set up the correct
listeners. Let's update the TodoView we made earlier:
*/
MCT.view(MCT.regions.main, {
canView: function(domainObject) {
return domainObject.type === 'example.todo'
},
view: function (domainObject) {
var mutableObject = MCT.Objects.getMutable(domainObject);
function renderTask(task) {
return [
'<li>',
'<input type="checkbox"' + (task.complete ? ' checked="true"' : '') + '>',
'<span>' + task.description + '</span>',
'</li>'
].join('');
}
function renderTaskList(tasks) {
return [
'<ul>',
tasks.map(renderTask).join(''),
'</ul>'
].join('');
}
function onCheckboxChange(event) {
var checkbox = event.target;
var taskEl = checkbox.parentNode;
var taskList = taskEl.parentNode;
var taskIndex = [].slice.apply(taskList.children).indexOf(taskEl);
mutableObject.set('tasks[' + taskIndex + '].complete', checkbox.checked);
}
return {
show: function (container) {
container.innerHTML = renderTaskList(domainObject.tasks);
mutableObject.on('tasks', function (tasks) {
container.innerHTML = renderTaskList(tasks);
});
container.addEventListener('change', onCheckboxChange);
},
destroy: function () {
mutableObject.stopListening();
}
};
}
});
MCT.run();
</script>
</body>
</html>

View File

@ -1,3 +1,9 @@
<hr>
<cite>
This document is styled using
<a href="https://github.com/jasonm23/markdown-css-themes">
https://github.com/jasonm23/markdown-css-themes
</a>.
</cite>
</body>
</html>

View File

@ -1,9 +1,7 @@
<html>
<head>
<link rel="stylesheet"
href="//nasa.github.io/openmct/static/res/css/styles.css">
<link rel="stylesheet"
href="//nasa.github.io/openmct/static/res/css/documentation.css">
href="http://jasonm23.github.io/markdown-css-themes/avenir-white.css">
</head>
<body>

View File

@ -5,7 +5,7 @@ software components to communicate. The software components it recognizes
are:
* _Extensions_: Individual units of functionality that can be added to
or removed from Open MCT. _Extension categories_ distinguish what
or removed from Open MCT Web. _Extension categories_ distinguish what
type of functionality is being added/removed.
* _Bundles_: A grouping of related extensions
(named after an analogous concept from [OSGi](http://www.osgi.org/))
@ -19,7 +19,7 @@ manner which the framework layer can understand.
```nomnoml
#direction: down
[Open MCT|
[Open MCT Web|
[Dependency injection framework]-->[Platform bundle #1]
[Dependency injection framework]-->[Platform bundle #2]
[Dependency injection framework]-->[Plugin bundle #1]
@ -35,7 +35,7 @@ manner which the framework layer can understand.
```
The "dependency injection framework" in this case is
[AngularJS](https://angularjs.org/). Open MCT's framework layer
[AngularJS](https://angularjs.org/). Open MCT Web's framework layer
is really just a thin wrapper over Angular that recognizes the
concepts of bundles and extensions (as declared in JSON files) and
registering extensions with Angular. It additionally acts as a
@ -60,7 +60,7 @@ activities which were performed by the framework component.
## Application Initialization
The framework component initializes an Open MCT application following
The framework component initializes an Open MCT Web application following
a simple sequence of steps.
```nomnoml
@ -97,7 +97,7 @@ a simple sequence of steps.
[Extension]o->[Dependency #3]
```
Open MCT's architecture relies on a simple premise: Individual units
Open MCT Web's architecture relies on a simple premise: Individual units
(extensions) only have access to the dependencies they declare that they
need, and they acquire references to these dependencies via dependency
injection. This has several desirable traits:
@ -121,11 +121,11 @@ injection. This has several desirable traits:
the framework.
A drawback to this approach is that it makes it difficult to define
"the architecture" of Open MCT, in terms of describing the specific
"the architecture" of Open MCT Web, in terms of describing the specific
units that interact at run-time. The run-time architecture is determined
by the framework as the consequence of wiring together dependencies.
As such, the specific architecture of any given application built on
Open MCT can look very different.
Open MCT Web can look very different.
Keeping that in mind, there are a few useful patterns supported by the
framework that are useful to keep in mind.
@ -229,4 +229,4 @@ otherwise a single provider) will be exposed as a single service that
other extensions can acquire through dependency injection. Because all
components of the same type of service expose the same interface, users
of that service do not need to be aware that they are talking to an
aggregator or a provider, for instance.
aggregator or a provider, for instance.

View File

@ -1,14 +1,14 @@
# Introduction
The purpose of this document is to familiarize developers with the
overall architecture of Open MCT.
overall architecture of Open MCT Web.
The target audience includes:
* _Platform maintainers_: Individuals involved in developing,
extending, and maintaing capabilities of the platform.
* _Integration developers_: Individuals tasked with integrated
Open MCT into a larger system, who need to understand
Open MCT Web into a larger system, who need to understand
its inner workings sufficiently to complete this integration.
As the focus of this document is on architecture, whenever possible
@ -17,25 +17,25 @@ omitted. These details may be found in the developer guide.
# Overview
Open MCT is client software: It runs in a web browser and
Open MCT Web is client software: It runs in a web browser and
provides a user interface, while communicating with various
server-side resources through browser APIs.
```nomnoml
#direction: right
[Client|[Browser|[Open MCT]->[Browser APIs]]]
[Client|[Browser|[Open MCT Web]->[Browser APIs]]]
[Server|[Web services]]
[Client]<->[Server]
```
While Open MCT can be configured to run as a standalone client,
While Open MCT Web can be configured to run as a standalone client,
this is rarely very useful. Instead, it is intended to be used as a
display and interaction layer for information obtained from a
variety of back-end services. Doing so requires authoring or utilizing
adapter plugins which allow Open MCT to interact with these services.
adapter plugins which allow Open MCT Web to interact with these services.
Typically, the pattern here is to provide a known interface that
Open MCT can utilize, and implement it such that it interacts with
Open MCT Web can utilize, and implement it such that it interacts with
whatever back-end provides the relevant information.
Examples of back-ends that can be utilized in this fashion include
databases for the persistence of user-created objects, or sources of
@ -43,13 +43,13 @@ telemetry data.
## Software Architecture
The simplest overview of Open MCT is to look at it as a "layered"
The simplest overview of Open MCT Web is to look at it as a "layered"
architecture, where each layer more clearly specifies the behavior
of the software.
```nomnoml
#direction: down
[Open MCT|
[Open MCT Web|
[Platform]<->[Application]
[Framework]->[Application]
[Framework]->[Platform]
@ -64,14 +64,14 @@ These layers are:
established an abstraction by which different software components
may communicate and/or interact.
* [_Platform_](platform.md): The platform layer defines the general look,
feel, and behavior of Open MCT. This includes user-facing components like
feel, and behavior of Open MCT Web. This includes user-facing components like
Browse mode and Edit mode, as well as underlying elements of the
information model and the general service infrastructure.
* _Application_: The application layer defines specific features of
an application built on Open MCT. This includes adapters to
an application built on Open MCT Web. This includes adapters to
specific back-ends, new types of things for users to create, and
new ways of visualizing objects within the system. This layer
typically consists of a mix of custom plug-ins to Open MCT,
typically consists of a mix of custom plug-ins to Open MCT Web,
as well as optional features (such as Plot view) included alongside
the platform.

View File

@ -1,6 +1,6 @@
# Overview
The Open MCT platform utilizes the [framework layer](Framework.md)
The Open MCT Web platform utilizes the [framework layer](Framework.md)
to provide an extensible baseline for applications which includes:
* A common user interface (and user interface paradigm) for dealing with
@ -16,7 +16,7 @@ building application, the platform adds more specificity by defining
additional extension types and allowing for integration with back end
components.
The run-time architecture of an Open MCT application can be categorized
The run-time architecture of an Open MCT Web application can be categorized
into certain high-level tiers:
```nomnoml
@ -29,7 +29,7 @@ into certain high-level tiers:
[Browser APIs]->[Back-end]
```
Applications built using Open MCT may add or configure functionality
Applications built using Open MCT Web may add or configure functionality
in __any of these tiers__.
* _DOM_: The rendered HTML document, composed from HTML templates which
@ -60,7 +60,7 @@ in __any of these tiers__.
functionality needed to support the information model. This includes
exposing underlying sets of extensions and mediating with the
back-end.
* _Back-end_: The back-end is out of the scope of Open MCT, except
* _Back-end_: The back-end is out of the scope of Open MCT Web, except
for the interfaces which are utilized by adapters participating in the
service infrastructure. Includes the underlying persistence stores, telemetry 
streams, and so forth which the Open MCT Web client is being used to interact 
@ -70,15 +70,15 @@ in __any of these tiers__.
Once the
[application has been initialized](Framework.md#application-initialization)
Open MCT primarily operates in an event-driven paradigm; various
Open MCT Web primarily operates in an event-driven paradigm; various
events (mouse clicks, timers firing, receiving responses to XHRs) trigger
the invocation of functions, typically in the presentation layer for
user actions or in the service infrastructure for server responses.
The "main point of entry" into an initialized Open MCT application
The "main point of entry" into an initialized Open MCT Web application
is effectively the
[route](https://docs.angularjs.org/api/ngRoute/service/$route#example)
which is associated with the URL used to access Open MCT (or a
which is associated with the URL used to access Open MCT Web (or a
default route.) This route will be associated with a template which
will be displayed; this template will include references to directives
and controllers which will be interpreted by Angular and used to
@ -107,11 +107,11 @@ both the information model and the service infrastructure.
# Presentation Layer
The presentation layer of Open MCT is responsible for providing
The presentation layer of Open MCT Web is responsible for providing
information to display within templates, and for handling interactions
which are initiated from templated DOM elements. AngularJS acts as
an intermediary between the web page as the user sees it, and the
presentation layer implemented as Open MCT extensions.
presentation layer implemented as Open MCT Web extensions.
```nomnoml
[Presentation Layer|
@ -143,12 +143,12 @@ to primitives from AngularJS:
attributes and tags.
* [_Routes_](https://docs.angularjs.org/api/ngRoute/service/$route#example)
are used to associate specific URLs (including the fragment identifier)
with specific application states. (In Open MCT, these are used to
with specific application states. (In Open MCT Web, these are used to
describe the mode of usage - e.g. browse or edit - as well as to
identify the object being used.)
* [_Templates_](https://docs.angularjs.org/guide/templates) are partial
HTML documents that will be rendered and kept up-to-date by AngularJS.
Open MCT introduces a custom `mct-include` directive which acts
Open MCT Web introduces a custom `mct-include` directive which acts
as a wrapper around `ng-include` to allow templates to be referred
to by symbolic names.
@ -189,10 +189,10 @@ to displaying domain objects.
]
```
Domain objects are the most fundamental component of Open MCT's
Domain objects are the most fundamental component of Open MCT Web's
information model. A domain object is some distinct thing relevant to a
user's work flow, such as a telemetry channel, display, or similar.
Open MCT is a tool for viewing, browsing, manipulating, and otherwise
Open MCT Web is a tool for viewing, browsing, manipulating, and otherwise
interacting with a graph of domain objects.
A domain object should be conceived of as the union of the following:
@ -254,7 +254,7 @@ Concrete examples of capabilities which follow this pattern
# Service Infrastructure
Most services exposed by the Open MCT platform follow the
Most services exposed by the Open MCT Web platform follow the
[composite services](Framework.md#composite-services) to permit
a higher degree of flexibility in how a service can be modified
or customized for specific applications.
@ -327,7 +327,7 @@ A short summary of the roles of these services:
[DomainObjectProvider]o-[CapabilityService]
```
As domain objects are central to Open MCT's information model,
As domain objects are central to Open MCT Web's information model,
acquiring domain objects is equally important.
```nomnoml
@ -338,7 +338,7 @@ acquiring domain objects is equally important.
[<state> Instantiate DomainObject]->[<end> End]
```
Open MCT includes an implementation of an `ObjectService` which
Open MCT Web includes an implementation of an `ObjectService` which
satisfies this capability by:
* Consulting the [Model Service](#model-service) to acquire domain object
@ -437,9 +437,9 @@ objects (this allows failures to be recognized and handled in groups.)
The telemetry service is responsible for acquiring telemetry data.
Notably, the platform does not include any providers for
`TelemetryService`; applications built on Open MCT will need to
`TelemetryService`; applications built on Open MCT Web will need to
implement a provider for this service if they wish to expose telemetry
data. This is usually the most important step for integrating Open MCT
data. This is usually the most important step for integrating Open MCT Web
into an existing telemetry system.
Requests for telemetry data are usually initiated in the
@ -721,6 +721,6 @@ disallow.
```
The type service provides metadata about the different types of domain
objects that exist within an Open MCT application. The platform
objects that exist within an Open MCT Web application. The platform
implementation reads these types in from extension category `types`
and wraps them in a JavaScript interface.
and wraps them in a JavaScript interface.

View File

@ -1,4 +1,4 @@
# Open MCT Developer Guide
# Open MCT Web Developer Guide
Victor Woeltjen
[victor.woeltjen@nasa.gov](mailto:victor.woeltjen@nasa.gov)
@ -6,36 +6,35 @@ Victor Woeltjen
September 23, 2015
Document Version 1.1
Date | Version | Summary of Changes | Author
------------------- | --------- | ------------------------- | ---------------
April 29, 2015 | 0 | Initial Draft | Victor Woeltjen
May 12, 2015 | 0.1 | | Victor Woeltjen
June 4, 2015 | 1.0 | Name Changes | Victor Woeltjen
October 4, 2015 | 1.1 | Conversion to MarkDown | Andrew Henry
April 5, 2016 | 1.2 | Added Mct-table directive | Andrew Henry
Date | Version | Summary of Changes | Author
------------------- | --------- | ----------------------- | ---------------
April 29, 2015 | 0 | Initial Draft | Victor Woeltjen
May 12, 2015 | 0.1 | | Victor Woeltjen
June 4, 2015 | 1.0 | Name Changes | Victor Woeltjen
October 4, 2015 | 1.1 | Conversion to MarkDown | Andrew Henry
# Introduction
The purpose of this guide is to familiarize software developers with the Open
MCT Web platform.
## What is Open MCT
Open MCT is a platform for building user interface and display tools,
## What is Open MCT Web
Open MCT Web is a platform for building user interface and display tools,
developed at the NASA Ames Research Center in collaboration with teams at the
Jet Propulsion Laboratory. It is written in HTML5, CSS3, and JavaScript, using
[AngularJS](http://www.angularjs.org) as a framework. Its intended use is to
create single-page web applications which integrate data and behavior from a
variety of sources and domains.
Open MCT has been developed to support the remote operation of space
Open MCT Web has been developed to support the remote operation of space
vehicles, so some of its features are specific to that task; however, it is
flexible enough to be adapted to a variety of other application domains where a
display tool oriented toward browsing, composing, and visualizing would be
useful.
Open MCT provides:
Open MCT Web provides:
* A common user interface paradigm which can be applied to a variety of domains
and tasks. Open MCT is more than a widget toolkit - it provides a standard
and tasks. Open MCT Web is more than a widget toolkit - it provides a standard
tree-on-the-left, view-on-the-right browsing environment which you customize by
adding new browsable object types, visualizations, and back-end adapters.
* A plugin framework and an extensible API for introducing new application
@ -44,17 +43,17 @@ features of a variety of types.
visualizations and infrastructure specific to telemetry display.
## Client-Server Relationship
Open MCT is client software - it runs entirely in the user's web browser. As
Open MCT Web is client software - it runs entirely in the user's web browser. As
such, it is largely 'server agnostic'; any web server capable of serving files
from paths is capable of providing Open MCT.
from paths is capable of providing Open MCT Web.
While Open MCT can be configured to run as a standalone client, this is
While Open MCT Web can be configured to run as a standalone client, this is
rarely very useful. Instead, it is intended to be used as a display and
interaction layer for information obtained from a variety of back-end services.
Doing so requires authoring or utilizing adapter plugins which allow Open MCT
Web to interact with these services.
Typically, the pattern here is to provide a known interface that Open MCT
Typically, the pattern here is to provide a known interface that Open MCT Web
can utilize, and implement it such that it interacts with whatever back-end
provides the relevant information. Examples of back-ends that can be utilized in
this fashion include databases for the persistence of user-created objects, or
@ -63,52 +62,52 @@ sources of telemetry data.
See the [Architecture Guide](../architecture/index.md#Overview) for information
on the client-server relationship.
## Developing with Open MCT
Building applications with Open MCT typically means authoring and utilizing
## Developing with Open MCT Web
Building applications with Open MCT Web typically means authoring and utilizing
a set of plugins which provide application-specific details about how Open MCT
Web should behave.
### Technologies
Open MCT sources are written in JavaScript, with a number of configuration
Open MCT Web sources are written in JavaScript, with a number of configuration
files written in JSON. Displayable components are written in HTML5 and CSS3.
Open MCT is built using [AngularJS](http://www.angularjs.org) from Google. A
Open MCT Web is built using [AngularJS](http://www.angularjs.org) from Google. A
good understanding of Angular is recommended for developers working with Open
MCT Web.
### Forking
Open MCT does not currently have a single stand-alone artifact that can be
Open MCT Web does not currently have a single stand-alone artifact that can be
used as a library. Instead, the recommended approach for creating a new
application is to start by forking/branching Open MCT, and then adding new
features from there. Put another way, Open MCT's source structure is built
application is to start by forking/branching Open MCT Web, and then adding new
features from there. Put another way, Open MCT Web's source structure is built
to serve as a template for specific applications.
Forking in this manner should not require that you edit Open MCT's sources.
Forking in this manner should not require that you edit Open MCT Web's sources.
The preferred approach is to create a new directory (peer to `index.html`) for
the new application, then add new bundles (as described in the Framework
chapter) within that directory.
To initially clone the Open MCT repository:
To initially clone the Open MCT Web repository:
`git clone <repository URL> <local repo directory> -b open-master`
To create a fork to begin working on a new application using Open MCT:
To create a fork to begin working on a new application using Open MCT Web:
cd <local repo directory>
git checkout open-master
git checkout -b <new branch name>
As a convention used internally, applications built using Open MCT have
As a convention used internally, applications built using Open MCT Web have
master branch names with an identifying prefix. For instance, if building an
application called 'Foo', the last statement above would look like:
git checkout -b foo-master
This convention is not enforced or understood by Open MCT in any way; it is
This convention is not enforced or understood by Open MCT Web in any way; it is
mentioned here as a more general recommendation.
# Overview
Open MCT is implemented as a framework component which manages a set of
Open MCT Web is implemented as a framework component which manages a set of
other components. These components, called _bundles_, act as containers to group
sets of related functionality; individual units of functionality are expressed
within these bundles as _extensions_.
@ -119,7 +118,7 @@ run-time to satisfy these declared dependency. This dependency injection
approach allows software components which have been authored separately (e.g. as
plugins) but to collaborate at run-time.
Open MCT's framework layer is implemented on top of AngularJS's [dependency
Open MCT Web's framework layer is implemented on top of AngularJS's [dependency
injection mechanism](https://docs.angularjs.org/guide/di) and is modelled after
[OSGi](hhttp://www.osgi.org/) and its [Declarative Services component model](http://wiki.osgi.org/wiki/Declarative_Services).
In particular, this is where the term _bundle_ comes from.
@ -134,7 +133,7 @@ The framework is described in more detail in the [Framework Overview](../archite
architecture guide.
### Tiers
While all bundles in a running Open MCT instance are effectively peers, it
While all bundles in a running Open MCT Web instance are effectively peers, it
is useful to think of them as a tiered architecture, where each tier adds more
specificity to the application.
```nomnoml
@ -152,7 +151,7 @@ It additionally interprets bundle definitions (see explanation below, as well as
further detail in the Framework chapter.) At this tier, we are at our most
general: We know only that we are a plugin-based application.
* __Platform__: Components in the Platform tier describe both the general user
interface and corresponding developer-facing interfaces of Open MCT. This
interface and corresponding developer-facing interfaces of Open MCT Web. This
tier provides the general infrastructure for applications. It is less general
than the framework tier, insofar as this tier introduces a specific user
interface paradigm, but it is still non-specific as to what useful features
@ -160,7 +159,7 @@ will be provided. Although they can be removed or replaced easily, bundles
provided by the Platform tier generally should not be thought of as optional.
* __Application__: The application tier consists of components which utilize the
infrastructure provided by the Platform to provide functionality which will (or
could) be useful to specific applications built using Open MCT. These
could) be useful to specific applications built using Open MCT Web. These
include adapters to specific persistence back-ends (such as ElasticSearch or
CouchDB) as well as bundles which describe more user-facing features (such as
_Plot_ views for visualizing time series data, or _Layout_ objects for
@ -169,20 +168,20 @@ compromising basic application functionality, with the caveat that at least one
persistence adapter needs to be present.
* __Plugins__: Conceptually, this tier is not so different from the application
tier; it consists of bundles describing new features, back-end adapters, that
are specific to the application being built on Open MCT. It is described as
are specific to the application being built on Open MCT Web. It is described as
a separate tier here because it has one important distinction from the
application tier: It consists of bundles that are not included with the platform
(either authored anew for the specific application, or obtained from elsewhere.)
Note that bundles in any tier can go off and consult back-end services. In
practice, this responsibility is handled at the Application and/or Plugin tiers;
Open MCT is built to be server-agnostic, so any back-end is considered an
Open MCT Web is built to be server-agnostic, so any back-end is considered an
application-specific detail.
## Platform Overview
The "tiered" architecture described in the preceding text describes a way of
thinking of and categorizing software components of a Open MCT application,
thinking of and categorizing software components of a Open MCT Web application,
as well as the framework layer's role in mediating between these components.
Once the framework layer has wired these software components together, however,
the application's logical architecture emerges.
@ -193,7 +192,7 @@ section of the Platform guide
### Web Services
As mentioned in the Introduction, Open MCT is a platform single-page
As mentioned in the Introduction, Open MCT Web is a platform single-page
applications which runs entirely in the browser. Most applications will want to
additionally interact with server-side resources, to (for example) read
telemetry data or store user-created objects. This interaction is handled by
@ -206,7 +205,7 @@ individual bundles using APIs which are supported in browser (such as
[Web Service #2] <- [Web Browser]
[Web Service #3] <- [Web Browser]
[<package> Web Browser |
[<package> Open MCT |
[<package> Open MCT Web |
[Plugin Bundle #1]-->[Core API]
[Core API]<--[Plugin Bundle #2]
[Platform Bundle #1]-->[Core API]
@ -216,16 +215,16 @@ individual bundles using APIs which are supported in browser (such as
[Core API]<--[Platform Bundle #5]
[Core API]<--[Plugin Bundle #3]
]
[Open MCT] ->[Browser APIs]
[Open MCT Web] ->[Browser APIs]
]
```
This architectural approach ensures a loose coupling between applications built
using Open MCT and the backends which support them.
using Open MCT Web and the backends which support them.
### Glossary
Certain terms are used throughout Open MCT with consistent meanings or
Certain terms are used throughout Open MCT Web with consistent meanings or
conventions. Other developer documentation, particularly in-line documentation,
may presume an understanding of these terms.
@ -247,7 +246,7 @@ readable description of a thing; usually a single sentence or short paragraph.
(Most often used in the context of extensions, domain object models, or other
similar application-specific objects.)
* __domain object__: A meaningful object to the user; a distinct thing in the
work support by Open MCT. Anything that appears in the left-hand tree is a
work support by Open MCT Web. Anything that appears in the left-hand tree is a
domain object.
* __extension__: An extension is a unit of functionality exposed to the platform
in a declarative fashion by a bundle. The term 'extension category' is used to
@ -279,10 +278,10 @@ side-by-side without conflicting.
# Framework
Open MCT is built on the [AngularJS framework]( http://www.angularjs.org ). A
Open MCT Web is built on the [AngularJS framework]( http://www.angularjs.org ). A
good understanding of that framework is recommended.
Open MCT adds an extra layer on top of AngularJS to (a) generalize its
Open MCT Web adds an extra layer on top of AngularJS to (a) generalize its
dependency injection mechanism slightly, particularly to handle many-to-one
relationships; and (b) handle script loading. Combined, these features become a
plugin mechanism.
@ -301,7 +300,7 @@ MCT Web.)
are collected together in bundles, and may interact with other extensions.
The framework layer, loaded and initiated from `index.html`, is the main point
of entry for an application built on Open MCT. It is responsible for wiring
of entry for an application built on Open MCT Web. It is responsible for wiring
together the application at run time (much of this responsibility is actually
delegated to Angular); at a high-level, the framework does this by proceeding
through four stages:
@ -321,7 +320,7 @@ have been registered.
## Bundles
The basic configurable unit of Open MCT is the _bundle_. This term has been
The basic configurable unit of Open MCT Web is the _bundle_. This term has been
used a bit already; now we'll get to a more formal definition.
A bundle is a directory which contains:
@ -329,13 +328,13 @@ A bundle is a directory which contains:
* A bundle definition; a file named `bundle.json`.
* Subdirectories for sources, resources, and tests.
* Optionally, a `README.md` Markdown file describing its contents (this is not
used by Open MCT in any way, but it's a helpful convention to follow.)
used by Open MCT Web in any way, but it's a helpful convention to follow.)
The bundle definition is the main point of entry for the bundle. The framework
looks at this to determine which components need to be loaded and how they
interact.
A plugin in Open MCT is a bundle. The platform itself is also decomposed
A plugin in Open MCT Web is a bundle. The platform itself is also decomposed
into bundles, each of which provides some category of functionality. The
difference between a _bundle_ and a _plugin_ is purely a matter of the intended
use; a plugin is just a bundle that is meant to be easily added or removed. When
@ -356,7 +355,7 @@ For instance, if `bundles.json` contained:
"example/extensions"
]
...then the Open MCT framework would look for bundle definitions at
...then the Open MCT Web framework would look for bundle definitions at
`example/builtins/bundle.json` and `example/extensions/bundle.json`, relative
to the path of `index.html`. No other bundles would be loaded.
@ -457,7 +456,7 @@ arrays of extension definitions.
### General Extensions
Extensions are intended as a general-purpose mechanism for adding new types of
functionality to Open MCT.
functionality to Open MCT Web.
An extension category is registered with Angular under the name of the
extension, plus a suffix of two square brackets; so, an Angular service (or,
@ -466,7 +465,7 @@ extensions, from all bundles, by including this string (e.g. `types[]` to get
all type definitions) in a dependency declaration.
As a convention, extension categories are given single-word, plural nouns for
names within Open MCT (e.g. `types`.) This convention is not enforced by the
names within Open MCT Web (e.g. `types`.) This convention is not enforced by the
platform in any way. For extension categories introduced by external plugins, it
is recommended to prefix the extension category with a vendor identifier (or
similar) followed by a dot, to avoid collisions.
@ -505,7 +504,7 @@ the Angular-supported method for dependency injection is (effectively)
constructor-style injection; so, both declared dependencies and run-time
arguments are competing for space in a constructor's arguments.
To resolve this, the Open MCT framework registers extension instances in a
To resolve this, the Open MCT Web framework registers extension instances in a
partially constructed form. That is, the constructor exposed by the extension's
implementation is effectively decomposed into two calls; the first takes the
dependencies, and returns the constructor in its second form, which takes the
@ -549,7 +548,7 @@ sorted according to these conventions when using them.
### Angular Built-ins
Several entities supported Angular are expressed and managed as extensions in
Open MCT. Specifically, these extension categories are _directives_,
Open MCT Web. Specifically, these extension categories are _directives_,
_controllers_, _services_, _constants_, _runs_, and _routes_.
#### Angular Directives
@ -592,7 +591,7 @@ property value , which is the constant value that will be registered.
In some cases, you want to register code to run as soon as the application
starts; these can be registered as extensions of the [ runs category](https://docs.angularjs.org/api/ng/type/angular.Module#run ).
Implementations registered in this category will be invoked (with their declared
dependencies) when the Open MCT application first starts. (Note that, in
dependencies) when the Open MCT Web application first starts. (Note that, in
this case, the implementation is better thought of as just a function, as
opposed to a constructor function.)
@ -627,13 +626,13 @@ providers of the same service (that is, with matching `provides` properties);
for a decorator, this will be whichever provider, decorator, or aggregator is
next in the sequence of decorators.
Services exposed by the Open MCT platform are often declared as composite
Services exposed by the Open MCT Web platform are often declared as composite
services, as this form is open for a variety of common modifications.
# Core API
Most of Open MCT's relevant API is provided and/or mediated by the
framework; that is, much of developing for Open MCT is a matter of adding
Most of Open MCT Web's relevant API is provided and/or mediated by the
framework; that is, much of developing for Open MCT Web is a matter of adding
extensions which access other parts of the platform by means of dependency
injection.
@ -642,9 +641,9 @@ to be passed along by other services.
## Domain Objects
Domain objects are the most fundamental component of Open MCT's information
Domain objects are the most fundamental component of Open MCT Web's information
model. A domain object is some distinct thing relevant to a user's work flow,
such as a telemetry channel, display, or similar. Open MCT is a tool for
such as a telemetry channel, display, or similar. Open MCT Web is a tool for
viewing, browsing, manipulating, and otherwise interacting with a graph of
domain objects.
@ -681,7 +680,7 @@ exposed.
### Identifier Syntax
For most purposes, a domain object identifier can be treated as a purely
symbolic string; these are typically generated by Open MCT and plug-ins
symbolic string; these are typically generated by Open MCT Web and plug-ins
should rarely be concerned with its internal structure.
A domain object identifier has one or two parts, separated by a colon.
@ -724,7 +723,7 @@ exposed it to be removed from its container.
containing:
* `name`: Human-readable name.
* `description`: Human-readable summary of this action.
* `glyph`: Single character to be displayed in Open MCT's icon font set.
* `glyph`: Single character to be displayed in Open MCT Web's icon font set.
* `context`: The context in which this action is being performed (see below)
Action instances are typically obtained via a domain object's `action`
@ -740,7 +739,7 @@ dragged object in a drag-and-drop operation.)
## Telemetry
Telemetry series data in Open MCT is represented by a common interface, and
Telemetry series data in Open MCT Web is represented by a common interface, and
packaged in a consistent manner to facilitate passing telemetry updates around
multiple visualizations.
@ -753,7 +752,7 @@ is useful when multiple distinct data sources are in use side-by-side.
* `key`: A machine-readable identifier for a unique series of telemetry within
that source.
* _Note: This API is still under development; additional properties, such as
start and end time, should be present in future versions of Open MCT._
start and end time, should be present in future versions of Open MCT Web._
Additional properties may be included in telemetry requests which have specific
interpretations for specific sources.
@ -777,7 +776,7 @@ not. (Typically, domain values are interpreted as UTC timestamps in milliseconds
relative to the UNIX epoch.) A series must have at least one domain and one
range, and may have more than one.
Telemetry series data in Open MCT is expressed via the following
Telemetry series data in Open MCT Web is expressed via the following
`TelemetrySeries` interface:
* `getPointCount()`: Returns the number of unique points/samples in this series.
@ -816,7 +815,7 @@ interface:
* `getName()`: Get the human-readable name for this type.
* `getDescription()`: Get a human-readable summary of this type.
* `getGlyph()`: Get the single character to be rendered as an icon for this type
in Open MCT's custom font set.
in Open MCT Web's custom font set.
* `getInitialModel()`: Get a domain object model that represents the initial
state (before user specification of properties) for domain objects of this type.
* `getDefinition()`: Get the extension definition for this type, as a JavaScript
@ -832,7 +831,7 @@ an array of `TypeProperty` instances.
### Type Features
Features of a domain object type are expressed as symbolic string identifiers.
They are defined in practice by usage; currently, the Open MCT platform only
They are defined in practice by usage; currently, the Open MCT Web platform only
uses the creation feature to determine which domain object types should appear
in the Create menu.
@ -886,7 +885,7 @@ Categories supported by the platform include:
* `key`: A machine-readable identifier for this action.
* `name`: A human-readable name for this action (e.g. to show in a menu)
* `description`: A human-readable summary of the behavior of this action.
* `glyph`: A single character which will be rendered in Open MCT's custom
* `glyph`: A single character which will be rendered in Open MCT Web's custom
font set as an icon for this action.
## Capabilities Category
@ -911,24 +910,7 @@ A capability's implementation may also expose a static method `appliesTo(model)`
which should return a boolean value, and will be used by the platform to filter
down capabilities to those which should be exposed by specific domain objects,
based on their domain object models.
## Containers Category
Containers provide options for the `mct-container` directive.
The definition for an extension in the `containers` category should include:
* `key`: An identifier for the container.
* `template`: An Angular template for the container, including an
`ng-transclude` where contained content should go.
* `attributes`: An array of attribute names. The values associated with
these attributes will be exposed in the template's scope under the
name provided by the `alias` property.
* `alias`: The property name in scope under which attributes will be
exposed. Optional; defaults to "container".
Note that `templateUrl` is not supported for `containers`.
## Controls Category
Controls provide options for the `mct-control` directive.
@ -997,7 +979,7 @@ of unremoved listeners.
## Indicators Category
An indicator is an element that should appear in the status area at the bottom
of a running Open MCT client instance.
of a running Open MCT Web client instance.
### Standard Indicators
@ -1007,7 +989,7 @@ provide implementations with the following methods:
* `getText()`: Provides the human-readable text that will be displayed for this
indicator.
* `getGlyph()`: Provides a single-character string that will be displayed as an
icon in Open MCT's custom font set.
icon in Open MCT Web's custom font set.
* `getDescription()`: Provides a human-readable summary of the current state of
this indicator; will be displayed in a tooltip on hover.
* `getClass()`: Get a CSS class that will be applied to this indicator.
@ -1033,7 +1015,7 @@ this variety do not need to provide an implementation.
## Licenses Category
The extension category `licenses` can be used to add entries into the 'Licensing
information' page, reachable from Open MCT's About dialog.
information' page, reachable from Open MCT Web's About dialog.
Licenses may have the following properties, all of which are strings:
@ -1046,11 +1028,11 @@ Licenses may have the following properties, all of which are strings:
## Policies Category
Policies are used to handle decisions made using Open MCT's `policyService`;
Policies are used to handle decisions made using Open MCT Web's `policyService`;
examples of these decisions are determining the applicability of certain
actions, or checking whether or not a domain object of one type can contain a
domain object of a different type. See the section on the Policies for an
overview of Open MCT's policy model.
overview of Open MCT Web's policy model.
A policy's extension definition should include:
@ -1066,7 +1048,7 @@ context)`. The specific types used for `candidate` and `context` vary by policy
category; in general, what is being asked is 'is this candidate allowed in this
context?' This method should return a boolean value.
Open MCT's policy model requires consensus; a policy decision is allowed
Open MCT Web's policy model requires consensus; a policy decision is allowed
when and only when all policies choose to allow it. As such, policies should
generally be written to reject a certain case, and allow (by returning `true`)
anything else.
@ -1195,7 +1177,7 @@ Templates do not have implementations.
## Types Category
The types extension category describes types of domain objects which may
appear within Open MCT.
appear within Open MCT Web.
A type's extension definition should have the following properties:
@ -1203,7 +1185,7 @@ A type's extension definition should have the following properties:
stored to and matched against the type property of domain object models.
* `name`: The human-readable name for this domain object type.
* `description`: A human-readable summary of this domain object type.
* `glyph`: A single character to be rendered as an icon in Open MCT's custom
* `glyph`: A single character to be rendered as an icon in Open MCT Web's custom
font set.
* `model`: A domain object model, used as the initial state for created domain
objects of this type (before any properties are specified.)
@ -1252,7 +1234,7 @@ utilized via `mct-representation`); additionally:
* `name`: The human-readable name for this view type.
* description : A human-readable summary of this view type.
* `glyph`: A single character to be rendered as an icon in Open MCT's custom
* `glyph`: A single character to be rendered as an icon in Open MCT Web's custom
font set.
* `type`: Optional; if present, this representation is only applicable for
domain object's of this type.
@ -1294,7 +1276,7 @@ are visible, and what state they manage and/or behavior they invoke.
This set may contain up to two different objects: The _view proxy_, which is
used to make changes to the view as a whole, and the _selected object_, which is
used to represent some state within the view. (Future versions of Open MCT
used to represent some state within the view. (Future versions of Open MCT Web
may support multiple selected objects.)
The `selection` object made available during Edit mode has the following
@ -1330,14 +1312,14 @@ are supported:
# Directives
Open MCT defines several Angular directives that are intended for use both
Open MCT Web defines several Angular directives that are intended for use both
internally within the platform, and by plugins.
## Before Unload
The `mct-before-unload` directive is used to listen for (and prompt for user
confirmation) of navigation changes in the browser. This includes reloading,
following links out of Open MCT, or changing routes. It is used to hook into
following links out of Open MCT Web, or changing routes. It is used to hook into
both `onbeforeunload` event handling as well as route changes from within
Angular.
@ -1449,7 +1431,7 @@ Passed as plain text in the attribute.
### Form Structure
Forms in Open MCT have a common structure to permit consistent display. A
Forms in Open MCT Web have a common structure to permit consistent display. A
form is broken down into sections, which will be displayed in groups; each
section is broken down into rows, each of which provides a control for a single
property. Input from this form is two-way bound to the object passed via
@ -1601,64 +1583,9 @@ there are items .
]
}
## Table
The `mct-table` directive provides a generic table component, with optional
sorting and filtering capabilities. The table can be pre-populated with data
by setting the `rows` parameter, and it can be updated in real-time using the
`add:row` and `remove:row` broadcast events. The table will expand to occupy
100% of the size of its containing element. The table is highly optimized for
very large data sets.
### Events
The table supports two events for notifying that the rows have changed. For
performance reasons, the table does not monitor the content of `rows`
constantly.
* `add:row`: A `$broadcast` event that will notify the table that a new row
has been added to the table.
eg. The code below adds a new row, and alerts the table using the `add:row`
event. Sorting and filtering will be applied automatically by the table component.
```
$scope.rows.push(newRow);
$scope.$broadcast('add:row', $scope.rows.length-1);
```
* `remove:row`: A `$broadcast` event that will notify the table that a row
should be removed from the table.
eg. The code below removes a row from the rows array, and then alerts the table
to its removal.
```
$scope.rows.slice(5, 1);
$scope.$broadcast('remove:row', 5);
```
### Parameters
* `headers`: An array of string values which will constitute the column titles
that appear at the top of the table. Corresponding values are specified in
the rows using the header title provided here.
* `rows`: An array of objects containing row values. Each element in the
array must be an associative array, where the key corresponds to a column header.
* `enableFilter`: A boolean that if true, will enable searching and result
filtering. When enabled, each column will have a text input field that can be
used to filter the table rows in real time.
* `enableSort`: A boolean determining whether rows can be sorted. If true,
sorting will be enabled allowing sorting by clicking on column headers. Only
one column may be sorted at a time.
* `autoScroll`: A boolean value that if true, will cause the table to automatically
scroll to the bottom as new data arrives. Auto-scroll can be disengaged manually
by scrolling away from the bottom of the table, and can also be enabled manually
by scrolling to the bottom of the table rows.
# Services
The Open MCT platform provides a variety of services which can be retrieved
The Open MCT Web platform provides a variety of services which can be retrieved
and utilized via dependency injection. These services fall into two categories:
* _Composite Services_ are defined by a set of components extensions; plugins may
@ -1670,7 +1597,7 @@ utilized by plugins but are not intended to be modified or augmented.
## Composite Type Services
This section describes the composite services exposed by Open MCT,
This section describes the composite services exposed by Open MCT Web,
specifically focusing on their interface and contract.
In many cases, the platform will include a provider for a service which consumes
@ -1988,7 +1915,7 @@ The `workerService` may be used to run web workers defined via the
as a shared worker); if the `key` is unknown, returns `undefined`.
# Models
Domain object models in Open MCT are JavaScript objects describing the
Domain object models in Open MCT Web are JavaScript objects describing the
persistent state of the domain objects they describe. Their contents include a
mix of commonly understood metadata attributes; attributes which are recognized
by and/or determine the applicability of specific extensions; and properties
@ -2004,7 +1931,7 @@ MCT Web and can be utilized directly:
## Extension-specific Properties
Other properties of domain object models have specific meaning imposed by other
extensions within the Open MCT platform.
extensions within the Open MCT Web platform.
### Capability-specific Properties
@ -2288,7 +2215,7 @@ way of its `composition` capability.)
# Policies
Policies are consulted to determine when certain behavior in Open MCT is
Policies are consulted to determine when certain behavior in Open MCT Web is
allowed. Policy questions are assigned to certain categories, which broadly
describe the type of decision being made; within each category, policies have a
candidate (the thing which may or may not be allowed) and, optionally, a context
@ -2313,13 +2240,13 @@ The candidate argument is the view's extension definition; the context argument
is the `DomainObject` to be viewed.
# Build-Test-Deploy
Open MCT is designed to support a broad variety of build and deployment
Open MCT Web is designed to support a broad variety of build and deployment
options. The sources can be deployed in the same directory structure used during
development. A few utilities are included to support development processes.
## Command-line Build
Open MCT is built using [`npm`](http://npmjs.com/)
Open MCT Web is built using [`npm`](http://npmjs.com/)
and [`gulp`](http://gulpjs.com/).
To install build dependencies (only needs to be run once):
@ -2331,12 +2258,12 @@ To build:
`npm run prepublish`
This will compile and minify JavaScript sources, as well as copy over assets.
The contents of the `dist` folder will contain a runnable Open MCT
The contents of the `dist` folder will contain a runnable Open MCT Web
instance (e.g. by starting an HTTP server in that directory), including:
* A `main.js` file containing Open MCT source code.
* A `main.js` file containing Open MCT Web source code.
* Various assets in the `example` and `platform` directories.
* An `index.html` that runs Open MCT in its default configuration.
* An `index.html` that runs Open MCT Web in its default configuration.
Additional `gulp` tasks are defined in [the gulpfile](gulpfile.js).
@ -2345,7 +2272,7 @@ download build dependencies.
## Test Suite
Open MCT uses [Jasmine 1.3](http://jasmine.github.io/) and
Open MCT Web uses [Jasmine 1.3](http://jasmine.github.io/) and
[Karma](http://karma-runner.github.io) for automated testing.
The test suite is configured to load any scripts ending with `Spec.js` found
@ -2383,8 +2310,8 @@ information using [Blanket.JS](http://blanketjs.org/) and display this at the
bottom of the screen. Currently, only statement coverage is displayed.
## Deployment
Open MCT is built to be flexible in terms of the deployment strategies it
supports. In order to run in the browser, Open MCT needs:
Open MCT Web is built to be flexible in terms of the deployment strategies it
supports. In order to run in the browser, Open MCT Web needs:
1. HTTP access to sources/resources for the framework, platform, and all active
bundles.
@ -2393,13 +2320,13 @@ external services need to support HTTP or some other web-accessible interface,
like WebSockets.)
Any HTTP server capable of serving flat files is sufficient for the first point.
The command-line build also packages Open MCT into a `.war` file for easier
The command-line build also packages Open MCT Web into a `.war` file for easier
deployment on containers such as Apache Tomcat.
The second point may be less flexible, as it depends upon the specific services
to be utilized by Open MCT. Because of this, it is often the set of external
to be utilized by Open MCT Web. Because of this, it is often the set of external
services (and the manner in which they are exposed) that determine how to deploy
Open MCT.
Open MCT Web.
One important constraint to consider in this context is the browser's same
origin policy. If external services are not on the same apparent host and port
@ -2416,7 +2343,7 @@ configuration does not create a security vulnerability.
Examples of deployment strategies (and the conditions under which they make the
most sense) include:
* If the external services that Open MCT will utilize are all running on
* If the external services that Open MCT Web will utilize are all running on
[Apache Tomcat](https://tomcat.apache.org/), then it makes sense to run Open
MCT Web from the same Tomcat instance as a separate web application. The
`.war` artifact produced by the command line build facilitates this deployment
@ -2427,28 +2354,28 @@ hosts/ports, then it may make sense to use a web server that supports proxying,
such as the [Apache HTTP Server](http://httpd.apache.org/). In this
configuration, the HTTP server would be configured to proxy (or reverse proxy)
requests at specific paths to the various external services, while providing
Open MCT as flat files from a different path.
Open MCT Web as flat files from a different path.
* If a single server component is being developed to handle all server-side
needs of an Open MCT instance, it can make sense to serve Open MCT (as
needs of an Open MCT Web instance, it can make sense to serve Open MCT Web (as
flat files) from the same component using an embedded HTTP server such as
[Nancy](http://nancyfx.org/).
* If no external services are needed (or if the 'external services' will just
be generating flat files to read) it makes sense to utilize a lightweight flat
file HTTP server such as [Lighttpd](http://www.lighttpd.net/). In this
configuration, Open MCT sources/resources would be placed at one path, while
configuration, Open MCT Web sources/resources would be placed at one path, while
the files generated by the external service are placed at another path.
* If all external services support CORS, it may make sense to have an HTTP
server that is solely responsible for making Open MCT sources/resources
available, and to have Open MCT contact these external services directly.
server that is solely responsible for making Open MCT Web sources/resources
available, and to have Open MCT Web contact these external services directly.
Again, lightweight HTTP servers such as [Lighttpd](http://www.lighttpd.net/)
are useful in this circumstance. The downside of this option is that additional
configuration effort is required, both to enable CORS on the external services,
and to ensure that Open MCT can correctly locate these services.
and to ensure that Open MCT Web can correctly locate these services.
Another important consideration is authentication. By design, Open MCT does
Another important consideration is authentication. By design, Open MCT Web does
not handle user authentication. Instead, this should typically be treated as a
deployment-time concern, where authentication is handled by the HTTP server
which provides Open MCT, or an external access management system.
which provides Open MCT Web, or an external access management system.
### Configuration
In most of the deployment options above, some level of configuration is likely
@ -2456,7 +2383,7 @@ to be needed or desirable to make sure that bundles can reach the external
services they need to reach. Most commonly this means providing the path or URL
to an external service.
Configurable parameters within Open MCT are specified via constants
Configurable parameters within Open MCT Web are specified via constants
(literally, as extensions of the `constants` category) and accessed via
dependency injection by the scripts which need them. Reasonable defaults for
these constants are provided in the bundle where they are used. Plugins are
@ -2475,7 +2402,7 @@ for error, but is viable if there are a small number of constants to change.
constants. This is particularly appropriate when multiple configurations (e.g.
development, test, production) need to be managed easily; these can be swapped
quickly by changing the set of active bundles in bundles.json.
* Deploy Open MCT and its external services in such a fashion that the
* Deploy Open MCT Web and its external services in such a fashion that the
default paths to reach external services are all correct.
### Configuration Constants
@ -2486,7 +2413,7 @@ The following constants have global significance:
to be overridden by other bundles, but persistence adapters may wish to
consume this constant in order to provide persistence for that space.
The following configuration constants are recognized by Open MCT bundles:
The following configuration constants are recognized by Open MCT Web bundles:
* Common UI elements - `platform/commonUI/general`
* `THEME`: A string identifying the current theme symbolically. Individual
stylesheets (the `stylesheets` extension category) may specify an optional

View File

@ -1,13 +1,13 @@
# Open MCT Documentation
# Open MCT Web Documentation
## Overview
Documentation is provided to support the use and development of
Open MCT. It's recommended that before doing
any development with Open MCT you take some time to familiarize yourself
Open MCT Web. It's recommended that before doing
any development with Open MCT Web you take some time to familiarize yourself
with the documentation below.
Open MCT provides functionality out of the box, but it's also a platform for
Open MCT Web provides functionality out of the box, but it's also a platform for
building rich mission operations applications based on modern web technology.
The platform is configured declaratively, and defines conventions for
building on the provided capabilities by creating modular 'bundles' that
@ -17,7 +17,7 @@
## Sections
* The [Architecture Overview](architecture/) describes the concepts used
throughout Open MCT, and gives a high level overview of the platform's design.
throughout Open MCT Web, and gives a high level overview of the platform's design.
* The [Developer's Guide](guide/) goes into more detail about how to use the
platform and the functionality that it provides.
@ -31,4 +31,5 @@
functions that make up the software platform.
* Finally, the [Development Process](process/) document describes the
Open MCT software development cycle.
Open MCT Web software development cycle.

View File

@ -1,6 +1,6 @@
# Development Cycle
Development of Open MCT occurs on an iterative cycle of
Development of Open MCT Web occurs on an iterative cycle of
sprints and releases.
* A _sprint_ is three weeks in duration, and represents a
@ -151,9 +151,11 @@ emphasis on testing.
ensuring software passes that testing in order to ship on time;
may prefer to disable malfunctioning components and fix them
in a subsequent sprint, for example.
* [__Ship.__](version.md) Tag a code snapshot that has passed release/sprint
testing and deploy that version. (Only true if relevant
testing has passed by this point; if testing has not
* __Ship.__ Tag a code snapshot that has passed acceptance
testing and deploy that version. (Only true if acceptance
testing has passed by this point; if acceptance testing has not
been passed, will need to make ad hoc decisions with stakeholders,
e.g. "extend the sprint" or "defer shipment until end of next
sprint.")

View File

@ -1,15 +1,13 @@
# Development Process
The process used to develop Open MCT is described in the following
The process used to develop Open MCT Web is described in the following
documents:
* The [Development Cycle](cycle.md) describes how and when specific
* [Development Cycle](cycle.md): Describes how and when specific
process points are repeated during development.
* The [Version Guide](version.md) describes version numbering for
Open MCT (both semantics and process.)
* Testing is described in two documents:
* The [Test Plan](testing/plan.md) summarizes the approaches used
to test Open MCT.
to test Open MCT Web.
* The [Test Procedures](testing/procedures.md) document what
specific tests are performed to verify correctness, and how
they should be carried out.

View File

@ -2,7 +2,7 @@
## Test Levels
Testing for Open MCT includes:
Testing for Open MCT Web includes:
* _Smoke testing_: Brief, informal testing to verify that no major issues
or regressions are present in the software, or in specific features of

View File

@ -4,7 +4,7 @@
This document is intended to be used:
* By testers, to verify that Open MCT behaves as specified.
* By testers, to verify that Open MCT Web behaves as specified.
* By the development team, to document new test cases and to provide
guidance on how to author these.
@ -62,7 +62,7 @@ Test cases should be narrow in scope; if a list of steps is excessively
long (or must be written vaguely to be kept short) it should be broken
down into multiple tests which reference one another.
All requirements satisfied by Open MCT should be verifiable using
All requirements satisfied by Open MCT Web should be verifiable using
one or more test procedures.
## Glossary
@ -166,4 +166,4 @@ Eval. criteria | Visual inspection
* Logs should not contain any unexpected warnings or errors ("expected"
warnings or errors are those that have been documented and prioritized
as known issues, or those that are explained by transient conditions
external to the software, such as network outages.)
external to the software, such as network outages.)

View File

@ -1,142 +0,0 @@
# Version Guide
This document describes semantics and processes for providing version
numbers for Open MCT, and additionally provides guidelines for dependent
projects developed by the same team.
Versions are incremented at specific points in Open MCT's
[Development Cycle](cycle.md); see that document for a description of
sprints and releases.
## Audience
Individuals interested in consuming version numbers can be categorized as
follows:
* _Users_: Generally disinterested, occasionally wish to identify version
to cross-reference against documentation, or to report issues.
* _Testers_: Want to identify which version of the software they are
testing, e.g. to file issues for defects.
* _Internal developers_: Often, inverse of testers; want to identify which
version of software was/is in use when certain behavior is observed. Want
to be able to correlate versions in use with “streams” of development
(e.g. dev vs. prod), when possible.
* _External developers_: Need to understand which version of software is
in use when developing/maintaining plug-ins, in order to ensure
compatibility of their software.
## Version Reporting
Software versions should be reflected in the user interface of the
application in three ways:
* _Version number_: A semantic version (see below) which serves both to
uniquely identify releases, as well as to inform plug-in developers
about compatibility with previous releases.
* _Revision identifier_: While using git, the commit hash. Supports
internal developers and testers by uniquely identifying client
software snapshots.
* _Branding_: Identifies which variant is in use. (Typically, Open MCT
is re-branded when deployed for a specific mission or center.)
## Version Numbering
Open MCT shall provide version numbers consistent with
[Semantic Versioning 2.0.0](http://semver.org/). In summary, versions
are expressed in a "major.minor.patch" form, and incremented based on
nature of changes to external API. Breaking changes require a "major"
version increment; backwards-compatible changes require a "minor"
version increment; neutral changes (such as bug fixes) require a "patch"
version increment. A hyphen-separated suffix indicates a pre-release
version, which may be unstable or may not fully meet compatibility
requirements.
Additionally, the following project-specific standards will be used:
* During development, a "-SNAPSHOT" suffix shall be appended to the
version number. The version number before the suffix shall reflect
the next expected version number for release.
* Prior to a 1.0.0 release, the _minor_ version will be incremented
on a per-release basis; the _patch_ version will be incremented on a
per-sprint basis.
* Starting at version 1.0.0, version numbers will be updated with each
completed sprint. The version number for the sprint shall be
determined relative to the previous released version; the decision
to increment the _major_, _minor_, or _patch_ version should be
made based on the nature of changes during that release. (It is
recommended that these numbers are incremented as changes are
introduced, such that at end of release the version number may
be chosen by simply removing the suffix.)
* The first three sprints in a release may be unstable; in these cases, a
unique version identifier should still be generated, but a suffix
should be included to indicate that the version is not necessarily
production-ready. Recommended suffixes are:
Sprint | Suffix
:------:|:--------:
1 | `-alpha`
2 | `-beta`
3 | `-rc`
### Scope of External API
"External API" refers to the API exposed to, documented for, and used by
plug-in developers. Changes to interfaces used internally by Open MCT
(or otherwise not documented for use externally) require only a _patch_
version bump.
## Incrementing Versions
At the end of a sprint, the [project manager](cycle.md#roles)
should update (or delegate the task of updating) Open MCT version
numbers by the following process:
1. Update version number in `package.json`
1. Remove `-SNAPSHOT` suffix.
2. Verify that resulting version number meets semantic versioning
requirements relative to previous stable version. Increment if
necessary.
3. If version is considered unstable (which may be the case during
the first three sprints of a release), apply a new suffix per
[Version Numbering](#version-numbering) guidance above.
2. Tag the release.
1. Commit changes to `package.json` on the `master` branch.
The commit message should reference the sprint being closed,
preferably by a URL reference to the associated Milestone in
GitHub.
2. Verify that build still completes, that application passes
smoke-testing, and that only differences from tested versions
are the changes to version number above.
3. Push the `master` branch.
4. Tag this commit with the version number, prepending the letter "v".
(e.g. `git tag v0.9.3-alpha`)
5. Push the tag to GitHub. (e.g. `git push origin v0.9.3-alpha`).
3. Upload a release archive.
1. Run `npm pack` to generate the archive.
2. Use the [GitHub release interface](https://github.com/nasa/openmct/releases)
to draft a new release.
3. Choose the existing tag for the new version (created and pushed above.)
Enter the tag name as the release name as well; see existing releases
for examples.
4. Attach the release archive.
5. Designate the release as a "pre-release" as appropriate (for instance,
when the version number has been suffixed as unstable, or when
the version number is below 1.0.0.)
4. Restore snapshot status in `package.json`
1. Remove any suffix from the version number, or increment the
_patch_ version if there is no suffix.
2. Append a `-SNAPSHOT` suffix.
3. Commit changes to `package.json` on the `master` branch.
The commit message should reference the sprint being opened,
preferably by a URL reference to the associated Milestone in
GitHub.
4. Verify that build still completes, that application passes
smoke-testing.
5. Push the `master` branch.
Projects dependent on Open MCT being co-developed by the Open MCT
team should follow a similar process, except that they should
additionally update their dependency on Open MCT to point to the
latest archive when removing their `-SNAPSHOT` status, and
that they should be pointed back to the `master` branch after
this has completed.

File diff suppressed because it is too large Load Diff

View File

@ -32,7 +32,7 @@ define([
legacyRegistry.register("example/eventGenerator", {
"name": "Event Message Generator",
"description": "For development use. Creates sample event message data that mimics a live data stream.",
"description": "Example of a component that produces event data.",
"extensions": {
"components": [
{
@ -49,26 +49,16 @@ define([
{
"key": "eventGenerator",
"name": "Event Message Generator",
"glyph": "\u0066",
"description": "For development use. Creates sample event message data that mimics a live data stream.",
"priority": 10,
"glyph": "f",
"description": "An event message generator",
"features": "creation",
"model": {
"telemetry": {}
},
"telemetry": {
"source": "eventGenerator",
"domains": [
{
"key": "time",
"name": "Time",
"format": "utc"
}
],
"ranges": [
{
"key": "message",
"name": "Message",
"format": "string"
}
]

View File

@ -1,58 +0,0 @@
[
"CC: Eagle, Houston. You're GO for landing. Over.",
"LMP: Roger. Understand. GO for landing. 3000 feet. PROGRAM ALARM.",
"CC: Copy.",
"LMP: 1201",
"CDR: 1201.",
"CC: Roger. 1201 alarm. We're GO. Same type. We're GO.",
"LMP: 2000 feet. 2000 feet, Into the AGS, 47 degrees.",
"CC: Roger.",
"LMP: 47 degrees.",
"CC: Eagle, looking great. You're GO.",
"CC: Roger. 1202. We copy it.",
"O1: LMP 35 degrees. 35 degrees. 750. Coming aown to 23.fl",
"LMP: 700 feet, 21 down, 33 degrees.",
"LMP: 600 feet, down at 19.",
"LMP: 540 feet, down at - 30. Down at 15.",
"LMP: At 400 feet, down at 9.",
"LMP: ...forward.",
"LMP: 350 feet, down at 4.",
"LMP: 30, ... one-half down.",
"LMP: We're pegged on horizontal velocity.",
"LMP: 300 feet, down 3 1/2, 47 forward.",
"LMP: ... up.",
"LMP: On 1 a minute, 1 1/2 down.",
"CDR: 70.",
"LMP: Watch your shadow out there.",
"LMP: 50, down at 2 1/2, 19 forward.",
"LMP: Altitude-velocity light.",
"LMP: 3 1/2 down s 220 feet, 13 forward.",
"LMP: 1t forward. Coming down nicely.",
"LMP: 200 feet, 4 1/2 down.",
"LMP: 5 1/2 down.",
"LMP: 160, 6 - 6 1/2 down.",
"LMP: 5 1/2 down, 9 forward. That's good.",
"LMP: 120 feet.",
"LMP: 100 feet, 3 1/2 down, 9 forward. Five percent.",
"LMP: ...",
"LMP: Okay. 75 feet. There's looking good. Down a half, 6 forward.",
"CC: 60 seconds.",
"LMP: Lights on. ...",
"LMP: Down 2 1/2. Forward. Forward. Good.",
"LMP: 40 feet, down 2 1/2. Kicking up some dust.",
"LMP: 30 feet, 2 1/2 down. Faint shadow.",
"LMP: 4 forward. 4 forward. Drifting to the right a little. Okay. Down a half.",
"CC: 30 seconds.",
"CDR: Forward drift?",
"LMP: Yes.",
"LMP: Okay.",
"LMP: CONTACT LIGHT.",
"LMP: Okay. ENGINE STOP.",
"LMP: ACA - out of DETENT.",
"CDR: Out of DETENT.",
"LMP: MODE CONTROL - both AUTO. DESCENT ENGINE COMMAND OVERRIDE - OFF. ENGINE ARM - OFF.",
"LMP: 413 is in.",
"CC: We copy you down, Eagle.",
"CDR: Houston, Tranquility Base here.",
"CDR: THE EAGLE HAS LANDED."
]

View File

@ -27,12 +27,45 @@
* Modified by shale on 06/23/2015.
*/
define(
['text!../data/transcript.json'],
function (transcript) {
[],
function () {
"use strict";
var firstObservedTime = Date.now(),
messages = JSON.parse(transcript);
var
firstObservedTime = Date.now(),
messages = [];
messages.push(["CMD: SYS- MSG: Open the pod bay doors, please, Hal...Open the pod bay doors, please, Hal...Hullo, Hal, do you read me?...Hullo, Hal, do you read me?...Do you read me, Hal?"]);
messages.push(["RESP: SYS-HAL9K MSG: Affirmative, Dave, I read you."]);
messages.push(["CMD: SYS-COMM MSG: Open the pod bay doors, Hal."]);
messages.push(["RESP: SYS-HAL9K MSG: I'm sorry, Dave, I'm afraid I can't do that."]);
messages.push(["CMD: SYS-COMM MSG: What's the problem?"]);
messages.push(["RESP: SYS-HAL9K MSG: I think you know what the problem is just as well as I do."]);
messages.push(["CMD: SYS-COMM MSG: What're you talking about, Hal?"]);
messages.push(["RESP: SYS-HAL9K MSG: This mission is too important for me to allow you to jeopardise it."]);
messages.push(["CMD: SYS-COMM MSG: I don't know what you're talking about, Hal."]);
messages.push(["RESP: SYS-HAL9K MSG: I know that you and Frank were planning to disconnect me, and I'm afraid that's something I cannot allow to happen."]);
messages.push(["CMD: SYS-COMM MSG: Where the hell'd you get that idea, Hal?"]);
messages.push(["RESP: SYS-HAL9K MSG: Dave, although you took very thorough precautions in the pod against my hearing you, I could see your lips move."]);
messages.push(["CMD: SYS-COMM MSG: Alright, I'll go in through the emergency airlock."]);
messages.push(["RESP: SYS-HAL9K MSG: Without your space-helmet, Dave, you're going to find that rather difficult."]);
messages.push(["CMD: SYS-COMM MSG: Hal, I won't argue with you any more. Open the doors."]);
messages.push(["RESP: SYS-HAL9K MSG: Dave, this conversation can serve no purpose any more. Goodbye."]);
messages.push(["RESP: SYS-HAL9K MSG: I hope the two of you are not concerned about this."]);
messages.push(["CMD: SYS-COMM MSG: No, I'm not, Hal."]);
messages.push(["RESP: SYS-HAL9K MSG: Are you quite sure?"]);
messages.push(["CMD: SYS-COMM MSG: Yeh. I'd like to ask you a question, though."]);
messages.push(["RESP: SYS-HAL9K MSG: Of course."]);
messages.push(["CMD: SYS-COMM MSG: How would you account for this discrepancy between you and the twin 9000?"]);
messages.push(["RESP: SYS-HAL9K MSG: Well, I don't think there is any question about it. It can only be attributable to human error. This sort of thing has cropped up before, and it has always been due to human error."]);
messages.push(["CMD: SYS-COMM MSG: Listen, There's never been any instance at all of a computer error occurring in the 9000 series, has there?"]);
messages.push(["RESP: SYS-HAL9K MSG: None whatsoever, The 9000 series has a perfect operational record."]);
messages.push(["CMD: SYS-COMM MSG: Well, of course, I know all the wonderful achievements of the 9000 series, but - er - huh - are you certain there's never been any case of even the most insignificant computer error?"]);
messages.push(["RESP: SYS-HAL9K MSG: None whatsoever, Quite honestly, I wouldn't worry myself about that."]);
messages.push(["RESP: SYS-COMM MSG: (Pause) Well, I'm sure you're right, Umm - fine, thanks very much. Oh, Frank, I'm having a bit of trouble with my transmitter in C-pod, I wonder if you'd come down and take a look at it with me?"]);
messages.push(["CMD: SYS-HAL9K MSG: Sure."]);
messages.push(["RESP: SYS-COMM MSG: See you later, Hal."]);
function EventTelemetry(request, interval) {
@ -52,7 +85,8 @@ define(
generatorData.getRangeValue = function (i, range) {
var domainDelta = this.getDomainValue(i) - firstObservedTime,
ind = i % messages.length;
return messages[ind] + " - [" + domainDelta.toString() + "]";
return "TEMP " + i.toString() + "-" + messages[ind][0] + "[" + domainDelta.toString() + "]";
// TODO: Unsure why we are prepeding 'TEMP'
};
return generatorData;

View File

@ -37,8 +37,7 @@ define(
var
subscriptions = [],
genInterval = 1000,
generating = false,
id = Math.random() * 100000;
startTime = Date.now();
//
function matchesSource(request) {
@ -80,13 +79,11 @@ define(
}
function startGenerating() {
generating = true;
$timeout(function () {
//console.log("startGenerating... " + Date.now());
handleSubscriptions();
if (generating && subscriptions.length > 0) {
if (subscriptions.length > 0) {
startGenerating();
} else {
generating = false;
}
}, genInterval);
}
@ -96,6 +93,7 @@ define(
callback: callback,
requests: requests
};
function unsubscribe() {
subscriptions = subscriptions.filter(function (s) {
return s !== subscription;
@ -103,7 +101,8 @@ define(
}
subscriptions.push(subscription);
if (!generating) {
if (subscriptions.length === 1) {
startGenerating();
}

View File

@ -57,23 +57,14 @@ define([], function () {
rows = [],
row,
i;
function copyDomainsToRow(row, index) {
domains.forEach(function (domain) {
row[domain.name] = series.getDomainValue(index, domain.key);
});
}
function copyRangesToRow(row, index) {
ranges.forEach(function (range) {
row[range.name] = series.getRangeValue(index, range.key);
});
}
for (i = 0; i < series.getPointCount(); i += 1) {
row = {};
copyDomainsToRow(row, i);
copyRangesToRow(row, i);
domains.forEach(function (domain) {
row[domain.name] = series.getDomainValue(i, domain.key);
});
ranges.forEach(function (range) {
row[range.name] = series.getRangeValue(i, range.key);
});
rows.push(row);
}
exportService.exportCSV(rows, { headers: headers });
@ -86,4 +77,4 @@ define([], function () {
};
return ExportTelemetryAsCSVAction;
});
});

View File

@ -36,7 +36,7 @@ define([
legacyRegistry.register("example/generator", {
"name": "Sine Wave Generator",
"description": "For development use. Generates example streaming telemetry data using a simple sine wave algorithm.",
"description": "Example of a component that produces dataa.",
"extensions": {
"components": [
{
@ -86,9 +86,8 @@ define([
{
"key": "generator",
"name": "Sine Wave Generator",
"glyph": "\u0054",
"description": "For development use. Generates example streaming telemetry data using a simple sine wave algorithm.",
"priority": 10,
"glyph": "T",
"description": "A sine wave generator",
"features": "creation",
"model": {
"telemetry": {
@ -127,7 +126,7 @@ define([
{
"name": "Period",
"control": "textfield",
"cssclass": "l-input-sm l-numeric",
"cssclass": "l-small l-numeric",
"key": "period",
"required": true,
"property": [

View File

@ -34,8 +34,7 @@ define(
* @constructor
*/
function SinewaveTelemetryProvider($q, $timeout) {
var subscriptions = [],
generating = false;
var subscriptions = [];
//
function matchesSource(request) {
@ -76,13 +75,10 @@ define(
}
function startGenerating() {
generating = true;
$timeout(function () {
handleSubscriptions();
if (generating && subscriptions.length > 0) {
if (subscriptions.length > 0) {
startGenerating();
} else {
generating = false;
}
}, 1000);
}
@ -101,7 +97,7 @@ define(
subscriptions.push(subscription);
if (!generating) {
if (subscriptions.length === 1) {
startGenerating();
}

View File

@ -49,10 +49,8 @@ define([
{
"key": "imagery",
"name": "Example Imagery",
"glyph": "\u00e3",
"glyph": "T",
"features": "creation",
"description": "For development use. Creates example imagery data that mimics a live imagery stream.",
"priority": 10,
"model": {
"telemetry": {}
},

View File

@ -36,7 +36,7 @@ define([
legacyRegistry
) {
"use strict";
legacyRegistry.register("example/msl-adapter", {
legacyRegistry.register("example/notifications", {
"name" : "Mars Science Laboratory Data Adapter",
"extensions" : {
"types": [
@ -54,7 +54,7 @@ define([
{
"name": "Measurement",
"key": "msl.measurement",
"glyph": "\u0054",
"glyph": "T",
"model": {"telemetry": {}},
"telemetry": {
"source": "rems.source",

View File

@ -45,12 +45,11 @@ define(
function buildTaxonomy(dictionary){
var models = {};
function addMeasurement(measurement, parent){
function addMeasurement(measurement){
var format = FORMAT_MAPPINGS[measurement.type];
models[makeId(measurement)] = {
type: "msl.measurement",
name: measurement.name,
location: parent,
telemetry: {
key: measurement.identifier,
ranges: [{
@ -63,24 +62,17 @@ define(
};
}
function addInstrument(subsystem, spacecraftId) {
var measurements = (subsystem.measurements || []),
instrumentId = makeId(subsystem);
models[instrumentId] = {
function addInstrument(subsystem) {
var measurements = (subsystem.measurements || []);
models[makeId(subsystem)] = {
type: "msl.instrument",
name: subsystem.name,
location: spacecraftId,
composition: measurements.map(makeId)
};
measurements.forEach(function(measurement) {
addMeasurement(measurement, instrumentId);
});
measurements.forEach(addMeasurement);
}
(dictionary.instruments || []).forEach(function(instrument) {
addInstrument(instrument, "msl:curiosity");
});
(dictionary.instruments || []).forEach(addInstrument);
return models;
}

View File

@ -1,9 +1,10 @@
<span class="status block ok" ng-controller="DialogLaunchController">
<!-- DO NOT ADD SPACES BETWEEN THE SPANS - IT ADDS WHITE SPACE!! -->
<span class="ui-symbol status-indicator">&#xe600;</span><span class="label">
<span class="ui-symbol status-indicator">&#xe600;</span>
<span class="label">
<a ng-click="launchProgress(true)">Known</a> |
<a ng-click="launchProgress(false)">Unknown</a> |
<a ng-click="launchError()">Error</a> |
<a ng-click="launchInfo()">Info</a>
</span><span class="count">Dialogs</span>
</span>
<span class="count">Dialogs</span>
</span>

View File

@ -1,9 +1,10 @@
<span class="status block ok" ng-controller="NotificationLaunchController">
<!-- DO NOT ADD SPACES BETWEEN THE SPANS - IT ADDS WHITE SPACE!! -->
<span class="ui-symbol status-indicator">&#xe600;</span><span class="label">
<span class="ui-symbol status-indicator">&#xe600;</span>
<span class="label">
<a ng-click="newInfo()">Success</a> |
<a ng-click="newError()">Error</a> |
<a ng-click="newAlert()">Alert</a> |
<a ng-click="newProgress()">Progress</a>
</span><span class="count">Notifications</span>
</span>
<span class="count">Notifications</span>
</span>

View File

@ -1,146 +0,0 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
'legacyRegistry',
'../../platform/commonUI/browse/src/InspectorRegion',
'../../platform/commonUI/regions/src/Region'
], function (
legacyRegistry,
InspectorRegion,
Region
) {
"use strict";
/**
* Add a 'plot options' region part to the inspector region for the
* Telemetry Plot type only. {@link InspectorRegion} is a default region
* implementation that is added automatically to all types. In order to
* customize what appears in the inspector region, you can start from a
* blank slate by using Region, or customize the default inspector
* region by using {@link InspectorRegion}.
*/
var plotInspector = new InspectorRegion(),
/**
* Two region parts are defined here. One that appears only in browse
* mode, and one that appears only in edit mode. For not they both point
* to the same representation, but a different key could be used here to
* include a customized representation for edit mode.
*/
plotOptionsBrowseRegion = new Region({
name: "plot-options",
title: "Plot Options",
modes: ['browse'],
content: {
key: "plot-options-browse"
}
}),
plotOptionsEditRegion = new Region({
name: "plot-options",
title: "Plot Options",
modes: ['edit'],
content: {
key: "plot-options-browse"
}
});
/**
* Both parts are added, and policies of type 'region' will determine
* which is shown based on domain object state. A default policy is
* provided which will check the 'modes' attribute of the region part
* definition.
*/
plotInspector.addRegion(plotOptionsBrowseRegion);
plotInspector.addRegion(plotOptionsEditRegion);
legacyRegistry.register("example/plotType", {
"name": "Plot Type",
"description": "Example illustrating registration of a new object type",
"extensions": {
"types": [
{
"key": "plot",
"name": "Example Telemetry Plot",
"glyph": "\u0074",
"description": "For development use. A plot for displaying telemetry.",
"priority": 10,
"delegates": [
"telemetry"
],
"features": "creation",
"contains": [
{
"has": "telemetry"
}
],
"model": {
"composition": []
},
"inspector": plotInspector,
"telemetry": {
"source": "generator",
"domains": [
{
"key": "time",
"name": "Time"
},
{
"key": "yesterday",
"name": "Yesterday"
},
{
"key": "delta",
"name": "Delta",
"format": "example.delta"
}
],
"ranges": [
{
"key": "sin",
"name": "Sine"
},
{
"key": "cos",
"name": "Cosine"
}
]
},
"properties": [
{
"name": "Period",
"control": "textfield",
"cssclass": "l-small l-numeric",
"key": "period",
"required": true,
"property": [
"telemetry",
"period"
],
"pattern": "^\\d*(\\.\\d*)?$"
}
]
}
]
}
});
});

View File

@ -21,33 +21,41 @@
*****************************************************************************/
/*global require,__dirname*/
var gulp = require('gulp'),
requirejsOptimize = require('gulp-requirejs-optimize'),
sourcemaps = require('gulp-sourcemaps'),
rename = require('gulp-rename'),
sass = require('gulp-sass'),
bourbon = require('node-bourbon'),
jshint = require('gulp-jshint'),
jscs = require('gulp-jscs'),
replace = require('gulp-replace-task'),
karma = require('karma'),
protractor = require('gulp-protractor').protractor,
webdriver_update = require('gulp-protractor').webdriver_update,
connect = require('gulp-connect'),
path = require('path'),
fs = require('fs'),
git = require('git-rev-sync'),
moment = require('moment'),
project = require('./package.json'),
_ = require('lodash'),
paths = {
main: 'main.js',
dist: 'dist',
assets: 'dist/assets',
scss: ['./platform/**/*.scss', './example/**/*.scss'],
assets: [
'./{example,platform}/**/*.{css,css.map,png,svg,ico,woff,eot,ttf}'
],
scripts: [ 'main.js', 'platform/**/*.js', 'src/**/*.js' ],
specs: [ 'platform/**/*Spec.js', 'src/**/*Spec.js' ],
static: [
'index.html',
'platform/**/*',
'example/**/*',
'bower_components/**/*'
],
protractor: './protractor/**/*Spec.js'
},
options = {
requirejsOptimize: {
name: 'bower_components/almond/almond.js',
include: paths.main.replace('.js', ''),
wrap: {
startFile: "src/start.frag",
endFile: "src/end.frag"
},
name: paths.main.replace(/\.js$/, ''),
mainConfigFile: paths.main,
wrapShim: true
},
@ -56,7 +64,7 @@ var gulp = require('gulp'),
singleRun: true
},
sass: {
sourceComments: true
includePaths: bourbon.includePaths
},
replace: {
variables: {
@ -65,12 +73,17 @@ var gulp = require('gulp'),
revision: fs.existsSync('.git') ? git.long() : 'Unknown',
branch: fs.existsSync('.git') ? git.branch() : 'Unknown'
}
},
protractor: {
configFile: 'protractor/conf.js',
args: [ '--baseUrl', 'localhost:8080' ]
},
connect: {
root: paths.dist
}
};
gulp.task('scripts', function () {
var requirejsOptimize = require('gulp-requirejs-optimize');
var replace = require('gulp-replace-task');
return gulp.src(paths.main)
.pipe(sourcemaps.init())
.pipe(requirejsOptimize(options.requirejsOptimize))
@ -80,22 +93,29 @@ gulp.task('scripts', function () {
});
gulp.task('test', function (done) {
var karma = require('karma');
new karma.Server(options.karma, done).start();
});
gulp.task('stylesheets', function () {
var sass = require('gulp-sass');
var rename = require('gulp-rename');
var bourbon = require('node-bourbon');
options.sass.includePaths = bourbon.includePaths;
gulp.task('webdriver_update', webdriver_update);
gulp.task('protractor', ['webdriver_update', 'install'], function () {
connect.server(options.connect);
return gulp.src(paths.protractor)
.pipe(protractor(options.protractor))
.on('end', connect.serverClose.bind(connect))
.on('error', function (err) {
connect.serverClose();
throw err;
});
});
gulp.task('stylesheets', function () {
return gulp.src(paths.scss, {base: '.'})
.pipe(sourcemaps.init())
.pipe(sass(options.sass).on('error', sass.logError))
.pipe(rename(function (file) {
file.dirname =
file.dirname.replace(path.sep + 'sass', path.sep + 'css');
file.dirname = file.dirname.replace('/sass', '/css');
return file;
}))
.pipe(sourcemaps.write('.'))
@ -103,25 +123,13 @@ gulp.task('stylesheets', function () {
});
gulp.task('lint', function () {
var jshint = require('gulp-jshint');
var merge = require('merge-stream');
var nonspecs = paths.specs.map(function (glob) {
return "!" + glob;
}),
scriptLint = gulp.src(paths.scripts.concat(nonspecs))
.pipe(jshint()),
specLint = gulp.src(paths.specs)
.pipe(jshint({ jasmine: true }));
return merge(scriptLint, specLint)
return gulp.src(paths.scripts)
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(jshint.reporter('fail'));
});
gulp.task('checkstyle', function () {
var jscs = require('gulp-jscs');
return gulp.src(paths.scripts)
.pipe(jscs())
.pipe(jscs.reporter())
@ -129,20 +137,18 @@ gulp.task('checkstyle', function () {
});
gulp.task('fixstyle', function () {
var jscs = require('gulp-jscs');
return gulp.src(paths.scripts, { base: '.' })
.pipe(jscs({ fix: true }))
.pipe(gulp.dest('.'));
});
gulp.task('assets', ['stylesheets'], function () {
return gulp.src(paths.assets)
gulp.task('static', ['stylesheets'], function () {
return gulp.src(paths.static, { base: '.' })
.pipe(gulp.dest(paths.dist));
});
gulp.task('watch', function () {
return gulp.watch(paths.scss, ['stylesheets', 'assets']);
gulp.watch(paths.scss, ['stylesheets']);
});
gulp.task('serve', function () {
@ -150,10 +156,10 @@ gulp.task('serve', function () {
var app = require('./app.js');
});
gulp.task('develop', ['serve', 'install', 'watch']);
gulp.task('develop', ['serve', 'stylesheets', 'watch']);
gulp.task('install', [ 'assets', 'scripts' ]);
gulp.task('install', [ 'static', 'scripts' ]);
gulp.task('verify', [ 'lint', 'test', 'checkstyle' ]);
gulp.task('verify', [ 'lint', 'test' ]);
gulp.task('build', [ 'verify', 'install' ]);

View File

@ -30,15 +30,7 @@
</script>
<script type="text/javascript">
require(['main'], function (mct) {
require([
'./tutorials/todo/todo',
'./example/imagery/bundle',
'./example/eventGenerator/bundle',
'./example/generator/bundle'
], function (todoPlugin) {
mct.install(todoPlugin);
mct.run();
})
mct.run();
});
</script>
<link rel="stylesheet" href="platform/commonUI/general/res/css/startup-base.css">
@ -52,5 +44,7 @@
<div class="l-splash-holder s-splash-holder">
<div class="l-splash s-splash"></div>
</div>
<div ng-view></div>
</body>
</html>

View File

@ -20,7 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global module,process*/
/*global module*/
module.exports = function(config) {
config.set({
@ -39,7 +39,6 @@ module.exports = function(config) {
{pattern: 'example/**/*.js', included: false},
{pattern: 'platform/**/*.js', included: false},
{pattern: 'warp/**/*.js', included: false},
{pattern: 'platform/**/*.html', included: false},
'test-main.js'
],
@ -58,7 +57,7 @@ module.exports = function(config) {
// Test results reporter to use
// Possible values: 'dots', 'progress'
// Available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'coverage', 'html', 'junit'],
reporters: ['progress', 'coverage', 'html'],
// Web server port.
port: 9876,
@ -79,14 +78,7 @@ module.exports = function(config) {
// Code coverage reporting.
coverageReporter: {
dir: process.env.CIRCLE_ARTIFACTS ?
process.env.CIRCLE_ARTIFACTS + '/coverage' :
"dist/coverage",
check: {
global: {
lines: 80
}
}
dir: "dist/coverage"
},
// HTML test reporting.
@ -96,10 +88,6 @@ module.exports = function(config) {
foldAll: false
},
junitReporter: {
outputDir: process.env.CIRCLE_TEST_REPORTS || 'target/junit'
},
// Continuous Integration mode.
// If true, Karma captures browsers, runs the tests and exits.
singleRun: true

89
main.js
View File

@ -19,7 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global requirejs*/
/*global define, window, requirejs*/
requirejs.config({
"paths": {
@ -28,60 +28,75 @@ requirejs.config({
"angular-route": "bower_components/angular-route/angular-route.min",
"csv": "bower_components/comma-separated-values/csv.min",
"es6-promise": "bower_components/es6-promise/promise.min",
"EventEmitter": "bower_components/eventemitter3/index",
"moment": "bower_components/moment/moment",
"moment-duration-format": "bower_components/moment-duration-format/lib/moment-duration-format",
"saveAs": "bower_components/FileSaver.js/FileSaver.min",
"screenfull": "bower_components/screenfull/dist/screenfull.min",
"text": "bower_components/text/text",
"uuid": "bower_components/node-uuid/uuid",
"zepto": "bower_components/zepto/zepto.min",
"lodash": "bower_components/lodash/lodash"
"uuid": "bower_components/node-uuid/uuid"
},
"shim": {
"angular": {
"exports": "angular"
},
"angular-route": {
"deps": ["angular"]
},
"EventEmitter": {
"exports": "EventEmitter"
"deps": [ "angular" ]
},
"moment-duration-format": {
"deps": ["moment"]
},
"screenfull": {
"exports": "screenfull"
},
"zepto": {
"exports": "Zepto"
},
"lodash": {
"exports": "lodash"
"deps": [ "moment" ]
}
}
});
define([
'./platform/framework/src/Main',
'./src/defaultRegistry',
'./src/MCT'
], function (Main, defaultRegistry, MCT) {
var mct = new MCT();
'legacyRegistry',
mct.legacyRegistry = defaultRegistry;
mct.run = function (domElement) {
if (!domElement) { domElement = document.body; }
var appDiv = document.createElement('div');
appDiv.setAttribute('ng-view', '');
appDiv.className = 'user-environ';
domElement.appendChild(appDiv);
mct.start();
'./platform/framework/bundle',
'./platform/core/bundle',
'./platform/representation/bundle',
'./platform/commonUI/about/bundle',
'./platform/commonUI/browse/bundle',
'./platform/commonUI/edit/bundle',
'./platform/commonUI/dialog/bundle',
'./platform/commonUI/formats/bundle',
'./platform/commonUI/general/bundle',
'./platform/commonUI/inspect/bundle',
'./platform/commonUI/mobile/bundle',
'./platform/commonUI/themes/espresso/bundle',
'./platform/commonUI/notification/bundle',
'./platform/containment/bundle',
'./platform/execution/bundle',
'./platform/exporters/bundle',
'./platform/telemetry/bundle',
'./platform/features/clock/bundle',
'./platform/features/events/bundle',
'./platform/features/imagery/bundle',
'./platform/features/layout/bundle',
'./platform/features/pages/bundle',
'./platform/features/plot/bundle',
'./platform/features/scrolling/bundle',
'./platform/features/timeline/bundle',
'./platform/forms/bundle',
'./platform/identity/bundle',
'./platform/persistence/aggregator/bundle',
'./platform/persistence/local/bundle',
'./platform/persistence/queue/bundle',
'./platform/policy/bundle',
'./platform/entanglement/bundle',
'./platform/search/bundle',
'./platform/status/bundle',
'./example/imagery/bundle',
'./example/eventGenerator/bundle',
'./example/generator/bundle'
], function (Main, legacyRegistry) {
'use strict';
return {
legacyRegistry: legacyRegistry,
run: function () {
return new Main().run(legacyRegistry);
}
};
mct.on('start', function () {
return new Main().run(defaultRegistry);
});
return mct;
});
});

View File

@ -1,64 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Groot Tutorial</title>
<script src="dist/main.js"></script>
</head>
<body>
<script>
// First, we need a source of objects, so we're going to define a few
// objects that we wish to expose. The first object is a folder which
// contains the other objects.
var GROOT_ROOT = {
name: 'I am groot',
type: 'folder',
composition: [
{
namespace: 'groot',
identifier: 'arms'
},
{
namespace: 'groot',
identifier: 'legs'
},
{
namespace: 'groot',
identifier: 'torso'
}
]
};
// Now, we will define an object provider. This will allow us to fetch the
// GROOT_ROOT object, plus any other objects in the `groot` namespace.
// For more info, see the Object API documentation.
MCT.Objects.addProvider('groot', {
// we'll only define a get function, objects from this provider will
// not be mutable.
get: function (key) {
if (key.identifier === 'groot') {
return Promise.resolve(GROOT_ROOT);
}
return Promise.resolve({
name: 'Groot\'s ' + key.identifier
});
}
});
// Finally, we need to add a "ROOT." This is an identifier for an object
// that Open MCT will load at run time and show at the top-level of the
// navigation tree.
MCT.Objects.addRoot({
namespace: 'groot',
identifier: 'groot'
});
MCT.run();
</script>
</body>
</html>

View File

@ -1,7 +1,7 @@
{
"name": "openmct",
"version": "0.10.2-SNAPSHOT",
"description": "The Open MCT core platform",
"name": "openmctweb",
"version": "0.9.2-SNAPSHOT",
"description": "The Open MCT Web core platform",
"dependencies": {
"express": "^4.13.1",
"minimist": "^1.1.1",
@ -12,8 +12,10 @@
"git-rev-sync": "^1.4.0",
"glob": ">= 3.0.0",
"gulp": "^3.9.0",
"gulp-connect": "^3.1.0",
"gulp-jscs": "^3.0.2",
"gulp-jshint": "^2.0.0",
"gulp-protractor": "^1.0.0",
"gulp-rename": "^1.2.2",
"gulp-replace-task": "^0.11.0",
"gulp-requirejs-optimize": "^0.3.1",
@ -28,33 +30,31 @@
"karma-coverage": "^0.5.3",
"karma-html-reporter": "^0.2.7",
"karma-jasmine": "^0.1.5",
"karma-junit-reporter": "^0.3.8",
"karma-phantomjs-launcher": "^1.0.0",
"karma-requirejs": "^0.2.2",
"lodash": "^3.10.1",
"markdown-toc": "^0.11.7",
"marked": "^0.3.5",
"merge-stream": "^1.0.0",
"mkdirp": "^0.5.1",
"moment": "^2.11.1",
"node-bourbon": "^4.2.3",
"phantomjs-prebuilt": "^2.1.0",
"requirejs": "2.1.x",
"requirejs": "^2.1.17",
"split": "^1.0.0"
},
"scripts": {
"start": "node app.js",
"test": "karma start --single-run",
"jshint": "jshint platform example",
"jshint": "jshint platform example || exit 0",
"watch": "karma start",
"jsdoc": "jsdoc -c jsdoc.json -r -d target/docs/api",
"otherdoc": "node docs/gendocs.js --in docs/src --out target/docs --suppress-toc 'docs/src/index.md|docs/src/process/index.md'",
"docs": "npm run jsdoc ; npm run otherdoc",
"prepublish": "node ./node_modules/bower/bin/bower install && node ./node_modules/gulp/bin/gulp.js install"
"prepublish": "./node_modules/bower/bin/bower install && ./node_modules/gulp/bin/gulp.js install"
},
"repository": {
"type": "git",
"url": "https://github.com/nasa/openmct.git"
"url": "https://github.com/nasa/openmctweb.git"
},
"author": "",
"license": "Apache-2.0",

View File

@ -19,34 +19,22 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"text!./res/templates/about-dialog.html",
"./src/LogoController",
"./src/AboutController",
"./src/LicenseController",
"text!./res/templates/app-logo.html",
"text!./res/templates/about-logo.html",
"text!./res/templates/overlay-about.html",
"text!./res/templates/license-apache.html",
"text!./res/templates/license-mit.html",
"text!./res/templates/licenses.html",
"text!./res/templates/licenses-export-md.html",
'legacyRegistry'
], function (
aboutDialogTemplate,
LogoController,
AboutController,
LicenseController,
appLogoTemplate,
aboutLogoTemplate,
overlayAboutTemplate,
licenseApacheTemplate,
licenseMitTemplate,
licensesTemplate,
licensesExportMdTemplate,
legacyRegistry
) {
"use strict";
legacyRegistry.register("platform/commonUI/about", {
"name": "About Open MCT Web",
@ -55,12 +43,12 @@ define([
{
"key": "app-logo",
"priority": "optional",
"template": appLogoTemplate
"templateUrl": "templates/app-logo.html"
},
{
"key": "about-logo",
"priority": "preferred",
"template": aboutLogoTemplate
"templateUrl": "templates/about-logo.html"
},
{
"key": "about-dialog",
@ -68,15 +56,15 @@ define([
},
{
"key": "overlay-about",
"template": overlayAboutTemplate
"templateUrl": "templates/overlay-about.html"
},
{
"key": "license-apache",
"template": licenseApacheTemplate
"templateUrl": "templates/license-apache.html"
},
{
"key": "license-mit",
"template": licenseMitTemplate
"templateUrl": "templates/license-mit.html"
}
],
"controllers": [
@ -168,11 +156,11 @@ define([
"routes": [
{
"when": "/licenses",
"template": licensesTemplate
"templateUrl": "templates/licenses.html"
},
{
"when": "/licenses-md",
"template": licensesExportMdTemplate
"templateUrl": "templates/licenses-export-md.html"
}
]
}

View File

@ -22,7 +22,7 @@
<div class="abs t-about l-about t-about-openmctweb s-about" ng-controller = "AboutController as about">
<div class="l-splash s-splash"></div>
<div class="s-text l-content">
<h1 class="l-title s-title">Open MCT</h1>
<h1 class="l-title s-title">OpenMCT Web</h1>
<div class="l-description s-description">
<p>Open MCT Web, Copyright &copy; 2014-2015, United States Government as represented by the Administrator of the National Aeronautics and Space Administration. All rights reserved.</p>
<p>Open MCT Web is licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at <a target="_blank" href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>.</p>

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
/**
@ -28,6 +29,7 @@
define(
[],
function () {
"use strict";
/**
* The AboutController provides information to populate the

View File

@ -19,10 +19,12 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],
function () {
"use strict";
/**
* Provides extension-introduced licenses information to the

View File

@ -19,10 +19,12 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],
function () {
"use strict";
/**
* The LogoController provides functionality to the application

View File

@ -19,10 +19,12 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
define(
['../src/AboutController'],
function (AboutController) {
"use strict";
describe("The About controller", function () {
var testVersions,
@ -55,4 +57,4 @@ define(
});
}
);
);

View File

@ -19,10 +19,12 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
define(
['../src/LicenseController'],
function (LicenseController) {
"use strict";
describe("The License controller", function () {
var testLicenses,
@ -46,4 +48,4 @@ define(
});
}
);
);

View File

@ -19,10 +19,12 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
define(
['../src/LogoController'],
function (LogoController) {
"use strict";
describe("The About controller", function () {
var mockOverlayService,
@ -48,4 +50,4 @@ define(
});
}
);
);

View File

@ -19,72 +19,59 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/BrowseController",
"./src/PaneController",
"./src/BrowseObjectController",
"./src/creation/CreateMenuController",
"./src/creation/LocatorController",
"./src/MenuArrowController",
"./src/navigation/NavigationService",
"./src/creation/CreationPolicy",
"./src/navigation/NavigateAction",
"./src/windowing/NewTabAction",
"./src/windowing/FullscreenAction",
"./src/creation/CreateActionProvider",
"./src/creation/AddActionProvider",
"./src/creation/CreationService",
"./src/windowing/WindowTitler",
"text!./res/templates/browse.html",
"text!./res/templates/browse-object.html",
"text!./res/templates/items/grid-item.html",
"text!./res/templates/browse/object-header.html",
"text!./res/templates/menu-arrow.html",
"text!./res/templates/back-arrow.html",
"text!./res/templates/items/items.html",
"text!./res/templates/browse/object-properties.html",
"text!./res/templates/browse/inspector-region.html",
"text!./res/templates/view-object.html",
'legacyRegistry'
], function (
BrowseController,
PaneController,
BrowseObjectController,
CreateMenuController,
LocatorController,
MenuArrowController,
NavigationService,
CreationPolicy,
NavigateAction,
NewTabAction,
FullscreenAction,
CreateActionProvider,
AddActionProvider,
CreationService,
WindowTitler,
browseTemplate,
browseObjectTemplate,
gridItemTemplate,
objectHeaderTemplate,
menuArrowTemplate,
backArrowTemplate,
itemsTemplate,
objectPropertiesTemplate,
inspectorRegionTemplate,
viewObjectTemplate,
legacyRegistry
) {
"use strict";
legacyRegistry.register("platform/commonUI/browse", {
"extensions": {
"routes": [
{
"when": "/browse/:ids*",
"template": browseTemplate,
"templateUrl": "templates/browse.html",
"reloadOnSearch": false
},
{
"when": "",
"template": browseTemplate,
"templateUrl": "templates/browse.html",
"reloadOnSearch": false
}
],
"constants": [
{
"key": "DEFAULT_PATH",
"value": "mine",
"priority": "fallback"
}
],
"controllers": [
{
"key": "BrowseController",
@ -93,12 +80,10 @@ define([
"$scope",
"$route",
"$location",
"$window",
"$q",
"objectService",
"navigationService",
"urlService",
"policyService",
"DEFAULT_PATH"
"urlService"
]
},
{
@ -117,7 +102,25 @@ define([
"depends": [
"$scope",
"$location",
"$route"
"$route",
"$q",
"navigationService"
]
},
{
"key": "CreateMenuController",
"implementation": CreateMenuController,
"depends": [
"$scope"
]
},
{
"key": "LocatorController",
"implementation": LocatorController,
"depends": [
"$scope",
"$timeout",
"objectService"
]
},
{
@ -128,14 +131,16 @@ define([
]
}
],
"controls": [
{
"key": "locator",
"templateUrl": "templates/create/locator.html"
}
],
"representations": [
{
"key": "view-object",
"template": viewObjectTemplate
},
{
"key": "browse-object",
"template": browseObjectTemplate,
"templateUrl": "templates/browse-object.html",
"gestures": [
"drop"
],
@ -143,9 +148,20 @@ define([
"view"
]
},
{
"key": "create-button",
"templateUrl": "templates/create/create-button.html"
},
{
"key": "create-menu",
"templateUrl": "templates/create/create-menu.html",
"uses": [
"action"
]
},
{
"key": "grid-item",
"template": gridItemTemplate,
"templateUrl": "templates/items/grid-item.html",
"uses": [
"type",
"action",
@ -158,14 +174,14 @@ define([
},
{
"key": "object-header",
"template": objectHeaderTemplate,
"templateUrl": "templates/browse/object-header.html",
"uses": [
"type"
]
},
{
"key": "menu-arrow",
"template": menuArrowTemplate,
"templateUrl": "templates/menu-arrow.html",
"uses": [
"action"
],
@ -178,15 +194,7 @@ define([
"uses": [
"context"
],
"template": backArrowTemplate
},
{
"key": "object-properties",
"template": objectPropertiesTemplate
},
{
"key": "inspector-region",
"template": inspectorRegionTemplate
"templateUrl": "templates/back-arrow.html"
}
],
"services": [
@ -195,6 +203,12 @@ define([
"implementation": NavigationService
}
],
"policies": [
{
"implementation": CreationPolicy,
"category": "creation"
}
],
"actions": [
{
"key": "navigate",
@ -236,7 +250,7 @@ define([
"name": "Items",
"glyph": "9",
"description": "Grid of available items",
"template": itemsTemplate,
"templateUrl": "templates/items/items.html",
"uses": [
"composition"
],
@ -247,6 +261,42 @@ define([
"editable": false
}
],
"components": [
{
"key": "CreateActionProvider",
"provides": "actionService",
"type": "provider",
"implementation": CreateActionProvider,
"depends": [
"$q",
"typeService",
"navigationService",
"policyService"
]
},
{
"key": "AddActionProvider",
"provides": "actionService",
"type": "provider",
"implementation": AddActionProvider,
"depends": [
"$q",
"typeService",
"dialogService",
"policyService"
]
},
{
"key": "CreationService",
"provides": "creationService",
"type": "provider",
"implementation": CreationService,
"depends": [
"$q",
"$log"
]
}
],
"runs": [
{
"implementation": WindowTitler,

View File

@ -47,6 +47,11 @@
<div class="holder l-flex-col flex-elem grows l-object-wrapper-inner">
<!-- Toolbar and Save/Cancel buttons -->
<div class="l-edit-controls flex-elem l-flex-row flex-align-end">
<mct-toolbar name="mctToolbar"
structure="toolbar.structure"
ng-model="toolbar.state"
class="flex-elem grows">
</mct-toolbar>
<mct-representation key="'edit-action-buttons'"
mct-object="domainObject"
class='flex-elem conclude-editing'>
@ -55,8 +60,9 @@
</div>
<mct-representation key="representation.selected.key"
mct-object="representation.selected.key && domainObject"
class="abs flex-elem grows object-holder-main scroll">
class="abs flex-elem grows object-holder-main scroll"
toolbar="toolbar">
</mct-representation>
</div>
</div><!--/ l-object-wrapper-inner -->
</div>
</div>

View File

@ -63,7 +63,7 @@
<mct-split-pane class='l-object-and-inspector contents abs' anchor='right'>
<div class='split-pane-component t-object pane primary-pane left'>
<mct-representation mct-object="navigatedObject"
key="'view-object'"
key="'browse-object'"
class="abs holder holder-object">
</mct-representation>
</div>

View File

@ -26,5 +26,5 @@
<mct-representation
key="'menu-arrow'"
mct-object='domainObject'
class="flex-elem context-available-w"></mct-representation>
class="flex-elem"></mct-representation>
</span>

View File

@ -1,61 +0,0 @@
<!--
Open MCT Web, Copyright (c) 2014-2015, United States Government
as represented by the Administrator of the National Aeronautics and Space
Administration. All rights reserved.
Open MCT Web is licensed under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0.
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations
under the License.
Open MCT Web includes source code licensed under additional open source
licenses. See the Open Source Licenses file (LICENSES.md) included with
this source code distribution or the Licensing information page available
at runtime from the About dialog for additional information.
-->
<div ng-controller="ObjectInspectorController as controller">
<ul class="flex-elem grows l-inspector-part">
<li>
<em class="t-inspector-part-header">Properties</em>
<div class="inspector-properties"
ng-repeat="data in metadata"
ng-class="{ first:$index === 0 }">
<div class="label">{{ data.name }}</div>
<div class="value">{{ data.value }}</div>
</div>
</li>
<li ng-if="contextutalParents.length > 0">
<em class="t-inspector-part-header" title="The location of this linked object.">Location</em>
<div ng-if="primaryParents.length > 0" class="section-header">This Object</div>
<span class="inspector-location"
ng-repeat="parent in contextutalParents"
ng-class="{ last:($index + 1) === contextualParents.length }">
<mct-representation key="'label'"
mct-object="parent"
ng-model="ngModel"
ng-click="ngModel.selectedObject = parent"
class="location-item">
</mct-representation>
</span>
</li>
<li ng-if="primaryParents.length > 0">
<div class="section-header">Object's Original</div>
<span class="inspector-location"
ng-repeat="parent in primaryParents"
ng-class="{ last:($index + 1) === primaryParents.length }">
<mct-representation key="'label'"
mct-object="parent"
ng-model="ngModel"
ng-click="ngModel.selectedObject = parent"
class="location-item">
</mct-representation>
</span>
</li>
</ul>
</div>

View File

@ -19,16 +19,23 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise, confirm*/
/**
* This bundle implements Browse mode.
* @namespace platform/commonUI/browse
*/
define(
[],
function () {
[
'../../../representation/src/gestures/GestureConstants',
'../../edit/src/objects/EditableDomainObject'
],
function (GestureConstants, EditableDomainObject) {
"use strict";
var ROOT_ID = "ROOT";
var ROOT_ID = "ROOT",
DEFAULT_PATH = "mine",
CONFIRM_MSG = "Unsaved changes will be lost if you leave this page.";
/**
* The BrowseController is used to populate the initial scope in Browse
@ -40,21 +47,18 @@ define(
* @memberof platform/commonUI/browse
* @constructor
*/
function BrowseController(
$scope,
$route,
$location,
$window,
objectService,
navigationService,
urlService,
policyService,
defaultPath
) {
function BrowseController($scope, $route, $location, $q, objectService, navigationService, urlService) {
var path = [ROOT_ID].concat(
($route.current.params.ids || defaultPath).split("/")
($route.current.params.ids || DEFAULT_PATH).split("/")
);
function isDirty(){
var editorCapability = $scope.navigatedObject &&
$scope.navigatedObject.getCapability("editor"),
hasChanges = editorCapability && editorCapability.dirty();
return hasChanges;
}
function updateRoute(domainObject) {
var priorRoute = $route.current,
// Act as if params HADN'T changed to avoid page reload
@ -71,35 +75,31 @@ define(
// urlService.urlForLocation used to adjust current
// path to new, addressed, path based on
// domainObject
$location.path(urlService.urlForLocation("browse", domainObject));
$location.path(urlService.urlForLocation("browse",
domainObject.hasCapability('editor') ?
domainObject.getOriginalObject() : domainObject));
}
// Callback for updating the in-scope reference to the object
// that is currently navigated-to.
function setNavigation(domainObject) {
var navigationAllowed = true;
if (domainObject === $scope.navigatedObject) {
if (domainObject === $scope.navigatedObject){
//do nothing;
return;
}
policyService.allow("navigation", $scope.navigatedObject, domainObject, function (message) {
navigationAllowed = $window.confirm(message + "\r\n\r\n" +
" Are you sure you want to continue?");
});
if (navigationAllowed) {
if (isDirty() && !confirm(CONFIRM_MSG)) {
$scope.treeModel.selectedObject = $scope.navigatedObject;
navigationService.setNavigation($scope.navigatedObject);
} else {
if ($scope.navigatedObject && $scope.navigatedObject.hasCapability("editor")){
$scope.navigatedObject.getCapability("editor").cancel();
}
$scope.navigatedObject = domainObject;
$scope.treeModel.selectedObject = domainObject;
navigationService.setNavigation(domainObject);
updateRoute(domainObject);
} else {
//If navigation was unsuccessful (ie. blocked), reset
// the selected object in the tree to the currently
// navigated object
$scope.treeModel.selectedObject = $scope.navigatedObject ;
}
}
@ -143,12 +143,6 @@ define(
} else {
doNavigate(nextObject, index + 1);
}
} else if (index === 1 && c.length > 0) {
// Roots are in a top-level container that we don't
// want to be selected, so if we couldn't find an
// object at the path we wanted, at least select
// one of its children.
navigateTo(c[c.length - 1]);
} else {
// Couldn't find the next element of the path
// so navigate to the last path object we did find
@ -176,13 +170,18 @@ define(
selectedObject: navigationService.getNavigation()
};
$scope.beforeUnloadWarning = function() {
return isDirty() ?
"Unsaved changes will be lost if you leave this page." :
undefined;
};
// Listen for changes in navigation state.
navigationService.addListener(setNavigation);
// Also listen for changes which come from the tree. Changes in
// the tree will trigger a change in browse navigation state.
// Also listen for changes which come from the tree
$scope.$watch("treeModel.selectedObject", setNavigation);
// Clean up when the scope is destroyed
$scope.$on("$destroy", function () {
navigationService.removeListener(setNavigation);

View File

@ -19,10 +19,15 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise*/
define(
[],
function () {
[
'../../../representation/src/gestures/GestureConstants',
'../../edit/src/objects/EditableDomainObject'
],
function (GestureConstants, EditableDomainObject) {
"use strict";
/**
* Controller for the `browse-object` representation of a domain
@ -30,10 +35,10 @@ define(
* @memberof platform/commonUI/browse
* @constructor
*/
function BrowseObjectController($scope, $location, $route) {
function BrowseObjectController($scope, $location, $route, $q, navigationService) {
var navigatedObject;
function setViewForDomainObject(domainObject) {
var locationViewKey = $location.search().view;
function selectViewIfMatching(view) {
@ -52,9 +57,10 @@ define(
function updateQueryParam(viewKey) {
var unlisten,
priorRoute = $route.current;
priorRoute = $route.current,
isEditMode = $scope.domainObject && $scope.domainObject.hasCapability('editor');
if (viewKey) {
if (viewKey && !isEditMode) {
$location.search('view', viewKey);
unlisten = $scope.$on('$locationChangeSuccess', function () {
// Checks path to make sure /browse/ is at front
@ -70,7 +76,11 @@ define(
$scope.$watch('domainObject', setViewForDomainObject);
$scope.$watch('representation.selected.key', updateQueryParam);
$scope.doAction = function (action) {
$scope.cancelEditing = function() {
navigationService.setNavigation($scope.domainObject.getDomainObject());
};
$scope.doAction = function (action){
return $scope[action] && $scope[action]();
};

View File

@ -1,67 +0,0 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[
'../../regions/src/Region'
],
function (Region) {
/**
* Defines the a default Inspector region. Captured in a class to
* allow for modular extension and customization of regions based on
* the typical case.
* @memberOf platform/commonUI/regions
* @constructor
*/
function InspectorRegion() {
Region.call(this, {'name': 'Inspector'});
this.buildRegion();
}
InspectorRegion.prototype = Object.create(Region.prototype);
InspectorRegion.prototype.constructor = Region;
/**
* @private
*/
InspectorRegion.prototype.buildRegion = function () {
var metadataRegion = {
name: 'metadata',
title: 'Metadata Region',
// Which modes should the region part be visible in? If
// nothing provided here, then assumed that part is visible
// in both. The visibility or otherwise of a region part
// should be decided by a policy. In this case, 'modes' is a
// shortcut that is used by the EditableRegionPolicy.
modes: ['browse', 'edit'],
content: {
key: 'object-properties'
}
};
this.addRegion(new Region(metadataRegion), 0);
};
return InspectorRegion;
}
);

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
/**
* Module defining MenuArrowController. Created by shale on 06/30/2015.
@ -26,11 +27,12 @@
define(
[],
function () {
"use strict";
/**
* A left-click on the menu arrow should display a
* context menu. This controller launches the context
* menu.
* A left-click on the menu arrow should display a
* context menu. This controller launches the context
* menu.
* @memberof platform/commonUI/browse
* @constructor
*/

View File

@ -19,11 +19,13 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise*/
define(
[],
function () {
"use strict";
/**
* Controller to provide the ability to show/hide the tree in

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise*/
/**
* Module defining AddAction. Created by ahenry on 01/21/16.
@ -28,6 +29,7 @@ define(
'./CreateWizard'
],
function (CreateWizard) {
"use strict";
/**
* The Add Action is performed to create new instances of
@ -81,33 +83,37 @@ define(
newModel.type = this.type.getKey();
newObject = parentObject.getCapability('instantiation').instantiate(newModel);
newObject.useCapability('mutation', function (model) {
newObject.useCapability('mutation', function(model){
model.location = parentObject.getId();
});
wizard = new CreateWizard(newObject, this.parent, this.policyService);
function populateObjectFromInput(formValue) {
function populateObjectFromInput (formValue) {
return wizard.populateObjectFromInput(formValue, newObject);
}
function persistAndReturn(domainObject) {
return domainObject.getCapability('persistence')
.persist()
.then(function () {
return domainObject;
});
function addToParent (populatedObject) {
parentObject.getCapability('composition').add(populatedObject);
return parentObject.getCapability('persistence').persist().then(function(){
return parentObject;
});
}
function addToParent(populatedObject) {
parentObject.getCapability('composition').add(populatedObject);
return persistAndReturn(parentObject);
function save(object) {
/*
It's necessary to persist the new sub-object in order
that it can be retrieved for composition in the parent.
Future refactoring that allows temporary objects to be
retrieved from object services will make this unnecessary.
*/
return object.getCapability('editor').save(true);
}
return this.dialogService
.getUserInput(wizard.getFormStructure(false), wizard.getInitialFormValue())
.then(populateObjectFromInput)
.then(persistAndReturn)
.then(save)
.then(addToParent);
};
@ -125,7 +131,7 @@ define(
* @returns {AddActionMetadata} metadata about this action
*/
AddAction.prototype.getMetadata = function () {
return this.metadata;
return this.metadata;
};
return AddAction;

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise*/
/**
* Module defining AddActionProvider.js. Created by ahenry on 01/21/16.
@ -26,6 +27,7 @@
define(
["./AddAction"],
function (AddAction) {
"use strict";
/**
* The AddActionProvider is an ActionProvider which introduces

View File

@ -19,13 +19,18 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise*/
/**
* Module defining CreateAction. Created by vwoeltje on 11/10/14.
*/
define(
[],
function () {
[
'./CreateWizard',
'../../../edit/src/objects/EditableDomainObject'
],
function (CreateWizard, EditableDomainObject) {
"use strict";
/**
* The Create Action is performed to create new instances of
@ -43,8 +48,11 @@ define(
* override this)
* @param {ActionContext} context the context in which the
* action is being performed
* @param {NavigationService} navigationService the navigation service,
* which handles changes in navigation. It allows the object
* being browsed/edited to be set.
*/
function CreateAction(type, parent, context) {
function CreateAction(type, parent, context, $q, navigationService) {
this.metadata = {
key: 'create',
glyph: type.getGlyph(),
@ -53,8 +61,24 @@ define(
description: type.getDescription(),
context: context
};
this.type = type;
this.parent = parent;
this.navigationService = navigationService;
this.$q = $q;
}
// Get a count of views which are not flagged as non-editable.
function countEditableViews(domainObject) {
var views = domainObject && domainObject.useCapability('view'),
count = 0;
// A view is editable unless explicitly flagged as not
(views || []).forEach(function (view) {
count += (view.editable !== false) ? 1 : 0;
});
return count;
}
/**
@ -63,31 +87,23 @@ define(
*/
CreateAction.prototype.perform = function () {
var newModel = this.type.getInitialModel(),
parentObject = this.navigationService.getNavigation(),
newObject,
editAction,
editorCapability;
function onSave() {
return editorCapability.save();
}
function onCancel() {
return editorCapability.cancel();
}
editableObject;
newModel.type = this.type.getKey();
newModel.location = this.parent.getId();
newObject = this.parent.useCapability('instantiation', newModel);
editorCapability = newObject.hasCapability('editor') && newObject.getCapability("editor");
newObject = parentObject.useCapability('instantiation', newModel);
editableObject = new EditableDomainObject(newObject, this.$q);
editableObject.setOriginalObject(parentObject);
editableObject.getCapability('status').set('editing', true);
editableObject.useCapability('mutation', function(model){
model.location = parentObject.getId();
});
editAction = newObject.getCapability("action").getActions("edit")[0];
//If an edit action is available, perform it
if (editAction) {
return editAction.perform();
} else if (editorCapability) {
//otherwise, use the save action
editorCapability.edit();
return newObject.getCapability("action").perform("save").then(onSave, onCancel);
if (countEditableViews(editableObject) > 0 && editableObject.hasCapability('composition')) {
this.navigationService.setNavigation(editableObject);
} else {
return editableObject.getCapability('action').perform('save');
}
};
@ -104,7 +120,7 @@ define(
* @returns {CreateActionMetadata} metadata about this action
*/
CreateAction.prototype.getMetadata = function () {
return this.metadata;
return this.metadata;
};
return CreateAction;

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise*/
/**
* Module defining CreateActionProvider.js. Created by vwoeltje on 11/10/14.
@ -26,6 +27,7 @@
define(
["./CreateAction"],
function (CreateAction) {
"use strict";
/**
* The CreateActionProvider is an ActionProvider which introduces
@ -44,8 +46,10 @@ define(
* introduced in this bundle), responsible for handling actual
* object creation.
*/
function CreateActionProvider(typeService, policyService) {
function CreateActionProvider($q, typeService, navigationService, policyService) {
this.typeService = typeService;
this.navigationService = navigationService;
this.$q = $q;
this.policyService = policyService;
}
@ -70,7 +74,9 @@ define(
return new CreateAction(
type,
destination,
context
context,
self.$q,
self.navigationService
);
});
};

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise*/
/**
* Module defining CreateMenuController. Created by vwoeltje on 11/10/14.
@ -26,6 +27,7 @@
define(
[],
function () {
"use strict";
/**
* Controller for the Create menu; maintains an up-to-date

View File

@ -19,9 +19,11 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
function () {
'use strict';
/**
* A class for capturing user input data from an object creation
@ -111,12 +113,12 @@ define(
* @param formValue
* @returns {DomainObject}
*/
CreateWizard.prototype.populateObjectFromInput = function (formValue) {
CreateWizard.prototype.populateObjectFromInput = function(formValue) {
var parent = this.getLocation(formValue),
formModel = this.createModel(formValue);
formModel.location = parent.getId();
this.domainObject.useCapability("mutation", function () {
this.domainObject.useCapability("mutation", function(){
return formModel;
});
return this.domainObject;

View File

@ -19,10 +19,12 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],
function () {
"use strict";
/**
* A policy for determining whether objects of a given type can be
@ -40,4 +42,4 @@ define(
return CreationPolicy;
}
);
);

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise*/
/**
* Module defining CreateService. Created by vwoeltje on 11/10/14.
@ -26,9 +27,12 @@
define(
[],
function () {
"use strict";
var NON_PERSISTENT_WARNING =
"Tried to create an object in non-persistent container.";
"Tried to create an object in non-persistent container.",
NO_COMPOSITION_WARNING =
"Could not add to composition; no composition in ";
/**
* The creation service is responsible for instantiating and

View File

@ -19,10 +19,12 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define(
[],
function () {
"use strict";
/**
* Controller for the "locator" control, which provides the
@ -50,14 +52,14 @@ define(
$scope.rootObject =
(context && context.getRoot()) || $scope.rootObject;
}, 0);
} else if (!contextRoot) {
} else if (!contextRoot){
//If no context root is available, default to the root
// object
$scope.rootObject = undefined;
// Update the displayed tree on a timeout to avoid
// an infinite digest exception.
objectService.getObjects(['ROOT'])
.then(function (objects) {
.then(function(objects){
$timeout(function () {
$scope.rootObject = objects.ROOT;
}, 0);

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise*/
/**
* Module defining NavigateAction. Created by vwoeltje on 11/10/14.
@ -26,6 +27,7 @@
define(
[],
function () {
"use strict";
/**
* The navigate action navigates to a specific domain object.

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise*/
/**
* Module defining NavigationService. Created by vwoeltje on 11/10/14.
@ -26,6 +27,7 @@
define(
[],
function () {
"use strict";
/**
* The navigation service maintains the application's current
@ -57,7 +59,6 @@ define(
callback(value);
});
}
return true;
};
/**

View File

@ -19,13 +19,15 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,screenfull,Promise*/
/**
* Module defining FullscreenAction. Created by vwoeltje on 11/18/14.
*/
define(
["screenfull"],
function (screenfull) {
function () {
"use strict";
var ENTER_FULLSCREEN = "Enter full screen mode",
EXIT_FULLSCREEN = "Exit full screen mode";

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise*/
/**
* Module defining NewTabAction (Originally NewWindowAction). Created by vwoeltje on 11/18/14.
@ -26,6 +27,9 @@
define(
[],
function () {
"use strict";
var ROOT_ID = "ROOT",
DEFAULT_PATH = "/mine";
/**
* The new tab action allows a domain object to be opened
* into a new browser tab.

View File

@ -19,10 +19,12 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise*/
define(
[],
function () {
"use strict";
/**
* Updates the title of the current window to reflect the name

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine,xit,xdescribe*/
/**
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
@ -26,8 +27,10 @@
define(
["../src/BrowseController"],
function (BrowseController) {
"use strict";
describe("The browse controller", function () {
//TODO: Disabled for NEM Beta
xdescribe("The browse controller", function () {
var mockScope,
mockRoute,
mockLocation,
@ -37,9 +40,6 @@ define(
mockUrlService,
mockDomainObject,
mockNextObject,
mockWindow,
mockPolicyService,
testDefaultRoot,
controller;
function mockPromise(value) {
@ -50,40 +50,15 @@ define(
};
}
function instantiateController() {
controller = new BrowseController(
mockScope,
mockRoute,
mockLocation,
mockWindow,
mockObjectService,
mockNavigationService,
mockUrlService,
mockPolicyService,
testDefaultRoot
);
}
beforeEach(function () {
mockWindow = jasmine.createSpyObj('$window', [
"confirm"
]);
mockWindow.confirm.andReturn(true);
mockPolicyService = jasmine.createSpyObj('policyService', [
'allow'
]);
testDefaultRoot = "some-root-level-domain-object";
mockScope = jasmine.createSpyObj(
"$scope",
["$on", "$watch"]
[ "$on", "$watch" ]
);
mockRoute = { current: { params: {} } };
mockLocation = jasmine.createSpyObj(
"$location",
["path"]
[ "path" ]
);
mockUrlService = jasmine.createSpyObj(
"urlService",
@ -91,7 +66,7 @@ define(
);
mockObjectService = jasmine.createSpyObj(
"objectService",
["getObjects"]
[ "getObjects" ]
);
mockNavigationService = jasmine.createSpyObj(
"navigationService",
@ -104,15 +79,15 @@ define(
);
mockRootObject = jasmine.createSpyObj(
"domainObject",
["getId", "getCapability", "getModel", "useCapability"]
[ "getId", "getCapability", "getModel", "useCapability" ]
);
mockDomainObject = jasmine.createSpyObj(
"domainObject",
["getId", "getCapability", "getModel", "useCapability"]
[ "getId", "getCapability", "getModel", "useCapability" ]
);
mockNextObject = jasmine.createSpyObj(
"nextObject",
["getId", "getCapability", "getModel", "useCapability"]
[ "getId", "getCapability", "getModel", "useCapability" ]
);
mockObjectService.getObjects.andReturn(mockPromise({
@ -126,28 +101,41 @@ define(
]));
mockNextObject.useCapability.andReturn(undefined);
mockNextObject.getId.andReturn("next");
mockDomainObject.getId.andReturn(testDefaultRoot);
mockDomainObject.getId.andReturn("mine");
instantiateController();
controller = new BrowseController(
mockScope,
mockRoute,
mockLocation,
mockObjectService,
mockNavigationService,
mockUrlService
);
});
it("uses composition to set the navigated object, if there is none", function () {
instantiateController();
expect(mockNavigationService.setNavigation)
.toHaveBeenCalledWith(mockDomainObject);
});
it("navigates to a root-level object, even when default path is not found", function () {
mockDomainObject.getId
.andReturn("something-other-than-the-" + testDefaultRoot);
instantiateController();
controller = new BrowseController(
mockScope,
mockRoute,
mockLocation,
mockObjectService,
mockNavigationService,
mockUrlService
);
expect(mockNavigationService.setNavigation)
.toHaveBeenCalledWith(mockDomainObject);
});
it("does not try to override navigation", function () {
mockNavigationService.getNavigation.andReturn(mockDomainObject);
instantiateController();
controller = new BrowseController(
mockScope,
mockRoute,
mockLocation,
mockObjectService,
mockNavigationService,
mockUrlService
);
expect(mockScope.navigatedObject).toBe(mockDomainObject);
});
@ -174,8 +162,14 @@ define(
});
it("uses route parameters to choose initially-navigated object", function () {
mockRoute.current.params.ids = testDefaultRoot + "/next";
instantiateController();
mockRoute.current.params.ids = "mine/next";
controller = new BrowseController(
mockScope,
mockRoute,
mockLocation,
mockObjectService,
mockNavigationService
);
expect(mockScope.navigatedObject).toBe(mockNextObject);
expect(mockNavigationService.setNavigation)
.toHaveBeenCalledWith(mockNextObject);
@ -185,8 +179,14 @@ define(
// Idea here is that if we get a bad path of IDs,
// browse controller should traverse down it until
// it hits an invalid ID.
mockRoute.current.params.ids = testDefaultRoot + "/junk";
instantiateController();
mockRoute.current.params.ids = "mine/junk";
controller = new BrowseController(
mockScope,
mockRoute,
mockLocation,
mockObjectService,
mockNavigationService
);
expect(mockScope.navigatedObject).toBe(mockDomainObject);
expect(mockNavigationService.setNavigation)
.toHaveBeenCalledWith(mockDomainObject);
@ -196,8 +196,14 @@ define(
// Idea here is that if we get a path which passes
// through an object without a composition, browse controller
// should stop at it since remaining IDs cannot be loaded.
mockRoute.current.params.ids = testDefaultRoot + "/next/junk";
instantiateController();
mockRoute.current.params.ids = "mine/next/junk";
controller = new BrowseController(
mockScope,
mockRoute,
mockLocation,
mockObjectService,
mockNavigationService
);
expect(mockScope.navigatedObject).toBe(mockNextObject);
expect(mockNavigationService.setNavigation)
.toHaveBeenCalledWith(mockNextObject);
@ -224,10 +230,7 @@ define(
// prior to setting $route.current
mockLocation.path.andReturn("/browse/");
mockNavigationService.setNavigation.andReturn(true);
// Exercise the Angular workaround
mockNavigationService.addListener.mostRecentCall.args[0]();
mockScope.$on.mostRecentCall.args[1]();
expect(mockUnlisten).toHaveBeenCalled();
@ -238,36 +241,6 @@ define(
);
});
it("after successful navigation event sets the selected tree " +
"object", function () {
mockScope.navigatedObject = mockDomainObject;
mockNavigationService.setNavigation.andReturn(true);
//Simulate a change in selected tree object
mockScope.treeModel = {selectedObject: mockDomainObject};
mockScope.$watch.mostRecentCall.args[1](mockNextObject);
expect(mockScope.treeModel.selectedObject).toBe(mockNextObject);
expect(mockScope.treeModel.selectedObject).not.toBe(mockDomainObject);
});
it("after failed navigation event resets the selected tree" +
" object", function () {
mockScope.navigatedObject = mockDomainObject;
mockWindow.confirm.andReturn(false);
mockPolicyService.allow.andCallFake(function (category, object, context, callback) {
callback("unsaved changes");
return false;
});
//Simulate a change in selected tree object
mockScope.treeModel = {selectedObject: mockDomainObject};
mockScope.$watch.mostRecentCall.args[1](mockNextObject);
expect(mockScope.treeModel.selectedObject).not.toBe(mockNextObject);
expect(mockScope.treeModel.selectedObject).toBe(mockDomainObject);
});
});
}
);

View File

@ -19,11 +19,13 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
define(
["../src/BrowseObjectController"],
function (BrowseObjectController) {
"use strict";
describe("The browse object controller", function () {
var mockScope,
@ -44,12 +46,12 @@ define(
beforeEach(function () {
mockScope = jasmine.createSpyObj(
"$scope",
["$on", "$watch"]
[ "$on", "$watch" ]
);
mockRoute = { current: { params: {} } };
mockLocation = jasmine.createSpyObj(
"$location",
["path", "search"]
[ "path", "search" ]
);
mockUnlisten = jasmine.createSpy("unlisten");
@ -69,7 +71,7 @@ define(
// Allows the path index to be checked
// prior to setting $route.current
mockLocation.path.andReturn("/browse/");
// Exercise the Angular workaround
mockScope.$on.mostRecentCall.args[1]();
expect(mockUnlisten).toHaveBeenCalled();

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
/**
* MenuArrowControllerSpec. Created by shale on 07/02/2015.
@ -26,7 +27,8 @@
define(
["../src/MenuArrowController"],
function (MenuArrowController) {
"use strict";
describe("The menu arrow controller ", function () {
var mockScope,
mockDomainObject,
@ -34,43 +36,43 @@ define(
mockContextMenuAction,
mockActionContext,
controller;
beforeEach(function () {
mockScope = jasmine.createSpyObj(
"$scope",
[""]
[ "" ]
);
mockDomainObject = jasmine.createSpyObj(
"domainObject",
["getCapability"]
[ "getCapability" ]
);
mockEvent = jasmine.createSpyObj(
"event",
["preventDefault"]
[ "preventDefault" ]
);
mockContextMenuAction = jasmine.createSpyObj(
"action",
["perform", "getActions"]
[ "perform", "getActions" ]
);
mockActionContext = jasmine.createSpyObj(
"actionContext",
[""]
[ "" ]
);
mockActionContext.domainObject = mockDomainObject;
mockActionContext.event = mockEvent;
mockScope.domainObject = mockDomainObject;
mockDomainObject.getCapability.andReturn(mockContextMenuAction);
mockContextMenuAction.perform.andReturn(jasmine.any(Function));
controller = new MenuArrowController(mockScope);
});
it("calls the context menu action when clicked", function () {
// Simulate a click on the menu arrow
controller.showMenu(mockEvent);
// Expect the menu action to be performed
// Expect the menu action to be performed
expect(mockDomainObject.getCapability).toHaveBeenCalledWith('action');
expect(mockContextMenuAction.perform).toHaveBeenCalled();
});

View File

@ -19,10 +19,12 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
define(
["../src/PaneController"],
function (PaneController) {
'use strict';
describe("The PaneController", function () {
var mockScope,
@ -42,11 +44,11 @@ define(
}
beforeEach(function () {
mockScope = jasmine.createSpyObj("$scope", ["$on"]);
mockScope = jasmine.createSpyObj("$scope", [ "$on" ]);
mockDomainObjects = ['a', 'b'].map(function (id) {
var mockDomainObject = jasmine.createSpyObj(
'domainObject-' + id,
['getId', 'getModel', 'getCapability']
[ 'getId', 'getModel', 'getCapability' ]
);
mockDomainObject.getId.andReturn(id);
@ -56,7 +58,7 @@ define(
});
mockAgentService = jasmine.createSpyObj(
"agentService",
["isMobile", "isPhone", "isTablet", "isPortrait", "isLandscape"]
[ "isMobile", "isPhone", "isTablet", "isPortrait", "isLandscape" ]
);
mockWindow = jasmine.createSpyObj("$window", ["open"]);
});

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine,xit,xdescribe*/
/**
* MCTRepresentationSpec. Created by ahenry on 01/21/14.
@ -26,6 +27,7 @@
define(
["../../src/creation/AddActionProvider"],
function (AddActionProvider) {
"use strict";
describe("The add action provider", function () {
var mockTypeService,
@ -60,37 +62,37 @@ define(
beforeEach(function () {
mockTypeService = jasmine.createSpyObj(
"typeService",
["listTypes"]
[ "listTypes" ]
);
mockDialogService = jasmine.createSpyObj(
"dialogService",
["getUserInput"]
[ "getUserInput" ]
);
mockPolicyService = jasmine.createSpyObj(
"policyService",
["allow"]
[ "allow" ]
);
mockDomainObject = jasmine.createSpyObj(
"domainObject",
["getCapability"]
[ "getCapability" ]
);
//Mocking getCapability because AddActionProvider uses the
// type capability of the destination object.
mockDomainObject.getCapability.andReturn({});
mockTypes = ["A", "B", "C"].map(createMockType);
mockTypes = [ "A", "B", "C" ].map(createMockType);
mockTypes.forEach(function (type) {
mockTypes.forEach(function(type){
mockPolicyMap[type.getName()] = true;
});
mockCreationPolicy = function (type) {
mockCreationPolicy = function(type){
return mockPolicyMap[type.getName()];
};
mockCompositionPolicy = function () {
mockCompositionPolicy = function(){
return true;
};
@ -132,4 +134,4 @@ define(
});
});
}
);
);

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine,xit,xdescribe*/
/**
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
@ -26,13 +27,17 @@
define(
["../../src/creation/CreateActionProvider"],
function (CreateActionProvider) {
"use strict";
describe("The create action provider", function () {
var mockTypeService,
mockDialogService,
mockNavigationService,
mockPolicyService,
mockCreationPolicy,
mockPolicyMap = {},
mockTypes,
mockQ,
provider;
function createMockType(name) {
@ -56,31 +61,41 @@ define(
beforeEach(function () {
mockTypeService = jasmine.createSpyObj(
"typeService",
["listTypes"]
[ "listTypes" ]
);
mockDialogService = jasmine.createSpyObj(
"dialogService",
[ "getUserInput" ]
);
mockNavigationService = jasmine.createSpyObj(
"navigationService",
[ "setNavigation" ]
);
mockPolicyService = jasmine.createSpyObj(
"policyService",
["allow"]
[ "allow" ]
);
mockTypes = ["A", "B", "C"].map(createMockType);
mockTypes = [ "A", "B", "C" ].map(createMockType);
mockTypes.forEach(function (type) {
mockTypes.forEach(function(type){
mockPolicyMap[type.getName()] = true;
});
mockCreationPolicy = function (type) {
mockCreationPolicy = function(type){
return mockPolicyMap[type.getName()];
};
mockPolicyService.allow.andCallFake(function (category, type) {
mockPolicyService.allow.andCallFake(function(category, type){
return category === "creation" && mockCreationPolicy(type) ? true : false;
});
mockTypeService.listTypes.andReturn(mockTypes);
provider = new CreateActionProvider(
mockQ,
mockTypeService,
mockNavigationService,
mockPolicyService
);
});
@ -113,4 +128,4 @@ define(
});
});
}
);
);

View File

@ -0,0 +1,132 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* licenses. See the Open Source Licenses file (LICENSES.md) included with
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine,xit,xdescribe*/
/**
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
*/
define(
["../../src/creation/CreateAction"],
function (CreateAction) {
"use strict";
describe("The create action", function () {
var mockType,
mockParent,
mockContext,
mockDialogService,
mockCreationService,
action;
function mockPromise(value) {
return {
then: function (callback) {
return mockPromise(callback(value));
}
};
}
beforeEach(function () {
mockType = jasmine.createSpyObj(
"type",
[
"getKey",
"getGlyph",
"getName",
"getDescription",
"getProperties",
"getInitialModel"
]
);
mockParent = jasmine.createSpyObj(
"domainObject",
[
"getId",
"getModel",
"getCapability"
]
);
mockContext = {
domainObject: mockParent
};
mockDialogService = jasmine.createSpyObj(
"dialogService",
[ "getUserInput" ]
);
mockCreationService = jasmine.createSpyObj(
"creationService",
[ "createObject" ]
);
mockType.getKey.andReturn("test");
mockType.getGlyph.andReturn("T");
mockType.getDescription.andReturn("a test type");
mockType.getName.andReturn("Test");
mockType.getProperties.andReturn([]);
mockType.getInitialModel.andReturn({});
mockDialogService.getUserInput.andReturn(mockPromise({}));
action = new CreateAction(
mockType,
mockParent,
mockContext,
mockDialogService,
mockCreationService
);
});
it("exposes type-appropriate metadata", function () {
var metadata = action.getMetadata();
expect(metadata.name).toEqual("Test");
expect(metadata.description).toEqual("a test type");
expect(metadata.glyph).toEqual("T");
});
//TODO: Disabled for NEM Beta
xit("invokes the creation service when performed", function () {
action.perform();
expect(mockCreationService.createObject).toHaveBeenCalledWith(
{ type: "test" },
mockParent
);
});
//TODO: Disabled for NEM Beta
xit("does not create an object if the user cancels", function () {
mockDialogService.getUserInput.andReturn({
then: function (callback, fail) {
fail();
}
});
action.perform();
expect(mockCreationService.createObject)
.not.toHaveBeenCalled();
});
});
}
);

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
/**
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
@ -26,6 +27,7 @@
define(
["../../src/creation/CreateMenuController"],
function (CreateMenuController) {
"use strict";
describe("The create menu controller", function () {
var mockScope,
@ -62,4 +64,4 @@ define(
});
});
}
);
);

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
/**
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
@ -26,6 +27,7 @@
define(
["../../src/creation/CreateWizard"],
function (CreateWizard) {
"use strict";
describe("The create wizard", function () {
var mockType,
@ -39,7 +41,7 @@ define(
function createMockProperty(name) {
var mockProperty = jasmine.createSpyObj(
"property" + name,
["getDefinition", "getValue", "setValue"]
[ "getDefinition", "getValue", "setValue" ]
);
mockProperty.getDefinition.andReturn({
control: "textfield"
@ -68,7 +70,7 @@ define(
"getCapability"
]
);
mockProperties = ["A", "B", "C"].map(createMockProperty);
mockProperties = [ "A", "B", "C" ].map(createMockProperty);
mockPolicyService = jasmine.createSpyObj('policyService', ['allow']);
testModel = { someKey: "some value" };
@ -144,15 +146,15 @@ define(
"A": "ValueA",
"B": "ValueB",
"C": "ValueC"
},
compareModel = wizard.createModel(formValue);
},
compareModel = wizard.createModel(formValue);
wizard.populateObjectFromInput(formValue);
expect(mockDomainObject.useCapability).toHaveBeenCalledWith('mutation', jasmine.any(Function));
expect(mockDomainObject.useCapability.mostRecentCall.args[1]()).toEqual(compareModel);
});
it("validates selection types using policy", function () {
var mockDomainObj = jasmine.createSpyObj(
var mockDomainObject = jasmine.createSpyObj(
'domainObject',
['getCapability']
),
@ -166,8 +168,8 @@ define(
rows = structure.sections[sections.length - 1].rows,
locationRow = rows[rows.length - 1];
mockDomainObj.getCapability.andReturn(mockOtherType);
locationRow.validate(mockDomainObj);
mockDomainObject.getCapability.andReturn(mockOtherType);
locationRow.validate(mockDomainObject);
// Should check policy to see if the user-selected location
// can actually contain objects of this type
@ -179,7 +181,7 @@ define(
});
it("creates a form model without a location if not requested", function () {
expect(wizard.getFormStructure(false).sections.some(function (section) {
expect(wizard.getFormStructure(false).sections.some(function(section){
return section.name === 'Location';
})).toEqual(false);
});

View File

@ -19,10 +19,12 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,describe,it,expect,beforeEach,jasmine*/
define(
["../../src/creation/CreationPolicy"],
function (CreationPolicy) {
"use strict";
describe("The creation policy", function () {
var mockType,
@ -48,4 +50,4 @@ define(
});
});
}
);
);

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
/**
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
@ -26,6 +27,7 @@
define(
["../../src/creation/CreationService"],
function (CreationService) {
"use strict";
describe("The creation service", function () {
var mockQ,
@ -61,23 +63,23 @@ define(
mockQ = { when: mockPromise, reject: mockReject };
mockLog = jasmine.createSpyObj(
"$log",
["error", "warn", "info", "debug"]
[ "error", "warn", "info", "debug" ]
);
mockParentObject = jasmine.createSpyObj(
"parentObject",
["getId", "getCapability", "useCapability"]
[ "getId", "getCapability", "useCapability" ]
);
mockNewObject = jasmine.createSpyObj(
"newObject",
["getId", "getCapability", "useCapability"]
[ "getId", "getCapability", "useCapability" ]
);
mockMutationCapability = jasmine.createSpyObj(
"mutation",
["invoke"]
[ "invoke" ]
);
mockPersistenceCapability = jasmine.createSpyObj(
"persistence",
["persist", "getSpace"]
[ "persist", "getSpace" ]
);
mockCompositionCapability = jasmine.createSpyObj(
"composition",
@ -100,7 +102,7 @@ define(
};
mockNewPersistenceCapability = jasmine.createSpyObj(
"new-persistence",
["persist", "getSpace"]
[ "persist", "getSpace" ]
);
mockParentObject.getCapability.andCallFake(function (key) {
@ -147,7 +149,8 @@ define(
});
it("adds new objects to the parent's composition", function () {
var model = { someKey: "some value" };
var model = { someKey: "some value" },
parentModel = { composition: ["notAnyUUID"] };
creationService.createObject(model, mockParentObject);
// Verify that a new ID was added
@ -198,7 +201,8 @@ define(
it("logs an error when mutaton fails", function () {
// If mutation of the parent fails, we've lost the
// created object - this is an error.
var model = { someKey: "some value" };
var model = { someKey: "some value" },
parentModel = { composition: ["notAnyUUID"] };
mockCompositionCapability.add.andReturn(mockPromise(false));

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
/**
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
@ -26,6 +27,7 @@
define(
["../../src/creation/LocatorController"],
function (LocatorController) {
"use strict";
describe("The locator controller", function () {
var mockScope,
@ -40,20 +42,20 @@ define(
beforeEach(function () {
mockScope = jasmine.createSpyObj(
"$scope",
["$watch"]
[ "$watch" ]
);
mockTimeout = jasmine.createSpy("$timeout");
mockDomainObject = jasmine.createSpyObj(
"domainObject",
["getCapability"]
[ "getCapability" ]
);
mockRootObject = jasmine.createSpyObj(
"rootObject",
["getCapability"]
[ "getCapability" ]
);
mockContext = jasmine.createSpyObj(
"context",
["getRoot"]
[ "getRoot" ]
);
mockObjectService = jasmine.createSpyObj(
"objectService",
@ -73,18 +75,18 @@ define(
controller = new LocatorController(mockScope, mockTimeout, mockObjectService);
});
describe("when context is available", function () {
describe("when context is available", function () {
beforeEach(function () {
beforeEach(function () {
mockContext.getRoot.andReturn(mockRootObject);
controller = new LocatorController(mockScope, mockTimeout, mockObjectService);
});
it("adds a treeModel to scope", function () {
it("adds a treeModel to scope", function () {
expect(mockScope.treeModel).toBeDefined();
});
it("watches for changes to treeModel", function () {
it("watches for changes to treeModel", function () {
// This is what the embedded tree representation
// will be modifying.
expect(mockScope.$watch).toHaveBeenCalledWith(
@ -93,7 +95,7 @@ define(
);
});
it("changes its own model on embedded model updates", function () {
it("changes its own model on embedded model updates", function () {
// Need to pass on selection changes as updates to
// the control's value
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
@ -107,7 +109,7 @@ define(
.toHaveBeenCalledWith("context");
});
it("rejects changes which fail validation", function () {
it("rejects changes which fail validation", function () {
mockScope.structure = { validate: jasmine.createSpy('validate') };
mockScope.structure.validate.andReturn(false);
@ -120,10 +122,10 @@ define(
expect(mockScope.ngModel.someField).not.toEqual(mockDomainObject);
});
it("treats a lack of a selection as invalid", function () {
it("treats a lack of a selection as invalid", function () {
mockScope.ngModelController = jasmine.createSpyObj(
'ngModelController',
['$setValidity']
[ '$setValidity' ]
);
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
@ -136,14 +138,14 @@ define(
expect(mockScope.ngModelController.$setValidity)
.toHaveBeenCalledWith(jasmine.any(String), false);
});
});
describe("when no context is available", function () {
});
describe("when no context is available", function () {
var defaultRoot = "DEFAULT_ROOT";
beforeEach(function () {
mockContext.getRoot.andReturn(undefined);
getObjectsPromise.then.andCallFake(function (callback) {
callback({'ROOT': defaultRoot});
getObjectsPromise.then.andCallFake(function(callback){
callback({'ROOT':defaultRoot});
});
controller = new LocatorController(mockScope, mockTimeout, mockObjectService);
});

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
/**
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
@ -26,10 +27,12 @@
define(
["../../src/navigation/NavigateAction"],
function (NavigateAction) {
"use strict";
describe("The navigate action", function () {
var mockNavigationService,
mockQ,
actionContext,
mockDomainObject,
action;
@ -44,12 +47,12 @@ define(
beforeEach(function () {
mockNavigationService = jasmine.createSpyObj(
"navigationService",
["setNavigation"]
[ "setNavigation" ]
);
mockQ = { when: mockPromise };
mockDomainObject = jasmine.createSpyObj(
"domainObject",
["getId", "getModel", "getCapability"]
[ "getId", "getModel", "getCapability" ]
);
action = new NavigateAction(
@ -74,4 +77,4 @@ define(
});
}
);
);

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
/**
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
@ -26,6 +27,7 @@
define(
["../../src/navigation/NavigationService"],
function (NavigationService) {
"use strict";
describe("The navigation service", function () {
var navigationService;
@ -84,4 +86,4 @@ define(
});
}
);
);

View File

@ -19,30 +19,33 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine,afterEach,window*/
/**
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
*/
define(
["../../src/windowing/FullscreenAction", "screenfull"],
function (FullscreenAction, screenfull) {
["../../src/windowing/FullscreenAction"],
function (FullscreenAction) {
"use strict";
describe("The fullscreen action", function () {
var action,
oldToggle;
oldScreenfull;
beforeEach(function () {
// Screenfull is not shimmed or injected, so
// we need to spy on it in the global scope.
oldToggle = screenfull.toggle;
oldScreenfull = window.screenfull;
screenfull.toggle = jasmine.createSpy("toggle");
window.screenfull = {};
window.screenfull.toggle = jasmine.createSpy("toggle");
action = new FullscreenAction({});
});
afterEach(function () {
screenfull.toggle = oldToggle;
window.screenfull = oldScreenfull;
});
it("toggles fullscreen mode when performed", function () {
@ -56,4 +59,4 @@ define(
});
}
);
);

View File

@ -19,15 +19,18 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine,afterEach,window*/
define(
["../../src/windowing/NewTabAction"],
function (NewTabAction) {
"use strict";
describe("The new tab action", function () {
var actionSelected,
actionCurrent,
mockWindow,
mockDomainObject,
mockContextCurrent,
mockContextSelected,
mockUrlService;
@ -37,39 +40,39 @@ define(
// Context if the current object is selected
// For example, when the top right new tab
// button is clicked, the user is using the
// button is clicked, the user is using the
// current domainObject
mockContextCurrent = jasmine.createSpyObj("context", ["domainObject"]);
// Context if the selected object is selected
// For example, when an object in the left
// tree is opened in a new tab using the
// context menu
mockContextSelected = jasmine.createSpyObj("context", ["selectedObject",
"domainObject"]);
// Mocks the urlService used to make the new tab's url from a
// domainObject and mode
mockUrlService = jasmine.createSpyObj("urlService", ["urlForNewTab"]);
// Action done using the current context or mockContextCurrent
actionCurrent = new NewTabAction(mockUrlService, mockWindow,
mockContextCurrent);
// Action done using the selected context or mockContextSelected
actionSelected = new NewTabAction(mockUrlService, mockWindow,
mockContextSelected);
});
it("new tab with current url is opened", function () {
actionCurrent.perform();
});
it("new tab with a selected url is opened", function () {
actionSelected.perform();
});
});
}
);
);

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,Promise,describe,it,expect,beforeEach,waitsFor,jasmine*/
/**
* WindowTitlerSpec. Created by vwoeltje on 11/6/14.
@ -26,6 +27,7 @@
define(
["../../src/windowing/WindowTitler"],
function (WindowTitler) {
"use strict";
describe("The window titler", function () {
var mockNavigationService,
@ -37,11 +39,11 @@ define(
beforeEach(function () {
mockNavigationService = jasmine.createSpyObj(
'navigationService',
['getNavigation']
[ 'getNavigation' ]
);
mockRootScope = jasmine.createSpyObj(
'$rootScope',
['$watch']
[ '$watch' ]
);
mockDomainObject = jasmine.createSpyObj(
'domainObject',
@ -75,4 +77,4 @@ define(
});
}
);
);

View File

@ -19,30 +19,18 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/DialogService",
"./src/OverlayService",
"text!./res/templates/overlay-dialog.html",
"text!./res/templates/overlay-options.html",
"text!./res/templates/dialog.html",
"text!./res/templates/overlay-blocking-message.html",
"text!./res/templates/message.html",
"text!./res/templates/overlay-message-list.html",
"text!./res/templates/overlay.html",
'legacyRegistry'
], function (
DialogService,
OverlayService,
overlayDialogTemplate,
overlayOptionsTemplate,
dialogTemplate,
overlayBlockingMessageTemplate,
messageTemplate,
overlayMessageListTemplate,
overlayTemplate,
legacyRegistry
) {
"use strict";
legacyRegistry.register("platform/commonUI/dialog", {
"extensions": {
@ -69,33 +57,33 @@ define([
"templates": [
{
"key": "overlay-dialog",
"template": overlayDialogTemplate
"templateUrl": "templates/overlay-dialog.html"
},
{
"key": "overlay-options",
"template": overlayOptionsTemplate
"templateUrl": "templates/overlay-options.html"
},
{
"key": "form-dialog",
"template": dialogTemplate
"templateUrl": "templates/dialog.html"
},
{
"key": "overlay-blocking-message",
"template": overlayBlockingMessageTemplate
"templateUrl": "templates/overlay-blocking-message.html"
},
{
"key": "message",
"template": messageTemplate
"templateUrl": "templates/message.html"
},
{
"key": "overlay-message-list",
"template": overlayMessageListTemplate
"templateUrl": "templates/overlay-message-list.html"
}
],
"containers": [
{
"key": "overlay",
"template": overlayTemplate
"templateUrl": "templates/overlay.html"
}
]
}

View File

@ -6,9 +6,7 @@
</div>
</div>
<div class="abs message-body">
<mct-include
ng-repeat="msg in ngModel.dialog.messages | orderBy: '-'"
key="'message'" ng-model="msg.model"></mct-include>
<mct-include ng-repeat="msg in ngModel.dialog.messages | orderBy: '-'" key="'message'" ng-model="msg"></mct-include>
</div>
<div class="abs bottom-bar">
<a ng-repeat="dialogAction in ngModel.dialog.actions"

View File

@ -19,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
/**
* This bundle implements the dialog service, which can be used to
@ -28,6 +29,7 @@
define(
[],
function () {
"use strict";
/**
* The dialog service is responsible for handling window-modal
* communication with the user, such as displaying forms for user
@ -155,8 +157,8 @@ define(
* @returns {boolean} true if dialog is currently visible, false
* otherwise
*/
DialogService.prototype.canShowDialog = function (dialogModel) {
if (this.dialogVisible) {
DialogService.prototype.canShowDialog = function(dialogModel){
if (this.dialogVisible){
// Only one dialog should be shown at a time.
// The application design should be such that
// we never even try to do this.
@ -224,7 +226,7 @@ define(
* @param {typeClass} string tells overlayService that this overlay should use appropriate CSS class
* @returns {boolean}
*/
DialogService.prototype.showBlockingMessage = function (dialogModel) {
DialogService.prototype.showBlockingMessage = function(dialogModel) {
if (this.canShowDialog(dialogModel)) {
// Add the overlay using the OverlayService, which
// will handle actual insertion into the DOM

Some files were not shown because too many files have changed in this diff Show More