mirror of
https://github.com/nasa/openmct.git
synced 2024-12-23 23:12:23 +00:00
linting fixes
This commit is contained in:
commit
33c37ebf19
@ -11,12 +11,12 @@ jobs:
|
||||
name: Update npm
|
||||
command: 'sudo npm install -g npm@latest'
|
||||
- restore_cache:
|
||||
key: dependency-cache-13-{{ checksum "package.json" }}
|
||||
key: dependency-cache-{{ checksum "package.json" }}
|
||||
- run:
|
||||
name: Installing dependencies (npm install)
|
||||
command: npm install
|
||||
- save_cache:
|
||||
key: dependency-cache-13-{{ checksum "package.json" }}
|
||||
key: dependency-cache-{{ checksum "package.json" }}
|
||||
paths:
|
||||
- node_modules
|
||||
- run:
|
||||
|
103
.eslintrc.js
103
.eslintrc.js
@ -120,6 +120,91 @@ module.exports = {
|
||||
"no-useless-computed-key": "error",
|
||||
// https://eslint.org/docs/rules/rest-spread-spacing
|
||||
"rest-spread-spacing": ["error"],
|
||||
// https://eslint.org/docs/rules/no-var
|
||||
"no-var": "error",
|
||||
// https://eslint.org/docs/rules/one-var
|
||||
"one-var": ["error", "never"],
|
||||
// https://eslint.org/docs/rules/default-case-last
|
||||
"default-case-last": "error",
|
||||
// https://eslint.org/docs/rules/default-param-last
|
||||
"default-param-last": "error",
|
||||
// https://eslint.org/docs/rules/grouped-accessor-pairs
|
||||
"grouped-accessor-pairs": "error",
|
||||
// https://eslint.org/docs/rules/no-constructor-return
|
||||
"no-constructor-return": "error",
|
||||
// https://eslint.org/docs/rules/array-callback-return
|
||||
"array-callback-return": "error",
|
||||
// https://eslint.org/docs/rules/no-invalid-this
|
||||
"no-invalid-this": "error", // Believe this one actually surfaces some bugs
|
||||
// https://eslint.org/docs/rules/func-style
|
||||
"func-style": ["error", "declaration"],
|
||||
// https://eslint.org/docs/rules/no-unused-expressions
|
||||
"no-unused-expressions": "error",
|
||||
// https://eslint.org/docs/rules/no-useless-concat
|
||||
"no-useless-concat": "error",
|
||||
// https://eslint.org/docs/rules/radix
|
||||
"radix": "error",
|
||||
// https://eslint.org/docs/rules/require-await
|
||||
"require-await": "error",
|
||||
// https://eslint.org/docs/rules/no-alert
|
||||
"no-alert": "error",
|
||||
// https://eslint.org/docs/rules/no-useless-constructor
|
||||
"no-useless-constructor": "error",
|
||||
// https://eslint.org/docs/rules/no-duplicate-imports
|
||||
"no-duplicate-imports": "error",
|
||||
|
||||
// https://eslint.org/docs/rules/no-implicit-coercion
|
||||
"no-implicit-coercion": "error",
|
||||
//https://eslint.org/docs/rules/no-unneeded-ternary
|
||||
"no-unneeded-ternary": "error",
|
||||
// https://eslint.org/docs/rules/semi
|
||||
"semi": ["error", "always"],
|
||||
// https://eslint.org/docs/rules/no-multi-spaces
|
||||
"no-multi-spaces": "error",
|
||||
// https://eslint.org/docs/rules/key-spacing
|
||||
"key-spacing": ["error", {
|
||||
"afterColon": true
|
||||
}],
|
||||
// https://eslint.org/docs/rules/keyword-spacing
|
||||
"keyword-spacing": ["error", {
|
||||
"before": true,
|
||||
"after": true
|
||||
}],
|
||||
// https://eslint.org/docs/rules/comma-spacing
|
||||
// Also requires one line code fix
|
||||
"comma-spacing": ["error", {
|
||||
"after": true
|
||||
}],
|
||||
//https://eslint.org/docs/rules/no-whitespace-before-property
|
||||
"no-whitespace-before-property": "error",
|
||||
// https://eslint.org/docs/rules/object-curly-newline
|
||||
"object-curly-newline": ["error", {"consistent": true, "multiline": true}],
|
||||
// https://eslint.org/docs/rules/object-property-newline
|
||||
"object-property-newline": "error",
|
||||
// https://eslint.org/docs/rules/brace-style
|
||||
"brace-style": "error",
|
||||
// https://eslint.org/docs/rules/no-multiple-empty-lines
|
||||
"no-multiple-empty-lines": ["error", {"max": 1}],
|
||||
// https://eslint.org/docs/rules/operator-linebreak
|
||||
"operator-linebreak": ["error", "before", {"overrides": {"=": "after"}}],
|
||||
// https://eslint.org/docs/rules/padding-line-between-statements
|
||||
"padding-line-between-statements":["error", {
|
||||
"blankLine": "always",
|
||||
"prev": "multiline-block-like",
|
||||
"next": "*"
|
||||
}, {
|
||||
"blankLine": "always",
|
||||
"prev": "*",
|
||||
"next": "return"
|
||||
}],
|
||||
// https://eslint.org/docs/rules/space-infix-ops
|
||||
"space-infix-ops": "error",
|
||||
// https://eslint.org/docs/rules/space-unary-ops
|
||||
"space-unary-ops": ["error", {"words": true, "nonwords": false}],
|
||||
// https://eslint.org/docs/rules/arrow-spacing
|
||||
"arrow-spacing": "error",
|
||||
// https://eslint.org/docs/rules/semi-spacing
|
||||
"semi-spacing": ["error", {"before": false, "after": true}],
|
||||
|
||||
"vue/html-indent": [
|
||||
"error",
|
||||
@ -151,28 +236,24 @@ module.exports = {
|
||||
}
|
||||
}],
|
||||
"vue/multiline-html-element-content-newline": "off",
|
||||
"vue/singleline-html-element-content-newline": "off"
|
||||
"vue/singleline-html-element-content-newline": "off",
|
||||
|
||||
},
|
||||
"overrides": [
|
||||
{
|
||||
"files": ["*Spec.js"],
|
||||
"files": LEGACY_FILES,
|
||||
"rules": {
|
||||
"no-unused-vars": [
|
||||
"warn",
|
||||
{
|
||||
"vars": "all",
|
||||
"args": "none",
|
||||
"varsIgnorePattern": "controller",
|
||||
|
||||
"varsIgnorePattern": "controller"
|
||||
}
|
||||
]
|
||||
}
|
||||
}, {
|
||||
"files": LEGACY_FILES,
|
||||
"rules": {
|
||||
// https://eslint.org/docs/rules/no-nested-ternary
|
||||
],
|
||||
"no-nested-ternary": "off",
|
||||
"no-var": "off"
|
||||
"no-var": "off",
|
||||
"one-var": "off"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2020, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
"./src/EventTelemetryProvider"
|
||||
@ -29,7 +28,7 @@ define([
|
||||
"use strict";
|
||||
|
||||
return {
|
||||
name:"example/eventGenerator",
|
||||
name: "example/eventGenerator",
|
||||
definition: {
|
||||
"name": "Event Message Generator",
|
||||
"description": "For development use. Creates sample event message data that mimics a live data stream.",
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2020, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define */
|
||||
|
||||
/**
|
||||
* Module defining EventTelemetry.
|
||||
@ -44,13 +43,14 @@ define(
|
||||
};
|
||||
|
||||
generatorData.getDomainValue = function (i, domain) {
|
||||
return i * interval +
|
||||
(domain !== 'delta' ? firstObservedTime : 0);
|
||||
return i * interval
|
||||
+ (domain !== 'delta' ? firstObservedTime : 0);
|
||||
};
|
||||
|
||||
generatorData.getRangeValue = function (i, range) {
|
||||
var domainDelta = this.getDomainValue(i) - firstObservedTime,
|
||||
ind = i % messages.length;
|
||||
|
||||
return messages[ind] + " - [" + domainDelta.toString() + "]";
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,Promise*/
|
||||
|
||||
/**
|
||||
* Module defining EventTelemetryProvider. Created by chacskaylo on 06/18/2015.
|
||||
@ -57,6 +56,7 @@ define(
|
||||
results.forEach(function (result) {
|
||||
packaged[result.key] = result.telemetry;
|
||||
});
|
||||
|
||||
// Format as expected (sources -> keys -> telemetry)
|
||||
return { eventGenerator: packaged };
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
* 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';
|
||||
@ -76,13 +75,14 @@ define([], function () {
|
||||
copyRangesToRow(row, i);
|
||||
rows.push(row);
|
||||
}
|
||||
|
||||
exportService.exportCSV(rows, { headers: headers });
|
||||
});
|
||||
};
|
||||
|
||||
ExportTelemetryAsCSVAction.appliesTo = function (context) {
|
||||
return context.domainObject &&
|
||||
context.domainObject.hasCapability("telemetry");
|
||||
return context.domainObject
|
||||
&& context.domainObject.hasCapability("telemetry");
|
||||
};
|
||||
|
||||
return ExportTelemetryAsCSVAction;
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
'./ExportTelemetryAsCSVAction'
|
||||
@ -27,7 +26,7 @@ define([
|
||||
"use strict";
|
||||
|
||||
return {
|
||||
name:"example/export",
|
||||
name: "example/export",
|
||||
definition: {
|
||||
"name": "Example of using CSV Export",
|
||||
"extensions": {
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
"./src/ExampleFormController"
|
||||
@ -29,7 +28,7 @@ define([
|
||||
"use strict";
|
||||
|
||||
return {
|
||||
name:"example/forms",
|
||||
name: "example/forms",
|
||||
definition: {
|
||||
"name": "Declarative Forms example",
|
||||
"sources": "src",
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2020, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,window*/
|
||||
|
||||
define(
|
||||
[],
|
||||
@ -80,7 +79,7 @@ define(
|
||||
control: "button",
|
||||
csslass: "icon-save",
|
||||
click: function () {
|
||||
window.alert("Save");
|
||||
console.log("Save");
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -88,7 +87,7 @@ define(
|
||||
csslass: "icon-x",
|
||||
description: "Button B",
|
||||
click: function () {
|
||||
window.alert("Cancel");
|
||||
console.log("Cancel");
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -97,7 +96,7 @@ define(
|
||||
description: "Button C",
|
||||
disabled: true,
|
||||
click: function () {
|
||||
window.alert("Delete");
|
||||
console.log("Delete");
|
||||
}
|
||||
}
|
||||
]
|
||||
@ -152,10 +151,22 @@ define(
|
||||
name: "Choose something",
|
||||
control: "select",
|
||||
options: [
|
||||
{ name: "Hats", value: "hats" },
|
||||
{ name: "Bats", value: "bats" },
|
||||
{ name: "Cats", value: "cats" },
|
||||
{ name: "Mats", value: "mats" }
|
||||
{
|
||||
name: "Hats",
|
||||
value: "hats"
|
||||
},
|
||||
{
|
||||
name: "Bats",
|
||||
value: "bats"
|
||||
},
|
||||
{
|
||||
name: "Cats",
|
||||
value: "cats"
|
||||
},
|
||||
{
|
||||
name: "Mats",
|
||||
value: "mats"
|
||||
}
|
||||
],
|
||||
key: "aChoice"
|
||||
},
|
||||
@ -164,10 +175,22 @@ define(
|
||||
control: "select",
|
||||
required: true,
|
||||
options: [
|
||||
{ name: "Hats", value: "hats" },
|
||||
{ name: "Bats", value: "bats" },
|
||||
{ name: "Cats", value: "cats" },
|
||||
{ name: "Mats", value: "mats" }
|
||||
{
|
||||
name: "Hats",
|
||||
value: "hats"
|
||||
},
|
||||
{
|
||||
name: "Bats",
|
||||
value: "bats"
|
||||
},
|
||||
{
|
||||
name: "Cats",
|
||||
value: "cats"
|
||||
},
|
||||
{
|
||||
name: "Mats",
|
||||
value: "mats"
|
||||
}
|
||||
],
|
||||
key: "aRequiredChoice"
|
||||
}
|
||||
|
@ -110,14 +110,14 @@ define([
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function GeneratorMetadataProvider() {
|
||||
|
||||
}
|
||||
|
||||
GeneratorMetadataProvider.prototype.supportsMetadata = function (domainObject) {
|
||||
return METADATA_BY_TYPE.hasOwnProperty(domainObject.type);
|
||||
return Object.prototype.hasOwnProperty.call(METADATA_BY_TYPE, domainObject.type);
|
||||
};
|
||||
|
||||
GeneratorMetadataProvider.prototype.getMetadata = function (domainObject) {
|
||||
|
@ -62,18 +62,22 @@ define([
|
||||
var workerRequest = {};
|
||||
|
||||
props.forEach(function (prop) {
|
||||
if (domainObject.telemetry && domainObject.telemetry.hasOwnProperty(prop)) {
|
||||
if (domainObject.telemetry && Object.prototype.hasOwnProperty.call(domainObject.telemetry, prop)) {
|
||||
workerRequest[prop] = domainObject.telemetry[prop];
|
||||
}
|
||||
if (request && request.hasOwnProperty(prop)) {
|
||||
|
||||
if (request && Object.prototype.hasOwnProperty.call(request, prop)) {
|
||||
workerRequest[prop] = request[prop];
|
||||
}
|
||||
if (!workerRequest.hasOwnProperty(prop)) {
|
||||
|
||||
if (!Object.prototype.hasOwnProperty.call(workerRequest, prop)) {
|
||||
workerRequest[prop] = REQUEST_DEFAULTS[prop];
|
||||
}
|
||||
|
||||
workerRequest[prop] = Number(workerRequest[prop]);
|
||||
});
|
||||
workerRequest.name = domainObject.name;
|
||||
|
||||
return workerRequest;
|
||||
};
|
||||
|
||||
@ -81,11 +85,13 @@ define([
|
||||
var workerRequest = this.makeWorkerRequest(domainObject, request);
|
||||
workerRequest.start = request.start;
|
||||
workerRequest.end = request.end;
|
||||
|
||||
return this.workerInterface.request(workerRequest);
|
||||
};
|
||||
|
||||
GeneratorProvider.prototype.subscribe = function (domainObject, callback) {
|
||||
var workerRequest = this.makeWorkerRequest(domainObject, {});
|
||||
|
||||
return this.workerInterface.subscribe(workerRequest, callback);
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
|
||||
@ -78,12 +77,15 @@ define([
|
||||
if (datum[range] > RED[range]) {
|
||||
return LIMITS.rh;
|
||||
}
|
||||
|
||||
if (datum[range] < -RED[range]) {
|
||||
return LIMITS.rl;
|
||||
}
|
||||
|
||||
if (datum[range] > YELLOW[range]) {
|
||||
return LIMITS.yh;
|
||||
}
|
||||
|
||||
if (datum[range] < -YELLOW[range]) {
|
||||
return LIMITS.yl;
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ define([
|
||||
var interval = setInterval(function () {
|
||||
var now = Date.now();
|
||||
var datum = pointForTimestamp(now, duration, domainObject.name);
|
||||
datum.value += "";
|
||||
datum.value = String(datum.value);
|
||||
callback(datum);
|
||||
}, duration);
|
||||
|
||||
@ -57,7 +57,6 @@ define([
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
StateGeneratorProvider.prototype.supportsRequest = function (domainObject, options) {
|
||||
return domainObject.type === 'example.state-generator';
|
||||
};
|
||||
@ -69,11 +68,13 @@ define([
|
||||
if (options.strategy === 'latest' || options.size === 1) {
|
||||
start = end;
|
||||
}
|
||||
|
||||
var data = [];
|
||||
while (start <= end && data.length < 5000) {
|
||||
data.push(pointForTimestamp(start, duration, domainObject.name));
|
||||
start += duration;
|
||||
}
|
||||
|
||||
return Promise.resolve(data);
|
||||
};
|
||||
|
||||
|
@ -72,13 +72,16 @@ define([
|
||||
});
|
||||
var messageId;
|
||||
|
||||
let self = this;
|
||||
function callback(message) {
|
||||
if (message.error) {
|
||||
deferred.reject(message.error);
|
||||
} else {
|
||||
deferred.resolve(message.data);
|
||||
}
|
||||
delete this.callbacks[messageId];
|
||||
|
||||
delete self.callbacks[messageId];
|
||||
|
||||
}
|
||||
|
||||
messageId = this.dispatch('request', request, callback.bind(this));
|
||||
@ -101,8 +104,5 @@ define([
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
return WorkerInterface;
|
||||
});
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2017, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2020, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -20,8 +20,6 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/*global self*/
|
||||
|
||||
(function () {
|
||||
|
||||
var FIFTEEN_MINUTES = 15 * 60 * 1000;
|
||||
@ -64,13 +62,14 @@
|
||||
data: {
|
||||
name: data.name,
|
||||
utc: nextStep,
|
||||
yesterday: nextStep - 60*60*24*1000,
|
||||
yesterday: nextStep - 60 * 60 * 24 * 1000,
|
||||
sin: sin(nextStep, data.period, data.amplitude, data.offset, data.phase, data.randomness),
|
||||
cos: cos(nextStep, data.period, data.amplitude, data.offset, data.phase, data.randomness)
|
||||
}
|
||||
});
|
||||
nextStep += step;
|
||||
}
|
||||
|
||||
return nextStep;
|
||||
}
|
||||
|
||||
@ -87,6 +86,7 @@
|
||||
if (request.end === undefined) {
|
||||
request.end = Date.now();
|
||||
}
|
||||
|
||||
if (request.start === undefined) {
|
||||
request.start = request.end - FIFTEEN_MINUTES;
|
||||
}
|
||||
@ -110,11 +110,12 @@
|
||||
data.push({
|
||||
name: request.name,
|
||||
utc: nextStep,
|
||||
yesterday: nextStep - 60*60*24*1000,
|
||||
yesterday: nextStep - 60 * 60 * 24 * 1000,
|
||||
sin: sin(nextStep, period, amplitude, offset, phase, randomness),
|
||||
cos: cos(nextStep, period, amplitude, offset, phase, randomness)
|
||||
});
|
||||
}
|
||||
|
||||
self.postMessage({
|
||||
id: message.id,
|
||||
data: data
|
||||
@ -122,13 +123,13 @@
|
||||
}
|
||||
|
||||
function cos(timestamp, period, amplitude, offset, phase, randomness) {
|
||||
return amplitude *
|
||||
Math.cos(phase + (timestamp / period / 1000 * Math.PI * 2)) + (amplitude * Math.random() * randomness) + offset;
|
||||
return amplitude
|
||||
* Math.cos(phase + (timestamp / period / 1000 * Math.PI * 2)) + (amplitude * Math.random() * randomness) + offset;
|
||||
}
|
||||
|
||||
function sin(timestamp, period, amplitude, offset, phase, randomness) {
|
||||
return amplitude *
|
||||
Math.sin(phase + (timestamp / period / 1000 * Math.PI * 2)) + (amplitude * Math.random() * randomness) + offset;
|
||||
return amplitude
|
||||
* Math.sin(phase + (timestamp / period / 1000 * Math.PI * 2)) + (amplitude * Math.random() * randomness) + offset;
|
||||
}
|
||||
|
||||
function sendError(error, message) {
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
"./GeneratorProvider",
|
||||
@ -56,7 +55,7 @@ define([
|
||||
initialize: function (object) {
|
||||
object.telemetry = {
|
||||
duration: 5
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
"./src/ExampleIdentityService"
|
||||
@ -29,7 +28,7 @@ define([
|
||||
"use strict";
|
||||
|
||||
return {
|
||||
name:"example/identity",
|
||||
name: "example/identity",
|
||||
definition: {
|
||||
"extensions": {
|
||||
"components": [
|
||||
|
@ -19,32 +19,35 @@
|
||||
* 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";
|
||||
|
||||
var DEFAULT_IDENTITY = { key: "user", name: "Example User" },
|
||||
var DEFAULT_IDENTITY = {
|
||||
key: "user",
|
||||
name: "Example User"
|
||||
},
|
||||
DIALOG_STRUCTURE = {
|
||||
name: "Identify Yourself",
|
||||
sections: [{ rows: [
|
||||
{
|
||||
name: "User ID",
|
||||
control: "textfield",
|
||||
key: "key",
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: "Human name",
|
||||
control: "textfield",
|
||||
key: "name",
|
||||
required: true
|
||||
}
|
||||
]}]
|
||||
sections: [{
|
||||
rows: [
|
||||
{
|
||||
name: "User ID",
|
||||
control: "textfield",
|
||||
key: "key",
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: "Human name",
|
||||
control: "textfield",
|
||||
key: "name",
|
||||
required: true
|
||||
}
|
||||
]
|
||||
}]
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Example implementation of an identity service. This prompts the
|
||||
* user to enter a name and user ID; in a more realistic
|
||||
@ -77,14 +80,14 @@ define(
|
||||
*/
|
||||
ExampleIdentityProvider.prototype.returnUser = function (user) {
|
||||
return this.user = user;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
ExampleIdentityProvider.prototype.returnUndefined = function () {
|
||||
return undefined;
|
||||
}
|
||||
};
|
||||
|
||||
return ExampleIdentityProvider;
|
||||
}
|
||||
|
@ -85,28 +85,28 @@ define([
|
||||
data.push(pointForTimestamp(start, domainObject.name));
|
||||
start += 5000;
|
||||
}
|
||||
|
||||
return Promise.resolve(data);
|
||||
}
|
||||
};
|
||||
|
||||
var ladProvider = {
|
||||
supportsRequest: function (domainObject, options) {
|
||||
return domainObject.type === 'example.imagery' &&
|
||||
options.strategy === 'latest';
|
||||
return domainObject.type === 'example.imagery'
|
||||
&& options.strategy === 'latest';
|
||||
},
|
||||
request: function (domainObject, options) {
|
||||
return Promise.resolve([pointForTimestamp(Date.now(), domainObject.name)]);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return function install(openmct) {
|
||||
openmct.types.addType('example.imagery', {
|
||||
key: 'example.imagery',
|
||||
name: 'Example Imagery',
|
||||
cssClass: 'icon-image',
|
||||
description: 'For development use. Creates example imagery ' +
|
||||
'data that mimics a live imagery stream.',
|
||||
description: 'For development use. Creates example imagery '
|
||||
+ 'data that mimics a live imagery stream.',
|
||||
creatable: true,
|
||||
initialize: function (object) {
|
||||
object.telemetry = {
|
||||
@ -140,7 +140,7 @@ define([
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -19,13 +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";
|
||||
|
||||
return {
|
||||
name:"example/mobile",
|
||||
name: "example/mobile",
|
||||
definition: {
|
||||
"name": "Mobile",
|
||||
"description": "Allows elements with pertinence to mobile usage and development",
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
"./src/RemsTelemetryServerAdapter",
|
||||
@ -31,14 +30,15 @@ define([
|
||||
RemsTelemetryProvider
|
||||
) {
|
||||
"use strict";
|
||||
|
||||
return {
|
||||
name:"example/msl",
|
||||
name: "example/msl",
|
||||
definition: {
|
||||
"name" : "Mars Science Laboratory Data Adapter",
|
||||
"extensions" : {
|
||||
"name": "Mars Science Laboratory Data Adapter",
|
||||
"extensions": {
|
||||
"types": [
|
||||
{
|
||||
"name":"Mars Science Laboratory",
|
||||
"name": "Mars Science Laboratory",
|
||||
"key": "msl.curiosity",
|
||||
"cssClass": "icon-object"
|
||||
},
|
||||
@ -89,7 +89,7 @@ define([
|
||||
],
|
||||
"services": [
|
||||
{
|
||||
"key":"rems.adapter",
|
||||
"key": "rems.adapter",
|
||||
"implementation": RemsTelemetryServerAdapter,
|
||||
"depends": ["$http", "$log", "REMS_WS_URL"]
|
||||
}
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
@ -38,7 +37,7 @@ define(
|
||||
"identifier": "msl",
|
||||
"instruments": [
|
||||
{
|
||||
"name":"rems",
|
||||
"name": "rems",
|
||||
"identifier": "rems",
|
||||
"measurements": [
|
||||
{
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
function () {
|
||||
@ -81,6 +80,7 @@ define(
|
||||
(dictionary.instruments || []).forEach(function (instrument) {
|
||||
addInstrument(instrument, "msl:curiosity");
|
||||
});
|
||||
|
||||
return models;
|
||||
}
|
||||
|
||||
@ -90,6 +90,7 @@ define(
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
return RemsTelemetryModelProvider;
|
||||
}
|
||||
);
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define */
|
||||
define (
|
||||
['./RemsTelemetrySeries'],
|
||||
function (RemsTelemetrySeries) {
|
||||
@ -74,6 +73,7 @@ define (
|
||||
RemsTelemetryProvider.prototype.subscribe = function (callback, requests) {
|
||||
return function () {};
|
||||
};
|
||||
|
||||
RemsTelemetryProvider.prototype.unsubscribe = function (callback, requests) {
|
||||
return function () {};
|
||||
};
|
||||
|
@ -19,7 +19,6 @@
|
||||
* 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";
|
||||
@ -57,6 +56,7 @@ define(
|
||||
RemsTelemetrySeries.prototype.getPointCount = function () {
|
||||
return this.data.length;
|
||||
};
|
||||
|
||||
/**
|
||||
* The domain value at the given index. The Rems telemetry data is
|
||||
* time ordered, so the domain value is the time stamp of each data
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
/*jslint es5: true */
|
||||
|
||||
define(
|
||||
@ -95,28 +94,32 @@ define(
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function fallbackToLocal() {
|
||||
self.$log.warn("Loading REMS data failed, probably due to" +
|
||||
" cross origin policy. Falling back to local data");
|
||||
self.$log.warn("Loading REMS data failed, probably due to"
|
||||
+ " cross origin policy. Falling back to local data");
|
||||
|
||||
return self.$http.get(self.localDataURI);
|
||||
}
|
||||
|
||||
//Filter results to match request parameters
|
||||
function filterResults(results) {
|
||||
return results.filter(function (result) {
|
||||
return result.date >= (request.start || Number.MIN_VALUE) &&
|
||||
result.date <= (request.end || Number.MAX_VALUE);
|
||||
return result.date >= (request.start || Number.MIN_VALUE)
|
||||
&& result.date <= (request.end || Number.MAX_VALUE);
|
||||
});
|
||||
}
|
||||
|
||||
function packageAndResolve(results) {
|
||||
return {id: id, values: results};
|
||||
return {
|
||||
id: id,
|
||||
values: results
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
return (this.promise = this.promise || this.$http.get(this.REMS_WS_URL))
|
||||
.catch(fallbackToLocal)
|
||||
.then(processResponse)
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
"./src/DialogLaunchController",
|
||||
@ -39,7 +38,7 @@ define([
|
||||
"use strict";
|
||||
|
||||
return {
|
||||
name:"example/notifications",
|
||||
name: "example/notifications",
|
||||
definition: {
|
||||
"extensions": {
|
||||
"templates": [
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
@ -91,7 +90,6 @@ define(
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
Demonstrates launching an error dialog
|
||||
*/
|
||||
@ -132,9 +130,9 @@ define(
|
||||
var dialog,
|
||||
model = {
|
||||
title: "Info Dialog Example",
|
||||
actionText: "This is an example of a blocking info" +
|
||||
" dialog. This dialog can be used to draw the user's" +
|
||||
" attention to an event.",
|
||||
actionText: "This is an example of a blocking info"
|
||||
+ " dialog. This dialog can be used to draw the user's"
|
||||
+ " attention to an event.",
|
||||
severity: "info",
|
||||
primaryOption: {
|
||||
label: "OK",
|
||||
@ -153,6 +151,7 @@ define(
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
return DialogLaunchController;
|
||||
}
|
||||
);
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,window*/
|
||||
|
||||
define(
|
||||
[],
|
||||
@ -42,9 +41,11 @@ define(
|
||||
DialogLaunchIndicator.prototype.getGlyphClass = function () {
|
||||
return 'ok';
|
||||
};
|
||||
|
||||
DialogLaunchIndicator.prototype.getText = function () {
|
||||
return "Launch test dialog";
|
||||
};
|
||||
|
||||
DialogLaunchIndicator.prototype.getDescription = function () {
|
||||
return "Launch test dialog";
|
||||
};
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
@ -48,7 +47,8 @@ define(
|
||||
"Eros turpis, pulvinar turpis eros eu",
|
||||
"Lundium nascetur a, lectus montes ac, parturient in natoque, duis risus risus pulvinar pid rhoncus, habitasse auctor natoque!"
|
||||
];
|
||||
return actionTexts[Math.floor(Math.random()*3)];
|
||||
|
||||
return actionTexts[Math.floor(Math.random() * 3)];
|
||||
}
|
||||
|
||||
/**
|
||||
@ -61,6 +61,7 @@ define(
|
||||
severity: "error"
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Launch a new notification with a severity of 'Alert'.
|
||||
*/
|
||||
@ -73,7 +74,6 @@ define(
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Launch a new notification with a progress bar that is updated
|
||||
* periodically, tracking an ongoing process.
|
||||
@ -93,10 +93,10 @@ define(
|
||||
* @param notification
|
||||
*/
|
||||
function incrementProgress() {
|
||||
progress = Math.min(100, Math.floor(progress + Math.random() * 30))
|
||||
let progressText = ["Estimated time" +
|
||||
" remaining:" +
|
||||
" about ", 60 - Math.floor((progress / 100) * 60), " seconds"].join(" ");
|
||||
progress = Math.min(100, Math.floor(progress + Math.random() * 30));
|
||||
let progressText = ["Estimated time"
|
||||
+ " remaining:"
|
||||
+ " about ", 60 - Math.floor((progress / 100) * 60), " seconds"].join(" ");
|
||||
notification.progress(progress, progressText);
|
||||
|
||||
if (progress < 100) {
|
||||
@ -120,6 +120,7 @@ define(
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
return NotificationLaunchController;
|
||||
}
|
||||
);
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define,window*/
|
||||
|
||||
define(
|
||||
[],
|
||||
@ -42,9 +41,11 @@ define(
|
||||
NotificationLaunchIndicator.prototype.getGlyphClass = function () {
|
||||
return 'ok';
|
||||
};
|
||||
|
||||
NotificationLaunchIndicator.prototype.getText = function () {
|
||||
return "Launch notification";
|
||||
};
|
||||
|
||||
NotificationLaunchIndicator.prototype.getDescription = function () {
|
||||
return "Launch notification";
|
||||
};
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
"./src/BrowserPersistenceProvider"
|
||||
@ -29,7 +28,7 @@ define([
|
||||
"use strict";
|
||||
|
||||
return {
|
||||
name:"example/persistence",
|
||||
name: "example/persistence",
|
||||
definition: {
|
||||
"extensions": {
|
||||
"components": [
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
/**
|
||||
* Stubbed implementation of a persistence provider,
|
||||
@ -30,8 +29,6 @@ define(
|
||||
function () {
|
||||
'use strict';
|
||||
|
||||
|
||||
|
||||
function BrowserPersistenceProvider($q, SPACE) {
|
||||
var spaces = SPACE ? [SPACE] : [],
|
||||
caches = {},
|
||||
@ -51,6 +48,7 @@ define(
|
||||
},
|
||||
listObjects: function (space) {
|
||||
var cache = caches[space];
|
||||
|
||||
return promises.as(
|
||||
cache ? Object.keys(cache) : null
|
||||
);
|
||||
@ -68,6 +66,7 @@ define(
|
||||
},
|
||||
readObject: function (space, key) {
|
||||
var cache = caches[space];
|
||||
|
||||
return promises.as(
|
||||
cache ? cache[key] : null
|
||||
);
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
"./src/ExamplePolicy"
|
||||
@ -29,7 +28,7 @@ define([
|
||||
"use strict";
|
||||
|
||||
return {
|
||||
name:"example/policy",
|
||||
name: "example/policy",
|
||||
definition: {
|
||||
"name": "Example Policy",
|
||||
"description": "Provides an example of using policies to prohibit actions.",
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
@ -37,6 +36,7 @@ define(
|
||||
model = (domainObject && domainObject.getModel()) || {},
|
||||
name = model.name || "",
|
||||
metadata = action.getMetadata() || {};
|
||||
|
||||
return metadata.key !== 'remove' || name.indexOf('foo') < 0;
|
||||
}
|
||||
};
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
"./src/WatchIndicator",
|
||||
@ -31,7 +30,7 @@ define([
|
||||
"use strict";
|
||||
|
||||
return {
|
||||
name:"example/profiling",
|
||||
name: "example/profiling",
|
||||
definition: {
|
||||
"extensions": {
|
||||
"indicators": [
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define([
|
||||
"./src/ScratchPersistenceProvider"
|
||||
@ -29,7 +28,7 @@ define([
|
||||
"use strict";
|
||||
|
||||
return {
|
||||
name:"example/scratchpad",
|
||||
name: "example/scratchpad",
|
||||
definition: {
|
||||
"extensions": {
|
||||
"roots": [
|
||||
|
@ -20,8 +20,6 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
/*global define,window*/
|
||||
|
||||
define(
|
||||
[],
|
||||
function () {
|
||||
@ -54,13 +52,14 @@ define(
|
||||
if (space === 'scratch') {
|
||||
this.table[key] = JSON.stringify(value);
|
||||
}
|
||||
|
||||
return this.$q.when(space === 'scratch');
|
||||
};
|
||||
|
||||
ScratchPersistenceProvider.prototype.readObject = function (space, key) {
|
||||
return this.$q.when(
|
||||
(space === 'scratch' && this.table[key]) ?
|
||||
JSON.parse(this.table[key]) : undefined
|
||||
(space === 'scratch' && this.table[key])
|
||||
? JSON.parse(this.table[key]) : undefined
|
||||
);
|
||||
};
|
||||
|
||||
@ -68,6 +67,7 @@ define(
|
||||
if (space === 'scratch') {
|
||||
delete this.table[key];
|
||||
}
|
||||
|
||||
return this.$q.when(space === 'scratch');
|
||||
};
|
||||
|
||||
|
@ -7,9 +7,9 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
msg: 'Hello world!'
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
|
@ -17,6 +17,7 @@ function SimpleVuePlugin() {
|
||||
},
|
||||
view: function (domainObject) {
|
||||
var vm;
|
||||
|
||||
return {
|
||||
show: function (container) {
|
||||
vm = new Vue(HelloWorld);
|
||||
@ -29,7 +30,7 @@ function SimpleVuePlugin() {
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
export default SimpleVuePlugin
|
||||
export default SimpleVuePlugin;
|
||||
|
@ -22,31 +22,111 @@ define([
|
||||
menusTemplate
|
||||
) {
|
||||
return {
|
||||
name:"example/styleguide",
|
||||
name: "example/styleguide",
|
||||
definition: {
|
||||
"name": "Open MCT Style Guide",
|
||||
"description": "Examples and documentation illustrating UI styles in use in Open MCT.",
|
||||
"extensions":
|
||||
{
|
||||
"types": [
|
||||
{ "key": "styleguide.intro", "name": "Introduction", "cssClass": "icon-page", "description": "Introduction and overview to the style guide" },
|
||||
{ "key": "styleguide.standards", "name": "Standards", "cssClass": "icon-page", "description": "" },
|
||||
{ "key": "styleguide.colors", "name": "Colors", "cssClass": "icon-page", "description": "" },
|
||||
{ "key": "styleguide.status", "name": "status", "cssClass": "icon-page", "description": "Limits, telemetry paused, etc." },
|
||||
{ "key": "styleguide.glyphs", "name": "Glyphs", "cssClass": "icon-page", "description": "Glyphs overview" },
|
||||
{ "key": "styleguide.controls", "name": "Controls", "cssClass": "icon-page", "description": "Buttons, selects, HTML controls" },
|
||||
{ "key": "styleguide.input", "name": "Text Inputs", "cssClass": "icon-page", "description": "Various text inputs" },
|
||||
{ "key": "styleguide.menus", "name": "Menus", "cssClass": "icon-page", "description": "Context menus, dropdowns" }
|
||||
{
|
||||
"key": "styleguide.intro",
|
||||
"name": "Introduction",
|
||||
"cssClass": "icon-page",
|
||||
"description": "Introduction and overview to the style guide"
|
||||
},
|
||||
{
|
||||
"key": "styleguide.standards",
|
||||
"name": "Standards",
|
||||
"cssClass": "icon-page",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"key": "styleguide.colors",
|
||||
"name": "Colors",
|
||||
"cssClass": "icon-page",
|
||||
"description": ""
|
||||
},
|
||||
{
|
||||
"key": "styleguide.status",
|
||||
"name": "status",
|
||||
"cssClass": "icon-page",
|
||||
"description": "Limits, telemetry paused, etc."
|
||||
},
|
||||
{
|
||||
"key": "styleguide.glyphs",
|
||||
"name": "Glyphs",
|
||||
"cssClass": "icon-page",
|
||||
"description": "Glyphs overview"
|
||||
},
|
||||
{
|
||||
"key": "styleguide.controls",
|
||||
"name": "Controls",
|
||||
"cssClass": "icon-page",
|
||||
"description": "Buttons, selects, HTML controls"
|
||||
},
|
||||
{
|
||||
"key": "styleguide.input",
|
||||
"name": "Text Inputs",
|
||||
"cssClass": "icon-page",
|
||||
"description": "Various text inputs"
|
||||
},
|
||||
{
|
||||
"key": "styleguide.menus",
|
||||
"name": "Menus",
|
||||
"cssClass": "icon-page",
|
||||
"description": "Context menus, dropdowns"
|
||||
}
|
||||
],
|
||||
"views": [
|
||||
{ "key": "styleguide.intro", "type": "styleguide.intro", "template": introTemplate, "editable": false },
|
||||
{ "key": "styleguide.standards", "type": "styleguide.standards", "template": standardsTemplate, "editable": false },
|
||||
{ "key": "styleguide.colors", "type": "styleguide.colors", "template": colorsTemplate, "editable": false },
|
||||
{ "key": "styleguide.status", "type": "styleguide.status", "template": statusTemplate, "editable": false },
|
||||
{ "key": "styleguide.glyphs", "type": "styleguide.glyphs", "template": glyphsTemplate, "editable": false },
|
||||
{ "key": "styleguide.controls", "type": "styleguide.controls", "template": controlsTemplate, "editable": false },
|
||||
{ "key": "styleguide.input", "type": "styleguide.input", "template": inputTemplate, "editable": false },
|
||||
{ "key": "styleguide.menus", "type": "styleguide.menus", "template": menusTemplate, "editable": false }
|
||||
{
|
||||
"key": "styleguide.intro",
|
||||
"type": "styleguide.intro",
|
||||
"template": introTemplate,
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": "styleguide.standards",
|
||||
"type": "styleguide.standards",
|
||||
"template": standardsTemplate,
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": "styleguide.colors",
|
||||
"type": "styleguide.colors",
|
||||
"template": colorsTemplate,
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": "styleguide.status",
|
||||
"type": "styleguide.status",
|
||||
"template": statusTemplate,
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": "styleguide.glyphs",
|
||||
"type": "styleguide.glyphs",
|
||||
"template": glyphsTemplate,
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": "styleguide.controls",
|
||||
"type": "styleguide.controls",
|
||||
"template": controlsTemplate,
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": "styleguide.input",
|
||||
"type": "styleguide.input",
|
||||
"template": inputTemplate,
|
||||
"editable": false
|
||||
},
|
||||
{
|
||||
"key": "styleguide.menus",
|
||||
"type": "styleguide.menus",
|
||||
"template": menusTemplate,
|
||||
"editable": false
|
||||
}
|
||||
],
|
||||
"roots": [
|
||||
{
|
||||
@ -56,7 +136,7 @@ define([
|
||||
"models": [
|
||||
{
|
||||
"id": "styleguide:home",
|
||||
"priority" : "preferred",
|
||||
"priority": "preferred",
|
||||
"model": {
|
||||
"type": "folder",
|
||||
"name": "Style Guide Home",
|
||||
@ -73,7 +153,7 @@ define([
|
||||
},
|
||||
{
|
||||
"id": "styleguide:ui-elements",
|
||||
"priority" : "preferred",
|
||||
"priority": "preferred",
|
||||
"model": {
|
||||
"type": "folder",
|
||||
"name": "UI Elements",
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
@ -30,14 +29,46 @@ define(
|
||||
var pages = {};
|
||||
|
||||
// Add pages
|
||||
pages.intro = { name: "Introduction", type: "styleguide.intro", location: "styleguide:home" };
|
||||
pages.standards = { name: "Standards", type: "styleguide.standards", location: "styleguide:home" };
|
||||
pages.colors = { name: "Colors", type: "styleguide.colors", location: "styleguide:home" };
|
||||
pages.glyphs = { name: "Glyphs", type: "styleguide.glyphs", location: "styleguide:home" };
|
||||
pages.status = { name: "Status Indication", type: "styleguide.status", location: "styleguide:home" };
|
||||
pages.controls = { name: "Controls", type: "styleguide.controls", location: "styleguide:ui-elements" };
|
||||
pages.input = { name: "Text Inputs", type: "styleguide.input", location: "styleguide:ui-elements" };
|
||||
pages.menus = { name: "Menus", type: "styleguide.menus", location: "styleguide:ui-elements" };
|
||||
pages.intro = {
|
||||
name: "Introduction",
|
||||
type: "styleguide.intro",
|
||||
location: "styleguide:home"
|
||||
};
|
||||
pages.standards = {
|
||||
name: "Standards",
|
||||
type: "styleguide.standards",
|
||||
location: "styleguide:home"
|
||||
};
|
||||
pages.colors = {
|
||||
name: "Colors",
|
||||
type: "styleguide.colors",
|
||||
location: "styleguide:home"
|
||||
};
|
||||
pages.glyphs = {
|
||||
name: "Glyphs",
|
||||
type: "styleguide.glyphs",
|
||||
location: "styleguide:home"
|
||||
};
|
||||
pages.status = {
|
||||
name: "Status Indication",
|
||||
type: "styleguide.status",
|
||||
location: "styleguide:home"
|
||||
};
|
||||
pages.controls = {
|
||||
name: "Controls",
|
||||
type: "styleguide.controls",
|
||||
location: "styleguide:ui-elements"
|
||||
};
|
||||
pages.input = {
|
||||
name: "Text Inputs",
|
||||
type: "styleguide.input",
|
||||
location: "styleguide:ui-elements"
|
||||
};
|
||||
pages.menus = {
|
||||
name: "Menus",
|
||||
type: "styleguide.menus",
|
||||
location: "styleguide:ui-elements"
|
||||
};
|
||||
|
||||
return {
|
||||
getModels: function () {
|
||||
@ -46,6 +77,6 @@ define(
|
||||
};
|
||||
}
|
||||
|
||||
return ExampleStyleGuideModelProvider
|
||||
return ExampleStyleGuideModelProvider;
|
||||
}
|
||||
);
|
||||
|
3
indexTest.js
Normal file
3
indexTest.js
Normal file
@ -0,0 +1,3 @@
|
||||
const testsContext = require.context('.', true, /\/(src|platform)\/.*Spec.js$/);
|
||||
|
||||
testsContext.keys().forEach(testsContext);
|
@ -52,12 +52,16 @@ module.exports = (config) => {
|
||||
basePath: '',
|
||||
frameworks: ['jasmine'],
|
||||
files: [
|
||||
'platform/**/*Spec.js',
|
||||
'src/**/*Spec.js'
|
||||
'indexTest.js'
|
||||
],
|
||||
port: 9876,
|
||||
reporters: reporters,
|
||||
browsers: browsers,
|
||||
client: {
|
||||
jasmine: {
|
||||
random: false
|
||||
}
|
||||
},
|
||||
customLaunchers: {
|
||||
ChromeDebugging: {
|
||||
base: 'Chrome',
|
||||
@ -82,20 +86,20 @@ module.exports = (config) => {
|
||||
reports: ['html', 'lcovonly', 'text-summary'],
|
||||
thresholds: {
|
||||
global: {
|
||||
lines: 62
|
||||
lines: 64
|
||||
}
|
||||
}
|
||||
},
|
||||
preprocessors: {
|
||||
'platform/**/*Spec.js': ['webpack', 'sourcemap'],
|
||||
'src/**/*Spec.js': ['webpack', 'sourcemap']
|
||||
'indexTest.js': ['webpack', 'sourcemap']
|
||||
},
|
||||
webpack: webpackConfig,
|
||||
webpackMiddleware: {
|
||||
stats: 'errors-only',
|
||||
logLevel: 'warn'
|
||||
},
|
||||
concurrency: 1,
|
||||
singleRun: true,
|
||||
browserNoActivityTimeout: 90000
|
||||
});
|
||||
}
|
||||
};
|
||||
|
@ -32,6 +32,6 @@ if (document.currentScript) {
|
||||
|
||||
const MCT = require('./src/MCT');
|
||||
|
||||
var openmct = new MCT();
|
||||
const openmct = new MCT();
|
||||
|
||||
module.exports = openmct;
|
||||
|
28
package.json
28
package.json
@ -6,7 +6,7 @@
|
||||
"devDependencies": {
|
||||
"angular": ">=1.8.0",
|
||||
"angular-route": "1.4.14",
|
||||
"babel-eslint": "8.2.6",
|
||||
"babel-eslint": "10.0.3",
|
||||
"comma-separated-values": "^3.6.4",
|
||||
"concurrently": "^3.6.1",
|
||||
"copy-webpack-plugin": "^4.5.2",
|
||||
@ -22,7 +22,7 @@
|
||||
"d3-selection": "1.3.x",
|
||||
"d3-time": "1.0.x",
|
||||
"d3-time-format": "2.1.x",
|
||||
"eslint": "5.2.0",
|
||||
"eslint": "7.0.0",
|
||||
"eslint-plugin-vue": "^6.0.0",
|
||||
"eslint-plugin-you-dont-need-lodash-underscore": "^6.10.0",
|
||||
"eventemitter3": "^1.2.0",
|
||||
@ -39,27 +39,27 @@
|
||||
"istanbul-instrumenter-loader": "^3.0.1",
|
||||
"jasmine-core": "^3.1.0",
|
||||
"jsdoc": "^3.3.2",
|
||||
"karma": "^2.0.3",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-firefox-launcher": "^1.3.0",
|
||||
"karma-cli": "^1.0.1",
|
||||
"karma-coverage": "^1.1.2",
|
||||
"karma-coverage-istanbul-reporter": "^2.1.1",
|
||||
"karma-html-reporter": "^0.2.7",
|
||||
"karma-jasmine": "^1.1.2",
|
||||
"karma-sourcemap-loader": "^0.3.7",
|
||||
"karma-webpack": "^3.0.0",
|
||||
"karma": "5.1.1",
|
||||
"karma-chrome-launcher": "3.1.0",
|
||||
"karma-firefox-launcher": "1.3.0",
|
||||
"karma-cli": "2.0.0",
|
||||
"karma-coverage": "2.0.3",
|
||||
"karma-coverage-istanbul-reporter": "3.0.3",
|
||||
"karma-html-reporter": "0.2.7",
|
||||
"karma-jasmine": "3.3.1",
|
||||
"karma-sourcemap-loader": "0.3.7",
|
||||
"karma-webpack": "4.0.2",
|
||||
"location-bar": "^3.0.1",
|
||||
"lodash": "^4.17.12",
|
||||
"markdown-toc": "^0.11.7",
|
||||
"marked": "^0.3.5",
|
||||
"mini-css-extract-plugin": "^0.4.1",
|
||||
"minimist": "^1.1.1",
|
||||
"minimist": "^1.2.5",
|
||||
"moment": "2.25.3",
|
||||
"moment-duration-format": "^2.2.2",
|
||||
"moment-timezone": "0.5.28",
|
||||
"node-bourbon": "^4.2.3",
|
||||
"node-sass": "^4.9.2",
|
||||
"node-sass": "^4.14.1",
|
||||
"painterro": "^1.0.35",
|
||||
"printj": "^1.2.1",
|
||||
"raw-loader": "^0.5.1",
|
||||
|
@ -47,7 +47,7 @@ define([
|
||||
) {
|
||||
|
||||
return {
|
||||
name:"platform/commonUI/about",
|
||||
name: "platform/commonUI/about",
|
||||
definition: {
|
||||
"name": "About Open MCT",
|
||||
"extensions": {
|
||||
|
@ -20,7 +20,6 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
/**
|
||||
* Implements Open MCT's About dialog.
|
||||
* @namespace platform/commonUI/about
|
||||
|
@ -25,14 +25,20 @@ define(
|
||||
function (AboutController) {
|
||||
|
||||
describe("The About controller", function () {
|
||||
var testVersions,
|
||||
mockWindow,
|
||||
controller;
|
||||
let testVersions;
|
||||
let mockWindow;
|
||||
let controller;
|
||||
|
||||
beforeEach(function () {
|
||||
testVersions = [
|
||||
{ name: "Some name", value: "1.2.3" },
|
||||
{ name: "Some other name", value: "3.2.1" }
|
||||
{
|
||||
name: "Some name",
|
||||
value: "1.2.3"
|
||||
},
|
||||
{
|
||||
name: "Some other name",
|
||||
value: "3.2.1"
|
||||
}
|
||||
];
|
||||
mockWindow = jasmine.createSpyObj("$window", ["open"]);
|
||||
controller = new AboutController(testVersions, mockWindow);
|
||||
@ -50,8 +56,6 @@ define(
|
||||
controller.openLicenses();
|
||||
expect(mockWindow.open).toHaveBeenCalledWith("#/licenses");
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ define([
|
||||
) {
|
||||
|
||||
return {
|
||||
name:"platform/commonUI/browse",
|
||||
name: "platform/commonUI/browse",
|
||||
definition: {
|
||||
"extensions": {
|
||||
"routes": [
|
||||
|
@ -46,6 +46,7 @@ define(
|
||||
NavigateAction.prototype.perform = function () {
|
||||
if (this.navigationService.shouldNavigate()) {
|
||||
this.navigationService.setNavigation(this.domainObject, true);
|
||||
|
||||
return Promise.resolve({});
|
||||
}
|
||||
|
||||
|
@ -69,8 +69,10 @@ define(
|
||||
NavigationService.prototype.setNavigation = function (domainObject, force) {
|
||||
if (force) {
|
||||
this.doNavigation(domainObject);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.navigated === domainObject) {
|
||||
return true;
|
||||
}
|
||||
@ -81,6 +83,7 @@ define(
|
||||
}
|
||||
|
||||
this.doNavigation(domainObject);
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
@ -120,6 +123,7 @@ define(
|
||||
*/
|
||||
NavigationService.prototype.shouldNavigate = function () {
|
||||
var doNotNavigate = this.shouldWarnBeforeNavigate();
|
||||
|
||||
return !doNotNavigate || this.$window.confirm(doNotNavigate);
|
||||
};
|
||||
|
||||
@ -135,6 +139,7 @@ define(
|
||||
*/
|
||||
NavigationService.prototype.checkBeforeNavigation = function (checkFn) {
|
||||
this.checks.push(checkFn);
|
||||
|
||||
return function removeCheck() {
|
||||
this.checks = this.checks.filter(function (fn) {
|
||||
return checkFn !== fn;
|
||||
@ -172,6 +177,7 @@ define(
|
||||
if (reasons.length) {
|
||||
return reasons.join('\n');
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
@ -186,6 +192,7 @@ define(
|
||||
if (shouldWarnBeforeNavigate) {
|
||||
return shouldWarnBeforeNavigate;
|
||||
}
|
||||
|
||||
if (this.oldUnload) {
|
||||
return this.oldUnload.apply(undefined, [].slice.apply(arguments));
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ define([], function () {
|
||||
|
||||
function getParent(domainObject) {
|
||||
var context = domainObject.getCapability('context');
|
||||
|
||||
return context.getParent();
|
||||
}
|
||||
|
||||
|
@ -53,6 +53,7 @@ define([
|
||||
|
||||
it("sets navigation if it is allowed", function () {
|
||||
mockNavigationService.shouldNavigate.and.returnValue(true);
|
||||
|
||||
return action.perform()
|
||||
.then(function () {
|
||||
expect(mockNavigationService.setNavigation)
|
||||
@ -63,6 +64,7 @@ define([
|
||||
it("does not set navigation if it is not allowed", function () {
|
||||
mockNavigationService.shouldNavigate.and.returnValue(false);
|
||||
var onSuccess = jasmine.createSpy('onSuccess');
|
||||
|
||||
return action.perform()
|
||||
.then(onSuccess, function () {
|
||||
expect(onSuccess).not.toHaveBeenCalled();
|
||||
|
@ -79,7 +79,6 @@ define(
|
||||
navigationService.addListener(callback);
|
||||
navigationService.removeListener(callback);
|
||||
|
||||
|
||||
navigationService.setNavigation(testObject);
|
||||
expect(callback).not.toHaveBeenCalled();
|
||||
});
|
||||
|
@ -70,6 +70,7 @@ define([
|
||||
jasmine.createSpy('throttled-' + mockThrottledFns.length);
|
||||
mockThrottledFn.and.callFake(fn);
|
||||
mockThrottledFns.push(mockThrottledFn);
|
||||
|
||||
return mockThrottledFn;
|
||||
});
|
||||
mockTopic.and.returnValue(mockMutationTopic);
|
||||
@ -81,7 +82,7 @@ define([
|
||||
}[c];
|
||||
});
|
||||
mockDomainObject.hasCapability.and.callFake(function (c) {
|
||||
return !!mockDomainObject.getCapability(c);
|
||||
return Boolean(mockDomainObject.getCapability(c));
|
||||
});
|
||||
mockParentObject.getCapability.and.callFake(function (c) {
|
||||
return {
|
||||
@ -102,7 +103,6 @@ define([
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
it("listens for mutation with a throttled function", function () {
|
||||
expect(mockMutationTopic.listen)
|
||||
.toHaveBeenCalledWith(jasmine.any(Function));
|
||||
@ -129,8 +129,8 @@ define([
|
||||
});
|
||||
|
||||
[false, true].forEach(function (isEditRoot) {
|
||||
var caseName = isEditRoot ?
|
||||
"that are being edited" : "that are not being edited";
|
||||
var caseName = isEditRoot
|
||||
? "that are being edited" : "that are not being edited";
|
||||
|
||||
function itNavigatesAsExpected() {
|
||||
if (isOrphan && !isEditRoot) {
|
||||
|
@ -45,7 +45,7 @@ define([
|
||||
) {
|
||||
|
||||
return {
|
||||
name:"platform/commonUI/dialog",
|
||||
name: "platform/commonUI/dialog",
|
||||
definition: {
|
||||
"extensions": {
|
||||
"services": [
|
||||
|
@ -28,7 +28,6 @@ define(
|
||||
// the a specific template that can be included via mct-include
|
||||
var TEMPLATE = '<mct-include ng-model="overlay" key="key" ng-class="typeClass"></mct-include>';
|
||||
|
||||
|
||||
/**
|
||||
* The OverlayService is responsible for pre-pending templates to
|
||||
* the body of the document, which is useful for displaying templates
|
||||
@ -53,6 +52,7 @@ define(
|
||||
this.findBody = function () {
|
||||
return $document.find('body');
|
||||
};
|
||||
|
||||
this.newScope = function () {
|
||||
return $rootScope.$new();
|
||||
};
|
||||
|
@ -129,8 +129,8 @@ define(
|
||||
);
|
||||
});
|
||||
|
||||
it("invokes the overlay service with the correct parameters when" +
|
||||
" a blocking dialog is requested", function () {
|
||||
it("invokes the overlay service with the correct parameters when"
|
||||
+ " a blocking dialog is requested", function () {
|
||||
var dialogModel = {};
|
||||
expect(dialogService.showBlockingMessage(dialogModel)).not.toBe(false);
|
||||
expect(mockOverlayService.createOverlay).toHaveBeenCalledWith(
|
||||
|
@ -48,7 +48,7 @@ define(
|
||||
mockScope = jasmine.createSpyObj("scope", ["$destroy"]);
|
||||
mockTimeout = function (callback) {
|
||||
callback();
|
||||
}
|
||||
};
|
||||
|
||||
mockDocument.find.and.returnValue(mockBody);
|
||||
mockCompile.and.returnValue(mockTemplate);
|
||||
|
@ -56,6 +56,7 @@ define(
|
||||
//navigate back to parent because nothing to show.
|
||||
return domainObject.getCapability("location").getOriginal().then(function (original) {
|
||||
parent = original.getCapability("context").getParent();
|
||||
|
||||
return parent.getCapability("action").perform("navigate");
|
||||
});
|
||||
}
|
||||
@ -78,9 +79,10 @@ define(
|
||||
*/
|
||||
CancelAction.appliesTo = function (context) {
|
||||
var domainObject = (context || {}).domainObject;
|
||||
return domainObject !== undefined &&
|
||||
domainObject.hasCapability('editor') &&
|
||||
domainObject.getCapability('editor').isEditContextRoot();
|
||||
|
||||
return domainObject !== undefined
|
||||
&& domainObject.hasCapability('editor')
|
||||
&& domainObject.getCapability('editor').isEditContextRoot();
|
||||
};
|
||||
|
||||
return CancelAction;
|
||||
|
@ -91,9 +91,9 @@ define(
|
||||
|
||||
// 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();
|
||||
return type && type.hasFeature('creation')
|
||||
&& domainObject.hasCapability('editor')
|
||||
&& !domainObject.getCapability('editor').isEditContextRoot();
|
||||
};
|
||||
|
||||
return EditAction;
|
||||
|
@ -24,7 +24,6 @@ define(
|
||||
[],
|
||||
function () {
|
||||
|
||||
|
||||
/**
|
||||
* Add one domain object to another's composition.
|
||||
* @constructor
|
||||
@ -42,8 +41,9 @@ define(
|
||||
|
||||
// Link these objects
|
||||
function doLink() {
|
||||
var composition = self.domainObject &&
|
||||
self.domainObject.getCapability('composition');
|
||||
var composition = self.domainObject
|
||||
&& self.domainObject.getCapability('composition');
|
||||
|
||||
return composition && composition.add(self.selectedObject);
|
||||
}
|
||||
|
||||
|
@ -99,4 +99,3 @@ define(
|
||||
|
||||
);
|
||||
|
||||
|
||||
|
@ -51,6 +51,7 @@ define(
|
||||
// Property definition is same as form row definition
|
||||
var row = JSON.parse(JSON.stringify(property.getDefinition()));
|
||||
row.key = index;
|
||||
|
||||
return row;
|
||||
}).filter(function (row) {
|
||||
// Only show properties which are editable
|
||||
|
@ -86,10 +86,11 @@ define(
|
||||
*/
|
||||
SaveAction.appliesTo = function (context) {
|
||||
var domainObject = (context || {}).domainObject;
|
||||
return domainObject !== undefined &&
|
||||
domainObject.hasCapability('editor') &&
|
||||
domainObject.getCapability('editor').isEditContextRoot() &&
|
||||
domainObject.getModel().persisted !== undefined;
|
||||
|
||||
return domainObject !== undefined
|
||||
&& domainObject.hasCapability('editor')
|
||||
&& domainObject.getCapability('editor').isEditContextRoot()
|
||||
&& domainObject.getModel().persisted !== undefined;
|
||||
};
|
||||
|
||||
return SaveAction;
|
||||
|
@ -20,7 +20,6 @@
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
|
||||
|
||||
define([
|
||||
'../creation/CreateWizard',
|
||||
'./SaveInProgressDialog'
|
||||
@ -50,6 +49,7 @@ function (
|
||||
this.injectObjectService = function () {
|
||||
this.objectService = $injector.get("objectService");
|
||||
};
|
||||
|
||||
this.dialogService = dialogService;
|
||||
this.copyService = copyService;
|
||||
this.notificationService = notificationService;
|
||||
@ -75,6 +75,7 @@ function (
|
||||
if (!this.objectService) {
|
||||
this.injectObjectService();
|
||||
}
|
||||
|
||||
return this.objectService;
|
||||
};
|
||||
|
||||
@ -118,11 +119,13 @@ function (
|
||||
|
||||
function showBlockingDialog(object) {
|
||||
dialog.show();
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
function hideBlockingDialog(object) {
|
||||
dialog.hide();
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
@ -138,11 +141,12 @@ function (
|
||||
|
||||
function allowClone(objectToClone) {
|
||||
var allowed =
|
||||
(objectToClone.getId() === domainObject.getId()) ||
|
||||
objectToClone.getCapability('location').isOriginal();
|
||||
(objectToClone.getId() === domainObject.getId())
|
||||
|| objectToClone.getCapability('location').isOriginal();
|
||||
if (allowed) {
|
||||
toUndirty.push(objectToClone);
|
||||
}
|
||||
|
||||
return allowed;
|
||||
}
|
||||
|
||||
@ -160,14 +164,14 @@ function (
|
||||
}
|
||||
|
||||
function saveAfterClone(clonedObject) {
|
||||
return this.openmct.editor.save().then(() => {
|
||||
return self.openmct.editor.save().then(() => {
|
||||
// Force mutation for search indexing
|
||||
return clonedObject;
|
||||
})
|
||||
});
|
||||
}
|
||||
|
||||
function finishEditing(clonedObject) {
|
||||
return fetchObject(clonedObject.getId())
|
||||
return fetchObject(clonedObject.getId());
|
||||
}
|
||||
|
||||
function indexForSearch(savedObject) {
|
||||
@ -180,6 +184,7 @@ function (
|
||||
|
||||
function onSuccess(object) {
|
||||
self.notificationService.info("Save Succeeded");
|
||||
|
||||
return object;
|
||||
}
|
||||
|
||||
@ -188,6 +193,7 @@ function (
|
||||
if (reason !== "user canceled") {
|
||||
self.notificationService.error("Save Failed");
|
||||
}
|
||||
|
||||
throw reason;
|
||||
}
|
||||
|
||||
@ -205,7 +211,6 @@ function (
|
||||
.catch(onFailure);
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Check if this action is applicable in a given context.
|
||||
* This will ensure that a domain object is present in the context,
|
||||
@ -214,10 +219,11 @@ function (
|
||||
*/
|
||||
SaveAsAction.appliesTo = function (context) {
|
||||
var domainObject = (context || {}).domainObject;
|
||||
return domainObject !== undefined &&
|
||||
domainObject.hasCapability('editor') &&
|
||||
domainObject.getCapability('editor').isEditContextRoot() &&
|
||||
domainObject.getModel().persisted === undefined;
|
||||
|
||||
return domainObject !== undefined
|
||||
&& domainObject.hasCapability('editor')
|
||||
&& domainObject.getCapability('editor').isEditContextRoot()
|
||||
&& domainObject.getModel().persisted === undefined;
|
||||
};
|
||||
|
||||
return SaveAsAction;
|
||||
|
@ -83,6 +83,7 @@ define(
|
||||
*/
|
||||
EditorCapability.prototype.save = function () {
|
||||
console.warn('DEPRECATED: cannot save via edit capability, use openmct.editor instead.');
|
||||
|
||||
return Promise.resolve();
|
||||
};
|
||||
|
||||
@ -95,6 +96,7 @@ define(
|
||||
*/
|
||||
EditorCapability.prototype.finish = function () {
|
||||
console.warn('DEPRECATED: cannot finish via edit capability, use openmct.editor instead.');
|
||||
|
||||
return Promise.resolve();
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
['./TransactionalPersistenceCapability'],
|
||||
@ -56,9 +55,10 @@ define(
|
||||
|
||||
capabilities.persistence = function (domainObject) {
|
||||
var original =
|
||||
(typeof persistenceCapability === 'function') ?
|
||||
persistenceCapability(domainObject) :
|
||||
persistenceCapability;
|
||||
(typeof persistenceCapability === 'function')
|
||||
? persistenceCapability(domainObject)
|
||||
: persistenceCapability;
|
||||
|
||||
return new TransactionalPersistenceCapability(
|
||||
self.$q,
|
||||
self.transactionService,
|
||||
@ -66,6 +66,7 @@ define(
|
||||
domainObject
|
||||
);
|
||||
};
|
||||
|
||||
return capabilities;
|
||||
};
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
|
||||
define(
|
||||
[],
|
||||
@ -64,6 +63,7 @@ define(
|
||||
wrappedPersistence.persist.bind(wrappedPersistence),
|
||||
wrappedPersistence.refresh.bind(wrappedPersistence)
|
||||
);
|
||||
|
||||
//Need to return a promise from this function
|
||||
return this.$q.when(true);
|
||||
} else {
|
||||
@ -74,6 +74,7 @@ define(
|
||||
TransactionalPersistenceCapability.prototype.refresh = function () {
|
||||
this.transactionManager
|
||||
.clearTransactionsFor(this.domainObject.getId());
|
||||
|
||||
return this.persistenceCapability.refresh();
|
||||
};
|
||||
|
||||
|
@ -48,9 +48,9 @@ define(
|
||||
// Maintain all "conclude-editing" and "save" actions in the
|
||||
// present context.
|
||||
function updateActions() {
|
||||
$scope.saveActions = $scope.action ?
|
||||
$scope.action.getActions(SAVE_ACTION_CONTEXT) :
|
||||
[];
|
||||
$scope.saveActions = $scope.action
|
||||
? $scope.action.getActions(SAVE_ACTION_CONTEXT)
|
||||
: [];
|
||||
|
||||
$scope.saveActionsAsMenuOptions = $scope.saveActions.map(actionToMenuOption);
|
||||
|
||||
@ -58,9 +58,9 @@ define(
|
||||
clickedAction.perform();
|
||||
};
|
||||
|
||||
$scope.otherEditActions = $scope.action ?
|
||||
$scope.action.getActions(OTHERS_ACTION_CONTEXT) :
|
||||
[];
|
||||
$scope.otherEditActions = $scope.action
|
||||
? $scope.action.getActions(OTHERS_ACTION_CONTEXT)
|
||||
: [];
|
||||
|
||||
// Required because Angular does not allow 'bind'
|
||||
// in expressions.
|
||||
|
@ -30,11 +30,11 @@ define(
|
||||
|
||||
function cancelEditing(domainObject) {
|
||||
var navigatedObject = domainObject,
|
||||
editorCapability = navigatedObject &&
|
||||
navigatedObject.getCapability("editor");
|
||||
editorCapability = navigatedObject
|
||||
&& navigatedObject.getCapability("editor");
|
||||
|
||||
return editorCapability &&
|
||||
editorCapability.finish();
|
||||
return editorCapability
|
||||
&& editorCapability.finish();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -35,8 +35,8 @@ define(
|
||||
// Update root object based on represented object
|
||||
function updateRoot(domainObject) {
|
||||
var root = self.rootDomainObject,
|
||||
context = domainObject &&
|
||||
domainObject.getCapability('context'),
|
||||
context = domainObject
|
||||
&& domainObject.getCapability('context'),
|
||||
newRoot = context && context.getTrueRoot(),
|
||||
oldId = root && root.getId(),
|
||||
newId = newRoot && newRoot.getId();
|
||||
@ -51,6 +51,7 @@ define(
|
||||
// Update root when represented object changes
|
||||
$scope.$watch('domainObject', updateRoot);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the root-level domain object, as reported by the
|
||||
* represented domain object.
|
||||
|
@ -104,7 +104,6 @@ define(
|
||||
// We will disable this.
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Metadata associated with a Create action.
|
||||
* @typedef {ActionMetadata} CreateActionMetadata
|
||||
|
@ -38,9 +38,9 @@ define(
|
||||
function CreateMenuController($scope) {
|
||||
// Update the set of Create actions
|
||||
function refreshActions() {
|
||||
$scope.createActions = $scope.action ?
|
||||
$scope.action.getActions('create') :
|
||||
[];
|
||||
$scope.createActions = $scope.action
|
||||
? $scope.action.getActions('create')
|
||||
: [];
|
||||
}
|
||||
|
||||
// Listen for new instances of the represented object's
|
||||
|
@ -56,10 +56,11 @@ define(
|
||||
*/
|
||||
CreateWizard.prototype.getFormStructure = function (includeLocation) {
|
||||
var sections = [],
|
||||
domainObject = this.domainObject;
|
||||
domainObject = this.domainObject,
|
||||
self = this;
|
||||
|
||||
function validateLocation(parent) {
|
||||
return parent && this.openmct.composition.checkPolicy(parent.useCapability('adapter'), domainObject.useCapability('adapter'));
|
||||
return parent && self.openmct.composition.checkPolicy(parent.useCapability('adapter'), domainObject.useCapability('adapter'));
|
||||
}
|
||||
|
||||
sections.push({
|
||||
@ -114,6 +115,7 @@ define(
|
||||
this.domainObject.useCapability("mutation", function () {
|
||||
return formModel;
|
||||
});
|
||||
|
||||
return this.domainObject;
|
||||
};
|
||||
|
||||
|
@ -73,12 +73,13 @@ define(
|
||||
// as a child contained by that parent.
|
||||
function addToComposition() {
|
||||
var compositionCapability = parent.getCapability('composition'),
|
||||
addResult = compositionCapability &&
|
||||
compositionCapability.add(newObject);
|
||||
addResult = compositionCapability
|
||||
&& compositionCapability.add(newObject);
|
||||
|
||||
return self.$q.when(addResult).then(function (result) {
|
||||
if (!result) {
|
||||
self.$log.error("Could not modify " + parent.getId());
|
||||
|
||||
return undefined;
|
||||
}
|
||||
|
||||
@ -92,6 +93,7 @@ define(
|
||||
// what space to create the new object's model in.
|
||||
if (!persistence || !newObjectPersistence) {
|
||||
self.$log.warn(NON_PERSISTENT_WARNING);
|
||||
|
||||
return self.$q.reject(new Error(NON_PERSISTENT_WARNING));
|
||||
}
|
||||
|
||||
@ -99,8 +101,6 @@ define(
|
||||
return newObjectPersistence.persist().then(addToComposition);
|
||||
};
|
||||
|
||||
|
||||
|
||||
return CreationService;
|
||||
}
|
||||
);
|
||||
|
@ -38,8 +38,8 @@ define(
|
||||
// * treeModel: The model for the embedded tree representation,
|
||||
// used for bi-directional object selection.
|
||||
function setLocatingObject(domainObject, priorObject) {
|
||||
var context = domainObject &&
|
||||
domainObject.getCapability("context"),
|
||||
var context = domainObject
|
||||
&& domainObject.getCapability("context"),
|
||||
contextRoot = context && context.getRoot();
|
||||
|
||||
if (contextRoot && contextRoot !== $scope.rootObject) {
|
||||
@ -65,11 +65,12 @@ define(
|
||||
$scope.ngModel[$scope.field] = domainObject;
|
||||
|
||||
// Restrict which locations can be selected
|
||||
if (domainObject &&
|
||||
$scope.structure &&
|
||||
$scope.structure.validate) {
|
||||
if (domainObject
|
||||
&& $scope.structure
|
||||
&& $scope.structure.validate) {
|
||||
if (!$scope.structure.validate(domainObject)) {
|
||||
setLocatingObject(priorObject, undefined);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -78,7 +79,7 @@ define(
|
||||
if ($scope.ngModelController) {
|
||||
$scope.ngModelController.$setValidity(
|
||||
'composition',
|
||||
!!$scope.treeModel.selectedObject
|
||||
Boolean($scope.treeModel.selectedObject)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -45,6 +45,7 @@ define(
|
||||
// because it may be saved elsewhere
|
||||
if ((key === 'edit' && category === 'view-control') || key === 'properties') {
|
||||
let newStyleObject = objectUtils.toNewFormat(domainObject, domainObject.getId());
|
||||
|
||||
return this.openmct.objects.isPersistable(newStyleObject);
|
||||
}
|
||||
|
||||
|
@ -74,6 +74,7 @@ define(
|
||||
model.configuration = model.configuration || {};
|
||||
model.configuration[this.key] = configuration;
|
||||
}
|
||||
|
||||
domainObject.useCapability('mutation', function () {
|
||||
return model;
|
||||
});
|
||||
|
@ -41,6 +41,7 @@ define(['./Transaction'], function (Transaction) {
|
||||
Transaction.prototype.commit.bind(this),
|
||||
Transaction.prototype.cancel.bind(this)
|
||||
);
|
||||
|
||||
return Promise.resolve(true);
|
||||
};
|
||||
|
||||
|
@ -41,8 +41,12 @@ define([], function () {
|
||||
* pair of callbacks from the transaction
|
||||
*/
|
||||
Transaction.prototype.add = function (commit, cancel) {
|
||||
var callback = { commit: commit, cancel: cancel };
|
||||
var callback = {
|
||||
commit: commit,
|
||||
cancel: cancel
|
||||
};
|
||||
this.callbacks.push(callback);
|
||||
|
||||
return function () {
|
||||
this.callbacks = this.callbacks.filter(function (c) {
|
||||
return c !== callback;
|
||||
@ -91,6 +95,5 @@ define([], function () {
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
return Transaction;
|
||||
});
|
||||
|
@ -50,7 +50,7 @@ define([], function () {
|
||||
* @returns {boolean} true if callbacks have been added
|
||||
*/
|
||||
TransactionManager.prototype.isScheduled = function (id) {
|
||||
return !!this.clearTransactionFns[id];
|
||||
return Boolean(this.clearTransactionFns[id]);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -77,6 +77,7 @@ define([], function () {
|
||||
return promiseFn().then(nextFn);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear any existing persistence calls for object with given ID. This ensures only the most recent persistence
|
||||
* call is executed. This should prevent stale objects being persisted and overwriting fresh ones.
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global define*/
|
||||
define(
|
||||
['./Transaction', './NestedTransaction'],
|
||||
function (Transaction, NestedTransaction) {
|
||||
@ -48,9 +47,9 @@ define(
|
||||
* #cancel} are called
|
||||
*/
|
||||
TransactionService.prototype.startTransaction = function () {
|
||||
var transaction = this.isActive() ?
|
||||
new NestedTransaction(this.transactions[0]) :
|
||||
new Transaction(this.$log);
|
||||
var transaction = this.isActive()
|
||||
? new NestedTransaction(this.transactions[0])
|
||||
: new Transaction(this.$log);
|
||||
|
||||
this.transactions.push(transaction);
|
||||
};
|
||||
@ -99,13 +98,16 @@ define(
|
||||
if (!transaction) {
|
||||
return Promise.reject();
|
||||
}
|
||||
|
||||
if (!this.isActive()) {
|
||||
return transaction.commit()
|
||||
.then(function (r) {
|
||||
this.cacheService.flush();
|
||||
|
||||
return r;
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
return transaction.commit();
|
||||
};
|
||||
|
||||
@ -119,6 +121,7 @@ define(
|
||||
*/
|
||||
TransactionService.prototype.cancel = function () {
|
||||
var transaction = this.transactions.pop();
|
||||
|
||||
return transaction ? transaction.cancel() : Promise.reject();
|
||||
};
|
||||
|
||||
|
@ -102,7 +102,7 @@ define(
|
||||
});
|
||||
|
||||
mockDomainObject.hasCapability.and.callFake(function (name) {
|
||||
return !!capabilities[name];
|
||||
return Boolean(capabilities[name]);
|
||||
});
|
||||
|
||||
capabilities.editor.finish.and.returnValue(mockPromise(true));
|
||||
@ -123,8 +123,8 @@ define(
|
||||
expect(CancelAction.appliesTo(actionContext)).toBeFalsy();
|
||||
});
|
||||
|
||||
it("invokes the editor capability's cancel functionality when" +
|
||||
" performed", function () {
|
||||
it("invokes the editor capability's cancel functionality when"
|
||||
+ " performed", function () {
|
||||
mockDomainObject.getModel.and.returnValue({persisted: 1});
|
||||
//Return true from navigate action
|
||||
capabilities.action.perform.and.returnValue(mockPromise(true));
|
||||
|
@ -93,7 +93,6 @@ define(
|
||||
action = new EditAndComposeAction(actionContext);
|
||||
});
|
||||
|
||||
|
||||
it("adds to the parent's composition when performed", function () {
|
||||
action.perform();
|
||||
expect(mockComposition.add)
|
||||
@ -106,8 +105,8 @@ define(
|
||||
expect(mockEditAction.perform).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("Does not enable edit mode for objects that do not have an" +
|
||||
" edit action", function () {
|
||||
it("Does not enable edit mode for objects that do not have an"
|
||||
+ " edit action", function () {
|
||||
mockActionCapability.getActions.and.returnValue([]);
|
||||
action.perform();
|
||||
expect(mockEditAction.perform).not.toHaveBeenCalled();
|
||||
|
@ -64,7 +64,10 @@ define(
|
||||
return true;
|
||||
}
|
||||
};
|
||||
context = { someKey: "some value", domainObject: object };
|
||||
context = {
|
||||
someKey: "some value",
|
||||
domainObject: object
|
||||
};
|
||||
dialogService = {
|
||||
getUserInput: function () {
|
||||
return mockPromise(input);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2020, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global describe,it,expect,beforeEach,jasmine*/
|
||||
|
||||
define(
|
||||
["../../src/actions/SaveAction"],
|
||||
@ -138,6 +137,7 @@ define(
|
||||
it("notifies if saving succeeded", function () {
|
||||
var mockCallback = jasmine.createSpy("callback");
|
||||
mockEditorCapability.save.and.returnValue(Promise.resolve());
|
||||
|
||||
return action.perform().then(mockCallback).then(function () {
|
||||
expect(mockNotificationService.info).toHaveBeenCalled();
|
||||
expect(mockNotificationService.error).not.toHaveBeenCalled();
|
||||
@ -147,6 +147,7 @@ define(
|
||||
it("notifies if saving failed", function () {
|
||||
var mockCallback = jasmine.createSpy("callback");
|
||||
mockEditorCapability.save.and.returnValue(Promise.reject("some failure reason"));
|
||||
|
||||
return action.perform().then(mockCallback).then(function () {
|
||||
expect(mockNotificationService.error).toHaveBeenCalled();
|
||||
expect(mockNotificationService.info).not.toHaveBeenCalled();
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global describe,it,expect,beforeEach,jasmine*/
|
||||
|
||||
define(
|
||||
["../../src/actions/SaveAndStopEditingAction"],
|
||||
@ -97,7 +96,6 @@ define(
|
||||
action = new SaveAndStopEditingAction(dialogService, notificationService, actionContext);
|
||||
});
|
||||
|
||||
|
||||
it("only applies to domain object with an editor capability", function () {
|
||||
expect(SaveAndStopEditingAction.appliesTo(actionContext)).toBe(true);
|
||||
expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor");
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2020, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global describe,it,expect,beforeEach,jasmine,spyOn*/
|
||||
|
||||
define(
|
||||
["../../src/actions/SaveAsAction"],
|
||||
@ -42,15 +41,15 @@ define(
|
||||
function noop() {}
|
||||
|
||||
function mockPromise(value) {
|
||||
return (value || {}).then ? value :
|
||||
{
|
||||
return (value || {}).then ? value
|
||||
: {
|
||||
then: function (callback) {
|
||||
return mockPromise(callback(value));
|
||||
},
|
||||
catch: function (callback) {
|
||||
return mockPromise(callback(value));
|
||||
}
|
||||
} ;
|
||||
};
|
||||
}
|
||||
|
||||
beforeEach(function () {
|
||||
@ -67,7 +66,10 @@ define(
|
||||
mockDomainObject.getCapability.and.callFake(function (capability) {
|
||||
return capabilities[capability];
|
||||
});
|
||||
mockDomainObject.getModel.and.returnValue({location: 'a', persisted: undefined});
|
||||
mockDomainObject.getModel.and.returnValue({
|
||||
location: 'a',
|
||||
persisted: undefined
|
||||
});
|
||||
mockDomainObject.getId.and.returnValue(0);
|
||||
|
||||
mockClonedObject = jasmine.createSpyObj(
|
||||
@ -168,8 +170,8 @@ define(
|
||||
expect(SaveAsAction.appliesTo(actionContext)).toBe(false);
|
||||
});
|
||||
|
||||
it("only applies to domain object that has not already been" +
|
||||
" persisted", function () {
|
||||
it("only applies to domain object that has not already been"
|
||||
+ " persisted", function () {
|
||||
expect(SaveAsAction.appliesTo(actionContext)).toBe(true);
|
||||
expect(mockDomainObject.hasCapability).toHaveBeenCalledWith("editor");
|
||||
|
||||
|
@ -118,8 +118,8 @@ define(
|
||||
expect(capability.isEditContextRoot()).toBe(true);
|
||||
});
|
||||
|
||||
it("inEditingContext returns true if parent object is being" +
|
||||
" edited", function () {
|
||||
it("inEditingContext returns true if parent object is being"
|
||||
+ " edited", function () {
|
||||
mockStatusCapability.get.and.returnValue(false);
|
||||
mockParentStatus.get.and.returnValue(false);
|
||||
expect(capability.inEditContext()).toBe(false);
|
||||
@ -179,8 +179,8 @@ define(
|
||||
capability.edit();
|
||||
capability.finish();
|
||||
});
|
||||
it("returns true if the object has been modified since it" +
|
||||
" was last persisted", function () {
|
||||
it("returns true if the object has been modified since it"
|
||||
+ " was last persisted", function () {
|
||||
mockTransactionService.size.and.returnValue(0);
|
||||
expect(capability.dirty()).toBe(false);
|
||||
mockTransactionService.size.and.returnValue(1);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*****************************************************************************
|
||||
* Open MCT, Copyright (c) 2014-2018, United States Government
|
||||
* Open MCT, Copyright (c) 2014-2020, United States Government
|
||||
* as represented by the Administrator of the National Aeronautics and Space
|
||||
* Administration. All rights reserved.
|
||||
*
|
||||
@ -19,7 +19,6 @@
|
||||
* 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(
|
||||
[
|
||||
@ -76,15 +75,15 @@ define(
|
||||
);
|
||||
});
|
||||
|
||||
it("if no transaction is active, passes through to persistence" +
|
||||
" provider", function () {
|
||||
it("if no transaction is active, passes through to persistence"
|
||||
+ " provider", function () {
|
||||
mockTransactionManager.isActive.and.returnValue(false);
|
||||
capability.persist();
|
||||
expect(mockPersistence.persist).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("if transaction is active, persist and cancel calls are" +
|
||||
" queued", function () {
|
||||
it("if transaction is active, persist and cancel calls are"
|
||||
+ " queued", function () {
|
||||
mockTransactionManager.isActive.and.returnValue(true);
|
||||
capability.persist();
|
||||
expect(mockTransactionManager.addToTransaction).toHaveBeenCalled();
|
||||
|
@ -19,7 +19,6 @@
|
||||
* this source code distribution or the Licensing information page available
|
||||
* at runtime from the About dialog for additional information.
|
||||
*****************************************************************************/
|
||||
/*global describe,it,expect,beforeEach,jasmine*/
|
||||
|
||||
define(
|
||||
["../../src/controllers/EditActionController"],
|
||||
@ -40,6 +39,7 @@ define(
|
||||
mockedSaveActions.forEach(function (action) {
|
||||
action.getMetadata.and.returnValue(mockSaveActionMetadata);
|
||||
});
|
||||
|
||||
return mockedSaveActions;
|
||||
} else if (actionContext.category === "conclude-editing") {
|
||||
return ["a", "b", "c"];
|
||||
|
@ -54,7 +54,7 @@ define(
|
||||
);
|
||||
|
||||
mockCapabilities = {
|
||||
"editor" : mockEditorCapability,
|
||||
"editor": mockEditorCapability,
|
||||
"status": mockStatusCapability
|
||||
};
|
||||
|
||||
@ -77,7 +77,10 @@ define(
|
||||
|
||||
testViews = [
|
||||
{ key: 'abc' },
|
||||
{ key: 'def', someKey: 'some value' },
|
||||
{
|
||||
key: 'def',
|
||||
someKey: 'some value'
|
||||
},
|
||||
{ key: 'xyz' }
|
||||
];
|
||||
|
||||
|
@ -48,10 +48,10 @@ define(
|
||||
mockContext.getTrueRoot.and.callFake(function () {
|
||||
var mockRoot = jasmine.createSpyObj('root', ['getId']);
|
||||
mockRoot.getId.and.returnValue('root-id');
|
||||
|
||||
return mockRoot;
|
||||
});
|
||||
|
||||
|
||||
controller = new EditPanesController(mockScope);
|
||||
});
|
||||
|
||||
@ -97,6 +97,7 @@ define(
|
||||
mockContext.getTrueRoot.and.callFake(function () {
|
||||
var mockRoot = jasmine.createSpyObj('root', ['getId']);
|
||||
mockRoot.getId.and.returnValue('other-root-id');
|
||||
|
||||
return mockRoot;
|
||||
});
|
||||
|
||||
|
@ -51,6 +51,7 @@ define(
|
||||
);
|
||||
mockType.hasFeature.and.returnValue(true);
|
||||
mockType.getName.and.returnValue(name);
|
||||
|
||||
return mockType;
|
||||
}
|
||||
|
||||
@ -75,7 +76,7 @@ define(
|
||||
};
|
||||
|
||||
mockPolicyService.allow.and.callFake(function (category, type) {
|
||||
return category === "creation" && mockCreationPolicy(type) ? true : false;
|
||||
return Boolean(category === "creation" && mockCreationPolicy(type));
|
||||
});
|
||||
|
||||
mockTypeService.listTypes.and.returnValue(mockTypes);
|
||||
|
@ -77,7 +77,7 @@ define(
|
||||
]
|
||||
);
|
||||
mockDomainObject.hasCapability.and.callFake(function (name) {
|
||||
return !!capabilities[name];
|
||||
return Boolean(capabilities[name]);
|
||||
});
|
||||
mockDomainObject.getCapability.and.callFake(function (name) {
|
||||
return capabilities[name];
|
||||
@ -150,8 +150,8 @@ define(
|
||||
expect(mockEditAction.perform).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("uses the save-as action if object does not have an edit action" +
|
||||
" available", function () {
|
||||
it("uses the save-as action if object does not have an edit action"
|
||||
+ " available", function () {
|
||||
capabilities.action.getActions.and.returnValue([]);
|
||||
capabilities.action.perform.and.returnValue(mockPromise(undefined));
|
||||
capabilities.editor.save.and.returnValue(promise);
|
||||
|
@ -45,6 +45,7 @@ define(
|
||||
control: "textfield"
|
||||
});
|
||||
mockProperty.getValue.and.returnValue(name);
|
||||
|
||||
return mockProperty;
|
||||
}
|
||||
|
||||
@ -120,7 +121,10 @@ define(
|
||||
// Should have gotten a setValue call
|
||||
mockProperties.forEach(function (mockProperty, i) {
|
||||
expect(mockProperty.setValue).toHaveBeenCalledWith(
|
||||
{ someKey: "some value", type: 'test' },
|
||||
{
|
||||
someKey: "some value",
|
||||
type: 'test'
|
||||
},
|
||||
"field " + i
|
||||
);
|
||||
});
|
||||
@ -188,7 +192,6 @@ define(
|
||||
})).toEqual(false);
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
);
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user