diff --git a/API.md b/API.md
new file mode 100644
index 0000000000..24083e1cf6
--- /dev/null
+++ b/API.md
@@ -0,0 +1,285 @@
+# 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 loading via a script tag; it's easy to use
+in your project. The [`openmct`]{@link module:openmct} module is exported
+via AMD and CommonJS, and is also exposed as `openmct` in the global scope
+if loaded via a script tag.
+
+## 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 domain objects. 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!
+
+## Running Open MCT
+
+Once the [`openmct`](@link module:openmct) module has been loaded, you can
+simply invoke [`start`]{@link module:openmct.MCT#start} to run Open MCT:
+
+
+```
+openmct.start();
+```
+
+Generally, however, you will want to configure Open MCT by adding plugins
+before starting it. It is important to install plugins and configure Open MCT
+_before_ calling [`start`]{@link module:openmct.MCT#start}; Open MCT is not
+designed to be reconfigured once started.
+
+## Configuring Open MCT
+
+The [`openmct`]{@link module:openmct} module (more specifically, the
+[`MCT`]{@link module:openmct.MCT} class, of which `openmct` is an instance)
+exposes a variety of methods to allow the application to be configured,
+extended, and customized before running.
+
+Short examples follow; see the linked documentation for further details.
+
+### Adding Domain Object Types
+
+Custom types may be registered via
+[`openmct.types`]{@link module:openmct.MCT#types}:
+
+```
+openmct.types.addType('my-type', new openmct.Type({
+ label: "My Type",
+ description: "This is a type that I added!"
+});
+```
+
+### Adding Views
+
+Custom views may be registered based on the region in the application
+where they should appear:
+
+* [`openmct.mainViews`]{@link module:openmct.MCT#mainViews} is a registry
+ of views of domain objects which should appear in the main viewing area.
+* [`openmct.inspectors`]{@link module:openmct.MCT#inspectors} is a registry
+ of views of domain objects and/or active selections, which should appear in
+ the Inspector.
+* [`openmct.toolbars`]{@link module:openmct.MCT#toolbars} is a registry
+ of views of domain objects and/or active selections, which should appear in
+ the toolbar area while editing.
+* [`openmct.indicators`]{@link module:openmct.MCT#inspectors} is a registry
+ of views which should appear in the status area of the application.
+
+Example:
+
+```
+openmct.mainViews.addProvider({
+ canView: function (domainObject) {
+ return domainObject.type === 'my-type';
+ },
+ view: function (domainObject) {
+ return new MyView(domainObject);
+ }
+});
+```
+
+### Adding a Root-level Object
+
+In many cases, you'd like a certain object (or a certain hierarchy of
+objects) to be accessible from the top level of the application (the
+tree on the left-hand side of Open MCT.) It is typical to expose a telemetry
+dictionary as a hierarchy of telemetry-providing domain objects in this
+fashion.
+
+To do so, use the [`addRoot`]{@link module:openmct.ObjectAPI#addRoot} method
+of the [object API]{@link module:openmct.ObjectAPI}:
+
+```
+openmct.objects.addRoot({
+ identifier: { key: "my-key", namespace: "my-namespace" }
+ name: "My Root-level Object",
+ type: "my-type"
+});
+```
+
+You can also remove this root-level object via its identifier:
+
+```
+openmct.objects.removeRoot({ key: "my-key", namespace: "my-namespace" });
+```
+
+### Adding Composition Providers
+
+The "composition" of a domain object is the list of objects it contains,
+as shown (for example) in the tree for browsing. Open MCT provides a
+default solution for composition, but there may be cases where you want
+to provide the composition of a certain object (or type of object) dynamically.
+For instance, you may want to populate a hierarchy under a custom root-level
+object based on the contents of a telemetry dictionary.
+To do this, you can add a new CompositionProvider:
+
+```
+openmct.composition.addProvider({
+ appliesTo: function (domainObject) {
+ return domainObject.type === 'my-type';
+ },
+ load: function (domainObject) {
+ return Promise.resolve(myDomainObjects);
+ }
+});
+```
+
+### Adding Telemetry Providers
+
+When connecting to a new telemetry source, you will want to register a new
+[telemetry provider]{@link module:openmct.TelemetryAPI~TelemetryProvider}
+with the [telemetry API]{@link module:openmct.TelemetryAPI#addProvider}:
+
+```
+openmct.telemetry.addProvider({
+ canProvideTelemetry: function (domainObject) {
+ return domainObject.type === 'my-type';
+ },
+ properties: function (domainObject) {
+ return [
+ { key: 'value', name: "Temperature", units: "degC" },
+ { key: 'time', name: "UTC" }
+ ];
+ },
+ request: function (domainObject, options) {
+ var telemetryId = domainObject.myTelemetryId;
+ return myAdapter.request(telemetryId, options.start, options.end);
+ },
+ subscribe: function (domainObject, callback) {
+ var telemetryId = domainObject.myTelemetryId;
+ myAdapter.subscribe(telemetryId, callback);
+ return myAdapter.unsubscribe.bind(myAdapter, telemetryId, callback);
+ }
+});
+```
+
+The implementations for `request` and `subscribe` can vary depending on the
+nature of the endpoint which will provide telemetry. In the example above,
+it is assumed that `myAdapter` contains the specific implementations
+(HTTP requests, WebSocket connections, etc.) associated with some telemetry
+source.
+
+## Using Open MCT
+
+When implementing new features, it is useful and sometimes necessary to
+utilize functionality exposed by Open MCT.
+
+### Retrieving Composition
+
+To limit which objects are loaded at any given time, the composition of
+a domain object must be requested asynchronously:
+
+```
+openmct.composition(myObject).load().then(function (childObjects) {
+ childObjects.forEach(doSomething);
+});
+```
+
+### Support Common Gestures
+
+Custom views may also want to support common gestures using the
+[gesture API]{@link module:openmct.GestureAPI}. For instance, to make
+a view (or part of a view) selectable:
+
+```
+openmct.gestures.selectable(myHtmlElement, myDomainObject);
+```
+
+### Working with Domain Objects
+
+The [object API]{@link module:openmct.ObjectAPI} provides useful methods
+for working with domain objects.
+
+To make changes to a domain object, use the
+[`mutate`]{@link module:openmct.ObjectAPI#mutate} method:
+
+```
+openmct.objects.mutate(myDomainObject, "name", "New name!");
+```
+
+Making modifications in this fashion allows other usages of the domain
+object to remain up to date using the
+[`observe`]{@link module:openmct.ObjectAPI#observe} method:
+
+```
+openmct.objects.observe(myDomainObject, "name", function (newName) {
+ myLabel.textContent = newName;
+});
+```
+
+### Using Telemetry
+
+Very often in Open MCT, you wish to work with telemetry data (for instance,
+to display it in a custom visualization.)
+
+
+### Synchronizing with the Time Conductor
+
+Views which wish to remain synchronized with the state of Open MCT's
+time conductor should utilize
+[`openmct.conductor`]{@link module:openmct.TimeConductor}:
+
+```
+openmct.conductor.on('bounds', function (newBounds) {
+ requestTelemetry(newBounds.start, newBounds.end).then(displayTelemetry);
+});
+```
+
+## Plugins
+
+While you can register new features with Open MCT directly, it is generally
+more useful to package these as a plugin. A plugin is a function that takes
+[`openmct`]{@link module:openmct} as an argument, and performs configuration
+upon `openmct` when invoked.
+
+### Installing Plugins
+
+To install plugins, use the [`install`]{@link module:openmct.MCT#install}
+method:
+
+```
+openmct.install(myPlugin);
+```
+
+The plugin will be invoked to configure Open MCT before it is started.
+
+### Writing Plugins
+
+Plugins configure Open MCT, and should utilize the
+[`openmct`]{@link module:openmct} module to do so, as summarized above in
+"Configuring Open MCT" and "Using Open MCT" above.
+
+### Distributing Plugins
+
+Hosting or downloading plugins is outside of the scope of this documentation.
+We recommend distributing plugins as UMD modules which export a single
+function.
+
diff --git a/LICENSES.md b/LICENSES.md
index 483a6e4072..94a7fecf13 100644
--- a/LICENSES.md
+++ b/LICENSES.md
@@ -560,3 +560,132 @@ The above copyright notice and this permission notice shall be included in all c
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.
+---
+
+### Almond
+
+* Link: https://github.com/requirejs/almond
+
+* Version: 0.3.3
+
+* Author: jQuery Foundation
+
+* Description: Lightweight RequireJS replacement for builds
+
+#### License
+
+Copyright jQuery Foundation and other contributors, https://jquery.org/
+
+This software consists of voluntary contributions made by many
+individuals. For exact contribution history, see the revision history
+available at https://github.com/requirejs/almond
+
+The following license applies to all parts of this software except as
+documented below:
+
+====
+
+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.
+
+====
+
+Copyright and related rights for sample code are waived via CC0. Sample
+code is defined as all source code displayed within the prose of the
+documentation.
+
+CC0: http://creativecommons.org/publicdomain/zero/1.0/
+
+====
+
+Files located in the node_modules directory, and certain utilities used
+to build or test the software in the test and dist directories, are
+externally maintained libraries used by this software which have their own
+licenses; we recommend you read them, as their terms may differ from the
+terms above.
+
+
+### Lodash
+
+* Link: https://lodash.com
+
+* Version: 3.10.1
+
+* Author: Dojo Foundation
+
+* Description: Utility functions
+
+#### License
+
+Copyright 2012-2015 The Dojo Foundation
+Based on Underscore.js, copyright 2009-2015 Jeremy Ashkenas,
+DocumentCloud and Investigative Reporters & Editors
+
+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.
+
+### EventEmitter3
+
+* Link: https://github.com/primus/eventemitter3
+
+* Version: 1.2.0
+
+* Author: Arnout Kazemier
+
+* Description: Event-driven programming support
+
+#### License
+
+The MIT License (MIT)
+
+Copyright (c) 2014 Arnout Kazemier
+
+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.
diff --git a/README.md b/README.md
index b9486dad3c..8761314a0b 100644
--- a/README.md
+++ b/README.md
@@ -10,9 +10,24 @@ Try Open MCT now with our [live demo](https://openmct-demo.herokuapp.com/).

## New API
-A new API is currently under development that will deprecate a lot of the documentation currently in the docs directory, however Open MCT will remain compatible with the currently documented API. An updated set of tutorials is being developed with the new API, and progress on this task can be followed in the [associated pull request](https://github.com/nasa/openmct/pull/999). Any code in this branch should be considered experimental, and we welcome any feedback.
-Differences between the two APIs include a move away from a declarative system of JSON configuration files towards an imperative system based on function calls. Developers will be able to extend and build on Open MCT by making direct function calls to a public API. Open MCT is also being refactored to minimize the dependencies that using Open MCT imposes on developers, such as the current requirement to use Angular JS.
+A simpler, [easier-to-use API](https://nasa.github.io/openmct/docs/api/)
+has been added to Open MCT. Changes in this
+API include a move away from a declarative system of JSON configuration files
+towards an imperative system based on function calls. Developers will be able
+to extend and build on Open MCT by making direct function calls to a public
+API. Open MCT is also being refactored to minimize the dependencies that using
+Open MCT imposes on developers, such as the current requirement to use
+AngularJS.
+
+This new API has not yet been heavily used and is likely to contain defects.
+You can help by trying it out, and reporting any issues you encounter
+using our GitHub issue tracker. Such issues may include bugs, suggestions,
+missing documentation, or even just requests for help if you're having
+trouble.
+
+We want Open MCT to be as easy to use, install, run, and develop for as
+possible, and your feedback will help us get there!
## Building and Running Open MCT Locally
diff --git a/bower.json b/bower.json
index 419871fe57..161ee04186 100644
--- a/bower.json
+++ b/bower.json
@@ -19,6 +19,10 @@
"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",
+ "d3": "~4.1.0",
"html2canvas": "^0.4.1"
}
}
diff --git a/build-docs.sh b/build-docs.sh
index 29841f921e..22e87949bf 100755
--- a/build-docs.sh
+++ b/build-docs.sh
@@ -24,7 +24,7 @@
# Script to build and deploy docs.
-OUTPUT_DIRECTORY="target/docs"
+OUTPUT_DIRECTORY="dist/docs"
# Docs, once built, are pushed to the private website repo
REPOSITORY_URL="git@github.com:nasa/openmct-website.git"
WEBSITE_DIRECTORY="website"
diff --git a/docs/src/index.md b/docs/src/index.md
index 3b4d767106..1d523657f4 100644
--- a/docs/src/index.md
+++ b/docs/src/index.md
@@ -9,26 +9,29 @@
Open MCT 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
- extend the platform at a variety of extension points. The details of how to
+ The platform is configured by plugins which extend the platform at a variety
+ of extension points. The details of how to
extend the platform are provided in the following documentation.
## Sections
-
- * The [Architecture Overview](architecture/) describes the concepts used
- throughout Open MCT, 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.
-
- * The [Tutorials](tutorials/) give examples of extending the platform to add
- functionality,
- and integrate with data sources.
* The [API](api/) document is generated from inline documentation
using [JSDoc](http://usejsdoc.org/), and describes the JavaScript objects and
functions that make up the software platform.
- * Finally, the [Development Process](process/) document describes the
+ * The [Development Process](process/) document describes the
Open MCT software development cycle.
+
+## Legacy Documentation
+
+As we transition to a new API, the following documentation for the old API
+(which is supported during the transtion) may be useful as well:
+
+ * The [Architecture Overview](architecture/) describes the concepts used
+ throughout Open MCT, 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.
+
+ * The [Tutorials](tutorials/) give examples of extending the platform to add
+ functionality, and integrate with data sources.
diff --git a/example/localTimeSystem/bundle.js b/example/localTimeSystem/bundle.js
new file mode 100644
index 0000000000..1d1ff2cf39
--- /dev/null
+++ b/example/localTimeSystem/bundle.js
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * 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([
+ "./src/LocalTimeSystem",
+ "./src/LocalTimeFormat",
+ 'legacyRegistry'
+], function (
+ LocalTimeSystem,
+ LocalTimeFormat,
+ legacyRegistry
+) {
+ legacyRegistry.register("example/localTimeSystem", {
+ "extensions": {
+ "formats": [
+ {
+ "key": "local-format",
+ "implementation": LocalTimeFormat
+ }
+ ],
+ "timeSystems": [
+ {
+ "implementation": LocalTimeSystem,
+ "depends": ["$timeout"]
+ }
+ ]
+ }
+ });
+});
diff --git a/example/localTimeSystem/src/LADTickSource.js b/example/localTimeSystem/src/LADTickSource.js
new file mode 100644
index 0000000000..35fff32f54
--- /dev/null
+++ b/example/localTimeSystem/src/LADTickSource.js
@@ -0,0 +1,43 @@
+/*****************************************************************************
+ * 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(['../../../platform/features/conductor-v2/conductor/src/timeSystems/LocalClock'], function (LocalClock) {
+ /**
+ * @implements TickSource
+ * @constructor
+ */
+ function LADTickSource ($timeout, period) {
+ LocalClock.call(this, $timeout, period);
+
+ this.metadata = {
+ key: 'test-lad',
+ mode: 'lad',
+ cssclass: 'icon-clock',
+ label: 'Latest Available Data',
+ name: 'Latest available data',
+ description: 'Monitor real-time streaming data as it comes in. The Time Conductor and displays will automatically advance themselves based on a UTC clock.'
+ };
+ }
+ LADTickSource.prototype = Object.create(LocalClock.prototype);
+
+ return LADTickSource;
+});
diff --git a/example/localTimeSystem/src/LocalTimeFormat.js b/example/localTimeSystem/src/LocalTimeFormat.js
new file mode 100644
index 0000000000..a9b26ed4ef
--- /dev/null
+++ b/example/localTimeSystem/src/LocalTimeFormat.js
@@ -0,0 +1,112 @@
+/*****************************************************************************
+ * 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([
+ 'moment'
+], function (
+ moment
+) {
+
+ var DATE_FORMAT = "YYYY-MM-DD h:mm:ss.SSS a",
+ DATE_FORMATS = [
+ DATE_FORMAT,
+ "YYYY-MM-DD h:mm:ss a",
+ "YYYY-MM-DD h:mm a",
+ "YYYY-MM-DD"
+ ];
+
+ /**
+ * @typedef Scale
+ * @property {number} min the minimum scale value, in ms
+ * @property {number} max the maximum scale value, in ms
+ */
+
+ /**
+ * Formatter for UTC timestamps. Interprets numeric values as
+ * milliseconds since the start of 1970.
+ *
+ * @implements {Format}
+ * @constructor
+ * @memberof platform/commonUI/formats
+ */
+ function LocalTimeFormat() {
+ }
+
+ /**
+ * Returns an appropriate time format based on the provided value and
+ * the threshold required.
+ * @private
+ */
+ function getScaledFormat (d) {
+ var m = moment.utc(d);
+ /**
+ * Uses logic from d3 Time-Scales, v3 of the API. See
+ * https://github.com/d3/d3-3.x-api-reference/blob/master/Time-Scales.md
+ *
+ * Licensed
+ */
+ return [
+ [".SSS", function(m) { return m.milliseconds(); }],
+ [":ss", function(m) { return m.seconds(); }],
+ ["hh:mma", function(m) { return m.minutes(); }],
+ ["hha", function(m) { return m.hours(); }],
+ ["ddd DD", function(m) {
+ return m.days() &&
+ m.date() != 1;
+ }],
+ ["MMM DD", function(m) { return m.date() != 1; }],
+ ["MMMM", function(m) {
+ return m.month();
+ }],
+ ["YYYY", function() { return true; }]
+ ].filter(function (row){
+ return row[1](m);
+ })[0][0];
+ };
+
+ /**
+ *
+ * @param value
+ * @param {Scale} [scale] Optionally provides context to the
+ * format request, allowing for scale-appropriate formatting.
+ * @returns {string} the formatted date
+ */
+ LocalTimeFormat.prototype.format = function (value, scale) {
+ if (scale !== undefined){
+ var scaledFormat = getScaledFormat(value, scale);
+ if (scaledFormat) {
+ return moment.utc(value).format(scaledFormat);
+ }
+ }
+ return moment(value).format(DATE_FORMAT);
+ };
+
+ LocalTimeFormat.prototype.parse = function (text) {
+ return moment(text, DATE_FORMATS).valueOf();
+ };
+
+ LocalTimeFormat.prototype.validate = function (text) {
+ return moment(text, DATE_FORMATS).isValid();
+ };
+
+ return LocalTimeFormat;
+});
diff --git a/example/localTimeSystem/src/LocalTimeSystem.js b/example/localTimeSystem/src/LocalTimeSystem.js
new file mode 100644
index 0000000000..95485b7e69
--- /dev/null
+++ b/example/localTimeSystem/src/LocalTimeSystem.js
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * 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([
+ '../../../platform/features/conductor-v2/conductor/src/timeSystems/TimeSystem',
+ '../../../platform/features/conductor-v2/conductor/src/timeSystems/LocalClock',
+ './LADTickSource'
+], function (TimeSystem, LocalClock, LADTickSource) {
+ var THIRTY_MINUTES = 30 * 60 * 1000,
+ DEFAULT_PERIOD = 1000;
+
+ /**
+ * This time system supports UTC dates and provides a ticking clock source.
+ * @implements TimeSystem
+ * @constructor
+ */
+ function LocalTimeSystem ($timeout) {
+ TimeSystem.call(this);
+
+ /**
+ * Some metadata, which will be used to identify the time system in
+ * the UI
+ * @type {{key: string, name: string, glyph: string}}
+ */
+ this.metadata = {
+ 'key': 'local',
+ 'name': 'Local',
+ 'glyph': '\u0043'
+ };
+
+ this.fmts = ['local-format'];
+ this.sources = [new LocalClock($timeout, DEFAULT_PERIOD), new LADTickSource($timeout, DEFAULT_PERIOD)];
+ }
+
+ LocalTimeSystem.prototype = Object.create(TimeSystem.prototype);
+
+ LocalTimeSystem.prototype.formats = function () {
+ return this.fmts;
+ };
+
+ LocalTimeSystem.prototype.deltaFormat = function () {
+ return 'duration';
+ };
+
+ LocalTimeSystem.prototype.tickSources = function () {
+ return this.sources;
+ };
+
+ LocalTimeSystem.prototype.defaults = function (key) {
+ var now = Math.ceil(Date.now() / 1000) * 1000;
+ return {
+ key: 'local-default',
+ name: 'Local 12 hour time system defaults',
+ deltas: {start: THIRTY_MINUTES, end: 0},
+ bounds: {start: now - THIRTY_MINUTES, end: now}
+ };
+ };
+
+ return LocalTimeSystem;
+});
diff --git a/example/msl/bundle.js b/example/msl/bundle.js
index aefc3ffc16..fbd0843935 100644
--- a/example/msl/bundle.js
+++ b/example/msl/bundle.js
@@ -36,7 +36,7 @@ define([
legacyRegistry
) {
"use strict";
- legacyRegistry.register("example/notifications", {
+ legacyRegistry.register("example/msl-adapter", {
"name" : "Mars Science Laboratory Data Adapter",
"extensions" : {
"types": [
diff --git a/gulpfile.js b/gulpfile.js
index ff994c6a2c..e9a5d0fcf0 100644
--- a/gulpfile.js
+++ b/gulpfile.js
@@ -21,41 +21,34 @@
*****************************************************************************/
/*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'),
path = require('path'),
fs = require('fs'),
git = require('git-rev-sync'),
moment = require('moment'),
- merge = require('merge-stream'),
project = require('./package.json'),
_ = require('lodash'),
paths = {
- main: 'main.js',
+ main: 'openmct.js',
dist: 'dist',
- assets: 'dist/assets',
reports: 'dist/reports',
scss: ['./platform/**/*.scss', './example/**/*.scss'],
- scripts: [ 'main.js', 'platform/**/*.js', 'src/**/*.js' ],
+ assets: [
+ './{example,platform}/**/*.{css,css.map,png,svg,ico,woff,eot,ttf}'
+ ],
+ scripts: [ 'openmct.js', 'platform/**/*.js', 'src/**/*.js' ],
specs: [ 'platform/**/*Spec.js', 'src/**/*Spec.js' ],
- static: [
- 'index.html',
- 'platform/**/*',
- 'example/**/*',
- 'bower_components/**/*'
- ]
},
options = {
requirejsOptimize: {
- name: paths.main.replace(/\.js$/, ''),
+ name: 'bower_components/almond/almond.js',
+ include: paths.main.replace('.js', ''),
+ wrap: {
+ startFile: "src/start.frag",
+ endFile: "src/end.frag"
+ },
mainConfigFile: paths.main,
wrapShim: true
},
@@ -64,7 +57,6 @@ var gulp = require('gulp'),
singleRun: true
},
sass: {
- includePaths: bourbon.includePaths,
sourceComments: true
},
replace: {
@@ -78,6 +70,8 @@ var gulp = require('gulp'),
};
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))
@@ -87,10 +81,16 @@ 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;
+
return gulp.src(paths.scss, {base: '.'})
.pipe(sourcemaps.init())
.pipe(sass(options.sass).on('error', sass.logError))
@@ -104,6 +104,9 @@ 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;
}),
@@ -122,6 +125,8 @@ gulp.task('lint', function () {
});
gulp.task('checkstyle', function () {
+ var jscs = require('gulp-jscs');
+
return gulp.src(paths.scripts)
.pipe(jscs())
.pipe(jscs.reporter())
@@ -129,18 +134,20 @@ 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('static', ['stylesheets'], function () {
- return gulp.src(paths.static, { base: '.' })
+gulp.task('assets', ['stylesheets'], function () {
+ return gulp.src(paths.assets)
.pipe(gulp.dest(paths.dist));
});
gulp.task('watch', function () {
- gulp.watch(paths.scss, ['stylesheets']);
+ return gulp.watch(paths.scss, ['stylesheets', 'assets']);
});
gulp.task('serve', function () {
@@ -148,9 +155,9 @@ gulp.task('serve', function () {
var app = require('./app.js');
});
-gulp.task('develop', ['serve', 'stylesheets', 'watch']);
+gulp.task('develop', ['serve', 'install', 'watch']);
-gulp.task('install', [ 'static', 'scripts' ]);
+gulp.task('install', [ 'assets', 'scripts' ]);
gulp.task('verify', [ 'lint', 'test', 'checkstyle' ]);
diff --git a/index.html b/index.html
index fcd37cfb0b..aa5d79cfdc 100644
--- a/index.html
+++ b/index.html
@@ -28,12 +28,15 @@
@@ -47,7 +50,5 @@