Compare commits

..

106 Commits

Author SHA1 Message Date
Pete Richards
fed894fb72 stop live demo deploys 2017-08-15 12:44:17 -07:00
Pete Richards
2ef9820b48 Merge pull request #1321 from nasa/open1311
[Live Demo] Don't launch tour for object opened in new tab
2016-11-17 10:58:24 -08:00
Andrew Henry
efb7541d57 [Live Demo] Tour does not launch if opened in new tab. Also, externalized tour. Fixes #1311 2016-11-14 13:08:20 +00:00
Henry
a30cdb78e3 Changed proxy address to use heroku app 2016-09-29 17:34:53 -07:00
Henry
1d8637a150 [Live Demo] Removed build script step to delete dist 2016-09-29 17:23:19 -07:00
Henry
02aa11b9fb Changed output directory 2016-09-29 17:18:13 -07:00
Henry
b88a19bcdb Lower case x 2016-09-29 17:09:27 -07:00
Henry
c23c4d568d Removed npm install and change remote name 2016-09-29 17:07:38 -07:00
Henry
fca3d825fb [Live Demo] Added script to deploy live demo to github pages 2016-09-29 17:01:44 -07:00
Henry
fe28c22350 [Live Demo] Added CORS header to enable cross-origin requests from website 2016-09-29 11:37:19 -07:00
Henry
7c266a8b4e [Examples] Modified website link in tour 2016-09-20 16:31:42 -07:00
Henry
7354176166 [Examples] Cherry picked millibar conversion for MSL data 2016-09-20 16:12:31 -07:00
Victor Woeltjen
7b1ef58224 [Live Demo] Added link to website 2016-09-20 15:09:01 -07:00
Victor Woeltjen
916c2b667a Merge pull request #1138 from jlaneve/live_demo
[Hopscotch] Fix alignment of 'Edit Button' hopscotch. Fixes #1137
2016-08-24 16:11:22 -07:00
Julian LaNeve
27d9757d8c Fix alignment of 'Edit Button' hopscotch 2016-08-23 19:06:42 -05:00
Andrew Henry
c3ef6bdc2a Replaced clock text 2016-08-21 23:17:30 -07:00
Henry
986af46468 [Examples] #921 changed text in event generator example 2016-08-21 23:05:04 -07:00
Henry
bea6045621 [Examples] #921 changed text in event generator example 2016-08-21 23:04:44 -07:00
Henry
d60a06c997 Added url check to proxy 2016-08-10 12:38:45 -07:00
Henry
7411cb4f7e [Demo] #867 Made plots 2 elements to support stacked view 2016-05-20 16:41:00 -07:00
Pete Richards
ce645761f0 [Analytics] Track pageviews on hashchange 2016-05-12 13:47:07 -07:00
Henry
74812f67ab Added Google Analytics 2016-05-10 10:21:16 -07:00
Andrew Henry
2e5051555b Merge pull request #896 from nasa/live_demo884
Review and integrate live_demo884
2016-05-06 11:16:31 -07:00
Charles Hacskaylo
d10e7800c1 Merge branch 'live_demo' into live_demo884
# Conflicts:
#	demo/src/DemoInitializer.js
#	main.js
2016-05-05 23:12:41 -07:00
Charles Hacskaylo
224efe4149 [Frontend] Mods to tour content
open #884
2016-05-05 23:05:28 -07:00
Charles Hacskaylo
4f544f5c01 [Frontend] Modified initial width of treeview pane
open #884
2016-05-05 22:52:27 -07:00
Henry
87c462a12b Merge branch 'open885' into live_demo 2016-05-05 22:10:42 -07:00
Henry
c69a14ed06 Merge branch 'open892' into live_demo 2016-05-05 22:10:23 -07:00
Henry
6b5dc98c3f #885 modified procfile to run from dist directory 2016-05-05 22:05:20 -07:00
Henry
429b886f22 Added demo static files to gulp build 2016-05-05 22:05:20 -07:00
Henry
5c25b19f95 Addressed tour inconsistencies 2016-05-05 22:05:20 -07:00
Henry
758de1e17c Added items view for non-editable telemetry types 2016-05-05 22:05:19 -07:00
Henry
5ed22c99c2 Slight modification to demo data source 2016-05-05 22:05:19 -07:00
Henry
4f34551c89 Removed unnecessary decorator 2016-05-05 22:05:19 -07:00
Henry
e437189c69 Simplified DemoTelemetrySeries 2016-05-05 22:05:19 -07:00
Henry
94ecb1d68f Changed deployed app name in circle CI config 2016-05-05 22:05:19 -07:00
Henry
ae00175f0c Added demo scss to build path. Fixed #875 2016-05-05 22:05:19 -07:00
Henry
11fc11c441 Switched image styles to sass 2016-05-05 22:05:19 -07:00
Henry
a66d8b3308 Fixed jshint errors 2016-05-05 22:05:18 -07:00
Henry
b78ff61d17 Made demo telemetry non-editable 2016-05-05 22:05:18 -07:00
Henry
10e1ab7f45 Making demo telemetry sources non-modifiable 2016-05-05 22:05:18 -07:00
Henry
8aec1623a7 Removed Panel type 2016-05-05 22:05:18 -07:00
Henry
3cd754777c Updated tour 2016-05-05 22:05:18 -07:00
Henry
941d1e60e5 Fixed placement of tour bubble 2016-05-05 22:05:18 -07:00
Charles Hacskaylo
fc453f8789 Fix naming of 'Edit Display Layout Example'
open #858
- Mismatch between named example layout and
reference in Hopscotch tour fixed.
2016-05-05 22:05:18 -07:00
Charles Hacskaylo
8e247d4fcb [Config] Finessed content, bubble styling
open #858
- That's all for now folks.
2016-05-05 22:05:17 -07:00
Henry
3bd0a77be4 Added curiosity rover position imagery 2016-05-05 22:05:17 -07:00
Henry
f9d19eff0d Added 2016-05-05 22:05:04 -07:00
Henry
8a17b78c1d [Demo] Updated demo telemetry source 2016-05-05 22:03:13 -07:00
Henry
1ae17d6dde Merged 2016-05-05 22:03:13 -07:00
Henry
00d58d66ed Added license, fixed routing 2016-05-05 22:03:13 -07:00
Pete Richards
f9a7f899bb [CI] deploy live_demo to openmctweb-staging-un
Deploy live_demo to openmctweb-staging-un for testing.
2016-05-05 22:03:13 -07:00
Henry
82345be99e Switched to hopscotch AMD config 2016-05-05 22:03:13 -07:00
Henry
c14781a924 Updated image telemetry 2016-05-05 22:03:13 -07:00
Henry
fc7160464a Added phase shift to telemetry 2016-05-05 22:03:13 -07:00
Henry
73003164a1 Made some minor changes to layouts 2016-05-05 22:03:13 -07:00
Henry
f64ed7b784 [demo] Removed unneeded files, and added missing css 2016-05-05 22:03:13 -07:00
Henry
0cc3534d25 Example demo 2016-05-05 22:03:12 -07:00
Henry
73490b555a Initial tour 2016-05-05 22:03:12 -07:00
Henry
7f919b0595 Something 2016-05-05 22:03:12 -07:00
Henry
22694c4efe [Examples] Converted sinewave generator to object prototype form 2016-05-05 22:03:12 -07:00
Henry
245860ddaa Working on telemetry provider 2016-05-05 22:03:12 -07:00
Henry
25c59c2044 Suppressed time conductor for realtime 2016-05-05 22:03:12 -07:00
Andrew Henry
4d4cf33b51 Merge pull request #879 from nasa/table-headers-809
[Table] Fix headers in firefox
2016-05-05 22:02:39 -07:00
Henry
90a5b76084 Addressed tour inconsistencies 2016-05-05 10:52:10 -07:00
Henry
0166871cc1 Added items view for non-editable telemetry types 2016-05-04 17:52:18 -07:00
Henry
acd525645a Slight modification to demo data source 2016-05-03 16:10:55 -07:00
Henry
998399c7f7 Removed unnecessary decorator 2016-05-03 15:58:22 -07:00
Henry
9db43445e7 Simplified DemoTelemetrySeries 2016-05-03 15:57:39 -07:00
Henry
9b850c97a2 Changed deployed app name in circle CI config 2016-05-03 14:34:52 -07:00
Andrew Henry
d581e293fa Merge pull request #872 from nasa/live_demo869
Review and integrate live_demo869
2016-05-03 14:21:15 -07:00
Henry
d7996cd526 Added demo scss to build path. Fixed #875 2016-05-02 19:13:26 -07:00
Charles Hacskaylo
4c97413763 [Frontend] Removed bullets from ol, ul
open #869
- This should be cherry-picked into main
branches as well.
2016-04-29 10:50:24 -07:00
Henry
ca70310137 Switched image styles to sass 2016-04-27 18:45:02 -07:00
Henry
5202232f7a Fixed jshint errors 2016-04-27 16:57:47 -07:00
Henry
0d92c2db15 Made demo telemetry non-editable 2016-04-27 16:13:21 -07:00
Henry
932733afb4 Making demo telemetry sources non-modifiable 2016-04-27 14:42:34 -07:00
Henry
921e351d33 Removed Panel type 2016-04-27 12:01:17 -07:00
Henry
785c94cae3 Updated tour 2016-04-27 11:38:53 -07:00
Henry
404b24a2f3 Merge branch 'live_demo' of https://github.com/nasa/openmctweb into live_demo 2016-04-27 11:31:11 -07:00
Henry
a1ed34bcc8 Fixed placement of tour bubble 2016-04-27 11:31:06 -07:00
Andrew Henry
67bdcabc3d Merge pull request #863 from nasa/live_demo858
Fix naming of 'Edit Display Layout Example'
2016-04-27 11:30:26 -07:00
Charles Hacskaylo
ea54bf1b7f Fix naming of 'Edit Display Layout Example'
open #858
- Mismatch between named example layout and
reference in Hopscotch tour fixed.
2016-04-27 10:24:44 -07:00
Henry
4b71227d29 Merge branch 'live_demo' of https://github.com/nasa/openmctweb into live_demo 2016-04-27 08:08:40 -07:00
Andrew Henry
a5f3f55c55 Merge pull request #860 from nasa/live_demo858
Review and integrate live_demo858
2016-04-27 08:08:07 -07:00
Charles Hacskaylo
808d3a66ca Merge branch 'live_demo' of https://github.com/nasa/openmct into live_demo858
Conflicts:
	demo/src/DemoInitializer.js
2016-04-26 22:13:04 -07:00
Charles Hacskaylo
4e3edb85b3 [Config] Finessed content, bubble styling
open #858
- That's all for now folks.
2016-04-26 21:18:21 -07:00
Henry
87850119b8 Added curiosity rover position imagery 2016-04-26 18:29:52 -07:00
Charles Hacskaylo
9e36ca899f [Config] New tour content
open #858
- New tour content
- Using target as CSS selection strings
instead of document.querySelector(). This is
important to allow tour to work as user clicks
and mods the DOM
2016-04-26 17:55:54 -07:00
Henry
5f9cd8538b Added 2016-04-26 15:09:33 -07:00
Henry
37c5a11ece [Demo] Updated demo telemetry source 2016-04-26 14:47:03 -07:00
Henry
509e1970de Merged 2016-04-26 08:41:35 -07:00
Henry
77c4dc17f2 Added license, fixed routing 2016-04-26 08:41:35 -07:00
Pete Richards
78c474483e [CI] deploy live_demo to openmctweb-staging-un
Deploy live_demo to openmctweb-staging-un for testing.
2016-04-26 08:41:35 -07:00
Henry
955ba8721a Switched to hopscotch AMD config 2016-04-26 08:41:34 -07:00
Henry
429933087d Updated image telemetry 2016-04-26 08:41:34 -07:00
Henry
275a80c4ee Added phase shift to telemetry 2016-04-26 08:41:34 -07:00
Henry
9408a6d491 Made some minor changes to layouts 2016-04-26 08:41:34 -07:00
Henry
57bb6cc79f [demo] Removed unneeded files, and added missing css 2016-04-26 08:41:34 -07:00
Henry
e636b54521 Example demo 2016-04-26 08:41:34 -07:00
Henry
47106be99c Initial tour 2016-04-26 08:41:34 -07:00
Henry
54bf57d0e2 Something 2016-04-26 08:41:34 -07:00
Henry
41a5a49d86 [Examples] Converted sinewave generator to object prototype form 2016-04-26 08:41:34 -07:00
Henry
b83773c531 Working on telemetry provider 2016-04-26 08:41:34 -07:00
Henry
88f46d0e42 Suppressed time conductor for realtime 2016-04-26 08:41:34 -07:00
Henry
b3981e6158 Added local caching of query responses for REMS data. Also added code to mux simultaneous initial requests for data into a single http request. 2016-04-26 08:41:33 -07:00
869 changed files with 9746 additions and 6421 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
}

View File

@@ -1 +1 @@
web: node app.js --port $PORT
web: node app.js --port $PORT --directory dist

21
app.js
View File

@@ -17,6 +17,10 @@
fs = require('fs'),
request = require('request');
var proxyUrls = [
'http://cab.inta-csic.es/rems/wp-content/plugins/marsweather-widget/api.php'
];
// Defaults
options.port = options.port || options.p || 8080;
options.directory = options.directory || options.D || '.';
@@ -65,11 +69,18 @@
});
app.use('/proxyUrl', function proxyRequest(req, res, next) {
console.log('Proxying request to: ', req.query.url);
req.pipe(request({
url: req.query.url,
strictSSL: false
}).on('error', next)).pipe(res);
if (proxyUrls.indexOf(req.query.url) !== -1) {
res.header("Access-Control-Allow-Origin", "https://nasa.github.io");
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
console.log('Proxying request to: ', req.query.url);
req.pipe(request({
url: req.query.url,
strictSSL: false
}).on('error', next)).pipe(res);
} else {
res.status(400).send();
}
});
// Expose everything else as static files

View File

@@ -13,13 +13,11 @@
"moment-duration-format": "^1.3.0",
"requirejs": "~2.1.22",
"text": "requirejs-text#^2.0.14",
"es6-promise": "^3.0.2",
"es6-promise": "^3.3.0",
"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"
"zepto": "^1.1.6"
}
}

56
build-demo.sh Executable file
View File

@@ -0,0 +1,56 @@
#!/bin/bash
#*****************************************************************************
#* Open MCT, Copyright (c) 2014-2016, United States Government
#* as represented by the Administrator of the National Aeronautics and Space
#* Administration. All rights reserved.
#*
#* Open MCT 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 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.
#*****************************************************************************
# Script to build and deploy docs.
OUTPUT_DIRECTORY="dist"
# Docs, once built, are pushed to the private website repo
REPOSITORY_URL="git@github.com:nasa/openmct-website.git"
WEBSITE_DIRECTORY="website"
LIVE_DEMO_DIRECTORY="assets/live-demo"
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 in between builds.
REMOTE_NAME="website"
WEBSITE_BRANCH="master"
echo "git clone $REPOSITORY_URL website"
git clone $REPOSITORY_URL $WEBSITE_DIRECTORY || exit 1
echo "cp -r $OUTPUT_DIRECTORY/** $WEBSITE_DIRECTORY/$LIVE_DEMO_DIRECTORY"
cp -r $OUTPUT_DIRECTORY/** $WEBSITE_DIRECTORY/$LIVE_DEMO_DIRECTORY
echo "cd $WEBSITE_DIRECTORY"
cd $WEBSITE_DIRECTORY || exit 1
# Configure github for CircleCI user.
git config user.email "buildbot@circleci.com"
git config user.name "BuildBot"
echo "git add ."
git add .
echo "git commit -m \"Live demo updated from build $BUILD_SHA\""
git commit -m "Live demo updated from build $BUILD_SHA"
# Push to the website repo
git push

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
heroku:
appname: openmct-demo
- npm install canvas nomnoml
- ./build-docs.sh
- git push git@heroku.com:openmctweb-demo.git $CIRCLE_SHA1:refs/heads/master
openmctweb-staging-deux:
branch: mobile
heroku:
appname: openmctweb-staging-deux
test:
post:
- gulp lint
- gulp checkstyle
general:
branches:
ignore:
- gh-pages
- npm run jshint --silent

244
demo/bundle.js Normal file
View File

@@ -0,0 +1,244 @@
/*****************************************************************************
* 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([
"./src/conductor/DemoConductorRepresenter",
"./src/DemoInitializer",
"./src/conductor/ConductorServiceDecorator",
"./src/telemetry/DemoTelemetryProvider",
"./src/DemoModelProvider",
"./src/policies/CollectionViewPolicy",
'text!./res/image-template.html',
"text!../platform/commonUI/browse/res/templates/items/items.html",
'legacyRegistry'
], function (
DemoConductorRepresenter,
DemoInitializer,
ConductorServiceDecorator,
DemoTelemetryProvider,
DemoModelProvider,
CollectionViewPolicy,
ImageTemplate,
ItemsTemplate,
legacyRegistry
) {
"use strict";
legacyRegistry.register("demo", {
"name": "Live Demo configuration",
"description": "Adds demo data types, and demo-specific behavior",
"extensions": {
"representers": [
{
"implementation": DemoConductorRepresenter,
"depends": ["$q", "$compile", "conductorService", "views[]", "throttle", "navigationService"]
}
],
"components": [
{
"implementation": ConductorServiceDecorator,
"provides": "conductorService",
"type": "decorator"
},
{
"implementation": DemoTelemetryProvider,
"type": "provider",
"provides": "telemetryService",
"depends": ["$q", "$timeout"]
},
{
"implementation": DemoModelProvider,
"provides": "modelService",
"type": "provider",
"priority": "fallback"
},
],
"runs": [
{
"implementation": DemoInitializer,
"depends": [
"$timeout",
"representers[]",
"objectService",
"$location",
"agentService"
]
}
],
"roots": [
{
"id":"demo:realtime",
"model": {
"type":"collection",
"name": "Real-time Telemetry",
"composition": [
"be3d5df3-cc6e-4b8b-9865-fcd844e55b94",
"930dd0b9-9d98-4908-b19c-c1c887117d42"
]
},
"priority": "preferred"
}
],
"types": [
{
"key": "demo-telemetry",
"name": "Spacecraft Telemetry Generator",
"glyph": "T",
"description": "Mock realtime spacecraft telemetry",
"model": {
"telemetry": {
"period": 1000,
"multiplier": 10
}
},
"telemetry": {
"source": "demo-telemetry",
"domains": [
{
"key": "time",
"name": "Time"
}
],
"ranges": [
{
"key": "value",
"name": "value"
}
]
}
},
{
"key": "image-include",
"name": "Image include",
"glyph": "ã",
"description": "An image include that is resized to fit" +
" its container",
"views": [
"image-view"
],
"properties": [
{
"key": "url",
"name": "URL",
"control": "textfield",
"pattern": "^(ftp|https?)\\:\\/\\/\\w+(\\.\\w+)*(\\:\\d+)?(\\/\\S*)*$",
"required": true,
"cssclass": "l-input-lg"
}
]
},
{
"key": "demo.plot",
"name": "Telemetry Plot",
"glyph": "t",
"description": "A view that will plot telemetry in a" +
" chart.",
"priority": 899,
"delegates": [
"telemetry"
],
"views": [
"plot"
],
"features": "creation",
"contains": [
{
"has": "telemetry"
}
],
"model": {
"composition": []
}
},
{
"name": "Collection",
"key": "collection",
"glyph": "o",
"views": [
"collection-view"
],
"model": {"composition": []}
}
],
"licenses": [
{
"name": "Hopscotch",
"version": "0.2.5",
"author": "linkedin",
"description": "Hopscotch is a framework to make it easy" +
" for developers to add product tours to their pages.",
"license": "license-apache",
"website": "http://linkedin.github.io/hopscotch/",
"link": "https://raw.githubusercontent.com/linkedin/hopscotch/master/LICENSE"
}
],
"stylesheets": [
{
"stylesheetUrl": "css/hopscotch.css",
priority: "fallback"
},
{
"stylesheetUrl": "css/tour.css"
},
{
"stylesheetUrl": "css/image.css"
}
],
"constants": [
{
"key": "PLOT_FIXED_DURATION",
"value": 60000,
"comment": "1 minute."
}
],
"policies": [
{
"category": "view",
"implementation": CollectionViewPolicy
}
],
"views": [
{
"template": ImageTemplate,
"name": "ImageInclude",
"type": "image-include",
"key": "image-view",
"editable": false
},
{
"key": "collection-view",
"name": "collection",
"glyph": "9",
"description": "Grid of available items",
"template": ItemsTemplate,
"uses": [
"composition"
],
"editable": false
}
]
}
});
});

1022
demo/data/demo-models.json Normal file

File diff suppressed because it is too large Load Diff

17
demo/lib/hopscotch/hopscotch.min.js vendored Executable file

File diff suppressed because one or more lines are too long

521
demo/res/css/hopscotch.css Executable file
View File

@@ -0,0 +1,521 @@
/**! hopscotch - v0.2.5
*
* Copyright 2015 LinkedIn Corp. All rights reserved.
*
* 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.
*/
/**
* This fade animation is based on Dan Eden's animate.css (http://daneden.me/animate/), under the terms of the MIT license.
*
* Copyright 2013 Dan Eden.
*
* 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.
*/
.animated {
-webkit-animation-fill-mode: both;
-moz-animation-fill-mode: both;
-ms-animation-fill-mode: both;
-o-animation-fill-mode: both;
animation-fill-mode: both;
-webkit-animation-duration: 1s;
-moz-animation-duration: 1s;
-ms-animation-duration: 1s;
-o-animation-duration: 1s;
animation-duration: 1s;
}
@-webkit-keyframes fadeInUp {
0% {
opacity: 0;
-webkit-transform: translateY(20px);
}
100% {
opacity: 1;
-webkit-transform: translateY(0);
}
}
@-moz-keyframes fadeInUp {
0% {
opacity: 0;
-moz-transform: translateY(20px);
}
100% {
opacity: 1;
-moz-transform: translateY(0);
}
}
@-o-keyframes fadeInUp {
0% {
opacity: 0;
-o-transform: translateY(20px);
}
100% {
opacity: 1;
-o-transform: translateY(0);
}
}
@keyframes fadeInUp {
0% {
opacity: 0;
transform: translateY(20px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
.fade-in-up {
-webkit-animation-name: fadeInUp;
-moz-animation-name: fadeInUp;
-o-animation-name: fadeInUp;
animation-name: fadeInUp;
}
@-webkit-keyframes fadeInDown {
0% {
opacity: 0;
-webkit-transform: translateY(-20px);
}
100% {
opacity: 1;
-webkit-transform: translateY(0);
}
}
@-moz-keyframes fadeInDown {
0% {
opacity: 0;
-moz-transform: translateY(-20px);
}
100% {
opacity: 1;
-moz-transform: translateY(0);
}
}
@-o-keyframes fadeInDown {
0% {
opacity: 0;
-ms-transform: translateY(-20px);
}
100% {
opacity: 1;
-ms-transform: translateY(0);
}
}
@keyframes fadeInDown {
0% {
opacity: 0;
transform: translateY(-20px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
.fade-in-down {
-webkit-animation-name: fadeInDown;
-moz-animation-name: fadeInDown;
-o-animation-name: fadeInDown;
animation-name: fadeInDown;
}
@-webkit-keyframes fadeInRight {
0% {
opacity: 0;
-webkit-transform: translateX(-20px);
}
100% {
opacity: 1;
-webkit-transform: translateX(0);
}
}
@-moz-keyframes fadeInRight {
0% {
opacity: 0;
-moz-transform: translateX(-20px);
}
100% {
opacity: 1;
-moz-transform: translateX(0);
}
}
@-o-keyframes fadeInRight {
0% {
opacity: 0;
-o-transform: translateX(-20px);
}
100% {
opacity: 1;
-o-transform: translateX(0);
}
}
@keyframes fadeInRight {
0% {
opacity: 0;
transform: translateX(-20px);
}
100% {
opacity: 1;
transform: translateX(0);
}
}
.fade-in-right {
-webkit-animation-name: fadeInRight;
-moz-animation-name: fadeInRight;
-o-animation-name: fadeInRight;
animation-name: fadeInRight;
}
@-webkit-keyframes fadeInLeft {
0% {
opacity: 0;
-webkit-transform: translateX(20px);
}
100% {
opacity: 1;
-webkit-transform: translateX(0);
}
}
@-moz-keyframes fadeInLeft {
0% {
opacity: 0;
-moz-transform: translateX(20px);
}
100% {
opacity: 1;
-moz-transform: translateX(0);
}
}
@-o-keyframes fadeInLeft {
0% {
opacity: 0;
-o-transform: translateX(20px);
}
100% {
opacity: 1;
-o-transform: translateX(0);
}
}
@keyframes fadeInLeft {
0% {
opacity: 0;
transform: translateX(20px);
}
100% {
opacity: 1;
transform: translateX(0);
}
}
.fade-in-left {
-webkit-animation-name: fadeInLeft;
-moz-animation-name: fadeInLeft;
-o-animation-name: fadeInLeft;
animation-name: fadeInLeft;
}
div.hopscotch-bubble .hopscotch-nav-button {
/* borrowed from katy styles */
font-weight: bold;
border-width: 1px;
border-style: solid;
cursor: pointer;
margin: 0;
overflow: visible;
text-decoration: none !important;
width: auto;
padding: 0 10px;
height: 26px;
line-height: 24px;
font-size: 12px;
*zoom: 1;
white-space: nowrap;
display: -moz-inline-stack;
display: inline-block;
*vertical-align: auto;
zoom: 1;
*display: inline;
vertical-align: middle;
-moz-border-radius: 3px;
-ms-border-radius: 3px;
-o-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
div.hopscotch-bubble .hopscotch-nav-button:hover {
*zoom: 1;
-webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
-moz-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
div.hopscotch-bubble .hopscotch-nav-button:active {
-webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25) inset;
-moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25) inset;
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25) inset;
}
div.hopscotch-bubble .hopscotch-nav-button.next {
border-color: #1b5480;
color: #fff;
margin: 0 0 0 10px;
/* HS specific*/
text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35);
background-color: #287bbc;
filter: progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#287bbc', endColorstr='#23639a');
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #287bbc), color-stop(100%, #23639a));
background-image: -webkit-linear-gradient(top, #287bbc 0%, #23639a 100%);
background-image: -moz-linear-gradient(top, #287bbc 0%, #23639a 100%);
background-image: -o-linear-gradient(top, #287bbc 0%, #23639a 100%);
background-image: linear-gradient(top, #287bbc 0%, #23639a 100%);
}
div.hopscotch-bubble .hopscotch-nav-button.next:hover {
background-color: #2672ae;
filter: progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#2672ae', endColorstr='#1e4f7e');
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #2672ae), color-stop(100%, #1e4f7e));
background-image: -webkit-linear-gradient(top, #2672ae 0%, #1e4f7e 100%);
background-image: -moz-linear-gradient(top, #2672ae 0%, #1e4f7e 100%);
background-image: -o-linear-gradient(top, #2672ae 0%, #1e4f7e 100%);
background-image: linear-gradient(top, #2672ae 0%, #1e4f7e 100%);
}
div.hopscotch-bubble .hopscotch-nav-button.prev {
border-color: #a7a7a7;
color: #444;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
background-color: #f2f2f2;
filter: progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#f2f2f2', endColorstr='#e9e9e9');
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #f2f2f2), color-stop(100%, #e9e9e9));
background-image: -webkit-linear-gradient(top, #f2f2f2 0%, #e9e9e9 100%);
background-image: -moz-linear-gradient(top, #f2f2f2 0%, #e9e9e9 100%);
background-image: -o-linear-gradient(top, #f2f2f2 0%, #e9e9e9 100%);
background-image: linear-gradient(top, #f2f2f2 0%, #e9e9e9 100%);
}
div.hopscotch-bubble .hopscotch-nav-button.prev:hover {
background-color: #e8e8e8;
filter: progid:DXImageTransform.Microsoft.gradient(gradientType=0, startColorstr='#FFE8E8E8', endColorstr='#FFA9A9A9');
background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #e8e8e8), color-stop(13%, #e3e3e3), color-stop(32%, #d7d7d7), color-stop(71%, #b9b9b9), color-stop(100%, #a9a9a9));
background-image: -webkit-linear-gradient(top, #e8e8e8 0%, #e3e3e3 13%, #d7d7d7 32%, #b9b9b9 71%, #a9a9a9 100%);
background-image: -moz-linear-gradient(top, #e8e8e8 0%, #e3e3e3 13%, #d7d7d7 32%, #b9b9b9 71%, #a9a9a9 100%);
background-image: -o-linear-gradient(top, #e8e8e8 0%, #e3e3e3 13%, #d7d7d7 32%, #b9b9b9 71%, #a9a9a9 100%);
background-image: linear-gradient(top, #e8e8e8 0%, #e3e3e3 13%, #d7d7d7 32%, #b9b9b9 71%, #a9a9a9 100%);
}
div.hopscotch-bubble {
background-color: #ffffff;
border: 5px solid #000000;
border-radius: 10px;
/* default */
border: 5px solid rgba(0, 0, 0, 0.3);
/* transparent, if supported */
color: #333;
font-family: 'Helvetica Neue', Helvetica, Arial;
font-size: 13px;
position: absolute;
z-index: 999999;
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
-moz-background-clip: padding;
/* for Mozilla browsers*/
-webkit-background-clip: padding;
/* Webkit */
background-clip: padding-box;
/* browsers with full support */
}
div.hopscotch-bubble * {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
}
div.hopscotch-bubble.animate {
-moz-transition-property: top, left;
-moz-transition-duration: 1s;
-moz-transition-timing-function: ease-in-out;
-ms-transition-property: top, left;
-ms-transition-duration: 1s;
-ms-transition-timing-function: ease-in-out;
-o-transition-property: top, left;
-o-transition-duration: 1s;
-o-transition-timing-function: ease-in-out;
-webkit-transition-property: top, left;
-webkit-transition-duration: 1s;
-webkit-transition-timing-function: ease-in-out;
transition-property: top, left;
transition-duration: 1s;
transition-timing-function: ease-in-out;
}
div.hopscotch-bubble.invisible {
opacity: 0;
}
div.hopscotch-bubble.hide,
div.hopscotch-bubble .hide,
div.hopscotch-bubble .hide-all {
display: none;
}
div.hopscotch-bubble h3 {
color: #000;
font-family: Helvetica, Arial;
font-size: 16px;
font-weight: bold;
line-height: 19px;
margin: -1px 15px 0 0;
padding: 0;
}
div.hopscotch-bubble .hopscotch-bubble-container {
padding: 15px;
position: relative;
text-align: left;
-webkit-font-smoothing: antialiased;
/* to fix text flickering */
}
div.hopscotch-bubble .hopscotch-content {
font-family: 'Helvetica Neue', Helvetica, Arial;
font-weight: normal;
line-height: 17px;
margin: -5px 0 11px;
padding-top: 8px;
}
div.hopscotch-bubble .hopscotch-bubble-content {
margin: 0;
}
div.hopscotch-bubble.no-number .hopscotch-bubble-content {
margin: 0;
}
div.hopscotch-bubble .hopscotch-bubble-close {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
border: 0;
color: #000;
background: transparent url(../img/sprite-green.png) -192px -92px no-repeat;
display: block;
padding: 8px;
position: absolute;
text-decoration: none;
text-indent: -9999px;
width: 8px;
height: 8px;
top: 0;
right: 0;
}
div.hopscotch-bubble .hopscotch-bubble-close.hide,
div.hopscotch-bubble .hopscotch-bubble-close.hide-all {
display: none;
}
div.hopscotch-bubble .hopscotch-bubble-number {
display: none;
/* background: transparent url(../img/sprite-green.png) 0 0 no-repeat;
color: #fff;
display: block;
float: left;
font-size: 17px;
font-weight: bold;
line-height: 31px;
padding: 0 10px 0 0;
text-align: center;
width: 30px;
height: 30px; */
}
div.hopscotch-bubble .hopscotch-bubble-arrow-container {
position: absolute;
width: 34px;
height: 34px;
}
div.hopscotch-bubble .hopscotch-bubble-arrow-container .hopscotch-bubble-arrow,
div.hopscotch-bubble .hopscotch-bubble-arrow-container .hopscotch-bubble-arrow-border {
width: 0;
height: 0;
}
div.hopscotch-bubble .hopscotch-bubble-arrow-container.up {
top: -22px;
left: 10px;
}
div.hopscotch-bubble .hopscotch-bubble-arrow-container.up .hopscotch-bubble-arrow {
border-bottom: 17px solid #ffffff;
border-left: 17px solid transparent;
border-right: 17px solid transparent;
position: relative;
top: -10px;
}
div.hopscotch-bubble .hopscotch-bubble-arrow-container.up .hopscotch-bubble-arrow-border {
border-bottom: 17px solid #000000;
border-bottom: 17px solid rgba(0, 0, 0, 0.5);
border-left: 17px solid transparent;
border-right: 17px solid transparent;
}
div.hopscotch-bubble .hopscotch-bubble-arrow-container.down {
bottom: -39px;
left: 10px;
}
div.hopscotch-bubble .hopscotch-bubble-arrow-container.down .hopscotch-bubble-arrow {
border-top: 17px solid #ffffff;
border-left: 17px solid transparent;
border-right: 17px solid transparent;
position: relative;
top: -24px;
}
div.hopscotch-bubble .hopscotch-bubble-arrow-container.down .hopscotch-bubble-arrow-border {
border-top: 17px solid #000000;
border-top: 17px solid rgba(0, 0, 0, 0.5);
border-left: 17px solid transparent;
border-right: 17px solid transparent;
}
div.hopscotch-bubble .hopscotch-bubble-arrow-container.left {
top: 10px;
left: -22px;
}
div.hopscotch-bubble .hopscotch-bubble-arrow-container.left .hopscotch-bubble-arrow {
border-bottom: 17px solid transparent;
border-right: 17px solid #ffffff;
border-top: 17px solid transparent;
position: relative;
left: 7px;
top: -34px;
}
div.hopscotch-bubble .hopscotch-bubble-arrow-container.left .hopscotch-bubble-arrow-border {
border-right: 17px solid #000000;
border-right: 17px solid rgba(0, 0, 0, 0.5);
border-bottom: 17px solid transparent;
border-top: 17px solid transparent;
}
div.hopscotch-bubble .hopscotch-bubble-arrow-container.right {
top: 10px;
right: -39px;
}
div.hopscotch-bubble .hopscotch-bubble-arrow-container.right .hopscotch-bubble-arrow {
border-bottom: 17px solid transparent;
border-left: 17px solid #ffffff;
border-top: 17px solid transparent;
position: relative;
left: -7px;
top: -34px;
}
div.hopscotch-bubble .hopscotch-bubble-arrow-container.right .hopscotch-bubble-arrow-border {
border-left: 17px solid #000000;
border-left: 17px solid rgba(0, 0, 0, 0.5);
border-bottom: 17px solid transparent;
border-top: 17px solid transparent;
}
div.hopscotch-bubble .hopscotch-actions {
margin: 10px 0 0;
text-align: right;
}

12
demo/res/css/tour.css Normal file
View File

@@ -0,0 +1,12 @@
.mct-tour {
z-index: 100;
}
.hopscotch-content a {
color: #999;
}
.hopscotch-content a {
color: #999;
}
.hopscotch-content a:hover {
color: #0099cc;
}

View File

@@ -0,0 +1,24 @@
<!--
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>
<img class="scaled" ng-src="{{model.url}}">
</div>

BIN
demo/res/img/sprite-green.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

BIN
demo/res/img/sprite-orange.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

4
demo/res/sass/image.scss Normal file
View File

@@ -0,0 +1,4 @@
.scaled {
max-width: 100%;
max-height: 100%;
}

View File

@@ -0,0 +1,87 @@
/*****************************************************************************
* 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(
[
"../../platform/features/conductor/src/ConductorRepresenter",
"../lib/hopscotch/hopscotch.min",
"./Tour.js",
"zepto"
],
function (ConductorRepresenter, hopscotch, tour, $) {
"use strict";
function DemoInitializer($timeout, representers, objectService, $location, agentService) {
function indexOf(array, callback) {
return array.reduce(function (previous, element, index) {
if (previous === -1 && callback(element)) {
return index;
} else {
return previous;
}
}, -1);
}
function removeRepresenter(type) {
var index = indexOf(representers, function (representer) {
return representer.implementation === type;
});
if (index !== -1) {
representers.splice(index, 1);
}
}
removeRepresenter(ConductorRepresenter);
objectService.getObjects([
"mine"
]).then(function (objects) {
[
"88a26104-8bd5-445d-8b57-10b567d2823d",
"f3744144-8842-4b7a-bddc-4abbf21315d9",
"a32079d0-676b-4e9f-ade7-86d5d2f152fc",
"a330490d-59ba-4c0c-b046-e5450f29f39b",
"934b199f-917e-46a2-9935-3117a9e29218",
"b171cc31-2cc5-4ae9-ba40-baf1163f22c4"
].forEach(function (id, index) {
objects['mine'].getCapability('composition').add(id, index);
});
//For default route, redirect user to layout
if ($location.path().length == 0 || $location.path() === "/") {
$location.url("browse/mine/88a26104-8bd5-445d-8b57-10b567d2823d?view=layout");
}
});
if (!agentService.isMobile() &&
!window.opener) {
$timeout(function () {
hopscotch.endTour(true);
hopscotch.startTour(tour);
}, 3000);
}
}
return DemoInitializer;
}
);

View File

@@ -21,29 +21,27 @@
*****************************************************************************/
/*global define*/
define([
'./LegacyObjectAPIInterceptor',
'legacyRegistry'
], function (
LegacyObjectAPIInterceptor,
legacyRegistry
) {
legacyRegistry.register('src/api/objects', {
name: 'Object API',
description: 'The public Objects API',
extensions: {
components: [
{
provides: "objectService",
type: "decorator",
priority: "mandatory",
implementation: LegacyObjectAPIInterceptor,
depends: [
"roots[]",
"instantiate"
]
}
]
define(
["text!../data/demo-models.json"],
function (demoModels){
"use strict";
function DemoModelProvider(){
this.demoModels = JSON.parse(demoModels);
}
});
});
DemoModelProvider.prototype.getModels = function (ids) {
var self = this,
models = {};
ids.forEach(function (id) {
if (self.demoModels[id]) {
models[id] = self.demoModels[id];
}
});
return models;
}
return DemoModelProvider;
}
);

175
demo/src/Tour.js Normal file
View File

@@ -0,0 +1,175 @@
/*****************************************************************************
* 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(
[],
function () {
"use strict";
return {
id: "hello-hopscotch",
steps: [
{
title: "Welcome to Open MCT",
content: "This brief tour will introduce you" +
" to the main elements and concepts of the application. To cancel at any time, click the 'x' in the top right of this box, or click 'Next' to continue.",
target: ".user-environ",
placement: "top",
xOffset: "center",
yOffset: "center",
arrowOffset: "100000px"
},
{
title: "Object Tree",
content: "This contains all the objects you have access to, both telemetry objects and user-created objects. ",
target: "mct-tree ul.tree",
placement: "right"
},
{
title: "View Area",
content: "This area shows the contents of a selected item. Different types of items provide different views of their contents.",
target: ".object-holder-main",
placement: "top",
xOffset: "center",
yOffset: "200px",
arrowOffset: "center"
},
{
title: "Create Button",
content: "Many objects in the application are created via this button. <b>Click it now</b> to view the Create menu, and rollover each item in the menu to see more information about it. Or, click 'Next' to continue.",
target: ".create-btn",
placement: "right",
yOffset: "-10px",
nextOnTargetClick: true
},
{
title: "Inspection Pane",
content: "This pane shows useful information about the currently selected item.",
target: ".split-pane-component.t-inspect",
placement: "left"
},
{
title: "Search",
content: "Search filters items in the Object Tree by their name. You can also filter by object type by clicking the 'down' arrow in the right side of the input.",
target: ".search-bar",
placement: "right",
yOffset: "-20px"
},
{
title: "Editing",
content: "This part of the tour will step you through editing an object. Click 'Next' to continue.",
target: ".user-environ",
placement: "top",
xOffset: "center",
yOffset: "center",
arrowOffset: "100000px"
},
{
title: "Select Object to Edit",
content: "Expand the 'My Items' folder and click on the 'Edit Display Layout Example' object to select it. Click 'Next' when you're ready to continue.",
target: "mct-tree ul.tree",
placement: "right",
yOffset: "20px"
},
{
title: "Edit Button",
content: "<b>Click this button now</b> to begin editing the current object.",
target: ".object-browse-bar .btn-bar",
placement: "bottom",
arrowOffset: "170px",
width: "200px",
xOffset: "-180px",
nextOnTargetClick: true
},
{
title: "Editing",
content: "Each type of object can be edited in different ways. This Display Layout allows you to add, position, size and remove many different types of objects. ",
target: ".user-environ",
placement: "top",
xOffset: "center",
yOffset: "center",
arrowOffset: "100000px",
nextOnTargetClick: true
},
{
title: "Adding an Object",
content: "Lets add a telemetry element into our layout. Expand 'Real-time Telemetry', then 'Rover Subsystems', then 'Thermal'. Drag 'Wheel RL Temp' into the empty space in the example layout, then click 'Next' to continue.",
target: "mct-tree ul.tree",
yOffset: "50px",
placement: "right"
},
{
title: "Positioning and Resizing",
content: "Any object in a layout can be positioned and resized. Mouse over the object, and grab a corner and drag it to make it fit in the empty spot. When youre done, click 'Next' to continue.",
target: ".user-environ",
placement: "left",
xOffset: "center",
yOffset: "200px"
},
{
title: "Elements Pool",
content: "When the Object Inspector is expanded, this " +
"area lists all objects in the current object. " +
"To remove an object, right-click it and choose 'Remove' " +
"from the context menu.",
target: ".holder-elements",
placement: "left"
},
{
title: "Saving",
content: "When you are done editing, click 'Save' to save and exit editing. To exit without saving any changes, click the 'X' button.",
target: ".t-save",
width: "200px",
placement: "bottom",
nextOnTargetClick: true
},
{
title: "Object Types",
content: "Try experimenting by creating" +
" different object types, and adding objects to them by dragging them from the tree. Only certain types of objects can be dragged into a given object type - if a type of object cant be added, it simply wont. ",
target: ".user-environ",
placement: "top",
xOffset: "center",
yOffset: "center",
arrowOffset: "100000px"
},
{
title: "Thank You",
content: "<p>Thats the end of the tour." +
" Thanks" +
" for your time, and we hope you enjoy using" +
" and contributing to Open MCT!</p> " +
" <p>To find out more about Open MCT," +
" please visit our website -<p>" +
"<a target=\"_blank\"" +
" href=\"https://nasa.github.io/openmct/\">" +
"<strong>https://nasa.github.io/openmct</strong></a>",
target: ".user-environ",
placement: "top",
xOffset: "center",
yOffset: "center",
arrowOffset: "100000px"
}
]
};
}
);

View File

@@ -0,0 +1,87 @@
/*****************************************************************************
* 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(
[],
function () {
"use strict";
/**
* A policy that will test whether a given object OR all of its
* support historical telemetry
*/
function ConductorPolicy($q) {
this.$q = $q;
}
function fastPromise(value) {
return {
then: function (callback) {
return fastPromise(callback(value));
}
}
}
function and(array) {
return array.reduce(function (previous, next) {
return previous && next;
}, true);
}
function or(array) {
return array.reduce(function (previous, next) {
return previous || next;
}, false);
}
/**
* @param {DomainObject} candidate
* @returns {Promise} a promise resolved with true if the object
* supports historical telemetry
*/
ConductorPolicy.prototype.allow = function (candidate) {
var self = this;
//Does the object itself allow the time conductor?
if (candidate.hasCapability('telemetry') && candidate.getCapability('telemetry').getMetadata().historical) {
return fastPromise(true);
} else {
//If not, do all of its constituents allow time conductor?
if (candidate.hasCapability('composition')) {
return candidate.useCapability('composition').then(function (composition) {
if (composition.length === 0 ) {
return fastPromise(false);
} else {
return self.$q.all(composition.map(self.allow.bind(self))).then(or);
}
});
} else {
//if no, hide time conductor
return fastPromise(false);
}
}
};
return ConductorPolicy;
}
);

View File

@@ -0,0 +1,40 @@
/*****************************************************************************
* 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*/
define(
[],
function () {
"use strict";
function ConductorServiceDecorator(conductorService) {
this.conductorService = conductorService;
conductorService.getConductor().displayStart(Date.UTC(2012,8,7));
}
ConductorServiceDecorator.prototype.getConductor = function () {
return this.conductorService.getConductor();
};
return ConductorServiceDecorator;
}
);

View File

@@ -0,0 +1,73 @@
/*****************************************************************************
* 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(
[
"zepto",
"./ConductorPolicy",
"../../../platform/features/conductor/src/ConductorRepresenter"
],
function ($, ConductorPolicy, ConductorRepresenter) {
"use strict";
function DemoConductorRepresenter(
$q,
$compile,
conductorService,
views,
throttle,
navigationService,
scope,
element
) {
this.scope = scope;
this.element = element;
this.views = views;
this.conductorPolicy = new ConductorPolicy($q);
this.navigationService = navigationService;
ConductorRepresenter.call(this,
throttle,
conductorService,
$compile,
views,
scope,
element);
}
DemoConductorRepresenter.prototype = Object.create(ConductorRepresenter.prototype);
DemoConductorRepresenter.prototype.represent = function (representation, representedObject) {
var self = this;
if (this.views.indexOf(representation) !== -1 && representedObject.getId() === this.navigationService.getNavigation().getId()) {
this.conductorPolicy.allow(representedObject).then(function (show) {
if (show && representation.type !== 'folder') {
ConductorRepresenter.prototype.represent.call(self, representation, representedObject);
}
});
}
};
return DemoConductorRepresenter;
});

View File

@@ -19,31 +19,31 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
// Converts all templateUrl references in bundle.js files to
// plain template references, loading said templates with the
// RequireJS text plugin.
define(
function () {
"use strict";
var glob = require('glob'),
fs = require('fs');
/**
* Policy preventing the Plot view from being made available for
* domain objects which have non-numeric telemetry.
* @implements {Policy.<View, DomainObject>}
* @constructor
* @memberof platform/features/plot
*/
function CollectionViewPolicy() {
}
function migrate(file) {
var sourceCode = fs.readFileSync(file, 'utf8'),
lines = sourceCode.split('\n')
.filter(function (line) {
return !(/^\W*['"]use strict['"];\W*$/.test(line));
})
.filter(function (line) {
return line.indexOf("/*global") !== 0;
});
fs.writeFileSync(file, lines.join('\n'));
}
CollectionViewPolicy.prototype.allow = function (view, domainObject) {
if (view.key === 'collection-view') {
return ['collection', 'msl.curiosity', 'msl.instrument'].indexOf(domainObject.getModel().type) !== -1;
}
glob('@(src|platform)/**/*.js', {}, function (err, files) {
if (err) {
console.log(err);
return;
return true;
};
return CollectionViewPolicy;
}
);
files.forEach(migrate);
});

View File

@@ -0,0 +1,162 @@
/*****************************************************************************
* 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*/
/**
* Module defining SinewaveTelemetryProvider.
* Created by vwoeltje on 11/12/14.
*
* @memberof example/generator
*/
define(
["./DemoTelemetrySeries"],
function (DemoTelemetrySeries) {
"use strict";
var SOURCE = 'demo-telemetry',
series = {};
/**
* A telemetry provider that generates sine wave data for testing
* and telemetry purposes.
* @constructor
*/
function DemoTelemetryProvider($q, $timeout) {
this.$q = $q;
this.$timeout = $timeout;
this.subscriptions = [];
this.generating = false;
}
DemoTelemetryProvider.prototype.matchesSource = function (request) {
return request.source === SOURCE;
};
DemoTelemetryProvider.prototype.doPackage = function (results) {
var packaged = {},
result = {};
results.forEach(function (result) {
packaged[result.key] = result.telemetry;
});
result[SOURCE] = packaged;
// Format as expected (sources -> keys -> telemetry)
return result;
}
/**
* Produce some data to be passed to registered subscription callbacks
* @param request
* @returns {{key: string, telemetry: DemoTelemetrySeries}}
*/
DemoTelemetryProvider.prototype.generateData = function (request) {
if (!series[request.id]){
series[request.id] = {
phaseShift: Math.random() * 2 * Math.PI,
rangeOffset: 1 + Math.random()
};
}
return {
key: request.key,
telemetry: new DemoTelemetrySeries(request, series[request.id])
};
};
/**
* Invoke callbacks on all registered subscriptions when data is
* available.
*/
DemoTelemetryProvider.prototype.handleSubscriptions = function () {
var self = this;
self.subscriptions.forEach(function (subscription) {
var requests = subscription.requests;
subscription.callback(self.doPackage(
requests.filter(self.matchesSource).map(self.generateData)
));
});
};
/**
* Will start producing telemetry @ 1hz
*/
DemoTelemetryProvider.prototype.startGenerating = function () {
var self = this;
self.generating = true;
self.$timeout(function () {
self.handleSubscriptions();
if (self.generating && self.subscriptions.length > 0) {
self.startGenerating();
} else {
self.generating = false;
}
}, 1000);
};
/**
* Request historical telemetry from this source.
* @param requests
* @returns {object} an object with the request key as the key, and
* a SinewaveTelemetrySeries as its value
*/
DemoTelemetryProvider.prototype.requestTelemetry = function (requests) {
var self = this;
return this.$timeout(function () {
return self.doPackage(requests.filter(self.matchesSource).map(self.generateData));
}, 0);
};
/**
* Subscribe to realtime telemetry
* @param callback a function to call when data is available
* @param requests all current telemetry requests (will be tested to
* see if they match this source)
* @returns {function} a function to call to unsubscribe from this
* telemetry source
*/
DemoTelemetryProvider.prototype.subscribe = function (callback, requests) {
var self = this,
subscription = {
callback: callback,
requests: requests
};
function unsubscribe() {
self.subscriptions = self.subscriptions.filter(function (s) {
return s !== subscription;
});
//Also delete series object
subscription.requests.forEach(function (request) {
delete series[request.id];
});
}
self.subscriptions.push(subscription);
if (!this.generating) {
this.startGenerating();
}
return unsubscribe;
};
return DemoTelemetryProvider;
}
);

View File

@@ -0,0 +1,72 @@
/*****************************************************************************
* 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*/
/**
* Module defining SinewaveTelemetry. Created by vwoeltje on 11/12/14.
*/
define(
[],
function () {
"use strict";
var ONE_DAY = 60 * 60 * 24,
START_TIME = Date.now(), // Now minus a day.
firstObservedTime = Math.floor(START_TIME / 1000);
/**
*
* @constructor
*/
function DemoTelemetrySeries(request, options) {
var latestTime = Math.floor(Date.now() / 1000),
count = latestTime - firstObservedTime,
period = +request.period || 30,
generatorData = {};
generatorData.getPointCount = function () {
return count;
};
generatorData.getDomainValue = function (i, domain) {
// delta uses the same numeric values as the default domain,
// so it's not checked for here, just formatted for display
// differently.
return (i) * 1000 + firstObservedTime * 1000 -
(domain === 'yesterday' ? (ONE_DAY * 1000) : 0);
};
generatorData.getRangeValue = function (i, range) {
var rangeValue = Math.sin((i) * options.phaseShift / period),
damper = 0.05,
noise = Math.random() * damper;
rangeValue += options.rangeOffset;
rangeValue += noise;
return rangeValue;
};
return generatorData;
}
return DemoTelemetrySeries;
}
);

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>

File diff suppressed because it is too large Load Diff

View File

@@ -22,7 +22,10 @@
/*global define,Promise*/
/**
* Module defining SinewaveTelemetryProvider. Created by vwoeltje on 11/12/14.
* Module defining SinewaveTelemetryProvider.
* Created by vwoeltje on 11/12/14.
*
* @memberof example/generator
*/
define(
["./SinewaveTelemetrySeries"],
@@ -30,89 +33,114 @@ define(
"use strict";
/**
*
* A telemetry provider that generates sine wave data for testing
* and telemetry purposes.
* @constructor
*/
function SinewaveTelemetryProvider($q, $timeout) {
var subscriptions = [],
generating = false;
this.$q = $q;
this.$timeout = $timeout;
this.subscriptions = [];
this.generating = false;
}
//
function matchesSource(request) {
return request.source === "generator";
}
SinewaveTelemetryProvider.prototype.doPackage = function (results) {
var packaged = {};
results.forEach(function (result) {
packaged[result.key] = result.telemetry;
});
// Format as expected (sources -> keys -> telemetry)
return { generator: packaged };
};
// Used internally; this will be repacked by doPackage
function generateData(request) {
return {
key: request.key,
telemetry: new SinewaveTelemetrySeries(request)
};
}
/**
* Produce some data to be passed to registered subscription callbacks
* @param request
* @returns {{key: string, telemetry: SinewaveTelemetrySeries}}
*/
SinewaveTelemetryProvider.prototype.generateData = function (request) {
return {
key: request.key,
telemetry: new SinewaveTelemetrySeries(request)
};
};
//
function doPackage(results) {
var packaged = {};
results.forEach(function (result) {
packaged[result.key] = result.telemetry;
});
// Format as expected (sources -> keys -> telemetry)
return { generator: packaged };
}
SinewaveTelemetryProvider.prototype.matchesSource = function (request) {
return request.source === "generator";
};
function requestTelemetry(requests) {
return $timeout(function () {
return doPackage(requests.filter(matchesSource).map(generateData));
}, 0);
}
/**
* Invoke callbacks on all registered subscriptions when data is
* available.
*/
SinewaveTelemetryProvider.prototype.handleSubscriptions = function () {
var self = this;
self.subscriptions.forEach(function (subscription) {
var requests = subscription.requests;
subscription.callback(self.doPackage(
requests.filter(self.matchesSource).map(self.generateData)
));
});
};
function handleSubscriptions() {
subscriptions.forEach(function (subscription) {
var requests = subscription.requests;
subscription.callback(doPackage(
requests.filter(matchesSource).map(generateData)
));
});
}
/**
* Will start producing telemetry every second
*/
SinewaveTelemetryProvider.prototype.startGenerating = function () {
var self = this;
self.generating = true;
self.$timeout(function () {
self.handleSubscriptions();
if (self.generating && self.subscriptions.length > 0) {
self.startGenerating();
} else {
self.generating = false;
}
}, 1000);
};
function startGenerating() {
generating = true;
$timeout(function () {
handleSubscriptions();
if (generating && subscriptions.length > 0) {
startGenerating();
} else {
generating = false;
}
}, 1000);
}
/**
* Request historical telemetry from this source.
* @param requests
* @returns {object} an object with the request key as the key, and
* a SinewaveTelemetrySeries as its value
*/
SinewaveTelemetryProvider.prototype.requestTelemetry = function (requests) {
var self = this;
return this.$timeout(function () {
return self.doPackage(requests.filter(self.matchesSource).map(self.generateData));
}, 0);
};
function subscribe(callback, requests) {
var subscription = {
/**
* Subscribe to realtime telemetry
* @param callback a function to call when data is available
* @param requests all current telemetry requests (will be tested to
* see if they match this source)
* @returns {function} a function to call to unsubscribe from this
* telemetry source
*/
SinewaveTelemetryProvider.prototype.subscribe = function (callback, requests) {
var self = this,
subscription = {
callback: callback,
requests: requests
};
function unsubscribe() {
subscriptions = subscriptions.filter(function (s) {
return s !== subscription;
});
}
subscriptions.push(subscription);
if (!generating) {
startGenerating();
}
return unsubscribe;
function unsubscribe() {
self.subscriptions = self.subscriptions.filter(function (s) {
return s !== subscription;
});
}
return {
requestTelemetry: requestTelemetry,
subscribe: subscribe
};
}
self.subscriptions.push(subscription);
if (!this.generating) {
this.startGenerating();
}
return unsubscribe;
};
return SinewaveTelemetryProvider;
}

View File

@@ -30,11 +30,31 @@ define(
"use strict";
var firstObservedTime = Date.now(),
images = [
/*images = [
"http://www.nasa.gov/393811main_Palomar_ao_bouchez_10s_after_impact_4x3_946-710.png",
"http://www.nasa.gov/393821main_Palomar_ao_bouchez_15s_after_impact_4x3_946-710.png",
"http://www.nasa.gov/images/content/393801main_CfhtVeillet2_4x3_516-387.jpg",
"http://www.nasa.gov/images/content/392790main_1024_768_GeminiNorth_NightBeforeImpact_946-710.jpg"
"http://www.nasa.gov/images/content/392790main_1024_768_GeminiNorth_NightBeforeImpact_946-710.jpg"*/
images = [
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18731.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18732.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18733.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18734.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18735.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18736.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18737.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18738.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18739.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18740.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18741.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18742.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18743.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18744.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18745.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18746.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18747.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18748.jpg"
].map(function (url, index) {
return {
timestamp: firstObservedTime + 1000 * index,

View File

@@ -71,7 +71,7 @@ define([
"constants": [
{
"key": "REMS_WS_URL",
"value": "/proxyUrl?url=http://cab.inta-csic.es/rems/wp-content/plugins/marsweather-widget/api.php"
"value": "https://openmct-demo.herokuapp.com/proxyUrl?url=http://cab.inta-csic.es/rems/wp-content/plugins/marsweather-widget/api.php"
}
],
"roots": [

View File

@@ -44,31 +44,31 @@ define(
{
"name": "Min. Air Temperature",
"identifier": "min_temp",
"units": "degrees",
"units": "Degrees (C)",
"type": "float"
},
{
"name": "Max. Air Temperature",
"identifier": "max_temp",
"units": "degrees",
"units": "Degrees (C)",
"type": "float"
},
{
"name": "Atmospheric Pressure",
"identifier": "pressure",
"units": "pascals",
"units": "Millibars",
"type": "float"
},
{
"name": "Min. Ground Temperature",
"identifier": "min_gts_temp",
"units": "degrees",
"units": "Degrees (C)",
"type": "float"
},
{
"name": "Max. Ground Temperature",
"identifier": "max_gts_temp",
"units": "degrees",
"units": "Degrees (C)",
"type": "float"
}
]

View File

@@ -45,14 +45,14 @@ 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,
historical: true,
ranges: [{
key: "value",
name: measurement.units,
@@ -63,24 +63,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,9 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* Open MCT, Copyright (c) 2014-2016, 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
* Open MCT 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.
@@ -14,7 +14,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* Open MCT 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.
@@ -44,12 +44,18 @@ define(
*/
function RemsTelemetryServerAdapter($q, $http, $log, REMS_WS_URL) {
this.localDataURI = module.uri.substring(0, module.uri.lastIndexOf('/') + 1) + LOCAL_DATA;
this.deferreds = {};
this.REMS_WS_URL = REMS_WS_URL;
this.$q = $q;
this.$http = $http;
this.$log = $log;
this.cache = undefined;
this.dataTransforms = {
//Convert from pascals to millibars
'pressure': function pascalsToMillibars(pascals) {
return pascals / 100;
}
};
}
/**
@@ -64,16 +70,12 @@ define(
* @private
*/
RemsTelemetryServerAdapter.prototype.requestHistory = function(request) {
var self = this,
id = request.key,
deferred = this.$q.defer();
var self = this;
var id = request.key;
var dataTransforms = this.dataTransforms;
function processResponse(response){
var data = [];
/*
* Currently all data is returned for entire history of the mission. Cache response to avoid unnecessary re-queries.
*/
self.cache = response;
/*
* History data is organised by Sol. Iterate over sols...
*/
@@ -82,13 +84,14 @@ define(
* Check that valid data exists
*/
if (!isNaN(solData[id])) {
var dataTransform = dataTransforms[id];
/*
* Append each data point to the array of values
* for this data point property (min. temp, etc).
*/
data.unshift({
date: Date.parse(solData[TERRESTRIAL_DATE]),
value: solData[id]
value: dataTransform ? dataTransform(solData[id]) : solData[id]
});
}
});
@@ -109,18 +112,40 @@ define(
});
}
function packageAndResolve(results){
deferred.resolve({id: id, values: results});
function packageResults(results){
return {id: id, values: results};
}
this.$q.when(this.cache || this.$http.get(this.REMS_WS_URL))
return this.request()
.catch(fallbackToLocal)
.then(processResponse)
.then(filterResults)
.then(packageAndResolve);
.then(packageResults);
};
return deferred.promise;
/**
* Sends a request for data, or uses local cache (if available).
* Allows only one HTTP request at a time.
* @private
* @returns {Function|promise}
*/
RemsTelemetryServerAdapter.prototype.request = function () {
var self = this;
if (this.requestDeferred) {
return this.requestDeferred.promise;
} else {
this.requestDeferred = this.$q.defer();
this.$q.when(this.cache || this.$http.get(this.REMS_WS_URL))
.then(function(response){
self.cache = response;
self.requestDeferred.resolve(response);
self.requestDeferred = undefined;
return response;
})
.catch(this.requestDeferred.reject);
return this.requestDeferred.promise;
}
};
/**

View File

@@ -35,20 +35,18 @@ var gulp = require('gulp'),
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',
dist: 'dist',
assets: 'dist/assets',
scss: ['./platform/**/*.scss', './example/**/*.scss'],
scss: ['./platform/**/*.scss', './example/**/*.scss', './demo/**/*.scss'],
scripts: [ 'main.js', 'platform/**/*.js', 'src/**/*.js' ],
specs: [ 'platform/**/*Spec.js', 'src/**/*Spec.js' ],
static: [
'index.html',
'platform/**/*',
'example/**/*',
'demo/**/*',
'bower_components/**/*'
]
},
@@ -103,15 +101,8 @@ gulp.task('stylesheets', function () {
});
gulp.task('lint', function () {
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'));
});
@@ -147,6 +138,6 @@ gulp.task('develop', ['serve', 'stylesheets', 'watch']);
gulp.task('install', [ 'static', 'scripts' ]);
gulp.task('verify', [ 'lint', 'test', 'checkstyle' ]);
gulp.task('verify', [ 'lint', 'test' ]);
gulp.task('build', [ 'verify', 'install' ]);

View File

@@ -31,19 +31,27 @@
<script type="text/javascript">
require(['main'], function (mct) {
require([
'./tutorials/grootprovider/groots',
'./tutorials/todo/todo',
'./tutorials/todo/bundle',
'./example/imagery/bundle',
'./example/eventGenerator/bundle',
'./example/generator/bundle',
], function (grootify, todoPlugin) {
grootify(mct);
todoPlugin(mct);
mct.start();
})
'./example/msl/bundle',
'./demo/bundle',
], mct.run.bind(mct));
});
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-76951009-1', 'auto');
ga('send', 'pageview', '/live_demo');
window.addEventListener('hashchange', function () {
ga('send', 'pageview', '/live_demo' + window.location.hash.slice(1));
});
</script>
<link rel="stylesheet" href="platform/commonUI/general/res/css/startup-base.css">
<link rel="stylesheet" href="platform/commonUI/general/res/css/openmct.css">
<link rel="icon" type="image/png" href="platform/commonUI/general/res/images/favicons/favicon-32x32.png" sizes="32x32">

36
main.js
View File

@@ -1,9 +1,9 @@
/*****************************************************************************
* Open MCT Web, Copyright (c) 2014-2015, United States Government
* Open MCT, Copyright (c) 2014-2016, 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
* Open MCT 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.
@@ -14,7 +14,7 @@
* License for the specific language governing permissions and limitations
* under the License.
*
* Open MCT Web includes source code licensed under additional open source
* Open MCT 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.
@@ -27,26 +27,21 @@ requirejs.config({
"angular": "bower_components/angular/angular.min",
"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",
"es6-promise": "bower_components/es6-promise/es6-promise.min",
"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"
"zepto": "bower_components/zepto/zepto.min"
},
"shim": {
"angular": {
"exports": "angular"
},
"angular-route": {
"deps": ["angular"]
},
"EventEmitter": {
"exports": "EventEmitter"
"deps": [ "angular" ]
},
"moment-duration-format": {
"deps": ["moment"]
@@ -63,7 +58,6 @@ requirejs.config({
define([
'./platform/framework/src/Main',
'legacyRegistry',
'./src/MCT',
'./platform/framework/bundle',
'./platform/core/bundle',
@@ -89,6 +83,7 @@ define([
'./platform/features/plot/bundle',
'./platform/features/timeline/bundle',
'./platform/features/table/bundle',
'./platform/features/conductor/bundle',
'./platform/forms/bundle',
'./platform/identity/bundle',
'./platform/persistence/aggregator/bundle',
@@ -99,14 +94,11 @@ define([
'./platform/search/bundle',
'./platform/status/bundle',
'./platform/commonUI/regions/bundle'
], function (Main, legacyRegistry, MCT) {
var mct = new MCT();
mct.legacyRegistry = legacyRegistry;
mct.run = mct.start;
mct.on('start', function () {
return new Main().run(legacyRegistry);
});
return mct;
], function (Main, legacyRegistry) {
return {
legacyRegistry: legacyRegistry,
run: function () {
return new Main().run(legacyRegistry);
}
};
});

View File

@@ -1,6 +1,6 @@
{
"name": "openmct",
"version": "0.10.2-SNAPSHOT",
"version": "0.10.1-SNAPSHOT",
"description": "The Open MCT core platform",
"dependencies": {
"express": "^4.13.1",
@@ -34,7 +34,6 @@
"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",

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*/
define([
"text!./res/templates/about-dialog.html",
@@ -47,6 +48,7 @@ define([
licensesExportMdTemplate,
legacyRegistry
) {
"use strict";
legacyRegistry.register("platform/commonUI/about", {
"name": "About Open MCT Web",

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,19 +19,29 @@
* 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/create/locator.html",
"text!./res/templates/browse-object.html",
"text!./res/templates/create/create-button.html",
"text!./res/templates/create/create-menu.html",
"text!./res/templates/items/grid-item.html",
"text!./res/templates/browse/object-header.html",
"text!./res/templates/menu-arrow.html",
@@ -44,14 +54,23 @@ define([
BrowseController,
PaneController,
BrowseObjectController,
CreateMenuController,
LocatorController,
MenuArrowController,
NavigationService,
CreationPolicy,
NavigateAction,
NewTabAction,
FullscreenAction,
CreateActionProvider,
AddActionProvider,
CreationService,
WindowTitler,
browseTemplate,
locatorTemplate,
browseObjectTemplate,
createButtonTemplate,
createMenuTemplate,
gridItemTemplate,
objectHeaderTemplate,
menuArrowTemplate,
@@ -61,6 +80,7 @@ define([
inspectorRegionTemplate,
legacyRegistry
) {
"use strict";
legacyRegistry.register("platform/commonUI/browse", {
"extensions": {
@@ -118,6 +138,22 @@ define([
"$route"
]
},
{
"key": "CreateMenuController",
"implementation": CreateMenuController,
"depends": [
"$scope"
]
},
{
"key": "LocatorController",
"implementation": LocatorController,
"depends": [
"$scope",
"$timeout",
"objectService"
]
},
{
"key": "MenuArrowController",
"implementation": MenuArrowController,
@@ -126,6 +162,12 @@ define([
]
}
],
"controls": [
{
"key": "locator",
"template": locatorTemplate
}
],
"representations": [
{
"key": "view-object",
@@ -141,6 +183,17 @@ define([
"view"
]
},
{
"key": "create-button",
"template": createButtonTemplate
},
{
"key": "create-menu",
"template": createMenuTemplate,
"uses": [
"action"
]
},
{
"key": "grid-item",
"template": gridItemTemplate,
@@ -193,6 +246,12 @@ define([
"implementation": NavigationService
}
],
"policies": [
{
"implementation": CreationPolicy,
"category": "creation"
}
],
"actions": [
{
"key": "navigate",
@@ -245,6 +304,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

@@ -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

@@ -19,14 +19,18 @@
* 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'
],
function (GestureConstants) {
"use strict";
var ROOT_ID = "ROOT";
@@ -41,13 +45,13 @@ define(
* @constructor
*/
function BrowseController(
$scope,
$route,
$location,
$window,
objectService,
navigationService,
urlService,
$scope,
$route,
$location,
$window,
objectService,
navigationService,
urlService,
policyService,
defaultPath
) {
@@ -80,12 +84,12 @@ define(
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) {
policyService.allow("navigation", $scope.navigatedObject, domainObject, function(message){
navigationAllowed = $window.confirm(message + "\r\n\r\n" +
" Are you sure you want to continue?");
});

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";
/**
* Controller for the `browse-object` representation of a domain
@@ -33,7 +35,7 @@ define(
function BrowseObjectController($scope, $location, $route) {
var navigatedObject;
function setViewForDomainObject(domainObject) {
var locationViewKey = $location.search().view;
function selectViewIfMatching(view) {
@@ -70,7 +72,7 @@ define(
$scope.$watch('domainObject', setViewForDomainObject);
$scope.$watch('representation.selected.key', updateQueryParam);
$scope.doAction = function (action) {
$scope.doAction = function (action){
return $scope[action] && $scope[action]();
};

View File

@@ -19,12 +19,14 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define,window*/
define(
[
'../../regions/src/Region'
],
function (Region) {
"use strict";
/**
* Defines the a default Inspector region. Captured in a class to
@@ -45,7 +47,7 @@ define(
/**
* @private
*/
InspectorRegion.prototype.buildRegion = function () {
InspectorRegion.prototype.buildRegion = function() {
var metadataRegion = {
name: 'metadata',
title: 'Metadata Region',

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,13 +83,13 @@ 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);
}
@@ -99,7 +101,7 @@ define(
});
}
function addToParent(populatedObject) {
function addToParent (populatedObject) {
parentObject.getCapability('composition').add(populatedObject);
return persistAndReturn(parentObject);
}
@@ -125,7 +127,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

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,6 +27,7 @@
define(
["../src/BrowseController"],
function (BrowseController) {
"use strict";
describe("The browse controller", function () {
var mockScope,
@@ -78,12 +80,12 @@ define(
mockScope = jasmine.createSpyObj(
"$scope",
["$on", "$watch"]
[ "$on", "$watch" ]
);
mockRoute = { current: { params: {} } };
mockLocation = jasmine.createSpyObj(
"$location",
["path"]
[ "path" ]
);
mockUrlService = jasmine.createSpyObj(
"urlService",
@@ -91,7 +93,7 @@ define(
);
mockObjectService = jasmine.createSpyObj(
"objectService",
["getObjects"]
[ "getObjects" ]
);
mockNavigationService = jasmine.createSpyObj(
"navigationService",
@@ -104,15 +106,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({
@@ -255,7 +257,7 @@ define(
" object", function () {
mockScope.navigatedObject = mockDomainObject;
mockWindow.confirm.andReturn(false);
mockPolicyService.allow.andCallFake(function (category, object, context, callback) {
mockPolicyService.allow.andCallFake(function(category, object, context, callback){
callback("unsaved changes");
return false;
});

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*/
/**
* MCTIncudeSpec. Created by vwoeltje on 11/6/14.
@@ -26,6 +27,7 @@
define(
["../src/InspectorRegion"],
function (InspectorRegion) {
"use strict";
describe("The inspector region", function () {
var inspectorRegion;
@@ -40,4 +42,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*/
/**
* 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;

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,6 +19,7 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*global define*/
define([
"./src/DialogService",
@@ -43,6 +44,7 @@ define([
overlayTemplate,
legacyRegistry
) {
"use strict";
legacyRegistry.register("platform/commonUI/dialog", {
"extensions": {

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

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";
// Template to inject into the DOM to show the dialog; really just points to
// the a specific template that can be included via mct-include

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*/
/**
* MCTIncudeSpec. Created by vwoeltje on 11/6/14.
@@ -26,6 +27,7 @@
define(
["../src/DialogService"],
function (DialogService) {
"use strict";
describe("The dialog service", function () {
var mockOverlayService,
@@ -38,23 +40,23 @@ define(
beforeEach(function () {
mockOverlayService = jasmine.createSpyObj(
"overlayService",
["createOverlay"]
[ "createOverlay" ]
);
mockQ = jasmine.createSpyObj(
"$q",
["defer"]
[ "defer" ]
);
mockLog = jasmine.createSpyObj(
"$log",
["warn", "info", "debug"]
[ "warn", "info", "debug" ]
);
mockOverlay = jasmine.createSpyObj(
"overlay",
["dismiss"]
[ "dismiss" ]
);
mockDeferred = jasmine.createSpyObj(
"deferred",
["resolve", "reject"]
[ "resolve", "reject"]
);
mockDeferred.promise = "mock promise";
@@ -120,7 +122,7 @@ define(
});
it("invokes the overlay service with the correct parameters when" +
" a blocking dialog is requested", function () {
" a blocking dialog is requested", function() {
var dialogModel = {};
expect(dialogService.showBlockingMessage(dialogModel)).toBe(true);
expect(mockOverlayService.createOverlay).toHaveBeenCalledWith(

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*/
/**
* MCTIncudeSpec. Created by vwoeltje on 11/6/14.
@@ -26,6 +27,7 @@
define(
["../src/OverlayService"],
function (OverlayService) {
"use strict";
describe("The overlay service", function () {
var mockDocument,
@@ -38,13 +40,13 @@ define(
overlayService;
beforeEach(function () {
mockDocument = jasmine.createSpyObj("$document", ["find"]);
mockDocument = jasmine.createSpyObj("$document", [ "find" ]);
mockCompile = jasmine.createSpy("$compile");
mockRootScope = jasmine.createSpyObj("$rootScope", ["$new"]);
mockBody = jasmine.createSpyObj("body", ["prepend"]);
mockRootScope = jasmine.createSpyObj("$rootScope", [ "$new" ]);
mockBody = jasmine.createSpyObj("body", [ "prepend" ]);
mockTemplate = jasmine.createSpy("template");
mockElement = jasmine.createSpyObj("element", ["remove"]);
mockScope = jasmine.createSpyObj("scope", ["$destroy"]);
mockElement = jasmine.createSpyObj("element", [ "remove" ]);
mockScope = jasmine.createSpyObj("scope", [ "$destroy" ]);
mockDocument.find.andReturn(mockBody);
mockCompile.andReturn(mockTemplate);
@@ -96,4 +98,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*/
define([
"./src/controllers/EditActionController",
@@ -26,7 +27,7 @@ define([
"./src/controllers/ElementsController",
"./src/controllers/EditObjectController",
"./src/directives/MCTBeforeUnload",
"./src/actions/EditAndComposeAction",
"./src/actions/LinkAction",
"./src/actions/EditAction",
"./src/actions/PropertiesAction",
"./src/actions/RemoveAction",
@@ -40,18 +41,6 @@ define([
"./src/policies/EditContextualActionPolicy",
"./src/representers/EditRepresenter",
"./src/representers/EditToolbarRepresenter",
"./src/capabilities/EditorCapability",
"./src/capabilities/TransactionCapabilityDecorator",
"./src/services/TransactionService",
"./src/creation/CreateMenuController",
"./src/creation/LocatorController",
"./src/creation/CreationPolicy",
"./src/creation/CreateActionProvider",
"./src/creation/AddActionProvider",
"./src/creation/CreationService",
"text!./res/templates/create/locator.html",
"text!./res/templates/create/create-button.html",
"text!./res/templates/create/create-menu.html",
"text!./res/templates/library.html",
"text!./res/templates/edit-object.html",
"text!./res/templates/edit-action-buttons.html",
@@ -64,7 +53,7 @@ define([
ElementsController,
EditObjectController,
MCTBeforeUnload,
EditAndComposeAction,
LinkAction,
EditAction,
PropertiesAction,
RemoveAction,
@@ -78,18 +67,6 @@ define([
EditContextualActionPolicy,
EditRepresenter,
EditToolbarRepresenter,
EditorCapability,
TransactionCapabilityDecorator,
TransactionService,
CreateMenuController,
LocatorController,
CreationPolicy,
CreateActionProvider,
AddActionProvider,
CreationService,
locatorTemplate,
createButtonTemplate,
createMenuTemplate,
libraryTemplate,
editObjectTemplate,
editActionButtonsTemplate,
@@ -97,6 +74,7 @@ define([
topbarEditTemplate,
legacyRegistry
) {
"use strict";
legacyRegistry.register("platform/commonUI/edit", {
"extensions": {
@@ -130,22 +108,6 @@ define([
"$location",
"policyService"
]
},
{
"key": "CreateMenuController",
"implementation": CreateMenuController,
"depends": [
"$scope"
]
},
{
"key": "LocatorController",
"implementation": LocatorController,
"depends": [
"$scope",
"$timeout",
"objectService"
]
}
],
"directives": [
@@ -160,7 +122,7 @@ define([
"actions": [
{
"key": "compose",
"implementation": EditAndComposeAction
"implementation": LinkAction
},
{
"key": "edit",
@@ -168,7 +130,8 @@ define([
"depends": [
"$location",
"navigationService",
"$log"
"$log",
"$q"
],
"description": "Edit this object.",
"category": "view-control",
@@ -230,7 +193,10 @@ define([
"implementation": CancelAction,
"name": "Cancel",
"description": "Discard changes made to these objects.",
"depends": []
"depends": [
"$injector",
"navigationService"
]
}
],
"policies": [
@@ -253,13 +219,10 @@ define([
},
{
"category": "navigation",
"message": "Continuing will cause the loss of any unsaved changes.",
"message": "There are unsaved changes.",
"implementation": EditNavigationPolicy
},
{
"implementation": CreationPolicy,
"category": "creation"
}
],
"templates": [
{
@@ -298,73 +261,8 @@ define([
{
"key": "topbar-edit",
"template": topbarEditTemplate
},
{
"key": "create-button",
"template": createButtonTemplate
},
{
"key": "create-menu",
"template": createMenuTemplate,
"uses": [
"action"
]
}
],
"components": [
{
"type": "decorator",
"provides": "capabilityService",
"implementation": TransactionCapabilityDecorator,
"depends": [
"$q",
"transactionService"
],
"priority": "fallback"
},
{
"type": "provider",
"provides": "transactionService",
"implementation": TransactionService,
"depends": [
"$q",
"$log"
]
},
{
"key": "CreateActionProvider",
"provides": "actionService",
"type": "provider",
"implementation": CreateActionProvider,
"depends": [
"typeService",
"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"
]
}
],
"representers": [
{
"implementation": EditRepresenter,
@@ -379,30 +277,13 @@ define([
],
"constants": [
{
"key": "editModeBlacklist",
"key":"editModeBlacklist",
"value": ["copy", "follow", "window", "link", "locate"]
},
{
"key": "nonEditContextBlacklist",
"value": ["copy", "follow", "properties", "move", "link", "remove", "locate"]
}
],
"capabilities": [
{
"key": "editor",
"name": "Editor Capability",
"description": "Provides transactional editing capabilities",
"implementation": EditorCapability,
"depends": [
"transactionService"
]
}
],
"controls": [
{
"key": "locator",
"template": locatorTemplate
}
]
}
});

View File

@@ -26,7 +26,7 @@
</mct-include>
<div class="flex-elem grows vscroll">
<ul class="tree">
<li ng-repeat="containedObject in composition | filter:searchElements">
<li ng-repeat="containedObject in composition | filter:searchText">
<span class="tree-item">
<mct-representation
class="rep-object-label"

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';
/**
* The "Cancel" action; the action triggered by clicking Cancel from
@@ -31,8 +33,10 @@ define(
* @memberof platform/commonUI/edit
* @implements {Action}
*/
function CancelAction(context) {
function CancelAction($injector, navigationService, context) {
this.domainObject = context.domainObject;
this.navigationService = navigationService;
this.objectService = $injector.get('objectService');
}
/**
@@ -42,25 +46,30 @@ define(
* cancellation has completed
*/
CancelAction.prototype.perform = function () {
var domainObject = this.domainObject;
var domainObject = this.domainObject,
self = this;
function returnToBrowse() {
var parent;
//If the object existed already, navigate to refresh view
// with previous object state.
if (domainObject.getModel().persisted) {
domainObject.getCapability("action").perform("navigate");
} else {
//If the object was new, and user has cancelled, then
//navigate back to parent because nothing to show.
domainObject.getCapability("location").getOriginal().then(function (original) {
parent = original.getCapability("context").getParent();
parent.getCapability("action").perform("navigate");
});
}
// Look up the object's "editor.completion" capability;
// this is introduced by EditableDomainObject which is
// used to insulate underlying objects from changes made
// during editing.
function getEditorCapability() {
return domainObject.getCapability("editor");
}
return this.domainObject.getCapability("editor").cancel()
// Invoke any save behavior introduced by the editor.completion
// capability.
function doCancel(editor) {
return editor.cancel();
}
//Discard current 'editable' object, and retrieve original
// un-edited object.
function returnToBrowse() {
return self.navigationService.setNavigation(self.domainObject.getOriginalObject());
}
return doCancel(getEditorCapability())
.then(returnToBrowse);
};
@@ -73,8 +82,7 @@ define(
CancelAction.appliesTo = function (context) {
var domainObject = (context || {}).domainObject;
return domainObject !== undefined &&
domainObject.hasCapability('editor') &&
domainObject.getCapability('editor').isEditContextRoot();
domainObject.hasCapability("editor");
};
return CancelAction;

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,Promise*/
/**
* Module defining EditAction. Created by vwoeltje on 11/14/14.
*/
define(
[],
function () {
['../objects/EditableDomainObject'],
function (EditableDomainObject) {
"use strict";
// A no-op action to return in the event that the action cannot
// be completed.
@@ -44,7 +46,7 @@ define(
* @constructor
* @implements {Action}
*/
function EditAction($location, navigationService, $log, context) {
function EditAction($location, navigationService, $log, $q, context) {
var domainObject = (context || {}).domainObject;
// We cannot enter Edit mode if we have no domain object to
@@ -63,6 +65,7 @@ define(
this.domainObject = domainObject;
this.$location = $location;
this.navigationService = navigationService;
this.$q = $q;
}
/**
@@ -70,18 +73,25 @@ define(
*/
EditAction.prototype.perform = function () {
var self = this;
function cancelEditing() {
self.domainObject.getCapability('editor').cancel();
self.navigationService.removeListener(cancelEditing);
}
//If this is not the currently navigated object, then navigate
// to it.
if (this.navigationService.getNavigation() !== this.domainObject) {
this.navigationService.setNavigation(this.domainObject);
if (!this.domainObject.hasCapability("editor")) {
//TODO: This is only necessary because the drop gesture is
// wrapping the object itself, need to refactor this later.
// All responsibility for switching into edit mode should be
// in the edit action, and not duplicated in the gesture
this.domainObject = new EditableDomainObject(this.domainObject, this.$q);
}
this.navigationService.setNavigation(this.domainObject);
this.domainObject.getCapability('status').set('editing', true);
//Register a listener to automatically cancel this edit action
//if the user navigates away from this object.
function cancelEditing(navigatedTo){
if (!navigatedTo || navigatedTo.getId() !== self.domainObject.getId()) {
self.domainObject.getCapability('editor').cancel();
self.navigationService.removeListener(cancelEditing);
}
}
this.navigationService.addListener(cancelEditing);
this.domainObject.useCapability("editor");
};
/**
@@ -92,13 +102,11 @@ define(
*/
EditAction.appliesTo = function (context) {
var domainObject = (context || {}).domainObject,
type = domainObject && domainObject.getCapability('type');
type = domainObject && domainObject.getCapability('type'),
isEditMode = domainObject && domainObject.getDomainObject ? true : false;
// Only allow editing of types that support it and are not already
// being edited
return type && type.hasFeature('creation') &&
domainObject.hasCapability('editor') &&
!domainObject.getCapability('editor').isEditContextRoot();
// Only allow creatable types to be edited
return type && type.hasFeature('creation') && !isEditMode;
};
return EditAction;

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";
/**
@@ -31,14 +33,13 @@ define(
* @memberof platform/commonUI/edit
* @implements {Action}
*/
function EditAndComposeAction(context) {
function LinkAction(context) {
this.domainObject = (context || {}).domainObject;
this.selectedObject = (context || {}).selectedObject;
}
EditAndComposeAction.prototype.perform = function () {
var self = this,
editAction = this.domainObject.getCapability('action').getActions("edit")[0];
LinkAction.prototype.perform = function () {
var self = this;
// Persist changes to the domain object
function doPersist() {
@@ -55,13 +56,9 @@ define(
.then(doPersist);
}
if (editAction) {
editAction.perform();
}
return this.selectedObject && doLink();
};
return EditAndComposeAction;
return LinkAction;
}
);

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*/
/**
* Edit the properties of a domain object. Shows a dialog
@@ -28,6 +29,7 @@
define(
['./PropertiesDialog'],
function (PropertiesDialog) {
'use strict';
/**
* Implements the "Edit Properties" action, which prompts the user
@@ -63,10 +65,10 @@ define(
});
}
function showDialog(objType) {
function showDialog(type) {
// Create a dialog object to generate the form structure, etc.
var dialog =
new PropertiesDialog(objType, domainObject.getModel());
new PropertiesDialog(type, domainObject.getModel());
// Show the dialog
return dialogService.getUserInput(

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';
/**
* Construct a new Properties dialog.

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