Compare commits

...

20 Commits

Author SHA1 Message Date
9218508f63 Merge branch 'master' into lad-bounds-listener 2020-07-01 09:39:16 -07:00
39c1667619 simplified update values logic 2020-06-25 11:46:28 -07:00
9e825a94da removed some commented code 2020-06-25 10:56:37 -07:00
4b5ddf7dcb removed debug code, comment out local format metadata code, optimizing 2020-06-25 10:48:51 -07:00
0612dc8f9b changed local format to local-format 2020-06-24 13:48:46 -07:00
c1947d4080 Merge branch 'master' into lad-bounds-listener 2020-06-24 13:32:37 -07:00
bec9d8da6d updated for state generator as well 2020-06-23 16:58:30 -07:00
18bd7e08b1 modified generators to support local time system 2020-06-23 16:51:56 -07:00
9d8fb92158 error handling for no time system formatters, updated edge case race condition logic 2020-06-23 13:49:49 -07:00
18c25f3c7a merging master 2020-06-23 11:03:47 -07:00
517af6908a pr review updates: one type for timestamp, clearer logic for updating, size: 1 for history req 2020-06-09 13:47:26 -07:00
ae76ff42c3 Merge branch 'master' into lad-bounds-listener 2020-06-09 09:22:12 -07:00
14bc49451b removed "existingTimestamp" variable, it is now stored in instance "timestamp" variable 2020-05-12 13:12:53 -07:00
85da5e43b3 moved formatedTimestamp to a computed value to utilize caching 2020-05-08 16:24:58 -07:00
2b3541a323 Merge branch 'master' into lad-bounds-listener 2020-04-29 12:43:20 -07:00
51fb72dc04 updates from PR review 2020-04-28 17:02:04 -07:00
7a04aea90e removing console log 2020-04-17 16:45:24 -07:00
0bb475327c added matadatum with key === name to be ignored as well when selecting value to show 2020-04-17 16:44:18 -07:00
c474b998f0 added a backup if the object does not have a range hint (ex. images) 2020-04-17 16:22:03 -07:00
a02d421093 added bounds listener, moved history request to function, checking for race conditions 2020-04-16 12:19:20 -07:00
2 changed files with 53 additions and 9 deletions

View File

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

View File

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