Compare commits

...

12 Commits

Author SHA1 Message Date
Shefali
9f7a88090c Remove debouncing 2023-03-24 15:00:54 -07:00
Shefali
9fcebf8b11 Reduce debounce time 2023-03-24 14:52:35 -07:00
Shefali
d68d7bdd8e Fix formatting for local clock 2023-03-24 14:23:29 -07:00
Shefali
88cbd8e40c Check for clock being undefined 2023-03-24 10:33:49 -07:00
Shefali
d4bce52fb0 Remove unused code 2023-03-24 07:04:51 -07:00
Shefali
93214c235a Use formatting from clock when available. When clock changes, update the timestamp. 2023-03-24 06:50:41 -07:00
Shefali
907da30516 Pass openmct to format function 2023-03-24 05:57:30 -07:00
Shefali
eb9e0d8d4d Format Time from the clock 2023-03-23 15:59:59 -07:00
Shefali
eb3129bdb0 Use parseTime to get formatted time. 2023-03-23 15:54:04 -07:00
Shefali
d9877759d3 Change moment to use utc parsing 2023-03-23 15:02:53 -07:00
Shefali
ac21c1b70c Debounce the update timestamp call 2023-03-22 13:36:42 -07:00
Shefali
0ea776f688 Remote ticker for timelist and rename a function for readability 2023-03-22 13:11:18 -07:00
3 changed files with 28 additions and 23 deletions

View File

@@ -46,6 +46,7 @@ export default class RemoteClock extends DefaultClock {
this.timeTelemetryObject = undefined;
this.parseTime = undefined;
this.formatTime = undefined;
this.metadata = undefined;
this.lastTick = 0;
@@ -137,6 +138,10 @@ export default class RemoteClock extends DefaultClock {
this.parseTime = (datum) => {
return timeFormatter.parse(datum);
};
this.formatTime = (datum) => {
return timeFormatter.format(datum);
};
}
/**

View File

@@ -38,9 +38,8 @@
import {getValidatedData} from "../plan/util";
import ListView from '../../ui/components/List/ListView.vue';
import {getPreciseDuration} from "../../utils/duration";
import ticker from 'utils/clock/Ticker';
import {SORT_ORDER_OPTIONS} from "./constants";
import _ from 'lodash';
import moment from "moment";
import { v4 as uuid } from 'uuid';
@@ -53,16 +52,26 @@ const headerItems = [
isSortable: true,
property: 'start',
name: 'Start Time',
format: function (value, object) {
return `${moment(value).format(TIME_FORMAT)}Z`;
format: function (value, object, key, openmct) {
const clock = openmct.time.clock();
if (clock && clock.formatTime) {
return clock.formatTime(value);
} else {
return `${moment(value).format(TIME_FORMAT)}Z`;
}
}
}, {
defaultDirection: true,
isSortable: true,
property: 'end',
name: 'End Time',
format: function (value, object) {
return `${moment(value).format(TIME_FORMAT)}Z`;
format: function (value, object, key, openmct) {
const clock = openmct.time.clock();
if (clock && clock.formatTime) {
return clock.formatTime(value);
} else {
return `${moment(value).format(TIME_FORMAT)}Z`;
}
}
}, {
defaultDirection: false,
@@ -119,7 +128,7 @@ export default {
this.unlistenConfig = this.openmct.objects.observe(this.domainObject, 'configuration', this.setViewFromConfig);
this.removeStatusListener = this.openmct.status.observe(this.domainObject.identifier, this.setStatus);
this.status = this.openmct.status.get(this.domainObject.identifier);
this.unlistenTicker = ticker.listen(this.clearPreviousActivities);
this.openmct.time.on('bounds', this.updateTimestamp);
this.openmct.editor.on('isEditing', this.setEditState);
@@ -144,10 +153,6 @@ export default {
this.unlistenConfig();
}
if (this.unlistenTicker) {
this.unlistenTicker();
}
if (this.removeStatusListener) {
this.removeStatusListener();
}
@@ -192,8 +197,8 @@ export default {
}
},
updateTimestamp(_bounds, isTick) {
if (isTick === true) {
this.timestamp = this.openmct.time.clock().currentValue();
if (isTick === true && this.openmct.time.clock() !== undefined) {
this.updateTimeStampAndListActivities(this.openmct.time.clock().currentValue());
}
},
setViewFromClock(newClock) {
@@ -202,12 +207,11 @@ export default {
if (isFixedTime) {
this.hideAll = false;
this.showAll = true;
// clear invokes listActivities
this.clearPreviousActivities(this.openmct.time.bounds()?.start);
this.updateTimeStampAndListActivities(this.openmct.time.bounds()?.start);
} else {
this.setSort();
this.setViewBounds();
this.listActivities();
this.updateTimeStampAndListActivities(this.openmct.time.clock().currentValue());
}
},
addItem(domainObject) {
@@ -346,12 +350,8 @@ export default {
// sort by start time
this.planActivities = activities.sort(this.sortByStartTime);
},
clearPreviousActivities(time) {
if (time instanceof Date) {
this.timestamp = time.getTime();
} else {
this.timestamp = time;
}
updateTimeStampAndListActivities(time) {
this.timestamp = time;
this.listActivities();
},

View File

@@ -37,7 +37,7 @@ export default {
// eslint-disable-next-line you-dont-need-lodash-underscore/get
let value = _.get(this.item, property.key);
if (property.format) {
value = property.format(value, this.item, property.key);
value = property.format(value, this.item, property.key, this.openmct);
}
values.push({