Compare commits

...

3 Commits

Author SHA1 Message Date
Joshi
21bf508171 Update version number to 1.7.2 2021-05-17 10:20:29 -07:00
Shefali Joshi
dacec48aec Update condition sets in fixed timespan mode if the datum's timestamp is valid (#3852) 2021-05-11 19:25:56 -07:00
Andrew Henry
3ca133c782 Pass objectPath as property to LAD rows (#3870)
Includes some code cleanup
2021-05-11 18:58:17 -07:00
12 changed files with 79 additions and 29 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "openmct",
"version": "1.7.1-SNAPSHOT",
"version": "1.7.2",
"description": "The Open MCT core platform",
"dependencies": {},
"devDependencies": {

View File

@@ -43,12 +43,16 @@ export default function LADTableSetViewProvider(openmct) {
components: {
LadTableSet: LadTableSet
},
data() {
return {
domainObject
};
},
provide: {
openmct,
domainObject,
objectPath
},
template: '<lad-table-set></lad-table-set>'
template: '<lad-table-set :domain-object="domainObject"></lad-table-set>'
});
},
destroy: function (element) {

View File

@@ -56,7 +56,7 @@ export default {
type: Object,
required: true
},
objectPath: {
pathToTable: {
type: Array,
required: true
},
@@ -66,20 +66,19 @@ export default {
}
},
data() {
let currentObjectPath = this.objectPath.slice();
currentObjectPath.unshift(this.domainObject);
return {
timestamp: undefined,
value: '---',
valueClass: '',
currentObjectPath,
unit: ''
};
},
computed: {
formattedTimestamp() {
return this.timestamp !== undefined ? this.getFormattedTimestamp(this.timestamp) : '---';
},
objectPath() {
return [this.domainObject, ...this.pathToTable];
}
},
mounted() {
@@ -182,7 +181,7 @@ export default {
};
},
showContextMenu(event) {
let actionCollection = this.openmct.actions.get(this.currentObjectPath, this.getView());
let actionCollection = this.openmct.actions.get(this.objectPath, this.getView());
let allActions = actionCollection.getActionsObject();
let applicableActions = CONTEXT_MENU_ACTIONS.map(key => allActions[key]);

View File

@@ -33,10 +33,10 @@
</thead>
<tbody>
<lad-row
v-for="item in items"
:key="item.key"
:domain-object="item.domainObject"
:object-path="objectPath"
v-for="ladRow in items"
:key="ladRow.key"
:domain-object="ladRow.domainObject"
:path-to-table="objectPath"
:has-units="hasUnits"
/>
</tbody>

View File

@@ -43,9 +43,10 @@
</td>
</tr>
<lad-row
v-for="telemetryObject in ladTelemetryObjects[ladTable.key]"
:key="telemetryObject.key"
:domain-object="telemetryObject.domainObject"
v-for="ladRow in ladTelemetryObjects[ladTable.key]"
:key="ladRow.key"
:domain-object="ladRow.domainObject"
:path-to-table="ladTable.objectPath"
:has-units="hasUnits"
/>
</template>
@@ -60,7 +61,13 @@ export default {
components: {
LadRow
},
inject: ['openmct', 'domainObject'],
inject: ['openmct', 'objectPath'],
props: {
domainObject: {
type: Object,
required: true
}
},
data() {
return {
ladTableObjects: [],
@@ -106,6 +113,7 @@ export default {
let ladTable = {};
ladTable.domainObject = domainObject;
ladTable.key = this.openmct.objects.makeKeyString(domainObject.identifier);
ladTable.objectPath = [domainObject, ...this.objectPath];
this.$set(this.ladTelemetryObjects, ladTable.key, []);
this.ladTableObjects.push(ladTable);

View File

@@ -272,11 +272,11 @@ export default class Condition extends EventEmitter {
}
}
requestLADConditionResult() {
requestLADConditionResult(options) {
let latestTimestamp;
let criteriaResults = {};
const criteriaRequests = this.criteria
.map(criterion => criterion.requestLAD(this.conditionManager.telemetryObjects));
.map(criterion => criterion.requestLAD(this.conditionManager.telemetryObjects, options));
return Promise.all(criteriaRequests)
.then(results => {

View File

@@ -282,7 +282,7 @@ export default class ConditionManager extends EventEmitter {
return currentCondition;
}
requestLADConditionSetOutput() {
requestLADConditionSetOutput(options) {
if (!this.conditions.length) {
return Promise.resolve([]);
}
@@ -291,7 +291,7 @@ export default class ConditionManager extends EventEmitter {
let latestTimestamp;
let conditionResults = {};
const conditionRequests = this.conditions
.map(condition => condition.requestLADConditionResult());
.map(condition => condition.requestLADConditionResult(options));
return Promise.all(conditionRequests)
.then((results) => {

View File

@@ -40,10 +40,10 @@ export default class ConditionSetTelemetryProvider {
return domainObject.type === 'conditionSet';
}
request(domainObject) {
request(domainObject, options) {
let conditionManager = this.getConditionManager(domainObject);
return conditionManager.requestLADConditionSetOutput()
return conditionManager.requestLADConditionSetOutput(options)
.then(latestOutput => {
return latestOutput;
});
@@ -52,7 +52,9 @@ export default class ConditionSetTelemetryProvider {
subscribe(domainObject, callback) {
let conditionManager = this.getConditionManager(domainObject);
conditionManager.on('conditionSetResultUpdated', callback);
conditionManager.on('conditionSetResultUpdated', (data) => {
callback(data);
});
return this.destroyConditionManager.bind(this, this.openmct.objects.makeKeyString(domainObject.identifier));
}

View File

@@ -35,6 +35,7 @@ export default class StyleRuleManager extends EventEmitter {
if (styleConfiguration) {
this.initialize(styleConfiguration);
if (styleConfiguration.conditionSetIdentifier) {
this.openmct.time.on("bounds", this.refreshData.bind(this));
this.subscribeToConditionSet();
} else {
this.applyStaticStyle();
@@ -83,6 +84,25 @@ export default class StyleRuleManager extends EventEmitter {
});
}
refreshData(bounds, isTick) {
if (!isTick) {
let options = {
start: bounds.start,
end: bounds.end,
size: 1,
strategy: 'latest'
};
this.openmct.objects.get(this.conditionSetIdentifier).then((conditionSetDomainObject) => {
this.openmct.telemetry.request(conditionSetDomainObject, options)
.then(output => {
if (output && output.length) {
this.handleConditionSetResultUpdated(output[0]);
}
});
});
}
}
updateObjectStyleConfig(styleConfiguration) {
if (!styleConfiguration || !styleConfiguration.conditionSetIdentifier) {
this.initialize(styleConfiguration || {});
@@ -160,10 +180,14 @@ export default class StyleRuleManager extends EventEmitter {
destroy() {
if (this.stopProvidingTelemetry) {
this.stopProvidingTelemetry();
delete this.stopProvidingTelemetry;
}
this.openmct.time.off("bounds", this.refreshData);
this.openmct.editor.off('isEditing', this.toggleSubscription);
this.conditionSetIdentifier = undefined;
}

View File

@@ -147,12 +147,16 @@ export default class AllTelemetryCriterion extends TelemetryCriterion {
this.result = evaluateResults(Object.values(this.telemetryDataCache), this.telemetry);
}
requestLAD(telemetryObjects) {
const options = {
requestLAD(telemetryObjects, requestOptions) {
let options = {
strategy: 'latest',
size: 1
};
if (requestOptions !== undefined) {
options = Object.assign(options, requestOptions);
}
if (!this.isValid()) {
return this.formatData({}, telemetryObjects);
}

View File

@@ -137,12 +137,16 @@ export default class TelemetryCriterion extends EventEmitter {
}
}
requestLAD() {
const options = {
requestLAD(telemetryObjects, requestOptions) {
let options = {
strategy: 'latest',
size: 1
};
if (requestOptions !== undefined) {
options = Object.assign(options, requestOptions);
}
if (!this.isValid()) {
return {
id: this.id,

View File

@@ -269,7 +269,12 @@ export default {
},
subscribeToObject() {
this.subscription = this.openmct.telemetry.subscribe(this.domainObject, function (datum) {
if (this.openmct.time.clock() !== undefined) {
const key = this.openmct.time.timeSystem().key;
const datumTimeStamp = datum[key];
if (this.openmct.time.clock() !== undefined
|| (datumTimeStamp
&& (this.openmct.time.bounds().end >= datumTimeStamp))
) {
this.updateView(datum);
}
}.bind(this));