Compare commits

...

4 Commits

Author SHA1 Message Date
Shefali Joshi
eb95b1f50b cherry-pick(#6568): Only decrement and save if there is composition b… (#6599)
cherry-pick(#6568): Only decrement and save if there is composition but no child object reference (#6568)

Co-authored-by: David Tsay <3614296+davetsay@users.noreply.github.com>
2023-04-17 14:26:41 -07:00
Jamie V
c6e913245d cherry-pick #6562 : including identifier checks for exporting json (#6595) 2023-04-17 14:08:16 -07:00
Shefali Joshi
cf7016c814 cherry-pick(#6495): Remove ticker and rely solely on the clock ticks to update the timelist durations (#6529)
cherry-pick(#6495): Remove ticker and rely solely on the clock ticks to update the timelist durations (#6495)
* Remove ticker for timelist and rename a function for readability
* Use formatting for remote clock if available.
* throttle updates to the timestamp and listing activities
---------

Co-authored-by: Andrew Henry <akhenry@gmail.com>
2023-03-30 20:48:05 +00:00
Jesse Mazzella
91d0c0be10 chore: bump version to 2.2.0 2023-03-21 11:01:31 -07:00
5 changed files with 61 additions and 29 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "openmct",
"version": "2.2.0-SNAPSHOT",
"version": "2.2.0",
"description": "The Open MCT core platform",
"devDependencies": {
"@babel/eslint-parser": "7.18.9",

View File

@@ -156,11 +156,35 @@ export default class ExportAsJSONAction {
* @private
*/
_rewriteReferences() {
const oldKeyStrings = Object.keys(this.idMap);
let treeString = JSON.stringify(this.tree);
Object.keys(this.idMap).forEach(function (oldId) {
const newId = this.idMap[oldId];
treeString = treeString.split(oldId).join(newId);
}.bind(this));
oldKeyStrings.forEach((oldKeyString) => {
// this will cover keyStrings, identifiers and identifiers created
// by hand that may be structured differently from those created with 'makeKeyString'
const newKeyString = this.idMap[oldKeyString];
const newIdentifier = JSON.stringify(this.openmct.objects.parseKeyString(newKeyString));
const oldIdentifier = this.openmct.objects.parseKeyString(oldKeyString);
const oldIdentifierNamespaceFirst = JSON.stringify(oldIdentifier);
const oldIdentifierKeyFirst = JSON.stringify({
key: oldIdentifier.key,
namespace: oldIdentifier.namespace
});
// replace keyStrings
treeString = treeString.split(oldKeyString).join(newKeyString);
// check for namespace first identifiers, replace if necessary
if (treeString.includes(oldIdentifierNamespaceFirst)) {
treeString = treeString.split(oldIdentifierNamespaceFirst).join(newIdentifier);
}
// check for key first identifiers, replace if necessary
if (treeString.includes(oldIdentifierKeyFirst)) {
treeString = treeString.split(oldIdentifierKeyFirst).join(newIdentifier);
}
});
this.tree = JSON.parse(treeString);
}
/**
@@ -214,7 +238,9 @@ export default class ExportAsJSONAction {
}
}
});
this._decrementCallsAndSave();
if (!childObjectReferenceId) {
this._decrementCallsAndSave();
}
});
} else if (!childObjectReferenceId) {
this._decrementCallsAndSave();

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,8 @@ 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.updateTimestamp = _.throttle(this.updateTimestamp, 1000);
this.openmct.time.on('bounds', this.updateTimestamp);
this.openmct.editor.on('isEditing', this.setEditState);
@@ -144,10 +154,6 @@ export default {
this.unlistenConfig();
}
if (this.unlistenTicker) {
this.unlistenTicker();
}
if (this.removeStatusListener) {
this.removeStatusListener();
}
@@ -192,8 +198,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 +208,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 +351,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({