Compare commits
	
		
			13 Commits
		
	
	
		
			mct5510-co
			...
			tabs-lazyl
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					ce54906934 | ||
| 
						 | 
					aa4c6283de | ||
| 
						 | 
					5a1a96b0f4 | ||
| 
						 | 
					b8ebc70ee5 | ||
| 
						 | 
					f3d136af69 | ||
| 
						 | 
					218e73f595 | ||
| 
						 | 
					c67253a97b | ||
| 
						 | 
					2f58dfbfe7 | ||
| 
						 | 
					166cb55945 | ||
| 
						 | 
					83116257fc | ||
| 
						 | 
					775f1048bc | ||
| 
						 | 
					71a8b377bb | ||
| 
						 | 
					c43d3fcfc9 | 
@@ -1,5 +1,5 @@
 | 
			
		||||
<!--
 | 
			
		||||
 Open MCT, Copyright (c) 2014-2017, United States Government
 | 
			
		||||
 Open MCT, Copyright (c) 2014-2020, United States Government
 | 
			
		||||
 as represented by the Administrator of the National Aeronautics and Space
 | 
			
		||||
 Administration. All rights reserved.
 | 
			
		||||
 | 
			
		||||
@@ -43,9 +43,9 @@
 | 
			
		||||
            openmct.legacyRegistry.enable.bind(openmct.legacyRegistry)
 | 
			
		||||
        );
 | 
			
		||||
 | 
			
		||||
        openmct.install(openmct.plugins.LocalStorage());
 | 
			
		||||
        openmct.install(openmct.plugins.Espresso());
 | 
			
		||||
        openmct.install(openmct.plugins.MyItems());
 | 
			
		||||
        openmct.install(openmct.plugins.LocalStorage());
 | 
			
		||||
        openmct.install(openmct.plugins.Generator());
 | 
			
		||||
        openmct.install(openmct.plugins.ExampleImagery());
 | 
			
		||||
        openmct.install(openmct.plugins.UTCTimeSystem());
 | 
			
		||||
 
 | 
			
		||||
@@ -4,8 +4,7 @@
 | 
			
		||||
  "description": "The Open MCT core platform",
 | 
			
		||||
  "dependencies": {},
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "acorn": "6.2.0",
 | 
			
		||||
    "angular": "1.4.14",
 | 
			
		||||
    "angular": "1.7.9",
 | 
			
		||||
    "angular-route": "1.4.14",
 | 
			
		||||
    "babel-eslint": "8.2.6",
 | 
			
		||||
    "comma-separated-values": "^3.6.4",
 | 
			
		||||
@@ -53,9 +52,9 @@
 | 
			
		||||
    "marked": "^0.3.5",
 | 
			
		||||
    "mini-css-extract-plugin": "^0.4.1",
 | 
			
		||||
    "minimist": "^1.1.1",
 | 
			
		||||
    "moment": "^2.11.1",
 | 
			
		||||
    "moment": "2.25.3",
 | 
			
		||||
    "moment-duration-format": "^2.2.2",
 | 
			
		||||
    "moment-timezone": "^0.5.21",
 | 
			
		||||
    "moment-timezone": "0.5.28",
 | 
			
		||||
    "node-bourbon": "^4.2.3",
 | 
			
		||||
    "node-sass": "^4.9.2",
 | 
			
		||||
    "painterro": "^0.2.65",
 | 
			
		||||
 
 | 
			
		||||
@@ -87,6 +87,11 @@ define([
 | 
			
		||||
                bootstrapper
 | 
			
		||||
            );
 | 
			
		||||
 | 
			
		||||
        // Override of angular1.6 ! hashPrefix
 | 
			
		||||
        app.config(['$locationProvider', function ($locationProvider) {
 | 
			
		||||
            $locationProvider.hashPrefix('');
 | 
			
		||||
        }]);
 | 
			
		||||
 | 
			
		||||
        // Apply logging levels; this must be done now, before the
 | 
			
		||||
        // first log statement.
 | 
			
		||||
        new LogLevel(logLevel).configure(app, $log);
 | 
			
		||||
 
 | 
			
		||||
@@ -71,7 +71,7 @@ define([
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
                        "key": "ELASTIC_PATH",
 | 
			
		||||
                        "value": "mct/domain_object",
 | 
			
		||||
                        "value": "mct/_doc",
 | 
			
		||||
                        "priority": "fallback"
 | 
			
		||||
                    },
 | 
			
		||||
                    {
 | 
			
		||||
 
 | 
			
		||||
@@ -32,9 +32,9 @@ define(
 | 
			
		||||
        // JSLint doesn't like underscore-prefixed properties,
 | 
			
		||||
        // so hide them here.
 | 
			
		||||
        var SRC = "_source",
 | 
			
		||||
            REV = "_version",
 | 
			
		||||
            ID = "_id",
 | 
			
		||||
            CONFLICT = 409;
 | 
			
		||||
            CONFLICT = 409,
 | 
			
		||||
            SEQ_NO = "_seq_no",
 | 
			
		||||
            PRIMARY_TERM = "_primary_term";
 | 
			
		||||
 | 
			
		||||
        /**
 | 
			
		||||
         * The ElasticPersistenceProvider reads and writes JSON documents
 | 
			
		||||
@@ -104,7 +104,8 @@ define(
 | 
			
		||||
        // Get a domain object model out of ElasticSearch's response
 | 
			
		||||
        ElasticPersistenceProvider.prototype.getModel = function (response) {
 | 
			
		||||
            if (response && response[SRC]) {
 | 
			
		||||
                this.revs[response[ID]] = response[REV];
 | 
			
		||||
                this.revs[response[SEQ_NO]] = response[SEQ_NO];
 | 
			
		||||
                this.revs[response[PRIMARY_TERM]] = response[PRIMARY_TERM];
 | 
			
		||||
                return response[SRC];
 | 
			
		||||
            } else {
 | 
			
		||||
                return undefined;
 | 
			
		||||
@@ -116,7 +117,8 @@ define(
 | 
			
		||||
        // indicate that the request failed.
 | 
			
		||||
        ElasticPersistenceProvider.prototype.checkResponse = function (response, key) {
 | 
			
		||||
            if (response && !response.error) {
 | 
			
		||||
                this.revs[key] = response[REV];
 | 
			
		||||
                this.revs[SEQ_NO] = response[SEQ_NO];
 | 
			
		||||
                this.revs[PRIMARY_TERM] = response[PRIMARY_TERM];
 | 
			
		||||
                return response;
 | 
			
		||||
            } else {
 | 
			
		||||
                return this.handleError(response, key);
 | 
			
		||||
@@ -147,7 +149,7 @@ define(
 | 
			
		||||
            function checkUpdate(response) {
 | 
			
		||||
                return self.checkResponse(response, key);
 | 
			
		||||
            }
 | 
			
		||||
            return this.put(key, value, { version: this.revs[key] })
 | 
			
		||||
            return this.put(key, value)
 | 
			
		||||
                .then(checkUpdate);
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -85,7 +85,7 @@ define(
 | 
			
		||||
            it("allows object creation", function () {
 | 
			
		||||
                var model = { someKey: "some value" };
 | 
			
		||||
                mockHttp.and.returnValue(mockPromise({
 | 
			
		||||
                    data: { "_id": "abc", "_version": 1 }
 | 
			
		||||
                    data: { "_id": "abc", "_seq_no": 1, "_primary_term": 1 }
 | 
			
		||||
                }));
 | 
			
		||||
                provider.createObject("testSpace", "abc", model).then(capture);
 | 
			
		||||
                expect(mockHttp).toHaveBeenCalledWith({
 | 
			
		||||
@@ -100,7 +100,7 @@ define(
 | 
			
		||||
            it("allows object models to be read back", function () {
 | 
			
		||||
                var model = { someKey: "some value" };
 | 
			
		||||
                mockHttp.and.returnValue(mockPromise({
 | 
			
		||||
                    data: { "_id": "abc", "_version": 1, "_source": model }
 | 
			
		||||
                    data: { "_id": "abc", "_seq_no": 1, "_primary_term": 1, "_source": model }
 | 
			
		||||
                }));
 | 
			
		||||
                provider.readObject("testSpace", "abc").then(capture);
 | 
			
		||||
                expect(mockHttp).toHaveBeenCalledWith({
 | 
			
		||||
@@ -117,19 +117,19 @@ define(
 | 
			
		||||
 | 
			
		||||
                // First do a read to populate rev tags...
 | 
			
		||||
                mockHttp.and.returnValue(mockPromise({
 | 
			
		||||
                    data: { "_id": "abc", "_version": 42, "_source": {} }
 | 
			
		||||
                    data: { "_id": "abc", "_source": {} }
 | 
			
		||||
                }));
 | 
			
		||||
                provider.readObject("testSpace", "abc");
 | 
			
		||||
 | 
			
		||||
                // Now perform an update
 | 
			
		||||
                mockHttp.and.returnValue(mockPromise({
 | 
			
		||||
                    data: { "_id": "abc", "_version": 43, "_source": {} }
 | 
			
		||||
                    data: { "_id": "abc", "_seq_no": 1, "_source": {} }
 | 
			
		||||
                }));
 | 
			
		||||
                provider.updateObject("testSpace", "abc", model).then(capture);
 | 
			
		||||
                expect(mockHttp).toHaveBeenCalledWith({
 | 
			
		||||
                    url: "/test/db/abc",
 | 
			
		||||
                    method: "PUT",
 | 
			
		||||
                    params: { version: 42 },
 | 
			
		||||
                    params: undefined,
 | 
			
		||||
                    data: model
 | 
			
		||||
                });
 | 
			
		||||
                expect(capture.calls.mostRecent().args[0]).toBeTruthy();
 | 
			
		||||
@@ -138,13 +138,13 @@ define(
 | 
			
		||||
            it("allows object deletion", function () {
 | 
			
		||||
                // First do a read to populate rev tags...
 | 
			
		||||
                mockHttp.and.returnValue(mockPromise({
 | 
			
		||||
                    data: { "_id": "abc", "_version": 42, "_source": {} }
 | 
			
		||||
                    data: { "_id": "abc", "_source": {} }
 | 
			
		||||
                }));
 | 
			
		||||
                provider.readObject("testSpace", "abc");
 | 
			
		||||
 | 
			
		||||
                // Now perform an update
 | 
			
		||||
                mockHttp.and.returnValue(mockPromise({
 | 
			
		||||
                    data: { "_id": "abc", "_version": 42, "_source": {} }
 | 
			
		||||
                    data: { "_id": "abc", "_source": {} }
 | 
			
		||||
                }));
 | 
			
		||||
                provider.deleteObject("testSpace", "abc", {}).then(capture);
 | 
			
		||||
                expect(mockHttp).toHaveBeenCalledWith({
 | 
			
		||||
@@ -167,13 +167,13 @@ define(
 | 
			
		||||
                expect(capture).toHaveBeenCalledWith(undefined);
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            it("handles rejection due to version", function () {
 | 
			
		||||
            it("handles rejection due to _seq_no", function () {
 | 
			
		||||
                var model = { someKey: "some value" },
 | 
			
		||||
                    mockErrorCallback = jasmine.createSpy('error');
 | 
			
		||||
 | 
			
		||||
                // First do a read to populate rev tags...
 | 
			
		||||
                mockHttp.and.returnValue(mockPromise({
 | 
			
		||||
                    data: { "_id": "abc", "_version": 42, "_source": {} }
 | 
			
		||||
                    data: { "_id": "abc", "_seq_no": 1, "_source": {} }
 | 
			
		||||
                }));
 | 
			
		||||
                provider.readObject("testSpace", "abc");
 | 
			
		||||
 | 
			
		||||
@@ -196,7 +196,7 @@ define(
 | 
			
		||||
 | 
			
		||||
                // First do a read to populate rev tags...
 | 
			
		||||
                mockHttp.and.returnValue(mockPromise({
 | 
			
		||||
                    data: { "_id": "abc", "_version": 42, "_source": {} }
 | 
			
		||||
                    data: { "_id": "abc", "_seq_no": 1, "_source": {} }
 | 
			
		||||
                }));
 | 
			
		||||
                provider.readObject("testSpace", "abc");
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -204,7 +204,7 @@ export default class ConditionClass extends EventEmitter {
 | 
			
		||||
        let latestTimestamp;
 | 
			
		||||
        let criteriaResults = {};
 | 
			
		||||
        const criteriaRequests = this.criteria
 | 
			
		||||
            .map(criterion => criterion.requestLAD({telemetryObjects: this.conditionManager.telemetryObjects}));
 | 
			
		||||
            .map(criterion => criterion.requestLAD(this.conditionManager.telemetryObjects));
 | 
			
		||||
 | 
			
		||||
        return Promise.all(criteriaRequests)
 | 
			
		||||
            .then(results => {
 | 
			
		||||
 
 | 
			
		||||
@@ -55,7 +55,7 @@ export default class ConditionManager extends EventEmitter {
 | 
			
		||||
        this.telemetryObjects[id] = Object.assign({}, endpoint, {telemetryMetaData: this.openmct.telemetry.getMetadata(endpoint).valueMetadatas});
 | 
			
		||||
        this.subscriptions[id] = this.openmct.telemetry.subscribe(
 | 
			
		||||
            endpoint,
 | 
			
		||||
            this.telemetryReceived.bind(this, id)
 | 
			
		||||
            this.telemetryReceived.bind(this, endpoint)
 | 
			
		||||
        );
 | 
			
		||||
        this.updateConditionTelemetry();
 | 
			
		||||
    }
 | 
			
		||||
@@ -258,9 +258,13 @@ export default class ConditionManager extends EventEmitter {
 | 
			
		||||
                            this.openmct.time.timeSystem()
 | 
			
		||||
                        );
 | 
			
		||||
                    });
 | 
			
		||||
                    const currentCondition = this.getCurrentConditionLAD(conditionResults);
 | 
			
		||||
 | 
			
		||||
                    return Object.assign(
 | 
			
		||||
                    if (!Object.values(latestTimestamp).some(timeSystem => timeSystem)) {
 | 
			
		||||
                        return [];
 | 
			
		||||
                    }
 | 
			
		||||
 | 
			
		||||
                    const currentCondition = this.getCurrentConditionLAD(conditionResults);
 | 
			
		||||
                    const currentOutput = Object.assign(
 | 
			
		||||
                        {
 | 
			
		||||
                            output: currentCondition.configuration.output,
 | 
			
		||||
                            id: this.conditionSetDomainObject.identifier,
 | 
			
		||||
@@ -268,11 +272,15 @@ export default class ConditionManager extends EventEmitter {
 | 
			
		||||
                        },
 | 
			
		||||
                        latestTimestamp
 | 
			
		||||
                    );
 | 
			
		||||
 | 
			
		||||
                    return [currentOutput];
 | 
			
		||||
                });
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    isTelemetryUsed(id) {
 | 
			
		||||
    isTelemetryUsed(endpoint) {
 | 
			
		||||
        const id = this.openmct.objects.makeKeyString(endpoint.identifier);
 | 
			
		||||
 | 
			
		||||
        for(const condition of this.conditionClassCollection) {
 | 
			
		||||
            if (condition.isTelemetryUsed(id)) {
 | 
			
		||||
                return true;
 | 
			
		||||
@@ -282,12 +290,12 @@ export default class ConditionManager extends EventEmitter {
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    telemetryReceived(id, datum) {
 | 
			
		||||
        if (!this.isTelemetryUsed(id)) {
 | 
			
		||||
    telemetryReceived(endpoint, datum) {
 | 
			
		||||
        if (!this.isTelemetryUsed(endpoint)) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        const normalizedDatum = this.createNormalizedDatum(datum, id);
 | 
			
		||||
        const normalizedDatum = this.createNormalizedDatum(datum, endpoint);
 | 
			
		||||
        const timeSystemKey = this.openmct.time.timeSystem().key;
 | 
			
		||||
        let timestamp = {};
 | 
			
		||||
        timestamp[timeSystemKey] = normalizedDatum[timeSystemKey];
 | 
			
		||||
@@ -321,8 +329,11 @@ export default class ConditionManager extends EventEmitter {
 | 
			
		||||
        return data;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    createNormalizedDatum(telemetryDatum, id) {
 | 
			
		||||
        const normalizedDatum = Object.values(this.telemetryObjects[id].telemetryMetaData).reduce((datum, metadatum) => {
 | 
			
		||||
    createNormalizedDatum(telemetryDatum, endpoint) {
 | 
			
		||||
        const id = this.openmct.objects.makeKeyString(endpoint.identifier);
 | 
			
		||||
        const metadata = this.openmct.telemetry.getMetadata(endpoint).valueMetadatas;
 | 
			
		||||
 | 
			
		||||
        const normalizedDatum = Object.values(metadata).reduce((datum, metadatum) => {
 | 
			
		||||
            const testValue = this.getTestData(metadatum);
 | 
			
		||||
            const formatter = this.openmct.telemetry.getValueFormatter(metadatum);
 | 
			
		||||
            datum[metadatum.key] = testValue !== undefined ?  formatter.parse(testValue) : formatter.parse(telemetryDatum[metadatum.source]);
 | 
			
		||||
 
 | 
			
		||||
@@ -54,13 +54,22 @@ export default class ConditionSetMetadataProvider {
 | 
			
		||||
        return {
 | 
			
		||||
            values: this.getDomains().concat([
 | 
			
		||||
                {
 | 
			
		||||
                    name: 'Output',
 | 
			
		||||
                    key: 'output',
 | 
			
		||||
                    format: 'enum',
 | 
			
		||||
                    key: "state",
 | 
			
		||||
                    source: "output",
 | 
			
		||||
                    name: "State",
 | 
			
		||||
                    format: "enum",
 | 
			
		||||
                    enumerations: enumerations,
 | 
			
		||||
                    hints: {
 | 
			
		||||
                        range: 1
 | 
			
		||||
                    }
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    key: "output",
 | 
			
		||||
                    name: "Value",
 | 
			
		||||
                    format: "string",
 | 
			
		||||
                    hints: {
 | 
			
		||||
                        range: 2
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            ])
 | 
			
		||||
        };
 | 
			
		||||
 
 | 
			
		||||
@@ -45,7 +45,7 @@ export default class ConditionSetTelemetryProvider {
 | 
			
		||||
 | 
			
		||||
        return conditionManager.requestLADConditionSetOutput()
 | 
			
		||||
            .then(latestOutput => {
 | 
			
		||||
                return latestOutput ? [latestOutput] : [];
 | 
			
		||||
                return latestOutput;
 | 
			
		||||
            });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -22,6 +22,7 @@
 | 
			
		||||
 | 
			
		||||
import TelemetryCriterion from './TelemetryCriterion';
 | 
			
		||||
import { evaluateResults } from "../utils/evaluator";
 | 
			
		||||
import { getLatestTimestamp } from '../utils/time';
 | 
			
		||||
 | 
			
		||||
export default class AllTelemetryCriterion extends TelemetryCriterion {
 | 
			
		||||
 | 
			
		||||
@@ -107,40 +108,53 @@ export default class AllTelemetryCriterion extends TelemetryCriterion {
 | 
			
		||||
        this.result = evaluateResults(Object.values(this.telemetryDataCache), this.telemetry);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    requestLAD(options) {
 | 
			
		||||
        options = Object.assign({},
 | 
			
		||||
            options,
 | 
			
		||||
            {
 | 
			
		||||
                strategy: 'latest',
 | 
			
		||||
                size: 1
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
    requestLAD(telemetryObjects) {
 | 
			
		||||
        const options = {
 | 
			
		||||
            strategy: 'latest',
 | 
			
		||||
            size: 1
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        if (!this.isValid()) {
 | 
			
		||||
            return this.formatData({}, options.telemetryObjects);
 | 
			
		||||
            return this.formatData({}, telemetryObjects);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        let keys = Object.keys(Object.assign({}, options.telemetryObjects));
 | 
			
		||||
        let keys = Object.keys(Object.assign({}, telemetryObjects));
 | 
			
		||||
        const telemetryRequests = keys
 | 
			
		||||
            .map(key => this.openmct.telemetry.request(
 | 
			
		||||
                options.telemetryObjects[key],
 | 
			
		||||
                telemetryObjects[key],
 | 
			
		||||
                options
 | 
			
		||||
            ));
 | 
			
		||||
 | 
			
		||||
        let telemetryDataCache = {};
 | 
			
		||||
        return Promise.all(telemetryRequests)
 | 
			
		||||
            .then(telemetryRequestsResults => {
 | 
			
		||||
                let latestDatum;
 | 
			
		||||
                let latestTimestamp;
 | 
			
		||||
                const timeSystems = this.openmct.time.getAllTimeSystems();
 | 
			
		||||
                const timeSystem = this.openmct.time.timeSystem();
 | 
			
		||||
 | 
			
		||||
                telemetryRequestsResults.forEach((results, index) => {
 | 
			
		||||
                    latestDatum = results.length ? results[results.length - 1] : {};
 | 
			
		||||
                    if (index < telemetryRequestsResults.length-1) {
 | 
			
		||||
                        if (latestDatum) {
 | 
			
		||||
                            this.telemetryDataCache[latestDatum.id] = this.computeResult(latestDatum);
 | 
			
		||||
                        }
 | 
			
		||||
                    }
 | 
			
		||||
                    const latestDatum = results.length ? results[results.length - 1] : {};
 | 
			
		||||
                    const datumId = keys[index];
 | 
			
		||||
                    const normalizedDatum = this.createNormalizedDatum(latestDatum, telemetryObjects[datumId]);
 | 
			
		||||
 | 
			
		||||
                    telemetryDataCache[datumId] = this.computeResult(normalizedDatum);
 | 
			
		||||
 | 
			
		||||
                    latestTimestamp = getLatestTimestamp(
 | 
			
		||||
                        latestTimestamp,
 | 
			
		||||
                        normalizedDatum,
 | 
			
		||||
                        timeSystems,
 | 
			
		||||
                        timeSystem
 | 
			
		||||
                    );
 | 
			
		||||
                });
 | 
			
		||||
 | 
			
		||||
                const datum = {
 | 
			
		||||
                    result: evaluateResults(Object.values(telemetryDataCache), this.telemetry),
 | 
			
		||||
                    ...latestTimestamp
 | 
			
		||||
                };
 | 
			
		||||
 | 
			
		||||
                return {
 | 
			
		||||
                    id: this.id,
 | 
			
		||||
                    data: this.formatData(latestDatum, options.telemetryObjects)
 | 
			
		||||
                    data: datum
 | 
			
		||||
                };
 | 
			
		||||
            });
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -61,6 +61,21 @@ export default class TelemetryCriterion extends EventEmitter {
 | 
			
		||||
        this.telemetryObject = telemetryObjects[this.telemetryObjectIdAsString];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    createNormalizedDatum(telemetryDatum, endpoint) {
 | 
			
		||||
        const id = this.openmct.objects.makeKeyString(endpoint.identifier);
 | 
			
		||||
        const metadata = this.openmct.telemetry.getMetadata(endpoint).valueMetadatas;
 | 
			
		||||
 | 
			
		||||
        const normalizedDatum = Object.values(metadata).reduce((datum, metadatum) => {
 | 
			
		||||
            const formatter = this.openmct.telemetry.getValueFormatter(metadatum);
 | 
			
		||||
            datum[metadatum.key] = formatter.parse(telemetryDatum[metadatum.source]);
 | 
			
		||||
            return datum;
 | 
			
		||||
        }, {});
 | 
			
		||||
 | 
			
		||||
        normalizedDatum.id = id;
 | 
			
		||||
 | 
			
		||||
        return normalizedDatum;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    formatData(data) {
 | 
			
		||||
        const datum = {
 | 
			
		||||
            result: this.computeResult(data)
 | 
			
		||||
@@ -79,14 +94,11 @@ export default class TelemetryCriterion extends EventEmitter {
 | 
			
		||||
        this.result = this.computeResult(validatedData);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    requestLAD(options) {
 | 
			
		||||
        options = Object.assign({},
 | 
			
		||||
            options,
 | 
			
		||||
            {
 | 
			
		||||
                strategy: 'latest',
 | 
			
		||||
                size: 1
 | 
			
		||||
            }
 | 
			
		||||
        );
 | 
			
		||||
    requestLAD() {
 | 
			
		||||
        const options = {
 | 
			
		||||
            strategy: 'latest',
 | 
			
		||||
            size: 1
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        if (!this.isValid()) {
 | 
			
		||||
            return {
 | 
			
		||||
@@ -100,9 +112,11 @@ export default class TelemetryCriterion extends EventEmitter {
 | 
			
		||||
            options
 | 
			
		||||
        ).then(results => {
 | 
			
		||||
            const latestDatum = results.length ? results[results.length - 1] : {};
 | 
			
		||||
            const normalizedDatum = this.createNormalizedDatum(latestDatum, this.telemetryObject);
 | 
			
		||||
 | 
			
		||||
            return {
 | 
			
		||||
                id: this.id,
 | 
			
		||||
                data: this.formatData(latestDatum)
 | 
			
		||||
                data: this.formatData(normalizedDatum)
 | 
			
		||||
            };
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -54,27 +54,29 @@ function (
 | 
			
		||||
     * @constructor
 | 
			
		||||
     */
 | 
			
		||||
    function MCTChartController($scope) {
 | 
			
		||||
        this.$scope = $scope;
 | 
			
		||||
        this.isDestroyed = false;
 | 
			
		||||
        this.lines = [];
 | 
			
		||||
        this.pointSets = [];
 | 
			
		||||
        this.alarmSets = [];
 | 
			
		||||
        this.offset = {};
 | 
			
		||||
        this.config = $scope.config;
 | 
			
		||||
        this.listenTo(this.$scope, '$destroy', this.destroy, this);
 | 
			
		||||
        this.draw = this.draw.bind(this);
 | 
			
		||||
        this.scheduleDraw = this.scheduleDraw.bind(this);
 | 
			
		||||
        this.seriesElements = new WeakMap();
 | 
			
		||||
        this.$onInit = () => {
 | 
			
		||||
            this.$scope = $scope;
 | 
			
		||||
            this.isDestroyed = false;
 | 
			
		||||
            this.lines = [];
 | 
			
		||||
            this.pointSets = [];
 | 
			
		||||
            this.alarmSets = [];
 | 
			
		||||
            this.offset = {};
 | 
			
		||||
            this.config = $scope.config;
 | 
			
		||||
            this.listenTo(this.$scope, '$destroy', this.destroy, this);
 | 
			
		||||
            this.draw = this.draw.bind(this);
 | 
			
		||||
            this.scheduleDraw = this.scheduleDraw.bind(this);
 | 
			
		||||
            this.seriesElements = new WeakMap();
 | 
			
		||||
 | 
			
		||||
        this.listenTo(this.config.series, 'add', this.onSeriesAdd, this);
 | 
			
		||||
        this.listenTo(this.config.series, 'remove', this.onSeriesRemove, this);
 | 
			
		||||
        this.listenTo(this.config.yAxis, 'change:key', this.clearOffset, this);
 | 
			
		||||
        this.listenTo(this.config.xAxis, 'change:key', this.clearOffset, this);
 | 
			
		||||
        this.listenTo(this.config.yAxis, 'change', this.scheduleDraw);
 | 
			
		||||
        this.listenTo(this.config.xAxis, 'change', this.scheduleDraw);
 | 
			
		||||
        this.$scope.$watch('highlights', this.scheduleDraw);
 | 
			
		||||
        this.$scope.$watch('rectangles', this.scheduleDraw);
 | 
			
		||||
        this.config.series.forEach(this.onSeriesAdd, this);
 | 
			
		||||
            this.listenTo(this.config.series, 'add', this.onSeriesAdd, this);
 | 
			
		||||
            this.listenTo(this.config.series, 'remove', this.onSeriesRemove, this);
 | 
			
		||||
            this.listenTo(this.config.yAxis, 'change:key', this.clearOffset, this);
 | 
			
		||||
            this.listenTo(this.config.xAxis, 'change:key', this.clearOffset, this);
 | 
			
		||||
            this.listenTo(this.config.yAxis, 'change', this.scheduleDraw);
 | 
			
		||||
            this.listenTo(this.config.xAxis, 'change', this.scheduleDraw);
 | 
			
		||||
            this.$scope.$watch('highlights', this.scheduleDraw);
 | 
			
		||||
            this.$scope.$watch('rectangles', this.scheduleDraw);
 | 
			
		||||
            this.config.series.forEach(this.onSeriesAdd, this);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    eventHelpers.extend(MCTChartController.prototype);
 | 
			
		||||
 
 | 
			
		||||
@@ -34,25 +34,27 @@ define([
 | 
			
		||||
     * values near the cursor.
 | 
			
		||||
     */
 | 
			
		||||
    function MCTPlotController($scope, $element, $window) {
 | 
			
		||||
        this.$scope = $scope;
 | 
			
		||||
        this.$scope.config = this.config;
 | 
			
		||||
        this.$scope.plot = this;
 | 
			
		||||
        this.$element = $element;
 | 
			
		||||
        this.$window = $window;
 | 
			
		||||
        this.$onInit = () => {
 | 
			
		||||
            this.$scope = $scope;
 | 
			
		||||
            this.$scope.config = this.config;
 | 
			
		||||
            this.$scope.plot = this;
 | 
			
		||||
            this.$element = $element;
 | 
			
		||||
            this.$window = $window;
 | 
			
		||||
 | 
			
		||||
        this.xScale = new LinearScale(this.config.xAxis.get('displayRange'));
 | 
			
		||||
        this.yScale = new LinearScale(this.config.yAxis.get('displayRange'));
 | 
			
		||||
            this.xScale = new LinearScale(this.config.xAxis.get('displayRange'));
 | 
			
		||||
            this.yScale = new LinearScale(this.config.yAxis.get('displayRange'));
 | 
			
		||||
 | 
			
		||||
        this.pan = undefined;
 | 
			
		||||
        this.marquee = undefined;
 | 
			
		||||
            this.pan = undefined;
 | 
			
		||||
            this.marquee = undefined;
 | 
			
		||||
 | 
			
		||||
        this.chartElementBounds = undefined;
 | 
			
		||||
        this.tickUpdate = false;
 | 
			
		||||
            this.chartElementBounds = undefined;
 | 
			
		||||
            this.tickUpdate = false;
 | 
			
		||||
 | 
			
		||||
        this.$scope.plotHistory = this.plotHistory = [];
 | 
			
		||||
        this.listenTo(this.$scope, 'plot:clearHistory', this.clear, this);
 | 
			
		||||
            this.$scope.plotHistory = this.plotHistory = [];
 | 
			
		||||
            this.listenTo(this.$scope, 'plot:clearHistory', this.clear, this);
 | 
			
		||||
 | 
			
		||||
        this.initialize();
 | 
			
		||||
            this.initialize();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    MCTPlotController.$inject = ['$scope', '$element', '$window'];
 | 
			
		||||
 
 | 
			
		||||
@@ -114,15 +114,17 @@ define([
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    function MCTTicksController($scope, $element) {
 | 
			
		||||
        this.$scope = $scope;
 | 
			
		||||
        this.$element = $element;
 | 
			
		||||
        this.$onInit = () => {
 | 
			
		||||
            this.$scope = $scope;
 | 
			
		||||
            this.$element = $element;
 | 
			
		||||
 | 
			
		||||
        this.tickCount = 4;
 | 
			
		||||
        this.tickUpdate = false;
 | 
			
		||||
        this.listenTo(this.axis, 'change:displayRange', this.updateTicks, this);
 | 
			
		||||
        this.listenTo(this.axis, 'change:format', this.updateTicks, this);
 | 
			
		||||
        this.listenTo(this.$scope, '$destroy', this.stopListening, this);
 | 
			
		||||
        this.updateTicks();
 | 
			
		||||
            this.tickCount = 4;
 | 
			
		||||
            this.tickUpdate = false;
 | 
			
		||||
            this.listenTo(this.axis, 'change:displayRange', this.updateTicks, this);
 | 
			
		||||
            this.listenTo(this.axis, 'change:format', this.updateTicks, this);
 | 
			
		||||
            this.listenTo(this.$scope, '$destroy', this.stopListening, this);
 | 
			
		||||
            this.updateTicks();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    MCTTicksController.$inject = ['$scope', '$element'];
 | 
			
		||||
 
 | 
			
		||||
@@ -88,7 +88,8 @@ define([
 | 
			
		||||
    var bundleMap = {
 | 
			
		||||
        LocalStorage: 'platform/persistence/local',
 | 
			
		||||
        MyItems: 'platform/features/my-items',
 | 
			
		||||
        CouchDB: 'platform/persistence/couch'
 | 
			
		||||
        CouchDB: 'platform/persistence/couch',
 | 
			
		||||
        Elasticsearch: 'platform/persistence/elastic'
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    var plugins = _.mapValues(bundleMap, function (bundleName, pluginName) {
 | 
			
		||||
 
 | 
			
		||||
@@ -48,6 +48,7 @@
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <object-view
 | 
			
		||||
            v-if="internalDomainObject.keep_alive ? currentTab : isCurrent(tab)"
 | 
			
		||||
            class="c-tabs-view__object"
 | 
			
		||||
            :object="tab.domainObject"
 | 
			
		||||
        />
 | 
			
		||||
@@ -73,6 +74,7 @@ export default {
 | 
			
		||||
    },
 | 
			
		||||
    data: function () {
 | 
			
		||||
        return {
 | 
			
		||||
            internalDomainObject: this.domainObject,
 | 
			
		||||
            currentTab: {},
 | 
			
		||||
            tabsList: [],
 | 
			
		||||
            setCurrentTab: true,
 | 
			
		||||
@@ -88,6 +90,8 @@ export default {
 | 
			
		||||
            this.composition.load();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this.unsubscribe = this.openmct.objects.observe(this.internalDomainObject, '*', this.updateInternalDomainObject);
 | 
			
		||||
 | 
			
		||||
        document.addEventListener('dragstart', this.dragstart);
 | 
			
		||||
        document.addEventListener('dragend', this.dragend);
 | 
			
		||||
    },
 | 
			
		||||
@@ -96,6 +100,8 @@ export default {
 | 
			
		||||
        this.composition.off('remove', this.removeItem);
 | 
			
		||||
        this.composition.off('reorder', this.onReorder);
 | 
			
		||||
 | 
			
		||||
        this.unsubscribe();
 | 
			
		||||
 | 
			
		||||
        document.removeEventListener('dragstart', this.dragstart);
 | 
			
		||||
        document.removeEventListener('dragend', this.dragend);
 | 
			
		||||
    },
 | 
			
		||||
@@ -156,6 +162,9 @@ export default {
 | 
			
		||||
        },
 | 
			
		||||
        isCurrent(tab) {
 | 
			
		||||
            return _.isEqual(this.currentTab, tab)
 | 
			
		||||
        },
 | 
			
		||||
        updateInternalDomainObject(domainObject) {
 | 
			
		||||
            this.internalDomainObject = domainObject;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,27 @@ define([
 | 
			
		||||
                cssClass: 'icon-tabs-view',
 | 
			
		||||
                initialize(domainObject) {
 | 
			
		||||
                    domainObject.composition = [];
 | 
			
		||||
                }
 | 
			
		||||
                    domainObject.keep_alive = true;
 | 
			
		||||
                },
 | 
			
		||||
                form: [
 | 
			
		||||
                    {
 | 
			
		||||
                        "key": "keep_alive",
 | 
			
		||||
                        "name": "Keep Tabs Alive",
 | 
			
		||||
                        "control": "select",
 | 
			
		||||
                        "options": [
 | 
			
		||||
                            {
 | 
			
		||||
                                'name': 'True',
 | 
			
		||||
                                'value': true
 | 
			
		||||
                            },
 | 
			
		||||
                            {
 | 
			
		||||
                                'name': 'False',
 | 
			
		||||
                                'value': false
 | 
			
		||||
                            }
 | 
			
		||||
                        ],
 | 
			
		||||
                        "required": true,
 | 
			
		||||
                        "cssClass": "l-input"
 | 
			
		||||
                    }
 | 
			
		||||
                ]
 | 
			
		||||
            });
 | 
			
		||||
        };
 | 
			
		||||
    };
 | 
			
		||||
 
 | 
			
		||||
@@ -108,7 +108,7 @@ export default {
 | 
			
		||||
                let object = selection[0][0].context.item;
 | 
			
		||||
                if (object) {
 | 
			
		||||
                    let type = this.openmct.types.get(object.type);
 | 
			
		||||
                    this.showStyles = (this.excludeObjectTypes.indexOf(object.type) < 0) && type.definition.creatable;
 | 
			
		||||
                    this.showStyles = this.isLayoutObject(selection[0], object.type) || this.isCreatableObject(object, type);
 | 
			
		||||
                }
 | 
			
		||||
                if (!this.currentTabbedView.key || (!this.showStyles && this.currentTabbedView.key === this.tabbedViews[1].key))
 | 
			
		||||
                {
 | 
			
		||||
@@ -116,6 +116,14 @@ export default {
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        isLayoutObject(selection, objectType) {
 | 
			
		||||
            //we allow conditionSets to be styled if they're part of a layout
 | 
			
		||||
            return selection.length > 1 &&
 | 
			
		||||
                ((objectType === 'conditionSet') || (this.excludeObjectTypes.indexOf(objectType) < 0));
 | 
			
		||||
        },
 | 
			
		||||
        isCreatableObject(object, type) {
 | 
			
		||||
            return (this.excludeObjectTypes.indexOf(object.type) < 0) && type.definition.creatable;
 | 
			
		||||
        },
 | 
			
		||||
        updateCurrentTab(view) {
 | 
			
		||||
            this.currentTabbedView = view;
 | 
			
		||||
        },
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user