Compare commits
	
		
			20 Commits
		
	
	
		
			omm-r5.0.0
			...
			lad-bounds
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					9218508f63 | ||
| 
						 | 
					39c1667619 | ||
| 
						 | 
					9e825a94da | ||
| 
						 | 
					4b5ddf7dcb | ||
| 
						 | 
					0612dc8f9b | ||
| 
						 | 
					c1947d4080 | ||
| 
						 | 
					bec9d8da6d | ||
| 
						 | 
					18bd7e08b1 | ||
| 
						 | 
					9d8fb92158 | ||
| 
						 | 
					18c25f3c7a | ||
| 
						 | 
					517af6908a | ||
| 
						 | 
					ae76ff42c3 | ||
| 
						 | 
					14bc49451b | ||
| 
						 | 
					85da5e43b3 | ||
| 
						 | 
					2b3541a323 | ||
| 
						 | 
					51fb72dc04 | ||
| 
						 | 
					7a04aea90e | ||
| 
						 | 
					0bb475327c | ||
| 
						 | 
					c474b998f0 | ||
| 
						 | 
					a02d421093 | 
@@ -28,6 +28,16 @@ define([
 | 
			
		||||
                        domain: 2
 | 
			
		||||
                    }
 | 
			
		||||
                },
 | 
			
		||||
                // Need to enable "LocalTimeSystem" plugin to make use of this
 | 
			
		||||
                // {
 | 
			
		||||
                //     key: "local",
 | 
			
		||||
                //     name: "Time",
 | 
			
		||||
                //     format: "local-format",
 | 
			
		||||
                //     source: "utc",
 | 
			
		||||
                //     hints: {
 | 
			
		||||
                //         domain: 3
 | 
			
		||||
                //     }
 | 
			
		||||
                // },
 | 
			
		||||
                {
 | 
			
		||||
                    key: "sin",
 | 
			
		||||
                    name: "Sine",
 | 
			
		||||
@@ -61,6 +71,15 @@ define([
 | 
			
		||||
                        domain: 1
 | 
			
		||||
                    }
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    key: "local",
 | 
			
		||||
                    name: "Time",
 | 
			
		||||
                    format: "utc",
 | 
			
		||||
                    source: "utc",
 | 
			
		||||
                    hints: {
 | 
			
		||||
                        domain: 2
 | 
			
		||||
                    }
 | 
			
		||||
                },
 | 
			
		||||
                {
 | 
			
		||||
                    key: "state",
 | 
			
		||||
                    source: "value",
 | 
			
		||||
 
 | 
			
		||||
@@ -64,7 +64,7 @@ export default {
 | 
			
		||||
    },
 | 
			
		||||
    computed: {
 | 
			
		||||
        formattedTimestamp() {
 | 
			
		||||
            return this.timestamp !== undefined ? this.formats[this.timestampKey].format(this.timestamp) : '---';
 | 
			
		||||
            return this.timestamp !== undefined ? this.getFormattedTimestamp(this.timestamp) : '---';
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
    mounted() {
 | 
			
		||||
@@ -110,11 +110,11 @@ export default {
 | 
			
		||||
    },
 | 
			
		||||
    methods: {
 | 
			
		||||
        updateValues(datum) {
 | 
			
		||||
            let newTimestamp = this.formats[this.timestampKey].parse(datum),
 | 
			
		||||
            let newTimestamp = this.getParsedTimestamp(datum),
 | 
			
		||||
                limit;
 | 
			
		||||
 | 
			
		||||
            if(this.shouldUpdate(newTimestamp)) {
 | 
			
		||||
                this.timestamp = this.formats[this.timestampKey].parse(datum);
 | 
			
		||||
                this.timestamp = newTimestamp;
 | 
			
		||||
                this.value = this.formats[this.valueKey].format(datum);
 | 
			
		||||
                limit = this.limitEvaluator.evaluate(datum, this.valueMetadata);
 | 
			
		||||
                if (limit) {
 | 
			
		||||
@@ -125,9 +125,12 @@ export default {
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        shouldUpdate(newTimestamp) {
 | 
			
		||||
            return (this.timestamp === undefined) ||
 | 
			
		||||
                (this.inBounds(newTimestamp) &&
 | 
			
		||||
                newTimestamp > this.timestamp);
 | 
			
		||||
            let newTimestampInBounds = this.inBounds(newTimestamp),
 | 
			
		||||
                noExistingTimestamp = this.timestamp === undefined,
 | 
			
		||||
                newTimestampIsLatest = newTimestamp > this.timestamp;
 | 
			
		||||
 | 
			
		||||
            return newTimestampInBounds &&
 | 
			
		||||
                (noExistingTimestamp || newTimestampIsLatest);
 | 
			
		||||
        },
 | 
			
		||||
        requestHistory() {
 | 
			
		||||
            this.openmct
 | 
			
		||||
@@ -146,6 +149,7 @@ export default {
 | 
			
		||||
        updateBounds(bounds, isTick) {
 | 
			
		||||
            this.bounds = bounds;
 | 
			
		||||
            if(!isTick) {
 | 
			
		||||
                this.resetValues();
 | 
			
		||||
                this.requestHistory();
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
@@ -153,13 +157,34 @@ export default {
 | 
			
		||||
            return timestamp >= this.bounds.start && timestamp <= this.bounds.end;
 | 
			
		||||
        },
 | 
			
		||||
        updateTimeSystem(timeSystem) {
 | 
			
		||||
            this.value = '---';
 | 
			
		||||
            this.timestamp = '---';
 | 
			
		||||
            this.valueClass = '';
 | 
			
		||||
            this.resetValues();
 | 
			
		||||
            this.timestampKey = timeSystem.key;
 | 
			
		||||
        },
 | 
			
		||||
        showContextMenu(event) {
 | 
			
		||||
            this.openmct.contextMenu._showContextMenuForObjectPath(this.currentObjectPath, event.x, event.y, CONTEXT_MENU_ACTIONS);
 | 
			
		||||
        },
 | 
			
		||||
        resetValues() {
 | 
			
		||||
            this.value = '---';
 | 
			
		||||
            this.timestamp = undefined;
 | 
			
		||||
            this.valueClass = '';
 | 
			
		||||
        },
 | 
			
		||||
        getParsedTimestamp(timestamp) {
 | 
			
		||||
            if(this.timeSystemFormat()) {
 | 
			
		||||
                return this.formats[this.timestampKey].parse(timestamp);
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        getFormattedTimestamp(timestamp) {
 | 
			
		||||
            if(this.timeSystemFormat()) {
 | 
			
		||||
                return this.formats[this.timestampKey].format(timestamp);
 | 
			
		||||
            }
 | 
			
		||||
        },
 | 
			
		||||
        timeSystemFormat() {
 | 
			
		||||
            if(this.formats[this.timestampKey]) {
 | 
			
		||||
                return true;
 | 
			
		||||
            } else {
 | 
			
		||||
                console.warn(`No formatter for ${this.timestampKey} time system for ${this.domainObject.name}.`);
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user