Compare commits

...

4 Commits

803 changed files with 63055 additions and 51582 deletions

View File

@ -20,14 +20,33 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
"./src/EventTelemetryProvider"
], function (
EventTelemetryProvider
) {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
return {
import EventTelemetryProvider from './src/EventTelemetryProvider';
"use strict";
export default {
name: "example/eventGenerator",
definition: {
"name": "Event Message Generator",
@ -76,5 +95,4 @@ define([
]
}
}
};
});
};

View File

@ -25,14 +25,40 @@
* Created by chacskaylo on 06/18/2015.
* Modified by shale on 06/23/2015.
*/
define(
['../data/transcript.json'],
function (messages) {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
var firstObservedTime = Date.now();
/**
* Module defining EventTelemetry.
* Created by chacskaylo on 06/18/2015.
* Modified by shale on 06/23/2015.
*/
import messages from '../data/transcript.json';
function EventTelemetry(request, interval) {
"use strict";
var firstObservedTime = Date.now();
function EventTelemetry(request, interval) {
var latestObservedTime = Date.now(),
count = Math.floor((latestObservedTime - firstObservedTime) / interval),
@ -55,8 +81,6 @@ define(
};
return generatorData;
}
}
return EventTelemetry;
}
);
export default EventTelemetry;

View File

@ -23,16 +23,40 @@
/**
* Module defining EventTelemetryProvider. Created by chacskaylo on 06/18/2015.
*/
define(
["./EventTelemetry"],
function (EventTelemetry) {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
/**
* Module defining EventTelemetryProvider. Created by chacskaylo on 06/18/2015.
*/
import EventTelemetry from './EventTelemetry';
"use strict";
/**
*
* @constructor
*/
function EventTelemetryProvider($q, $timeout) {
function EventTelemetryProvider($q, $timeout) {
var subscriptions = [],
genInterval = 1000,
generating = false;
@ -111,8 +135,6 @@ define(
requestTelemetry: requestTelemetry,
subscribe: subscribe
};
}
}
return EventTelemetryProvider;
}
);
export default EventTelemetryProvider;

View File

@ -20,10 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([], function () {
'use strict';
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
'use strict';
/**
* An example of using the `exportService`; queries for telemetry
* and provides the results as a CSV file.
* @param {platform/exporters.ExportService} exportService the
@ -33,12 +54,12 @@ define([], function () {
* @memberof example/export
* @implements {Action}
*/
function ExportTelemetryAsCSVAction(exportService, context) {
function ExportTelemetryAsCSVAction(exportService, context) {
this.exportService = exportService;
this.context = context;
}
}
ExportTelemetryAsCSVAction.prototype.perform = function () {
ExportTelemetryAsCSVAction.prototype.perform = function () {
var context = this.context,
domainObject = context.domainObject,
telemetry = domainObject.getCapability("telemetry"),
@ -78,12 +99,11 @@ define([], function () {
exportService.exportCSV(rows, { headers: headers });
});
};
};
ExportTelemetryAsCSVAction.appliesTo = function (context) {
ExportTelemetryAsCSVAction.appliesTo = function (context) {
return context.domainObject
&& context.domainObject.hasCapability("telemetry");
};
};
return ExportTelemetryAsCSVAction;
});
export default ExportTelemetryAsCSVAction;

View File

@ -20,12 +20,33 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
'./ExportTelemetryAsCSVAction'
], function (ExportTelemetryAsCSVAction) {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
return {
import ExportTelemetryAsCSVAction from './ExportTelemetryAsCSVAction';
"use strict";
export default {
name: "example/export",
definition: {
"name": "Example of using CSV Export",
@ -42,5 +63,4 @@ define([
]
}
}
};
});
};

View File

@ -20,14 +20,33 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
"./src/ExampleFormController"
], function (
ExampleFormController
) {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
return {
import ExampleFormController from './src/ExampleFormController';
"use strict";
export default {
name: "example/forms",
definition: {
"name": "Declarative Forms example",
@ -49,5 +68,4 @@ define([
]
}
}
};
});
};

View File

@ -20,12 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
function ExampleFormController($scope) {
"use strict";
function ExampleFormController($scope) {
$scope.state = {
};
@ -198,8 +217,6 @@ define(
}
]
};
}
}
return ExampleFormController;
}
);
export default ExampleFormController;

View File

@ -1,10 +1,6 @@
define([
'lodash'
], function (
_
) {
import _ from 'lodash';
var METADATA_BY_TYPE = {
var METADATA_BY_TYPE = {
'generator': {
values: [
{
@ -119,24 +115,22 @@ define([
}
]
}
};
};
function GeneratorMetadataProvider() {
function GeneratorMetadataProvider() {
}
}
GeneratorMetadataProvider.prototype.supportsMetadata = function (domainObject) {
GeneratorMetadataProvider.prototype.supportsMetadata = function (domainObject) {
return Object.prototype.hasOwnProperty.call(METADATA_BY_TYPE, domainObject.type);
};
};
GeneratorMetadataProvider.prototype.getMetadata = function (domainObject) {
GeneratorMetadataProvider.prototype.getMetadata = function (domainObject) {
return Object.assign(
{},
domainObject.telemetry,
METADATA_BY_TYPE[domainObject.type]
);
};
};
return GeneratorMetadataProvider;
});
export default GeneratorMetadataProvider;

View File

@ -20,34 +20,52 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
'./WorkerInterface'
], function (
WorkerInterface
) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
var REQUEST_DEFAULTS = {
import WorkerInterface from './WorkerInterface';
var REQUEST_DEFAULTS = {
amplitude: 1,
period: 10,
offset: 0,
dataRateInHz: 1,
randomness: 0,
phase: 0
};
};
function GeneratorProvider() {
function GeneratorProvider() {
this.workerInterface = new WorkerInterface();
}
}
GeneratorProvider.prototype.canProvideTelemetry = function (domainObject) {
GeneratorProvider.prototype.canProvideTelemetry = function (domainObject) {
return domainObject.type === 'generator';
};
};
GeneratorProvider.prototype.supportsRequest =
GeneratorProvider.prototype.supportsRequest =
GeneratorProvider.prototype.supportsSubscribe =
GeneratorProvider.prototype.canProvideTelemetry;
GeneratorProvider.prototype.makeWorkerRequest = function (domainObject, request) {
GeneratorProvider.prototype.makeWorkerRequest = function (domainObject, request) {
var props = [
'amplitude',
'period',
@ -80,21 +98,20 @@ define([
workerRequest.name = domainObject.name;
return workerRequest;
};
};
GeneratorProvider.prototype.request = function (domainObject, request) {
GeneratorProvider.prototype.request = function (domainObject, request) {
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) {
GeneratorProvider.prototype.subscribe = function (domainObject, callback) {
var workerRequest = this.makeWorkerRequest(domainObject, {});
return this.workerInterface.subscribe(workerRequest, callback);
};
};
return GeneratorProvider;
});
export default GeneratorProvider;

View File

@ -20,13 +20,29 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
], function (
) {
var PURPLE = {
var PURPLE = {
sin: 2.2,
cos: 2.2
},
@ -73,15 +89,15 @@ define([
}
};
function SinewaveLimitProvider() {
function SinewaveLimitProvider() {
}
}
SinewaveLimitProvider.prototype.supportsLimits = function (domainObject) {
SinewaveLimitProvider.prototype.supportsLimits = function (domainObject) {
return domainObject.type === 'generator';
};
};
SinewaveLimitProvider.prototype.getLimitEvaluator = function (domainObject) {
SinewaveLimitProvider.prototype.getLimitEvaluator = function (domainObject) {
return {
evaluate: function (datum, valueMetadata) {
var range = valueMetadata && valueMetadata.key;
@ -103,9 +119,9 @@ define([
}
}
};
};
};
SinewaveLimitProvider.prototype.getLimits = function (domainObject) {
SinewaveLimitProvider.prototype.getLimits = function (domainObject) {
return {
limits: function () {
@ -168,7 +184,6 @@ define([
});
}
};
};
};
return SinewaveLimitProvider;
});
export default SinewaveLimitProvider;

View File

@ -20,29 +20,45 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
], function (
function StateGeneratorProvider() {
) {
}
function StateGeneratorProvider() {
}
function pointForTimestamp(timestamp, duration, name) {
function pointForTimestamp(timestamp, duration, name) {
return {
name: name,
utc: Math.floor(timestamp / duration) * duration,
value: Math.floor(timestamp / duration) % 2
};
}
}
StateGeneratorProvider.prototype.supportsSubscribe = function (domainObject) {
StateGeneratorProvider.prototype.supportsSubscribe = function (domainObject) {
return domainObject.type === 'example.state-generator';
};
};
StateGeneratorProvider.prototype.subscribe = function (domainObject, callback) {
StateGeneratorProvider.prototype.subscribe = function (domainObject, callback) {
var duration = domainObject.telemetry.duration * 1000;
var interval = setInterval(function () {
@ -55,13 +71,13 @@ define([
return function () {
clearInterval(interval);
};
};
};
StateGeneratorProvider.prototype.supportsRequest = function (domainObject, options) {
StateGeneratorProvider.prototype.supportsRequest = function (domainObject, options) {
return domainObject.type === 'example.state-generator';
};
};
StateGeneratorProvider.prototype.request = function (domainObject, options) {
StateGeneratorProvider.prototype.request = function (domainObject, options) {
var start = options.start;
var end = Math.min(Date.now(), options.end); // no future values
var duration = domainObject.telemetry.duration * 1000;
@ -76,8 +92,6 @@ define([
}
return Promise.resolve(data);
};
};
return StateGeneratorProvider;
});
export default StateGeneratorProvider;

View File

@ -20,35 +20,53 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
'raw-loader!./generatorWorker.js',
'uuid'
], function (
workerText,
uuid
) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
var workerBlob = new Blob(
import workerText from 'raw-loader!./generatorWorker.js';
import uuid from 'uuid';
var workerBlob = new Blob(
[workerText],
{type: 'application/javascript'}
);
var workerUrl = URL.createObjectURL(workerBlob);
);
var workerUrl = URL.createObjectURL(workerBlob);
function WorkerInterface() {
function WorkerInterface() {
this.worker = new Worker(workerUrl);
this.worker.onmessage = this.onMessage.bind(this);
this.callbacks = {};
}
}
WorkerInterface.prototype.onMessage = function (message) {
WorkerInterface.prototype.onMessage = function (message) {
message = message.data;
var callback = this.callbacks[message.id];
if (callback) {
callback(message);
}
};
};
WorkerInterface.prototype.dispatch = function (request, data, callback) {
WorkerInterface.prototype.dispatch = function (request, data, callback) {
var message = {
request: request,
data: data,
@ -62,9 +80,9 @@ define([
this.worker.postMessage(message);
return message.id;
};
};
WorkerInterface.prototype.request = function (request) {
WorkerInterface.prototype.request = function (request) {
var deferred = {};
var promise = new Promise(function (resolve, reject) {
deferred.resolve = resolve;
@ -87,9 +105,9 @@ define([
messageId = this.dispatch('request', request, callback.bind(this));
return promise;
};
};
WorkerInterface.prototype.subscribe = function (request, cb) {
WorkerInterface.prototype.subscribe = function (request, cb) {
function callback(message) {
cb(message.data);
}
@ -102,7 +120,6 @@ define([
});
delete this.callbacks[messageId];
}.bind(this);
};
};
return WorkerInterface;
});
export default WorkerInterface;

View File

@ -20,6 +20,28 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
(function () {
var FIFTEEN_MINUTES = 15 * 60 * 1000;

View File

@ -20,19 +20,35 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
"./GeneratorProvider",
"./SinewaveLimitProvider",
"./StateGeneratorProvider",
"./GeneratorMetadataProvider"
], function (
GeneratorProvider,
SinewaveLimitProvider,
StateGeneratorProvider,
GeneratorMetadataProvider
) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
return function (openmct) {
import GeneratorProvider from './GeneratorProvider';
import SinewaveLimitProvider from './SinewaveLimitProvider';
import StateGeneratorProvider from './StateGeneratorProvider';
import GeneratorMetadataProvider from './GeneratorMetadataProvider';
export default function (openmct) {
openmct.types.addType("example.state-generator", {
name: "State Generator",
@ -149,6 +165,4 @@ define([
openmct.telemetry.addProvider(new GeneratorProvider());
openmct.telemetry.addProvider(new GeneratorMetadataProvider());
openmct.telemetry.addProvider(new SinewaveLimitProvider());
};
});
};

View File

@ -20,14 +20,33 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
"./src/ExampleIdentityService"
], function (
ExampleIdentityService
) {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
return {
import ExampleIdentityService from './src/ExampleIdentityService';
"use strict";
export default {
name: "example/identity",
definition: {
"extensions": {
@ -44,5 +63,4 @@ define([
]
}
}
};
});
};

View File

@ -20,11 +20,9 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
function () {
"use strict";
"use strict";
var DEFAULT_IDENTITY = {
var DEFAULT_IDENTITY = {
key: "user",
name: "Example User"
},
@ -48,7 +46,7 @@ define(
}]
};
/**
/**
* Example implementation of an identity service. This prompts the
* user to enter a name and user ID; in a more realistic
* implementation, this would be read from a server, possibly
@ -58,37 +56,35 @@ define(
* @implements {IdentityService}
* @memberof platform/identity
*/
function ExampleIdentityProvider(dialogService, $q) {
function ExampleIdentityProvider(dialogService, $q) {
this.dialogService = dialogService;
this.$q = $q;
this.returnUser = this.returnUser.bind(this);
this.returnUndefined = this.returnUndefined.bind(this);
}
}
ExampleIdentityProvider.prototype.getUser = function () {
ExampleIdentityProvider.prototype.getUser = function () {
if (this.user) {
return this.$q.when(this.user);
} else {
return this.dialogService.getUserInput(DIALOG_STRUCTURE, DEFAULT_IDENTITY)
.then(this.returnUser, this.returnUndefined);
}
};
};
/**
/**
* @private
*/
ExampleIdentityProvider.prototype.returnUser = function (user) {
ExampleIdentityProvider.prototype.returnUser = function (user) {
return this.user = user;
};
};
/**
/**
* @private
*/
ExampleIdentityProvider.prototype.returnUndefined = function () {
ExampleIdentityProvider.prototype.returnUndefined = function () {
return undefined;
};
};
return ExampleIdentityProvider;
}
);
export default ExampleIdentityProvider;

View File

@ -20,6 +20,28 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
const DEFAULT_IMAGE_SAMPLES = [
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18731.jpg",
"https://www.hq.nasa.gov/alsj/a16/AS16-117-18732.jpg",

View File

@ -20,10 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([], function () {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
return {
"use strict";
export default {
name: "example/mobile",
definition: {
"name": "Mobile",
@ -37,5 +58,4 @@ define([], function () {
]
}
}
};
});
};

View File

@ -20,18 +20,35 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
"./src/RemsTelemetryServerAdapter",
"./src/RemsTelemetryModelProvider",
"./src/RemsTelemetryProvider"
], function (
RemsTelemetryServerAdapter,
RemsTelemetryModelProvider,
RemsTelemetryProvider
) {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
return {
import RemsTelemetryServerAdapter from './src/RemsTelemetryServerAdapter';
import RemsTelemetryModelProvider from './src/RemsTelemetryModelProvider';
import RemsTelemetryProvider from './src/RemsTelemetryProvider';
"use strict";
export default {
name: "example/msl",
definition: {
"name": "Mars Science Laboratory Data Adapter",
@ -110,6 +127,4 @@ define([
]
}
}
};
});
};

View File

@ -20,19 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
/**
* A data dictionary describes the telemetry available from a data
* source and its data types. The data dictionary will be parsed by a custom
* server provider for this data source (in this case
* {@link RemsTelemetryServerAdapter}).
*
* Typically a data dictionary would be made available alongside the
* telemetry data source itself.
*/
function () {
return {
export default {
"name": "Mars Science Laboratory",
"identifier": "msl",
"instruments": [
@ -73,6 +61,4 @@ define(
]
}
]
};
}
);
};

View File

@ -20,18 +20,16 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
function () {
"use strict";
"use strict";
var PREFIX = "msl_tlm:",
var PREFIX = "msl_tlm:",
FORMAT_MAPPINGS = {
float: "number",
integer: "number",
string: "string"
};
function RemsTelemetryModelProvider(adapter) {
function RemsTelemetryModelProvider(adapter) {
function isRelevant(id) {
return id.indexOf(PREFIX) === 0;
@ -89,8 +87,6 @@ define(
return ids.some(isRelevant) ? buildTaxonomy(adapter.dictionary) : {};
}
};
}
}
return RemsTelemetryModelProvider;
}
);
export default RemsTelemetryModelProvider;

View File

@ -19,19 +19,39 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
define (
['./RemsTelemetrySeries'],
function (RemsTelemetrySeries) {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
import RemsTelemetrySeries from './RemsTelemetrySeries';
var SOURCE = "rems.source";
"use strict";
function RemsTelemetryProvider(adapter, $q) {
var SOURCE = "rems.source";
function RemsTelemetryProvider(adapter, $q) {
this.adapter = adapter;
this.$q = $q;
}
}
/**
/**
* Retrieve telemetry from this telemetry source.
* @memberOf example/msl
* @param {Array<TelemetryRequest>} requests An array of all request
@ -40,7 +60,7 @@ define (
* @returns {Promise} A {@link Promise} resolved with a {@link RemsTelemetrySeries}
* object that wraps the telemetry returned from the telemetry source.
*/
RemsTelemetryProvider.prototype.requestTelemetry = function (requests) {
RemsTelemetryProvider.prototype.requestTelemetry = function (requests) {
var packaged = {},
relevantReqs,
adapter = this.adapter;
@ -65,19 +85,17 @@ define (
.then(function () {
return packaged;
});
};
};
/**
/**
* This data source does not support real-time subscriptions
*/
RemsTelemetryProvider.prototype.subscribe = function (callback, requests) {
RemsTelemetryProvider.prototype.subscribe = function (callback, requests) {
return function () {};
};
};
RemsTelemetryProvider.prototype.unsubscribe = function (callback, requests) {
RemsTelemetryProvider.prototype.unsubscribe = function (callback, requests) {
return function () {};
};
};
return RemsTelemetryProvider;
}
);
export default RemsTelemetryProvider;

View File

@ -19,11 +19,9 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
function () {
"use strict";
"use strict";
/**
/**
* @typedef {Object} RemsTelemetryValue
* @memberOf example/msl
* @property {number} date The date/time of the telemetry value. Constitutes the domain value of this value pair
@ -32,7 +30,7 @@ define(
* temperature, air pressure, etc.)
*/
/**
/**
* A representation of a collection of telemetry data. The REMS
* telemetry data is time ordered, with the 'domain' value
* constituting the time stamp of each data value and the
@ -45,40 +43,38 @@ define(
* @param {Array<RemsTelemetryValue>} data An array of telemetry values
* @constructor
*/
function RemsTelemetrySeries(data) {
function RemsTelemetrySeries(data) {
this.data = data;
}
}
/**
/**
* @returns {number} A count of the number of data values available in
* this series
*/
RemsTelemetrySeries.prototype.getPointCount = function () {
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
* value.
* @param index
* @returns {number} the time value in ms since 1 January 1970
*/
RemsTelemetrySeries.prototype.getDomainValue = function (index) {
RemsTelemetrySeries.prototype.getDomainValue = function (index) {
return this.data[index].date;
};
};
/**
/**
* The range value of the REMS data set is the value of the thing
* being measured, be it temperature, air pressure, etc.
* @param index The datum in the data series to return the range
* value of.
* @returns {number} A floating point number
*/
RemsTelemetrySeries.prototype.getRangeValue = function (index) {
RemsTelemetrySeries.prototype.getRangeValue = function (index) {
return this.data[index].value;
};
};
return RemsTelemetrySeries;
}
);
export default RemsTelemetrySeries;

View File

@ -21,18 +21,38 @@
*****************************************************************************/
/*jslint es5: true */
define(
[
"./MSLDataDictionary",
"module"
],
function (MSLDataDictionary, module) {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/*jslint es5: true */
var TERRESTRIAL_DATE = "terrestrial_date",
import MSLDataDictionary from './MSLDataDictionary';
import module from 'module';
"use strict";
var TERRESTRIAL_DATE = "terrestrial_date",
LOCAL_DATA = "../data/rems.json";
/**
/**
* Fetches historical data from the REMS instrument on the Curiosity
* Rover.
* @memberOf example/msl
@ -41,7 +61,7 @@ define(
* @param REMS_WS_URL The location of the REMS telemetry data.
* @constructor
*/
function RemsTelemetryServerAdapter($http, $log, REMS_WS_URL) {
function RemsTelemetryServerAdapter($http, $log, REMS_WS_URL) {
this.localDataURI = module.uri.substring(0, module.uri.lastIndexOf('/') + 1) + LOCAL_DATA;
this.REMS_WS_URL = REMS_WS_URL;
this.$http = $http;
@ -54,20 +74,20 @@ define(
return pascals / 100;
}
};
}
}
/**
/**
* The data dictionary for this data source.
* @type {MSLDataDictionary}
*/
RemsTelemetryServerAdapter.prototype.dictionary = MSLDataDictionary;
RemsTelemetryServerAdapter.prototype.dictionary = MSLDataDictionary;
/**
/**
* Fetches historical data from source, and associates it with the
* given request ID.
* @private
*/
RemsTelemetryServerAdapter.prototype.requestHistory = function (request) {
RemsTelemetryServerAdapter.prototype.requestHistory = function (request) {
var self = this,
id = request.key;
@ -125,9 +145,9 @@ define(
.then(processResponse)
.then(filterResults)
.then(packageAndResolve);
};
};
/**
/**
* Requests historical telemetry for the named data attribute. In
* the case of REMS, this data source exposes multiple different
* data variables from the REMS instrument, including temperature
@ -135,11 +155,8 @@ define(
* @param id The telemetry data point key to be queried.
* @returns {Promise | Array<RemsTelemetryValue>} that resolves with an Array of {@link RemsTelemetryValue} objects for the request data key.
*/
RemsTelemetryServerAdapter.prototype.history = function (request) {
RemsTelemetryServerAdapter.prototype.history = function (request) {
return this.requestHistory(request);
};
return RemsTelemetryServerAdapter;
}
);
};
export default RemsTelemetryServerAdapter;

View File

@ -20,24 +20,38 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
"./src/DialogLaunchController",
"./src/NotificationLaunchController",
"./src/DialogLaunchIndicator",
"./src/NotificationLaunchIndicator",
"./res/dialog-launch.html",
"./res/notification-launch.html"
], function (
DialogLaunchController,
NotificationLaunchController,
DialogLaunchIndicator,
NotificationLaunchIndicator,
DialogLaunch,
NotificationLaunch
) {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
return {
import DialogLaunchController from './src/DialogLaunchController';
import NotificationLaunchController from './src/NotificationLaunchController';
import DialogLaunchIndicator from './src/DialogLaunchIndicator';
import NotificationLaunchIndicator from './src/NotificationLaunchIndicator';
import DialogLaunch from './res/dialog-launch.html';
import NotificationLaunch from './res/notification-launch.html';
"use strict";
export default {
name: "example/notifications",
definition: {
"extensions": {
@ -86,5 +100,4 @@ define([
]
}
}
};
});
};

View File

@ -20,12 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
"use strict";
/**
* A controller for the dialog launch view. This view allows manual
* launching of dialogs for demonstration and testing purposes. It
* also demonstrates the use of the DialogService.
@ -36,7 +55,7 @@ define(
* @param notificationService
* @constructor
*/
function DialogLaunchController($scope, $timeout, $log, dialogService, notificationService) {
function DialogLaunchController($scope, $timeout, $log, dialogService, notificationService) {
/*
Demonstrates launching a progress dialog and updating it
@ -150,8 +169,6 @@ define(
}
};
}
}
return DialogLaunchController;
}
);
export default DialogLaunchController;

View File

@ -20,36 +20,53 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
"use strict";
/**
* A tool for manually invoking dialogs. When included this
* indicator will allow for dialogs of different types to be
* launched for demonstration and testing purposes.
* @constructor
*/
function DialogLaunchIndicator() {
function DialogLaunchIndicator() {
}
}
DialogLaunchIndicator.template = 'dialogLaunchTemplate';
DialogLaunchIndicator.template = 'dialogLaunchTemplate';
DialogLaunchIndicator.prototype.getGlyphClass = function () {
DialogLaunchIndicator.prototype.getGlyphClass = function () {
return 'ok';
};
};
DialogLaunchIndicator.prototype.getText = function () {
DialogLaunchIndicator.prototype.getText = function () {
return "Launch test dialog";
};
};
DialogLaunchIndicator.prototype.getDescription = function () {
DialogLaunchIndicator.prototype.getDescription = function () {
return "Launch test dialog";
};
};
return DialogLaunchIndicator;
}
);
export default DialogLaunchIndicator;

View File

@ -20,12 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
"use strict";
/**
* Allows launching of notification messages for the purposes of
* demonstration and testing. Also demonstrates use of
* the NotificationService. Notifications are non-blocking messages that
@ -38,7 +57,7 @@ define(
* @param notificationService
* @constructor
*/
function NotificationLaunchController($scope, $timeout, $log, notificationService) {
function NotificationLaunchController($scope, $timeout, $log, notificationService) {
var messageCounter = 1;
function getExampleActionText() {
@ -119,8 +138,6 @@ define(
});
};
}
}
return NotificationLaunchController;
}
);
export default NotificationLaunchController;

View File

@ -20,36 +20,53 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
"use strict";
/**
* A tool for manually invoking notifications. When included this
* indicator will allow for notifications of different types to be
* launched for demonstration and testing purposes.
* @constructor
*/
function NotificationLaunchIndicator() {
function NotificationLaunchIndicator() {
}
}
NotificationLaunchIndicator.template = 'notificationLaunchTemplate';
NotificationLaunchIndicator.template = 'notificationLaunchTemplate';
NotificationLaunchIndicator.prototype.getGlyphClass = function () {
NotificationLaunchIndicator.prototype.getGlyphClass = function () {
return 'ok';
};
};
NotificationLaunchIndicator.prototype.getText = function () {
NotificationLaunchIndicator.prototype.getText = function () {
return "Launch notification";
};
};
NotificationLaunchIndicator.prototype.getDescription = function () {
NotificationLaunchIndicator.prototype.getDescription = function () {
return "Launch notification";
};
};
return NotificationLaunchIndicator;
}
);
export default NotificationLaunchIndicator;

View File

@ -20,14 +20,33 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
"./src/BrowserPersistenceProvider"
], function (
BrowserPersistenceProvider
) {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
return {
import BrowserPersistenceProvider from './src/BrowserPersistenceProvider';
"use strict";
export default {
name: "example/persistence",
definition: {
"extensions": {
@ -50,5 +69,4 @@ define([
]
}
}
};
});
};

View File

@ -24,12 +24,35 @@
* Stubbed implementation of a persistence provider,
* to permit objects to be created, saved, etc.
*/
define(
[],
function () {
'use strict';
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
function BrowserPersistenceProvider($q, SPACE) {
/**
* Stubbed implementation of a persistence provider,
* to permit objects to be created, saved, etc.
*/
'use strict';
function BrowserPersistenceProvider($q, SPACE) {
var spaces = SPACE ? [SPACE] : [],
caches = {},
promises = {
@ -95,8 +118,6 @@ define(
}
};
}
}
return BrowserPersistenceProvider;
}
);
export default BrowserPersistenceProvider;

View File

@ -20,14 +20,33 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
"./src/ExamplePolicy"
], function (
ExamplePolicy
) {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
return {
import ExamplePolicy from './src/ExamplePolicy';
"use strict";
export default {
name: "example/policy",
definition: {
"name": "Example Policy",
@ -41,5 +60,4 @@ define([
]
}
}
};
});
};

View File

@ -20,12 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
function ExamplePolicy() {
"use strict";
function ExamplePolicy() {
return {
/**
* Disallow the Remove action on objects whose name contains
@ -40,8 +59,6 @@ define(
return metadata.key !== 'remove' || name.indexOf('foo') < 0;
}
};
}
}
return ExamplePolicy;
}
);
export default ExamplePolicy;

View File

@ -20,16 +20,34 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
"./src/WatchIndicator",
"./src/DigestIndicator"
], function (
WatchIndicator,
DigestIndicator
) {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
return {
import WatchIndicator from './src/WatchIndicator';
import DigestIndicator from './src/DigestIndicator';
"use strict";
export default {
name: "example/profiling",
definition: {
"extensions": {
@ -51,5 +69,4 @@ define([
]
}
}
};
});
};

View File

@ -20,19 +20,38 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
"use strict";
/**
* Displays the number of digests that have occurred since the
* indicator was first instantiated.
* @constructor
* @param $interval Angular's $interval
* @implements {Indicator}
*/
function DigestIndicator($interval, $rootScope) {
function DigestIndicator($interval, $rootScope) {
var digests = 0,
displayed = 0,
start = Date.now();
@ -74,9 +93,6 @@ define(
return "";
}
};
}
}
return DigestIndicator;
}
);
export default DigestIndicator;

View File

@ -20,17 +20,36 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
"use strict";
/**
* Updates a count of currently-active Angular watches.
* @constructor
* @param $interval Angular's $interval
*/
function WatchIndicator($interval, $rootScope) {
function WatchIndicator($interval, $rootScope) {
var watches = 0;
function count(scope) {
@ -78,9 +97,6 @@ define(
return "";
}
};
}
}
return WatchIndicator;
}
);
export default WatchIndicator;

View File

@ -20,14 +20,33 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
"./src/ScratchPersistenceProvider"
], function (
ScratchPersistenceProvider
) {
"use strict";
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
return {
import ScratchPersistenceProvider from './src/ScratchPersistenceProvider';
"use strict";
export default {
name: "example/scratchpad",
definition: {
"extensions": {
@ -59,5 +78,4 @@ define([
]
}
}
};
});
};

View File

@ -20,12 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
'use strict';
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
'use strict';
/**
* The ScratchPersistenceProvider keeps JSON documents in memory
* and provides a persistence interface, but changes are lost on reload.
* @memberof example/scratchpad
@ -33,47 +52,45 @@ define(
* @implements {PersistenceService}
* @param q Angular's $q, for promises
*/
function ScratchPersistenceProvider($q) {
function ScratchPersistenceProvider($q) {
this.$q = $q;
this.table = {};
}
}
ScratchPersistenceProvider.prototype.listSpaces = function () {
ScratchPersistenceProvider.prototype.listSpaces = function () {
return this.$q.when(['scratch']);
};
};
ScratchPersistenceProvider.prototype.listObjects = function (space) {
ScratchPersistenceProvider.prototype.listObjects = function (space) {
return this.$q.when(
space === 'scratch' ? Object.keys(this.table) : []
);
};
};
ScratchPersistenceProvider.prototype.createObject = function (space, key, value) {
ScratchPersistenceProvider.prototype.createObject = function (space, key, value) {
if (space === 'scratch') {
this.table[key] = JSON.stringify(value);
}
return this.$q.when(space === 'scratch');
};
};
ScratchPersistenceProvider.prototype.readObject = function (space, key) {
ScratchPersistenceProvider.prototype.readObject = function (space, key) {
return this.$q.when(
(space === 'scratch' && this.table[key])
? JSON.parse(this.table[key]) : undefined
);
};
};
ScratchPersistenceProvider.prototype.deleteObject = function (space, key, value) {
ScratchPersistenceProvider.prototype.deleteObject = function (space, key, value) {
if (space === 'scratch') {
delete this.table[key];
}
return this.$q.when(space === 'scratch');
};
};
ScratchPersistenceProvider.prototype.updateObject =
ScratchPersistenceProvider.prototype.updateObject =
ScratchPersistenceProvider.prototype.createObject;
return ScratchPersistenceProvider;
}
);
export default ScratchPersistenceProvider;

View File

@ -1,27 +1,15 @@
define([
"./src/ExampleStyleGuideModelProvider",
"./src/MCTExample",
"./res/templates/intro.html",
"./res/templates/standards.html",
"./res/templates/colors.html",
"./res/templates/status.html",
"./res/templates/glyphs.html",
"./res/templates/controls.html",
"./res/templates/input.html",
"./res/templates/menus.html"
], function (
ExampleStyleGuideModelProvider,
MCTExample,
introTemplate,
standardsTemplate,
colorsTemplate,
statusTemplate,
glyphsTemplate,
controlsTemplate,
inputTemplate,
menusTemplate
) {
return {
import ExampleStyleGuideModelProvider from './src/ExampleStyleGuideModelProvider';
import MCTExample from './src/MCTExample';
import introTemplate from './res/templates/intro.html';
import standardsTemplate from './res/templates/standards.html';
import colorsTemplate from './res/templates/colors.html';
import statusTemplate from './res/templates/status.html';
import glyphsTemplate from './res/templates/glyphs.html';
import controlsTemplate from './res/templates/controls.html';
import inputTemplate from './res/templates/input.html';
import menusTemplate from './res/templates/menus.html';
export default {
name: "example/styleguide",
definition: {
"name": "Open MCT Style Guide",
@ -184,5 +172,4 @@ define([
]
}
}
};
});
};

View File

@ -20,12 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
"use strict";
/*****************************************************************************
* 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.
*****************************************************************************/
function ExampleStyleGuideModelProvider($q) {
"use strict";
function ExampleStyleGuideModelProvider($q) {
var pages = {};
// Add pages
@ -75,8 +94,6 @@ define(
return $q.when(pages);
}
};
}
}
return ExampleStyleGuideModelProvider;
}
);
export default ExampleStyleGuideModelProvider;

View File

@ -1,10 +1,6 @@
define([
'../res/templates/mct-example.html'
], function (
MCTExampleTemplate
) {
import MCTExampleTemplate from '../res/templates/mct-example.html';
function MCTExample() {
function MCTExample() {
function link($scope, $element, $attrs, controller, $transclude) {
var codeEl = $element.find('pre');
var exampleEl = $element.find('div');
@ -24,7 +20,6 @@ define([
link: link,
replace: true
};
}
}
return MCTExample;
});
export default MCTExample;

View File

@ -7,6 +7,7 @@
"@percy/cli": "^1.0.0-beta.70",
"@percy/playwright": "^1.0.1",
"@playwright/test": "^1.16.3",
"5to6-codemod": "^1.8.0",
"allure-playwright": "^2.0.0-beta.14",
"angular": ">=1.8.0",
"angular-route": "1.4.14",
@ -36,6 +37,7 @@
"imports-loader": "^0.8.0",
"istanbul-instrumenter-loader": "^3.0.1",
"jasmine-core": "^3.7.1",
"jscodeshift": "^0.13.0",
"jsdoc": "^3.3.2",
"karma": "6.3.9",
"karma-chrome-launcher": "3.1.0",

View File

@ -20,33 +20,42 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
"./src/navigation/NavigationService",
"./src/navigation/NavigateAction",
"./src/navigation/OrphanNavigationHandler",
"./res/templates/browse.html",
"./res/templates/browse-object.html",
"./res/templates/browse/object-header.html",
"./res/templates/browse/object-header-frame.html",
"./res/templates/menu-arrow.html",
"./res/templates/back-arrow.html",
"./res/templates/browse/object-properties.html",
"./res/templates/browse/inspector-region.html"
], function (
NavigationService,
NavigateAction,
OrphanNavigationHandler,
browseTemplate,
browseObjectTemplate,
objectHeaderTemplate,
objectHeaderFrameTemplate,
menuArrowTemplate,
backArrowTemplate,
objectPropertiesTemplate,
inspectorRegionTemplate
) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
return {
import NavigationService from './src/navigation/NavigationService';
import NavigateAction from './src/navigation/NavigateAction';
import OrphanNavigationHandler from './src/navigation/OrphanNavigationHandler';
import browseTemplate from './res/templates/browse.html';
import browseObjectTemplate from './res/templates/browse-object.html';
import objectHeaderTemplate from './res/templates/browse/object-header.html';
import objectHeaderFrameTemplate from './res/templates/browse/object-header-frame.html';
import menuArrowTemplate from './res/templates/menu-arrow.html';
import backArrowTemplate from './res/templates/back-arrow.html';
import objectPropertiesTemplate from './res/templates/browse/object-properties.html';
import inspectorRegionTemplate from './res/templates/browse/inspector-region.html';
export default {
name: "platform/commonUI/browse",
definition: {
"extensions": {
@ -154,5 +163,4 @@ define([
]
}
}
};
});
};

View File

@ -20,32 +20,50 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[
'../../regions/src/Region'
],
function (Region) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
import Region from '../../regions/src/Region';
/**
* Defines the a default Inspector region. Captured in a class to
* allow for modular extension and customization of regions based on
* the typical case.
* @memberOf platform/commonUI/regions
* @constructor
*/
function InspectorRegion() {
function InspectorRegion() {
Region.call(this, {'name': 'Inspector'});
this.buildRegion();
}
}
InspectorRegion.prototype = Object.create(Region.prototype);
InspectorRegion.prototype.constructor = Region;
InspectorRegion.prototype = Object.create(Region.prototype);
InspectorRegion.prototype.constructor = Region;
/**
/**
* @private
*/
InspectorRegion.prototype.buildRegion = function () {
InspectorRegion.prototype.buildRegion = function () {
var metadataRegion = {
name: 'metadata',
title: 'Metadata Region',
@ -60,8 +78,6 @@ define(
}
};
this.addRegion(new Region(metadataRegion), 0);
};
};
return InspectorRegion;
}
);
export default InspectorRegion;

View File

@ -23,27 +23,42 @@
/**
* Module defining NavigateAction. Created by vwoeltje on 11/10/14.
*/
define(
[],
function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
* The navigate action navigates to a specific domain object.
* @memberof platform/commonUI/browse
* @constructor
* @implements {Action}
/**
* Module defining NavigateAction. Created by vwoeltje on 11/10/14.
*/
function NavigateAction(navigationService, context) {
function NavigateAction(navigationService, context) {
this.domainObject = context.domainObject;
this.navigationService = navigationService;
}
}
/**
/**
* Navigate to the object described in the context.
* @returns {Promise} a promise that is resolved once the
* navigation has been updated
*/
NavigateAction.prototype.perform = function () {
NavigateAction.prototype.perform = function () {
if (this.navigationService.shouldNavigate()) {
this.navigationService.setNavigation(this.domainObject, true);
@ -51,19 +66,17 @@ define(
}
return Promise.reject('Navigation Prevented by User');
};
};
/**
/**
* Navigate as an action is only applicable when a domain object
* is described in the action context.
* @param {ActionContext} context the context in which the action
* will be performed
* @returns {boolean} true if applicable
*/
NavigateAction.appliesTo = function (context) {
NavigateAction.appliesTo = function (context) {
return context.domainObject !== undefined;
};
};
return NavigateAction;
}
);
export default NavigateAction;

View File

@ -23,18 +23,32 @@
/**
* Module defining NavigationService. Created by vwoeltje on 11/10/14.
*/
define(
[],
function () {
/**
* The navigation service maintains the application's current
* navigation state, and allows listening for changes thereto.
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* @memberof platform/commonUI/browse
* @constructor
* 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.
*****************************************************************************/
/**
* Module defining NavigationService. Created by vwoeltje on 11/10/14.
*/
function NavigationService($window) {
function NavigationService($window) {
this.navigated = undefined;
this.callbacks = [];
this.checks = [];
@ -42,18 +56,18 @@ define(
this.oldUnload = $window.onbeforeunload;
$window.onbeforeunload = this.onBeforeUnload.bind(this);
}
}
/**
/**
* Get the current navigation state.
*
* @returns {DomainObject} the object that is navigated-to
*/
NavigationService.prototype.getNavigation = function () {
NavigationService.prototype.getNavigation = function () {
return this.navigated;
};
};
/**
/**
* Navigate to a specified object. If navigation checks exist and
* return reasons to prevent navigation, it will prompt the user before
* continuing. Trying to navigate to the currently navigated object will
@ -66,7 +80,7 @@ define(
* @param {Boolean} force if true, force navigation to occur.
* @returns {Boolean} true if navigation occurred, otherwise false.
*/
NavigationService.prototype.setNavigation = function (domainObject, force) {
NavigationService.prototype.setNavigation = function (domainObject, force) {
if (force) {
this.doNavigation(domainObject);
@ -85,9 +99,9 @@ define(
this.doNavigation(domainObject);
return true;
};
};
/**
/**
* Listen for changes in navigation. The passed callback will
* be invoked with the new domain object of navigation when
* this changes.
@ -95,24 +109,24 @@ define(
* @param {function} callback the callback to invoke when
* navigation state changes
*/
NavigationService.prototype.addListener = function (callback) {
NavigationService.prototype.addListener = function (callback) {
this.callbacks.push(callback);
};
};
/**
/**
* Stop listening for changes in navigation state.
*
* @param {function} callback the callback which should
* no longer be invoked when navigation state
* changes
*/
NavigationService.prototype.removeListener = function (callback) {
NavigationService.prototype.removeListener = function (callback) {
this.callbacks = this.callbacks.filter(function (cb) {
return cb !== callback;
});
};
};
/**
/**
* Check if navigation should proceed. May prompt a user for input
* if any checkFns return messages. Returns true if the user wishes to
* navigate, otherwise false. If using this prior to calling
@ -121,13 +135,13 @@ define(
*
* @returns {Boolean} true if the user wishes to navigate, otherwise false.
*/
NavigationService.prototype.shouldNavigate = function () {
NavigationService.prototype.shouldNavigate = function () {
var doNotNavigate = this.shouldWarnBeforeNavigate();
return !doNotNavigate || this.$window.confirm(doNotNavigate);
};
};
/**
/**
* Register a check function to be called before any navigation occurs.
* Check functions should return a human readable "message" if
* there are any reasons to prevent navigation. Otherwise, they should
@ -137,7 +151,7 @@ define(
* @param {Function} checkFn a function to call before navigation occurs.
* @returns {Function} removeCheck call to remove check
*/
NavigationService.prototype.checkBeforeNavigation = function (checkFn) {
NavigationService.prototype.checkBeforeNavigation = function (checkFn) {
this.checks.push(checkFn);
return function removeCheck() {
@ -145,27 +159,27 @@ define(
return checkFn !== fn;
});
}.bind(this);
};
};
/**
/**
* Private method to actually perform navigation.
*
* @private
*/
NavigationService.prototype.doNavigation = function (value) {
NavigationService.prototype.doNavigation = function (value) {
this.navigated = value;
this.callbacks.forEach(function (callback) {
callback(value);
});
};
};
/**
/**
* Returns either a false value, or a string that should be displayed
* to the user before navigation is allowed.
*
* @private
*/
NavigationService.prototype.shouldWarnBeforeNavigate = function () {
NavigationService.prototype.shouldWarnBeforeNavigate = function () {
var reasons = [];
this.checks.forEach(function (checkFn) {
var reason = checkFn();
@ -179,15 +193,15 @@ define(
}
return false;
};
};
/**
/**
* Listener for window on before unload event-- will warn before
* navigation is allowed.
*
* @private
*/
NavigationService.prototype.onBeforeUnload = function () {
NavigationService.prototype.onBeforeUnload = function () {
var shouldWarnBeforeNavigate = this.shouldWarnBeforeNavigate();
if (shouldWarnBeforeNavigate) {
return shouldWarnBeforeNavigate;
@ -196,8 +210,6 @@ define(
if (this.oldUnload) {
return this.oldUnload.apply(undefined, [].slice.apply(arguments));
}
};
};
return NavigationService;
}
);
export default NavigationService;

View File

@ -20,22 +20,29 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([], function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
* Navigates away from orphan objects whenever they are detected.
*
* An orphan object is an object whose apparent parent does not
* actually contain it. This may occur in certain circumstances, such
* as when persistence succeeds for a newly-created object but fails
* for its parent.
*
* @param throttle the `throttle` service
* @param topic the `topic` service
* @param navigationService the `navigationService`
* @constructor
*/
function OrphanNavigationHandler(throttle, topic, navigationService) {
function OrphanNavigationHandler(throttle, topic, navigationService) {
var throttledCheckNavigation;
function getParent(domainObject) {
@ -70,7 +77,6 @@ define([], function () {
navigationService.addListener(throttledCheckNavigation);
topic('mutation').listen(throttledCheckNavigation);
}
}
return OrphanNavigationHandler;
});
export default OrphanNavigationHandler;

View File

@ -23,11 +23,34 @@
/**
* MCTIncudeSpec. Created by vwoeltje on 11/6/14.
*/
define(
["../src/InspectorRegion"],
function (InspectorRegion) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
describe("The inspector region", function () {
/**
* MCTIncudeSpec. Created by vwoeltje on 11/6/14.
*/
import InspectorRegion from '../src/InspectorRegion';
describe("The inspector region", function () {
var inspectorRegion;
beforeEach(function () {
@ -38,6 +61,4 @@ define(
expect(inspectorRegion.regions.length).toBe(1);
});
});
}
);
});

View File

@ -23,13 +23,34 @@
/**
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
*/
define([
"../../src/navigation/NavigateAction"
], function (
NavigateAction
) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
describe("The navigate action", function () {
/**
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
*/
import NavigateAction from '../../src/navigation/NavigateAction';
describe("The navigate action", function () {
var mockNavigationService,
mockDomainObject,
action;
@ -81,5 +102,4 @@ define([
})).toBeTruthy();
});
});
});

View File

@ -23,11 +23,34 @@
/**
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
*/
define(
["../../src/navigation/NavigationService"],
function (NavigationService) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
describe("The navigation service", function () {
/**
* MCTRepresentationSpec. Created by vwoeltje on 11/6/14.
*/
import NavigationService from '../../src/navigation/NavigationService';
describe("The navigation service", function () {
var $window,
navigationService;
@ -83,6 +106,4 @@ define(
expect(callback).not.toHaveBeenCalled();
});
});
}
);
});

View File

@ -20,10 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
'../../src/navigation/OrphanNavigationHandler'
], function (OrphanNavigationHandler) {
describe("OrphanNavigationHandler", function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
import OrphanNavigationHandler from '../../src/navigation/OrphanNavigationHandler';
describe("OrphanNavigationHandler", function () {
var mockTopic,
mockThrottle,
mockMutationTopic,
@ -177,6 +198,4 @@ define([
});
});
});
});

View File

@ -20,31 +20,41 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
"./src/DialogService",
"./src/OverlayService",
"./res/templates/overlay-dialog.html",
"./res/templates/overlay-options.html",
"./res/templates/dialog.html",
"./res/templates/overlay-blocking-message.html",
"./res/templates/message.html",
"./res/templates/notification-message.html",
"./res/templates/overlay-message-list.html",
"./res/templates/overlay.html"
], function (
DialogService,
OverlayService,
overlayDialogTemplate,
overlayOptionsTemplate,
dialogTemplate,
overlayBlockingMessageTemplate,
messageTemplate,
notificationMessageTemplate,
overlayMessageListTemplate,
overlayTemplate
) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
return {
import DialogService from './src/DialogService';
import OverlayService from './src/OverlayService';
import overlayDialogTemplate from './res/templates/overlay-dialog.html';
import overlayOptionsTemplate from './res/templates/overlay-options.html';
import dialogTemplate from './res/templates/dialog.html';
import overlayBlockingMessageTemplate from './res/templates/overlay-blocking-message.html';
import messageTemplate from './res/templates/message.html';
import notificationMessageTemplate from './res/templates/notification-message.html';
import overlayMessageListTemplate from './res/templates/overlay-message-list.html';
import overlayTemplate from './res/templates/overlay.html';
export default {
name: "platform/commonUI/dialog",
definition: {
"extensions": {
@ -108,5 +118,4 @@ define([
]
}
}
};
});
};

View File

@ -25,17 +25,34 @@
* launch dialogs for user input & notifications.
* @namespace platform/commonUI/dialog
*/
define(
[],
function () {
/**
* The dialog service is responsible for handling window-modal
* communication with the user, such as displaying forms for user
* input.
* @memberof platform/commonUI/dialog
* @constructor
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
* This bundle implements the dialog service, which can be used to
* launch dialogs for user input & notifications.
* @namespace platform/commonUI/dialog
*/
function DialogService(overlayService, $q, $log, $document) {
function DialogService(overlayService, $q, $log, $document) {
this.overlayService = overlayService;
this.$q = $q;
this.$log = $log;
@ -44,12 +61,12 @@ define(
this.findBody = function () {
return $document.find('body');
};
}
}
/**
/**
* @private
*/
DialogService.prototype.dismissOverlay = function (overlay) {
DialogService.prototype.dismissOverlay = function (overlay) {
//Dismiss the overlay
overlay.dismiss();
@ -57,9 +74,9 @@ define(
if (overlay === this.activeOverlay) {
this.activeOverlay = undefined;
}
};
};
DialogService.prototype.getDialogResponse = function (key, model, resultGetter, typeClass) {
DialogService.prototype.getDialogResponse = function (key, model, resultGetter, typeClass) {
// We will return this result as a promise, because user
// input is asynchronous.
var deferred = this.$q.defer(),
@ -110,9 +127,9 @@ define(
}
return deferred.promise;
};
};
/**
/**
* Request user input via a window-modal dialog.
*
* @param {FormModel} formModel a description of the form
@ -123,7 +140,7 @@ define(
* user input cannot be obtained (for instance,
* because the user cancelled the dialog)
*/
DialogService.prototype.getUserInput = function (formModel, value) {
DialogService.prototype.getUserInput = function (formModel, value) {
var overlayModel = {
title: formModel.name,
message: formModel.message,
@ -142,31 +159,31 @@ define(
overlayModel,
resultGetter
);
};
};
/**
/**
* Request that the user chooses from a set of options,
* which will be shown as buttons.
*
* @param dialogModel a description of the dialog to show
* @return {Promise} a promise for the user's choice
*/
DialogService.prototype.getUserChoice = function (dialogModel) {
DialogService.prototype.getUserChoice = function (dialogModel) {
// Show the overlay-options dialog
return this.getDialogResponse(
"overlay-options",
{ dialog: dialogModel }
);
};
};
/**
/**
* Tests if a dialog can be displayed. A modal dialog may only be
* displayed if one is not already visible.
* Will log a warning message if it can't display a dialog.
* @returns {boolean} true if dialog is currently visible, false
* otherwise
*/
DialogService.prototype.canShowDialog = function (dialogModel) {
DialogService.prototype.canShowDialog = function (dialogModel) {
if (this.activeOverlay) {
// Only one dialog should be shown at a time.
// The application design should be such that
@ -181,9 +198,9 @@ define(
} else {
return true;
}
};
};
/**
/**
* A user action that can be performed from a blocking dialog. These
* actions will be rendered as buttons within a blocking dialog.
*
@ -194,12 +211,12 @@ define(
* button is clicked
*/
/**
/**
* @typedef DialogHandle
* @property {function} dismiss a function to dismiss the given dialog
*/
/**
/**
* A description of the model options that may be passed to the
* showBlockingMessage method. Note that the DialogModel described
* here is shared with the Notifications framework.
@ -233,7 +250,7 @@ define(
* be added to the dialog as buttons.
*/
/**
/**
* Displays a blocking (modal) dialog. This dialog can be used for
* displaying messages that require the user's
* immediate attention. The message may include an indication of
@ -243,7 +260,7 @@ define(
* @param {typeClass} string tells overlayService that this overlay should use appropriate CSS class
* @returns {boolean | {DialogHandle}}
*/
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
@ -264,8 +281,6 @@ define(
} else {
return false;
}
};
};
return DialogService;
}
);
export default DialogService;

View File

@ -20,15 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
// 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
var TEMPLATE = '<mct-include ng-model="overlay" key="key" ng-class="typeClass"></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
* which need to block the full screen.
@ -43,7 +59,7 @@ define(
* @memberof platform/commonUI/dialog
* @constructor
*/
function OverlayService($document, $compile, $rootScope, $timeout) {
function OverlayService($document, $compile, $rootScope, $timeout) {
this.$compile = $compile;
this.$timeout = $timeout;
@ -56,9 +72,9 @@ define(
this.newScope = function () {
return $rootScope.$new();
};
}
}
/**
/**
* Add a new overlay to the document. This will be
* prepended to the document body; the overlay's
* template (as pointed to by the `key` argument) is
@ -74,7 +90,7 @@ define(
* the overlay. Can be specified to provide custom styling of
* overlays
*/
OverlayService.prototype.createOverlay = function (key, overlayModel, typeClass) {
OverlayService.prototype.createOverlay = function (key, overlayModel, typeClass) {
// Create a new scope for this overlay
var scope = this.newScope(),
element;
@ -106,8 +122,6 @@ define(
return {
dismiss: dismiss
};
};
};
return OverlayService;
}
);
export default OverlayService;

View File

@ -23,11 +23,34 @@
/**
* MCTIncudeSpec. Created by vwoeltje on 11/6/14.
*/
define(
["../src/DialogService"],
function (DialogService) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
describe("The dialog service", function () {
/**
* MCTIncudeSpec. Created by vwoeltje on 11/6/14.
*/
import DialogService from '../src/DialogService';
describe("The dialog service", function () {
var mockOverlayService,
mockQ,
mockLog,
@ -209,6 +232,4 @@ define(
});
});
});
}
);
});

View File

@ -23,11 +23,34 @@
/**
* MCTIncudeSpec. Created by vwoeltje on 11/6/14.
*/
define(
["../src/OverlayService"],
function (OverlayService) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
describe("The overlay service", function () {
/**
* MCTIncudeSpec. Created by vwoeltje on 11/6/14.
*/
import OverlayService from '../src/OverlayService';
describe("The overlay service", function () {
var mockDocument,
mockCompile,
mockRootScope,
@ -99,6 +122,4 @@ define(
expect(mockScope.$destroy).toHaveBeenCalled();
});
});
}
);
});

View File

@ -20,40 +20,46 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
"./src/controllers/EditActionController",
"./src/controllers/EditPanesController",
"./src/controllers/EditObjectController",
"./src/actions/EditAndComposeAction",
"./src/actions/EditAction",
"./src/actions/SaveAction",
"./src/actions/SaveAndStopEditingAction",
"./src/actions/CancelAction",
"./src/policies/EditPersistableObjectsPolicy",
"./src/representers/EditRepresenter",
"./src/capabilities/EditorCapability",
"./res/templates/library.html",
"./res/templates/edit-object.html",
"./res/templates/edit-action-buttons.html",
"./res/templates/topbar-edit.html"
], function (
EditActionController,
EditPanesController,
EditObjectController,
EditAndComposeAction,
EditAction,
SaveAction,
SaveAndStopEditingAction,
CancelAction,
EditPersistableObjectsPolicy,
EditRepresenter,
EditorCapability,
libraryTemplate,
editObjectTemplate,
editActionButtonsTemplate,
topbarEditTemplate
) {
return {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
import EditActionController from './src/controllers/EditActionController';
import EditPanesController from './src/controllers/EditPanesController';
import EditObjectController from './src/controllers/EditObjectController';
import EditAndComposeAction from './src/actions/EditAndComposeAction';
import EditAction from './src/actions/EditAction';
import SaveAction from './src/actions/SaveAction';
import SaveAndStopEditingAction from './src/actions/SaveAndStopEditingAction';
import CancelAction from './src/actions/CancelAction';
import EditPersistableObjectsPolicy from './src/policies/EditPersistableObjectsPolicy';
import EditRepresenter from './src/representers/EditRepresenter';
import EditorCapability from './src/capabilities/EditorCapability';
import libraryTemplate from './res/templates/library.html';
import editObjectTemplate from './res/templates/edit-object.html';
import editActionButtonsTemplate from './res/templates/edit-action-buttons.html';
import topbarEditTemplate from './res/templates/topbar-edit.html';
export default {
name: "platform/commonUI/edit",
definition: {
"extensions": {
@ -205,5 +211,4 @@ define([
]
}
}
};
});
};

View File

@ -20,10 +20,7 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
function () {
/**
/**
* The "Cancel" action; the action triggered by clicking Cancel from
* Edit Mode. Exits the editing user interface and invokes object
* capabilities to persist the changes that have been made.
@ -31,17 +28,17 @@ define(
* @memberof platform/commonUI/edit
* @implements {Action}
*/
function CancelAction(context) {
function CancelAction(context) {
this.domainObject = context.domainObject;
}
}
/**
/**
* Cancel editing.
*
* @returns {Promise} a promise that will be fulfilled when
* cancellation has completed
*/
CancelAction.prototype.perform = function () {
CancelAction.prototype.perform = function () {
var domainObject = this.domainObject;
function returnToBrowse() {
@ -69,22 +66,20 @@ define(
//Do navigation first in order to trigger unsaved changes dialog
return returnToBrowse()
.then(cancel);
};
};
/**
/**
* Check if this action is applicable in a given context.
* This will ensure that a domain object is present in the context,
* and that this domain object is in Edit mode.
* @returns {boolean} true if applicable
*/
CancelAction.appliesTo = function (context) {
CancelAction.appliesTo = function (context) {
var domainObject = (context || {}).domainObject;
return domainObject !== undefined
&& domainObject.hasCapability('editor')
&& domainObject.getCapability('editor').isEditContextRoot();
};
};
return CancelAction;
}
);
export default CancelAction;

View File

@ -23,19 +23,38 @@
/**
* Module defining EditAction. Created by vwoeltje on 11/14/14.
*/
define(
[],
function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
// A no-op action to return in the event that the action cannot
// be completed.
var NULL_ACTION = {
/**
* Module defining EditAction. Created by vwoeltje on 11/14/14.
*/
var NULL_ACTION = {
perform: function () {
return undefined;
}
};
};
/**
/**
* The Edit action is performed when the user wishes to enter Edit
* mode (typically triggered by the Edit button.) This will
* show the user interface for editing (by way of a change in
@ -44,7 +63,7 @@ define(
* @constructor
* @implements {Action}
*/
function EditAction($location, navigationService, $log, context) {
function EditAction($location, navigationService, $log, context) {
var domainObject = (context || {}).domainObject;
// We cannot enter Edit mode if we have no domain object to
@ -63,12 +82,12 @@ define(
this.domainObject = domainObject;
this.$location = $location;
this.navigationService = navigationService;
}
}
/**
/**
* Enter edit mode.
*/
EditAction.prototype.perform = function () {
EditAction.prototype.perform = function () {
//If this is not the currently navigated object, then navigate
// to it.
@ -77,15 +96,15 @@ define(
}
this.domainObject.useCapability("editor");
};
};
/**
/**
* Check for applicability; verify that a domain object is present
* for this action to be performed upon.
* @param {ActionContext} context the context in which this action
* will be performed; should contain a `domainObject` property
*/
EditAction.appliesTo = function (context) {
EditAction.appliesTo = function (context) {
var domainObject = (context || {}).domainObject,
type = domainObject && domainObject.getCapability('type');
@ -94,8 +113,6 @@ define(
return type && type.hasFeature('creation')
&& domainObject.hasCapability('editor')
&& !domainObject.getCapability('editor').isEditContextRoot();
};
};
return EditAction;
}
);
export default EditAction;

View File

@ -20,22 +20,34 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
* Add one domain object to another's composition.
* @constructor
* @memberof platform/commonUI/edit
* @implements {Action}
*/
function EditAndComposeAction(context) {
function EditAndComposeAction(context) {
this.domainObject = (context || {}).domainObject;
this.selectedObject = (context || {}).selectedObject;
}
}
EditAndComposeAction.prototype.perform = function () {
EditAndComposeAction.prototype.perform = function () {
var self = this,
editAction = this.domainObject.getCapability('action').getActions("edit")[0];
@ -52,8 +64,6 @@ define(
}
return this.selectedObject && doLink();
};
};
return EditAndComposeAction;
}
);
export default EditAndComposeAction;

View File

@ -20,35 +20,55 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
['./SaveInProgressDialog'],
function (SaveInProgressDialog) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
import SaveInProgressDialog from './SaveInProgressDialog';
/**
* The "Save" action; it invokes object capabilities to persist
* the changes that have been made.
* @constructor
* @implements {Action}
* @memberof platform/commonUI/edit
*/
function SaveAction(
function SaveAction(
dialogService,
notificationService,
context
) {
) {
this.domainObject = (context || {}).domainObject;
this.dialogService = dialogService;
this.notificationService = notificationService;
}
}
/**
/**
* Save changes.
*
* @returns {Promise} a promise that will be fulfilled when
* cancellation has completed
* @memberof platform/commonUI/edit.SaveAction#
*/
SaveAction.prototype.perform = function () {
SaveAction.prototype.perform = function () {
var self = this,
domainObject = this.domainObject,
dialog = new SaveInProgressDialog(this.dialogService);
@ -76,23 +96,21 @@ define(
return doSave()
.then(onSuccess)
.catch(onFailure);
};
};
/**
/**
* Check if this action is applicable in a given context.
* This will ensure that a domain object is present in the context,
* and that this domain object is in Edit mode.
* @returns true if applicable
*/
SaveAction.appliesTo = function (context) {
SaveAction.appliesTo = function (context) {
var domainObject = (context || {}).domainObject;
return domainObject !== undefined
&& domainObject.hasCapability('editor')
&& domainObject.getCapability('editor').isEditContextRoot()
&& domainObject.getModel().persisted !== undefined;
};
};
return SaveAction;
}
);
export default SaveAction;

View File

@ -20,36 +20,56 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
["./SaveAction"],
function (SaveAction) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
import SaveAction from './SaveAction';
/**
* The "Save and Stop Editing" action performs a [Save action]{@link SaveAction}
* on the object under edit followed by exiting the edit user interface.
* @constructor
* @implements {Action}
* @memberof platform/commonUI/edit
*/
function SaveAndStopEditingAction(
function SaveAndStopEditingAction(
dialogService,
notificationService,
context
) {
) {
this.context = context;
this.domainObject = (context || {}).domainObject;
this.dialogService = dialogService;
this.notificationService = notificationService;
}
}
/**
/**
* Trigger a save operation and exit edit mode.
*
* @returns {Promise} a promise that will be fulfilled when
* cancellation has completed
* @memberof platform/commonUI/edit.SaveAndStopEditingAction#
*/
SaveAndStopEditingAction.prototype.perform = function () {
SaveAndStopEditingAction.prototype.perform = function () {
var domainObject = this.domainObject,
saveAction = new SaveAction(this.dialogService, this.notificationService, this.context);
@ -60,16 +80,14 @@ define(
return saveAction.perform()
.then(closeEditor)
.catch(closeEditor);
};
};
/**
/**
* Check if this action is applicable in a given context.
* This will ensure that a domain object is present in the context,
* and that this domain object is in Edit mode.
* @returns true if applicable
*/
SaveAndStopEditingAction.appliesTo = SaveAction.appliesTo;
SaveAndStopEditingAction.appliesTo = SaveAction.appliesTo;
return SaveAndStopEditingAction;
}
);
export default SaveAndStopEditingAction;

View File

@ -1,10 +1,9 @@
define([], function () {
function SaveInProgressDialog(dialogService) {
function SaveInProgressDialog(dialogService) {
this.dialogService = dialogService;
this.dialog = undefined;
}
}
SaveInProgressDialog.prototype.show = function () {
SaveInProgressDialog.prototype.show = function () {
this.dialog = this.dialogService.showBlockingMessage({
title: "Saving",
hint: "Do not navigate away from this page or close this browser tab while this message is displayed.",
@ -12,13 +11,12 @@ define([], function () {
severity: "info",
delay: true
});
};
};
SaveInProgressDialog.prototype.hide = function () {
SaveInProgressDialog.prototype.hide = function () {
if (this.dialog) {
this.dialog.dismiss();
}
};
};
return SaveInProgressDialog;
});
export default SaveInProgressDialog;

View File

@ -20,45 +20,52 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
* A capability that implements an editing 'session' for a domain
* object. An editing session is initiated via a call to .edit().
* Once initiated, any persist operations will be queued pending a
* subsequent call to [.save()](@link #save) or [.finish()](@link
* #finish).
* @param domainObject
* @constructor
*/
function EditorCapability(
function EditorCapability(
openmct,
domainObject
) {
) {
this.openmct = openmct;
this.domainObject = domainObject;
}
}
/**
/**
* Determines whether this object, or any of its ancestors are
* currently being edited.
* @returns boolean
*/
EditorCapability.prototype.inEditContext = function () {
EditorCapability.prototype.inEditContext = function () {
return this.openmct.editor.isEditing();
};
};
/**
/**
* Is this the root editing object (ie. the object that the user
* clicked 'edit' on)?
* @returns {*}
*/
EditorCapability.prototype.isEditContextRoot = function () {
EditorCapability.prototype.isEditContextRoot = function () {
return this.openmct.editor.isEditing();
};
};
return EditorCapability;
}
);
export default EditorCapability;

View File

@ -23,19 +23,40 @@
/**
* Module defining EditActionController. Created by vwoeltje on 11/17/14.
*/
define(
[],
function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
var SAVE_ACTION_CONTEXT = { category: 'save' };
var OTHERS_ACTION_CONTEXT = { category: 'conclude-editing' };
/**
* Module defining EditActionController. Created by vwoeltje on 11/17/14.
*/
var SAVE_ACTION_CONTEXT = { category: 'save' };
var OTHERS_ACTION_CONTEXT = { category: 'conclude-editing' };
/**
/**
* Controller which supplies action instances for Save/Cancel.
* @memberof platform/commonUI/edit
* @constructor
*/
function EditActionController($scope) {
function EditActionController($scope) {
function actionToMenuOption(action) {
return {
@ -72,8 +93,6 @@ define(
// Update set of actions whenever the action capability
// changes or becomes available.
$scope.$watch("action", updateActions);
}
}
return EditActionController;
}
);
export default EditActionController;

View File

@ -24,26 +24,48 @@
* This bundle implements Edit mode.
* @namespace platform/commonUI/edit
*/
define(
[],
function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
function cancelEditing(domainObject) {
/**
* This bundle implements Edit mode.
* @namespace platform/commonUI/edit
*/
function cancelEditing(domainObject) {
var navigatedObject = domainObject,
editorCapability = navigatedObject
&& navigatedObject.getCapability("editor");
return editorCapability
&& editorCapability.finish();
}
}
/**
/**
* Controller which is responsible for populating the scope for
* Edit mode
* @memberof platform/commonUI/edit
* @constructor
*/
function EditObjectController($scope, $location, navigationService) {
function EditObjectController($scope, $location, navigationService) {
this.scope = $scope;
var domainObject = $scope.domainObject;
@ -79,8 +101,6 @@ define(
$scope.doAction = function (action) {
return $scope[action] && $scope[action]();
};
}
}
return EditObjectController;
}
);
export default EditObjectController;

View File

@ -20,16 +20,29 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
* Supports the Library and Elements panes in Edit mode.
* @memberof platform/commonUI/edit
* @constructor
*/
function EditPanesController($scope) {
function EditPanesController($scope) {
var self = this;
// Update root object based on represented object
@ -50,17 +63,15 @@ define(
// Update root when represented object changes
$scope.$watch('domainObject', updateRoot);
}
}
/**
/**
* Get the root-level domain object, as reported by the
* represented domain object.
* @returns {DomainObject} the root object
*/
EditPanesController.prototype.getRoot = function () {
EditPanesController.prototype.getRoot = function () {
return this.rootDomainObject;
};
};
return EditPanesController;
}
);
export default EditPanesController;

View File

@ -20,22 +20,42 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
['objectUtils'],
function (objectUtils) {
/*****************************************************************************
* 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.
*****************************************************************************/
/**
import objectUtils from 'objectUtils';
/**
* Policy that prevents editing of any object from a provider that does not
* support persistence (ie. the 'save' operation). Editing is prevented
* as a subsequent save would fail, causing the loss of a user's changes.
* @param openmct
* @constructor
*/
function EditPersistableObjectsPolicy(openmct) {
function EditPersistableObjectsPolicy(openmct) {
this.openmct = openmct;
}
}
EditPersistableObjectsPolicy.prototype.allow = function (action, context) {
EditPersistableObjectsPolicy.prototype.allow = function (action, context) {
var domainObject = context.domainObject;
var key = action.getMetadata().key;
var category = (context || {}).category;
@ -50,8 +70,6 @@ define(
}
return true;
};
};
return EditPersistableObjectsPolicy;
}
);
export default EditPersistableObjectsPolicy;

View File

@ -20,44 +20,43 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
* The EditRepresenter is responsible for implementing
* representation-level behavior relevant to Edit mode.
* Specifically, this listens for changes to view configuration
* or to domain object models, and triggers persistence when
* these are detected.
*
* This is exposed as an extension of category `representers`,
* which mct-representation will utilize to add additional
* behavior to each representation.
*
* This will be called once per mct-representation directive,
* and may be reused for different domain objects and/or
* representations resulting from changes there.
*
* @memberof platform/commonUI/edit
* @implements {Representer}
* @constructor
*/
function EditRepresenter($log, $scope) {
function EditRepresenter($log, $scope) {
this.$log = $log;
this.$scope = $scope;
this.$scope.commit = this.commit.bind(this);
}
}
/**
/**
* Commit any changes made to the in-scope model to the domain object.
* Also commits any changes made to $scope.configuration to the proper
* configuration value for the current representation.
*
* @param {String} message a message to log with the commit message.
*/
EditRepresenter.prototype.commit = function (message) {
EditRepresenter.prototype.commit = function (message) {
var model = this.$scope.model,
configuration = this.$scope.configuration,
domainObject = this.domainObject;
@ -79,21 +78,19 @@ define(
return model;
});
}
};
};
// Handle a specific representation of a specific domain object
EditRepresenter.prototype.represent = function (representation, representedObject) {
// Handle a specific representation of a specific domain object
EditRepresenter.prototype.represent = function (representation, representedObject) {
this.domainObject = representedObject;
if (representation) {
this.key = representation.key;
} else {
delete this.key;
}
};
};
// Respond to the destruction of the current representation.
EditRepresenter.prototype.destroy = function () {};
// Respond to the destruction of the current representation.
EditRepresenter.prototype.destroy = function () {};
return EditRepresenter;
}
);
export default EditRepresenter;

View File

@ -20,11 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
["../../src/actions/CancelAction"],
function (CancelAction) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
describe("The Cancel action", function () {
import CancelAction from '../../src/actions/CancelAction';
describe("The Cancel action", function () {
var mockDomainObject,
mockParentObject,
capabilities = {},
@ -150,6 +170,4 @@ define(
action.perform();
expect(parentCapabilities.action.perform).toHaveBeenCalledWith("navigate");
});
});
}
);
});

View File

@ -20,11 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
["../../src/actions/EditAction"],
function (EditAction) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
describe("The Edit action", function () {
import EditAction from '../../src/actions/EditAction';
describe("The Edit action", function () {
var mockLocation,
mockNavigationService,
mockLog,
@ -103,6 +123,4 @@ define(
expect(mockDomainObject.useCapability).toHaveBeenCalledWith("editor");
});
});
}
);
});

View File

@ -20,11 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
["../../src/actions/EditAndComposeAction"],
function (EditAndComposeAction) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
describe("The Link action", function () {
import EditAndComposeAction from '../../src/actions/EditAndComposeAction';
describe("The Link action", function () {
var mockDomainObject,
mockParent,
mockContext,
@ -114,6 +134,4 @@ define(
.toHaveBeenCalledWith(mockDomainObject);
});
});
}
);
});

View File

@ -20,11 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
["../../src/actions/SaveAction"],
function (SaveAction) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
describe("The Save action", function () {
import SaveAction from '../../src/actions/SaveAction';
describe("The Save action", function () {
var mockDomainObject,
mockEditorCapability,
actionContext,
@ -154,6 +174,4 @@ define(
});
});
});
});
}
);
});

View File

@ -20,11 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
["../../src/actions/SaveAndStopEditingAction"],
function (SaveAndStopEditingAction) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
describe("The Save and Stop Editing action", function () {
import SaveAndStopEditingAction from '../../src/actions/SaveAndStopEditingAction';
describe("The Save and Stop Editing action", function () {
// Some mocks appear unused because the
// underlying SaveAction that this action
@ -123,6 +143,4 @@ define(
expect(mockEditorCapability.save).toHaveBeenCalled();
expect(mockEditorCapability.finish).toHaveBeenCalled();
});
});
}
);
});

View File

@ -20,11 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
["../../src/controllers/EditActionController"],
function (EditActionController) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
describe("The Edit Action controller", function () {
import EditActionController from '../../src/controllers/EditActionController';
describe("The Edit Action controller", function () {
var mockSaveActionMetadata = {
name: "mocked-save-action",
cssClass: "mocked-save-action-css"
@ -101,6 +121,4 @@ define(
makeControllerUpdateActions();
expect(mockScope.otherEditActions).toEqual(["a", "b", "c"]);
});
});
}
);
});

View File

@ -20,11 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
["../../src/controllers/EditObjectController"],
function (EditObjectController) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
describe("The Edit Object controller", function () {
import EditObjectController from '../../src/controllers/EditObjectController';
describe("The Edit Object controller", function () {
var mockScope,
mockObject,
testViews,
@ -133,6 +153,4 @@ define(
.toEqual(testViews[1]);
});
});
}
);
});

View File

@ -20,11 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
["../../src/controllers/EditPanesController"],
function (EditPanesController) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
describe("The Edit Panes controller", function () {
import EditPanesController from '../../src/controllers/EditPanesController';
describe("The Edit Panes controller", function () {
var mockScope,
mockDomainObject,
mockContext,
@ -109,6 +129,4 @@ define(
expect(controller.getRoot()).not.toBe(firstRoot);
expect(controller.getRoot().getId()).toEqual('other-root-id');
});
});
}
);
});

View File

@ -20,11 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
["../../src/policies/EditPersistableObjectsPolicy"],
function (EditPersistableObjectsPolicy) {
/*****************************************************************************
* 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.
*****************************************************************************/
describe("The Edit persistable objects policy", function () {
import EditPersistableObjectsPolicy from '../../src/policies/EditPersistableObjectsPolicy';
describe("The Edit persistable objects policy", function () {
var mockDomainObject,
mockEditAction,
mockPropertiesAction,
@ -97,6 +117,4 @@ define(
mockObjectAPI.isPersistable.and.returnValue(true);
expect(policy.allow(mockEditAction, testContext)).toBe(true);
});
});
}
);
});

View File

@ -20,12 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
'../../src/representers/EditRepresenter'
], function (
EditRepresenter
) {
describe('EditRepresenter', function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
import EditRepresenter from '../../src/representers/EditRepresenter';
describe('EditRepresenter', function () {
var $log,
$scope,
representer;
@ -83,5 +102,4 @@ define([
});
});
});

View File

@ -20,14 +20,33 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
"./src/FormatProvider",
"./src/DurationFormat"
], function (
FormatProvider,
DurationFormat
) {
return {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
import FormatProvider from './src/FormatProvider';
import DurationFormat from './src/DurationFormat';
export default {
name: "platform/commonUI/formats",
definition: {
"name": "Format Registry",
@ -68,5 +87,4 @@ define([
]
}
}
};
});
};

View File

@ -20,18 +20,36 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
'moment'
], function (
moment
) {
/*****************************************************************************
* 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.
*****************************************************************************/
var DATE_FORMAT = "HH:mm:ss",
import moment from 'moment';
var DATE_FORMAT = "HH:mm:ss",
DATE_FORMATS = [
DATE_FORMAT
];
/**
/**
* Formatter for duration. Uses moment to produce a date from a given
* value, but output is formatted to display only time. Can be used for
* specifying a time duration. For specifying duration, it's best to
@ -42,21 +60,20 @@ define([
* @constructor
* @memberof platform/commonUI/formats
*/
function DurationFormat() {
function DurationFormat() {
this.key = "duration";
}
}
DurationFormat.prototype.format = function (value) {
DurationFormat.prototype.format = function (value) {
return moment.utc(value).format(DATE_FORMAT);
};
};
DurationFormat.prototype.parse = function (text) {
DurationFormat.prototype.parse = function (text) {
return moment.duration(text).asMilliseconds();
};
};
DurationFormat.prototype.validate = function (text) {
DurationFormat.prototype.validate = function (text) {
return moment.utc(text, DATE_FORMATS, true).isValid();
};
};
return DurationFormat;
});
export default DurationFormat;

View File

@ -20,82 +20,29 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
], function (
) {
/**
* An object used to convert between numeric values and text values,
* typically used to display these values to the user and to convert
* user input to a numeric format, particularly for time formats.
* @interface Format
*/
/**
* Parse text (typically user input) to a numeric value.
* Behavior is undefined when the text cannot be parsed;
* `validate` should be called first if the text may be invalid.
* @method Format#parse
* @memberof Format#
* @param {string} text the text to parse
* @returns {number} the parsed numeric value
*/
/**
* @property {string} key A unique identifier for this formatter.
* @memberof Format#
*/
/**
* Determine whether or not some text (typically user input) can
* be parsed to a numeric value by this format.
* @method validate
* @memberof Format#
* @param {string} text the text to parse
* @returns {boolean} true if the text can be parsed
*/
/**
* Convert a numeric value to a text value for display using
* this format.
* @method format
* @memberof Format#
* @param {number} value the numeric value to format
* @param {number} [minValue] Contextual information for scaled formatting used in linear scales such as conductor
* and plot axes. Specifies the smallest number on the scale.
* @param {number} [maxValue] Contextual information for scaled formatting used in linear scales such as conductor
* and plot axes. Specifies the largest number on the scale
* @param {number} [count] Contextual information for scaled formatting used in linear scales such as conductor
* and plot axes. The number of labels on the scale.
* @returns {string} the text representation of the value
*/
/**
* Provides access to `Format` objects which can be used to
* convert values between human-readable text and numeric
* representations.
* @interface FormatService
*/
/**
* Look up a format by its symbolic identifier.
* @method getFormat
* @memberof FormatService#
* @param {string} key the identifier for this format
* @returns {Format} the format
* @throws {Error} errors when the requested format is unrecognized
*/
/**
* Provides formats from the `formats` extension category.
* @constructor
* @implements {FormatService}
* @memberof platform/commonUI/formats
* @param {Array.<function(new : Format)>} format constructors,
* from the `formats` extension category.
*/
function FormatProvider(formats) {
function FormatProvider(formats) {
var formatMap = {};
function addToMap(Format) {
@ -107,17 +54,15 @@ define([
formats.forEach(addToMap);
this.formatMap = formatMap;
}
}
FormatProvider.prototype.getFormat = function (key) {
FormatProvider.prototype.getFormat = function (key) {
var format = this.formatMap[key];
if (!format) {
throw new Error("FormatProvider: No format found for " + key);
}
return format;
};
};
return FormatProvider;
});
export default FormatProvider;

View File

@ -20,13 +20,33 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
['../src/FormatProvider'],
function (FormatProvider) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
var KEYS = ['a', 'b', 'c'];
import FormatProvider from '../src/FormatProvider';
describe("The FormatProvider", function () {
var KEYS = ['a', 'b', 'c'];
describe("The FormatProvider", function () {
var mockFormats,
mockFormatInstances,
provider;
@ -64,6 +84,4 @@ define(
}).toThrow();
});
});
}
);
});

View File

@ -20,103 +20,77 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
"./src/services/UrlService",
"./src/services/PopupService",
"./src/SplashScreenManager",
"./src/StyleSheetLoader",
"./src/controllers/TimeRangeController",
"./src/controllers/DateTimePickerController",
"./src/controllers/DateTimeFieldController",
"./src/controllers/TreeNodeController",
"./src/controllers/ActionGroupController",
"./src/controllers/ToggleController",
"./src/controllers/ClickAwayController",
"./src/controllers/ViewSwitcherController",
"./src/controllers/GetterSetterController",
"./src/controllers/SelectorController",
"./src/controllers/ObjectInspectorController",
"./src/controllers/BannerController",
"./src/directives/MCTContainer",
"./src/directives/MCTDrag",
"./src/directives/MCTSelectable",
"./src/directives/MCTClickElsewhere",
"./src/directives/MCTResize",
"./src/directives/MCTPopup",
"./src/directives/MCTScroll",
"./src/directives/MCTSplitPane",
"./src/directives/MCTSplitter",
"./src/directives/MCTTree",
"./src/directives/MCTIndicators",
"./src/filters/ReverseFilter",
"./res/templates/bottombar.html",
"./res/templates/controls/action-button.html",
"./res/templates/controls/input-filter.html",
"./res/templates/angular-indicator.html",
"./res/templates/message-banner.html",
"./res/templates/progress-bar.html",
"./res/templates/controls/time-controller.html",
"./res/templates/containers/accordion.html",
"./res/templates/subtree.html",
"./res/templates/tree.html",
"./res/templates/tree-node.html",
"./res/templates/label.html",
"./res/templates/controls/action-group.html",
"./res/templates/controls/switcher.html",
"./res/templates/object-inspector.html",
"./res/templates/controls/selector.html",
"./res/templates/controls/datetime-picker.html",
"./res/templates/controls/datetime-field.html"
], function (
UrlService,
PopupService,
SplashScreenManager,
StyleSheetLoader,
TimeRangeController,
DateTimePickerController,
DateTimeFieldController,
TreeNodeController,
ActionGroupController,
ToggleController,
ClickAwayController,
ViewSwitcherController,
GetterSetterController,
SelectorController,
ObjectInspectorController,
BannerController,
MCTContainer,
MCTDrag,
MCTSelectable,
MCTClickElsewhere,
MCTResize,
MCTPopup,
MCTScroll,
MCTSplitPane,
MCTSplitter,
MCTTree,
MCTIndicators,
ReverseFilter,
bottombarTemplate,
actionButtonTemplate,
inputFilterTemplate,
indicatorTemplate,
messageBannerTemplate,
progressBarTemplate,
timeControllerTemplate,
accordionTemplate,
subtreeTemplate,
treeTemplate,
treeNodeTemplate,
labelTemplate,
actionGroupTemplate,
switcherTemplate,
objectInspectorTemplate,
selectorTemplate,
datetimePickerTemplate,
datetimeFieldTemplate
) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
return {
import UrlService from './src/services/UrlService';
import PopupService from './src/services/PopupService';
import SplashScreenManager from './src/SplashScreenManager';
import StyleSheetLoader from './src/StyleSheetLoader';
import TimeRangeController from './src/controllers/TimeRangeController';
import DateTimePickerController from './src/controllers/DateTimePickerController';
import DateTimeFieldController from './src/controllers/DateTimeFieldController';
import TreeNodeController from './src/controllers/TreeNodeController';
import ActionGroupController from './src/controllers/ActionGroupController';
import ToggleController from './src/controllers/ToggleController';
import ClickAwayController from './src/controllers/ClickAwayController';
import ViewSwitcherController from './src/controllers/ViewSwitcherController';
import GetterSetterController from './src/controllers/GetterSetterController';
import SelectorController from './src/controllers/SelectorController';
import ObjectInspectorController from './src/controllers/ObjectInspectorController';
import BannerController from './src/controllers/BannerController';
import MCTContainer from './src/directives/MCTContainer';
import MCTDrag from './src/directives/MCTDrag';
import MCTSelectable from './src/directives/MCTSelectable';
import MCTClickElsewhere from './src/directives/MCTClickElsewhere';
import MCTResize from './src/directives/MCTResize';
import MCTPopup from './src/directives/MCTPopup';
import MCTScroll from './src/directives/MCTScroll';
import MCTSplitPane from './src/directives/MCTSplitPane';
import MCTSplitter from './src/directives/MCTSplitter';
import MCTTree from './src/directives/MCTTree';
import MCTIndicators from './src/directives/MCTIndicators';
import ReverseFilter from './src/filters/ReverseFilter';
import bottombarTemplate from './res/templates/bottombar.html';
import actionButtonTemplate from './res/templates/controls/action-button.html';
import inputFilterTemplate from './res/templates/controls/input-filter.html';
import indicatorTemplate from './res/templates/angular-indicator.html';
import messageBannerTemplate from './res/templates/message-banner.html';
import progressBarTemplate from './res/templates/progress-bar.html';
import timeControllerTemplate from './res/templates/controls/time-controller.html';
import accordionTemplate from './res/templates/containers/accordion.html';
import subtreeTemplate from './res/templates/subtree.html';
import treeTemplate from './res/templates/tree.html';
import treeNodeTemplate from './res/templates/tree-node.html';
import labelTemplate from './res/templates/label.html';
import actionGroupTemplate from './res/templates/controls/action-group.html';
import switcherTemplate from './res/templates/controls/switcher.html';
import objectInspectorTemplate from './res/templates/object-inspector.html';
import selectorTemplate from './res/templates/controls/selector.html';
import datetimePickerTemplate from './res/templates/controls/datetime-picker.html';
import datetimeFieldTemplate from './res/templates/controls/datetime-field.html';
export default {
name: "platform/commonUI/general",
definition: {
"name": "General UI elements",
@ -525,5 +499,4 @@ define([
]
}
}
};
});
};

View File

@ -20,13 +20,29 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
], function (
) {
function SplashScreenManager($document) {
function SplashScreenManager($document) {
var splash;
$document = $document[0];
splash = $document.querySelectorAll('.l-splash-holder')[0];
@ -38,7 +54,6 @@ define([
splash.addEventListener('transitionend', function () {
splash.parentNode.removeChild(splash);
});
}
}
return SplashScreenManager;
});
export default SplashScreenManager;

View File

@ -25,22 +25,34 @@
* platform styling.
* @namespace platform/commonUI/general
*/
define(
[],
function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
* The StyleSheetLoader adds links to style sheets exposed from
* various bundles as extensions of category `stylesheets`.
* @memberof platform/commonUI/general
* @constructor
* @param {object[]} stylesheets stylesheet extension definitions
* @param $document Angular's jqLite-wrapped document element
* @param {string} activeTheme the theme in use
* @param {string} [assetPath] the directory relative to which
* stylesheets will be found
/**
* This bundle provides various general-purpose UI elements, including
* platform styling.
* @namespace platform/commonUI/general
*/
function StyleSheetLoader(stylesheets, $document, activeTheme, assetPath) {
function StyleSheetLoader(stylesheets, $document, activeTheme, assetPath) {
var head = $document.find('head'),
document = $document[0];
@ -75,8 +87,6 @@ define(
// Add all stylesheets from extensions
stylesheets.filter(matchesTheme).forEach(addStyleSheet);
}
}
return StyleSheetLoader;
}
);
export default StyleSheetLoader;

View File

@ -23,27 +23,32 @@
/**
* Module defining ActionGroupController. Created by vwoeltje on 11/14/14.
*/
define(
[],
function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
* Controller which keeps an up-to-date list of actions of
* a certain category, and additionally bins them into
* groups as described by their metadata. Used specifically
* to support button groups.
*
* This will maintain two fields in the scope:
* * `groups`: An array of arrays. Each element in the outer
* array corresponds to a group; the inner array contains
* the actions which are in that group.
* * `ungrouped`: All actions which did not have a defined
* group.
*
* @memberof platform/commonUI/general
* @constructor
/**
* Module defining ActionGroupController. Created by vwoeltje on 11/14/14.
*/
function ActionGroupController($scope) {
function ActionGroupController($scope) {
// Separate out the actions that have been retrieved
// into groups, and populate scope with this.
@ -97,8 +102,6 @@ define(
// Start with empty arrays.
$scope.ungrouped = [];
$scope.groups = [];
}
}
return ActionGroupController;
}
);
export default ActionGroupController;

View File

@ -20,24 +20,29 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
/**
* A controller for banner notifications. Banner notifications are a
* non-blocking way of drawing the user's attention to an event such
* as system errors, or the progress or successful completion of an
* ongoing task. This controller provides scoped functions for
* dismissing and 'maximizing' notifications. See {@link NotificationService}
* for more details on Notifications.
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* @param $scope
* @param notificationService
* @param dialogService
* @constructor
*/
function BannerController($scope, notificationService, dialogService) {
* 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.
*****************************************************************************/
function BannerController($scope, notificationService, dialogService) {
$scope.active = notificationService.active;
$scope.action = function (action, $event) {
@ -71,7 +76,6 @@ define(
dialog = dialogService.showBlockingMessage(notification.model);
}
};
}
}
return BannerController;
});
export default BannerController;

View File

@ -20,21 +20,29 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
/**
* A ClickAwayController is used to toggle things (such as context
* menus) where clicking elsewhere in the document while the toggle
* is in an active state is intended to dismiss the toggle.
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* @memberof platform/commonUI/general
* @constructor
* @param $scope the scope in which this controller is active
* @param $document the document element, injected by Angular
*/
function ClickAwayController($document, $timeout) {
* 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.
*****************************************************************************/
function ClickAwayController($document, $timeout) {
var self = this;
this.state = false;
@ -48,50 +56,48 @@ define(
self.deactivate();
});
};
}
}
// Track state, but also attach and detach a listener for
// mouseup events on the document.
ClickAwayController.prototype.deactivate = function () {
// Track state, but also attach and detach a listener for
// mouseup events on the document.
ClickAwayController.prototype.deactivate = function () {
this.state = false;
this.$document.off("mouseup", this.clickaway);
};
};
ClickAwayController.prototype.activate = function () {
ClickAwayController.prototype.activate = function () {
this.state = true;
this.$document.on("mouseup", this.clickaway);
};
};
/**
/**
* Get the current state of the toggle.
* @return {boolean} true if active
*/
ClickAwayController.prototype.isActive = function () {
ClickAwayController.prototype.isActive = function () {
return this.state;
};
};
/**
/**
* Set a new state for the toggle.
* @return {boolean} true to activate
*/
ClickAwayController.prototype.setState = function (newState) {
ClickAwayController.prototype.setState = function (newState) {
if (this.state !== newState) {
this.toggle();
}
};
};
/**
/**
* Toggle the current state; activate if it is inactive,
* deactivate if it is active.
*/
ClickAwayController.prototype.toggle = function () {
ClickAwayController.prototype.toggle = function () {
if (this.state) {
this.deactivate();
} else {
this.activate();
}
};
};
return ClickAwayController;
}
);
export default ClickAwayController;

View File

@ -20,28 +20,29 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
* Controller to support the date-time entry field.
*
* Accepts a `format` property in the `structure` attribute
* which allows a date/time to be specified via its symbolic
* key (as will be used to look up said format from the
* `formatService`.)
*
* {@see FormatService}
* @constructor
* @memberof platform/commonUI/general
* @param $scope the Angular scope for this controller
* @param {FormatService} formatService the service to user to format
* domain values
* @param {string} defaultFormat the format to request when no
* format has been otherwise specified
*/
function DateTimeFieldController($scope, formatService, defaultFormat) {
function DateTimeFieldController($scope, formatService, defaultFormat) {
var formatter = formatService.getFormat(defaultFormat);
function updateFromModel(value) {
@ -105,8 +106,6 @@ define(
$scope.$watch('ngModel[field]', updateFromModel);
$scope.$watch('pickerModel.value', updateFromPicker);
$scope.$watch('textValue', updateFromView);
}
}
return DateTimeFieldController;
}
);
export default DateTimeFieldController;

View File

@ -20,11 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
['moment'],
function (moment) {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
var TIME_NAMES = {
import moment from 'moment';
var TIME_NAMES = {
'hours': "Hour",
'minutes': "Minute",
'seconds': "Second"
@ -43,7 +63,7 @@ define(
};
}());
/**
/**
* Controller to support the date-time picker.
*
* Adds/uses the following properties in scope:
@ -65,7 +85,7 @@ define(
*
* Months are zero-indexed, day-of-months are one-indexed.
*/
function DateTimePickerController($scope, now) {
function DateTimePickerController($scope, now) {
var year,
month, // For picker state, not model state
interacted = false;
@ -200,8 +220,6 @@ define(
$scope.$watch('ngModel[field]', updateFromModel);
$scope.$watchCollection('date', updateFromView);
$scope.$watchCollection('time', updateFromView);
}
}
return DateTimePickerController;
}
);
export default DateTimePickerController;

View File

@ -20,43 +20,29 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
* This controller acts as an adapter to permit getter-setter
* functions to be used as ng-model arguments to controls,
* such as the input-filter. This is supported natively in
* Angular 1.3+ via `ng-model-options`, so this controller
* should be made obsolete after any upgrade to Angular 1.3.
*
* It expects to find in scope a value `ngModel` which is a
* function which, when called with no arguments, acts as a
* getter, and when called with one argument, acts as a setter.
*
* It also publishes into the scope a value `getterSetter.value`
* which is meant to be used as an assignable expression.
*
* This controller watches both of these; when one changes,
* it will update the other's value to match. Because of this,
* the `ngModel` function should be both stable and computationally
* inexpensive, as it will be invoked often.
*
* Getter-setter style models can be preferable when there
* is significant indirection between templates; "dotless"
* expressions in `ng-model` can behave unexpectedly due to the
* rules of scope, but dots are lost when passed in via `ng-model`
* (so if a control is internally implemented using regular
* form elements, it can't transparently pass through the `ng-model`
* parameter it received.) Getter-setter functions are never the
* target of a scope assignment and so avoid this problem.
*
* @memberof platform/commonUI/general
* @constructor
* @param {Scope} $scope the controller's scope
*/
function GetterSetterController($scope) {
function GetterSetterController($scope) {
// Update internal assignable state based on changes
// to the getter-setter function.
@ -81,9 +67,6 @@ define(
// Publish an assignable field into scope.
$scope.getterSetter = {};
}
}
return GetterSetterController;
}
);
export default GetterSetterController;

View File

@ -23,17 +23,32 @@
/**
* Module defining ObjectInspectorController. Created by shale on 08/21/2015.
*/
define(
[],
function () {
/**
* The ObjectInspectorController gets and formats the data for
* the inspector display
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* @constructor
* 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.
*****************************************************************************/
/**
* Module defining ObjectInspectorController. Created by shale on 08/21/2015.
*/
function ObjectInspectorController($scope, objectService) {
function ObjectInspectorController($scope, objectService) {
$scope.primaryParents = [];
$scope.contextutalParents = [];
//$scope.isLink = false;
@ -112,8 +127,6 @@ define(
var mutation = $scope.domainObject.getCapability('mutation');
var unlisten = mutation.listen(getMetadata);
$scope.$on('$destroy', unlisten);
}
}
return ObjectInspectorController;
}
);
export default ObjectInspectorController;

View File

@ -20,13 +20,31 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
var ROOT_ID = "ROOT";
var ROOT_ID = "ROOT";
/**
/**
* Controller for the domain object selector control.
* @memberof platform/commonUI/general
* @constructor
@ -34,7 +52,7 @@ define(
* read domain objects
* @param $scope Angular scope for this controller
*/
function SelectorController(objectService, $scope) {
function SelectorController(objectService, $scope) {
var treeModel = {},
listModel = {},
previousSelected,
@ -98,31 +116,31 @@ define(
// Expose tree/list model for use in template directly
this.treeModel = treeModel;
this.listModel = listModel;
}
}
// Set the value of the field being edited
SelectorController.prototype.setField = function (value) {
// Set the value of the field being edited
SelectorController.prototype.setField = function (value) {
this.$scope.ngModel[this.$scope.field] = value;
};
};
// Get the value of the field being edited
SelectorController.prototype.getField = function () {
// Get the value of the field being edited
SelectorController.prototype.getField = function () {
return this.$scope.ngModel[this.$scope.field] || [];
};
};
/**
/**
* Get the root object to show in the left-hand tree.
* @returns {DomainObject} the root object
*/
SelectorController.prototype.root = function () {
SelectorController.prototype.root = function () {
return this.rootObject;
};
};
/**
/**
* Add a domain object to the list of selected objects.
* @param {DomainObject} the domain object to select
*/
SelectorController.prototype.select = function (domainObject) {
SelectorController.prototype.select = function (domainObject) {
var id = domainObject && domainObject.getId(),
list = this.getField() || [];
// Only select if we have a valid id,
@ -130,13 +148,13 @@ define(
if (id && list.indexOf(id) === -1) {
this.setField(list.concat([id]));
}
};
};
/**
/**
* Remove a domain object from the list of selected objects.
* @param {DomainObject} the domain object to select
*/
SelectorController.prototype.deselect = function (domainObject) {
SelectorController.prototype.deselect = function (domainObject) {
var id = domainObject && domainObject.getId(),
list = this.getField() || [];
// Only change if this was a valid id,
@ -149,16 +167,14 @@ define(
// Clear the current list selection
delete this.listModel.selectedObject;
}
};
};
/**
/**
* Get the currently-selected domain objects.
* @returns {DomainObject[]} the current selection
*/
SelectorController.prototype.selected = function () {
SelectorController.prototype.selected = function () {
return this.selectedObjects;
};
};
return SelectorController;
}
);
export default SelectorController;

View File

@ -20,29 +20,47 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define([
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
], function () {
var TICK_SPACING_PX = 150;
var TICK_SPACING_PX = 150;
/* format number as percent; 0.0-1.0 to "0%"-"100%" */
function toPercent(p) {
/* format number as percent; 0.0-1.0 to "0%"-"100%" */
function toPercent(p) {
return (100 * p) + "%";
}
}
function clamp(value, low, high) {
function clamp(value, low, high) {
return Math.max(low, Math.min(high, value));
}
}
function copyBounds(bounds) {
function copyBounds(bounds) {
return {
start: bounds.start,
end: bounds.end
};
}
}
/**
/**
* Controller used by the `time-controller` template.
* @memberof platform/commonUI/general
* @constructor
@ -53,7 +71,7 @@ define([
* format has been otherwise specified
* @param {Function} now a function to return current system time
*/
function TimeRangeController($scope, $timeout, formatService, defaultFormat, now) {
function TimeRangeController($scope, $timeout, formatService, defaultFormat, now) {
this.$scope = $scope;
this.formatService = formatService;
this.defaultFormat = defaultFormat;
@ -94,13 +112,13 @@ define([
this.$scope.$watch("parameters.format", this.updateFormat);
this.$scope.$watch("formModel.start", this.onFormStartChange);
this.$scope.$watch("formModel.end", this.onFormEndChange);
}
}
TimeRangeController.prototype.formatTimestamp = function (ts) {
TimeRangeController.prototype.formatTimestamp = function (ts) {
return this.formatter.format(ts);
};
};
TimeRangeController.prototype.updateTicks = function () {
TimeRangeController.prototype.updateTicks = function () {
var i, p, ts, start, end, span;
end = this.$scope.ngModel.outer.end;
start = this.$scope.ngModel.outer.start;
@ -111,16 +129,16 @@ define([
ts = p * span + start;
this.$scope.ticks.push(this.formatTimestamp(ts));
}
};
};
TimeRangeController.prototype.updateSpanWidth = function (w) {
TimeRangeController.prototype.updateSpanWidth = function (w) {
this.tickCount = Math.max(Math.floor(w / TICK_SPACING_PX), 2);
this.updateTicks();
};
};
TimeRangeController.prototype.updateViewForInnerSpanFromModel = function (
TimeRangeController.prototype.updateViewForInnerSpanFromModel = function (
ngModel
) {
) {
var span = ngModel.outer.end - ngModel.outer.start;
// Expose readable dates for the knobs
@ -132,18 +150,18 @@ define([
toPercent((ngModel.inner.start - ngModel.outer.start) / span);
this.$scope.endInnerPct =
toPercent((ngModel.outer.end - ngModel.inner.end) / span);
};
};
TimeRangeController.prototype.defaultBounds = function () {
TimeRangeController.prototype.defaultBounds = function () {
var t = this.now();
return {
start: t - 24 * 3600 * 1000, // One day
end: t
};
};
};
TimeRangeController.prototype.updateViewFromModel = function (ngModel) {
TimeRangeController.prototype.updateViewFromModel = function (ngModel) {
ngModel = ngModel || {};
ngModel.outer = ngModel.outer || this.defaultBounds();
ngModel.inner = ngModel.inner || copyBounds(ngModel.outer);
@ -153,31 +171,31 @@ define([
this.updateViewForInnerSpanFromModel(ngModel);
this.updateTicks();
};
};
TimeRangeController.prototype.startLeftDrag = function () {
TimeRangeController.prototype.startLeftDrag = function () {
this.initialDragValue = this.$scope.ngModel.inner.start;
};
};
TimeRangeController.prototype.startRightDrag = function () {
TimeRangeController.prototype.startRightDrag = function () {
this.initialDragValue = this.$scope.ngModel.inner.end;
};
};
TimeRangeController.prototype.startMiddleDrag = function () {
TimeRangeController.prototype.startMiddleDrag = function () {
this.initialDragValue = {
start: this.$scope.ngModel.inner.start,
end: this.$scope.ngModel.inner.end
};
};
};
TimeRangeController.prototype.toMillis = function (pixels) {
TimeRangeController.prototype.toMillis = function (pixels) {
var span =
this.$scope.ngModel.outer.end - this.$scope.ngModel.outer.start;
return (pixels / this.$scope.spanWidth) * span;
};
};
TimeRangeController.prototype.leftDrag = function (pixels) {
TimeRangeController.prototype.leftDrag = function (pixels) {
var delta = this.toMillis(pixels);
this.$scope.ngModel.inner.start = clamp(
this.initialDragValue + delta,
@ -185,9 +203,9 @@ define([
this.$scope.ngModel.inner.end - this.innerMinimumSpan
);
this.updateViewFromModel(this.$scope.ngModel);
};
};
TimeRangeController.prototype.rightDrag = function (pixels) {
TimeRangeController.prototype.rightDrag = function (pixels) {
var delta = this.toMillis(pixels);
this.$scope.ngModel.inner.end = clamp(
this.initialDragValue + delta,
@ -195,9 +213,9 @@ define([
this.$scope.ngModel.outer.end
);
this.updateViewFromModel(this.$scope.ngModel);
};
};
TimeRangeController.prototype.middleDrag = function (pixels) {
TimeRangeController.prototype.middleDrag = function (pixels) {
var delta = this.toMillis(pixels),
edge = delta < 0 ? 'start' : 'end',
opposite = delta < 0 ? 'end' : 'start';
@ -215,16 +233,16 @@ define([
- this.initialDragValue[edge];
this.updateViewFromModel(this.$scope.ngModel);
};
};
TimeRangeController.prototype.updateFormModel = function () {
TimeRangeController.prototype.updateFormModel = function () {
this.$scope.formModel = {
start: ((this.$scope.ngModel || {}).outer || {}).start,
end: ((this.$scope.ngModel || {}).outer || {}).end
};
};
};
TimeRangeController.prototype.updateOuterStart = function () {
TimeRangeController.prototype.updateOuterStart = function () {
var ngModel = this.$scope.ngModel;
ngModel.inner.start =
@ -237,9 +255,9 @@ define([
this.updateFormModel();
this.updateViewForInnerSpanFromModel(ngModel);
this.updateTicks();
};
};
TimeRangeController.prototype.updateOuterEnd = function () {
TimeRangeController.prototype.updateOuterEnd = function () {
var ngModel = this.$scope.ngModel;
ngModel.inner.end =
@ -252,15 +270,15 @@ define([
this.updateFormModel();
this.updateViewForInnerSpanFromModel(ngModel);
this.updateTicks();
};
};
TimeRangeController.prototype.updateFormat = function (key) {
TimeRangeController.prototype.updateFormat = function (key) {
this.formatter = this.formatService.getFormat(key || this.defaultFormat);
this.updateViewForInnerSpanFromModel(this.$scope.ngModel);
this.updateTicks();
};
};
TimeRangeController.prototype.updateBoundsFromForm = function () {
TimeRangeController.prototype.updateBoundsFromForm = function () {
var self = this;
//Allow Angular to trigger watches and determine whether values have changed.
@ -279,35 +297,34 @@ define([
self.formEndChanged = false;
}
});
};
};
TimeRangeController.prototype.onFormStartChange = function (
TimeRangeController.prototype.onFormStartChange = function (
newValue,
oldValue
) {
) {
if (!this.formStartChanged && newValue !== oldValue) {
this.formStartChanged = true;
}
};
};
TimeRangeController.prototype.onFormEndChange = function (
TimeRangeController.prototype.onFormEndChange = function (
newValue,
oldValue
) {
) {
if (!this.formEndChanged && newValue !== oldValue) {
this.formEndChanged = true;
}
};
};
TimeRangeController.prototype.validateStart = function (startValue) {
TimeRangeController.prototype.validateStart = function (startValue) {
return startValue
<= this.$scope.formModel.end - this.outerMinimumSpan;
};
};
TimeRangeController.prototype.validateEnd = function (endValue) {
TimeRangeController.prototype.validateEnd = function (endValue) {
return endValue
>= this.$scope.formModel.start + this.outerMinimumSpan;
};
};
return TimeRangeController;
});
export default TimeRangeController;

View File

@ -20,47 +20,56 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
/**
* A ToggleController is used to activate/deactivate things.
* A common usage is for "twistie"
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
* @memberof platform/commonUI/general
* @constructor
*/
function ToggleController() {
* 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.
*****************************************************************************/
function ToggleController() {
this.state = false;
this.setState = this.setState.bind(this);
}
}
/**
/**
* Get the current state of the toggle.
* @return {boolean} true if active
*/
ToggleController.prototype.isActive = function () {
ToggleController.prototype.isActive = function () {
return this.state;
};
};
/**
/**
* Set a new state for the toggle.
* @return {boolean} true to activate
*/
ToggleController.prototype.setState = function (newState) {
ToggleController.prototype.setState = function (newState) {
this.state = newState;
};
};
/**
/**
* Toggle the current state; activate if it is inactive,
* deactivate if it is active.
*/
ToggleController.prototype.toggle = function () {
ToggleController.prototype.toggle = function () {
this.state = !this.state;
};
};
return ToggleController;
}
);
export default ToggleController;

View File

@ -23,42 +23,32 @@
/**
* Module defining TreeNodeController. Created by vwoeltje on 11/10/14.
*/
define(
[],
function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
* The TreeNodeController supports the tree node representation;
* a tree node has a label for the current object as well as a
* subtree which shows (and is not loaded until) the node is
* expanded.
*
* This controller tracks the following, so that the tree node
* template may update its state accordingly:
*
* * Whether or not the tree node has ever been expanded (this
* is used to lazily load, exactly once, the subtree)
* * Whether or not the node is currently the domain object
* of navigation (this gets highlighted differently to
* provide the user with visual feedback.)
*
* Additionally, this controller will automatically trigger
* node expansion when this tree node's _subtree_ will contain
* the navigated object (recursively, this becomes an
* expand-to-show-navigated-object behavior.)
*
* Finally, if a `callback` property is passed in through the
* `parameters` attribute of the `tree-node`, that callback
* will be invoked whenever a user clicks in a manner which
* would result in a selection. This callback is invoked
* even if the selection does not change (if you are only
* interested in changes, watch the `selectedObject` property
* of the object passed in `ng-model` instead.)
*
* @memberof platform/commonUI/general
* @constructor
/**
* Module defining TreeNodeController. Created by vwoeltje on 11/10/14.
*/
function TreeNodeController($scope, $timeout) {
function TreeNodeController($scope, $timeout) {
var self = this,
selectedObject = ($scope.ngModel || {}).selectedObject;
@ -144,15 +134,15 @@ define(
// Listen for changes which will effect display parameters
$scope.$watch("ngModel.selectedObject", setSelection);
$scope.$watch("domainObject", checkSelection);
}
}
/**
/**
* Select the domain object represented by this node in the tree.
* This will both update the `selectedObject` property in
* the object passed in via `ng-model`, and will fire any `callback`
* passed in via `parameters`.
*/
TreeNodeController.prototype.select = function () {
TreeNodeController.prototype.select = function () {
if (this.$scope.ngModel) {
this.$scope.ngModel.selectedObject =
this.$scope.domainObject;
@ -161,14 +151,14 @@ define(
if ((this.$scope.parameters || {}).callback) {
this.$scope.parameters.callback(this.$scope.domainObject);
}
};
};
/**
/**
* This method should be called when a node is expanded
* to record that this has occurred, to support one-time
* lazy loading of the node's subtree.
*/
TreeNodeController.prototype.trackExpansion = function () {
TreeNodeController.prototype.trackExpansion = function () {
var self = this;
if (!self.hasBeenExpanded()) {
// Run on a timeout; if a lot of expansion needs to
@ -178,27 +168,25 @@ define(
self.hasBeenExpandedFlag = true;
}, 0);
}
};
};
/**
/**
* Check if this not has ever been expanded.
* @returns true if it has been expanded
*/
TreeNodeController.prototype.hasBeenExpanded = function () {
TreeNodeController.prototype.hasBeenExpanded = function () {
return this.hasBeenExpandedFlag;
};
};
/**
/**
* Check whether or not the domain object represented by
* this tree node should be highlighted.
* An object will be highlighted if it matches
* ngModel.selectedObject
* @returns true if this should be highlighted
*/
TreeNodeController.prototype.isSelected = function () {
TreeNodeController.prototype.isSelected = function () {
return this.isSelectedFlag;
};
};
return TreeNodeController;
}
);
export default TreeNodeController;

View File

@ -23,17 +23,32 @@
/**
* Module defining ViewSwitcherController. Created by vwoeltje on 11/7/14.
*/
define(
[],
function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
* Controller for the view switcher; populates and maintains a list
* of applicable views for a represented domain object.
* @memberof platform/commonUI/general
* @constructor
/**
* Module defining ViewSwitcherController. Created by vwoeltje on 11/7/14.
*/
function ViewSwitcherController($scope, $timeout) {
function ViewSwitcherController($scope, $timeout) {
// If the view capability gets refreshed, try to
// keep the same option chosen.
function findMatchingOption(options, selected) {
@ -65,9 +80,6 @@ define(
// Update view options when the in-scope results of using the
// view capability change.
$scope.$watch("view", updateOptions);
}
return ViewSwitcherController;
}
);
}
export default ViewSwitcherController;

View File

@ -20,18 +20,29 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
define(
[],
function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
* The `mct-click-elsewhere` directive will evaluate its
* associated expression whenever a `mousedown` occurs anywhere
* outside of the element that has the `mct-click-elsewhere`
* directive attached. This is useful for dismissing popups
* and the like.
*/
function MCTClickElsewhere($document) {
function MCTClickElsewhere($document) {
// Link; install event handlers.
function link(scope, element, attrs) {
@ -69,9 +80,6 @@ define(
// Link function, to install event handlers
link: link
};
}
return MCTClickElsewhere;
}
);
}
export default MCTClickElsewhere;

View File

@ -23,24 +23,32 @@
/**
* Module defining MCTContainer. Created by vwoeltje on 11/17/14.
*/
define(
[],
function () {
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2021, 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.
*****************************************************************************/
/**
* The mct-container is similar to the mct-include directive
* insofar as it allows templates to be referenced by
* symbolic keys instead of by URL. Unlike mct-include, it
* supports transclusion.
*
* Unlike mct-include, mct-container accepts a key as a
* plain string attribute, instead of as an Angular
* expression.
*
* @memberof platform/commonUI/general
* @constructor
/**
* Module defining MCTContainer. Created by vwoeltje on 11/17/14.
*/
function MCTContainer(containers) {
function MCTContainer(containers) {
var containerMap = {};
// Initialize container map from extensions
@ -84,8 +92,6 @@ define(
return container ? container.template : "";
}
};
}
}
return MCTContainer;
}
);
export default MCTContainer;

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