mirror of
https://github.com/nasa/openmct.git
synced 2025-06-18 23:28:14 +00:00
1.7.8 master (#4373)
* Notebook conflict auto retry 1.7.7 (#4230) * Use timeFormatter.parse to get the timestamp of imagery since the source could be something other than key (#4238) * If there is a pending create request for an id, queue a duplicate request. (#4243) * [Telemetry Tables] Handling Request Loading (#4245) * Fix file selection on pressing enter key (#4246) * starting loading as false, since that makes sense (#4247) * Hide independent time conductor mode if only 1 mode option is available. (#4250) * Fix bargraph color selection (#4253) * snapshot clicked while in edit mode should open in preview mode #4115 (#4257) * Fix missing object handling in several vues (#4259) * Flexible Layouts display Condition Sets as their editing/browsing interface (#4179) * Flexible Layouts display Condition Sets as their editing/browsing interface #4141 * [Telemetry Table] Progress bar tests (#4249) * Remove alert styling and hide pause button if in Fixed Time mode. (#4263) * [Table/Collection Fixes] Clearing correctly, no mutating options, no duplicate requests (#4261) * Condition sets only persist if actively editing (#4262) * Imagery views should follow time context (#4264) * Equal stacked plot y widths for all it's sub-plots (#4267) * Fix Bar Graph related CSS (#4270) * Bar graph review comment fixes (#4232) * Mct4196 - Fixes Conditional Styling not being applied when editing a Condition Widget (#4255) * Fix plot zoom when child of time strip (#4272) * Resume plot if no pan, zoom, or drag action is taken (#4138) (#4256) * [Telemetry Collection] No duplicate requests on load (#4274) * doing the easy thing first (#4278) * Bargraph time metadata should consider 'source' (#4289) * Show clicked image in large view (#4280) * added icon for inspector (#4275) * Bar graph style nullcheck (#4291) * Stacked plots need to align the Y axis (#4286) * Duplicate Request Fixes (#4295) * Add braintree sanitize url lib and sanitize form urls (#4296) * Mct4177 fix for telemetry endpoints with '.' in the key (#4308) * Remove additional request to load plots when mounted. (#4314) * Fix plots dup requests (#4324) * Merging 1.7.8 into master. Co-authored-by: Andrew Henry <akhenry@gmail.com> Co-authored-by: Jamie V <jamie.j.vigliotta@nasa.gov> Co-authored-by: Nikhil <nikhil.k.mandlik@nasa.gov> Co-authored-by: Khalid Adil <khalidadil29@gmail.com> Co-authored-by: Charles Hacskaylo <charlesh88@gmail.com> Co-authored-by: Scott Bell <scott@traclabs.com> Co-authored-by: Michael Rogers <michael@mhrogers.com>
This commit is contained in:
@ -65,7 +65,7 @@ export default class Condition extends EventEmitter {
|
||||
}
|
||||
|
||||
this.trigger = conditionConfiguration.configuration.trigger;
|
||||
this.description = '';
|
||||
this.summary = '';
|
||||
}
|
||||
|
||||
updateResult(datum) {
|
||||
@ -134,7 +134,6 @@ export default class Condition extends EventEmitter {
|
||||
criterionConfigurations.forEach((criterionConfiguration) => {
|
||||
this.addCriterion(criterionConfiguration);
|
||||
});
|
||||
this.updateDescription();
|
||||
}
|
||||
|
||||
updateCriteria(criterionConfigurations) {
|
||||
@ -146,7 +145,6 @@ export default class Condition extends EventEmitter {
|
||||
this.criteria.forEach((criterion) => {
|
||||
criterion.updateTelemetryObjects(this.conditionManager.telemetryObjects);
|
||||
});
|
||||
this.updateDescription();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -200,7 +198,6 @@ export default class Condition extends EventEmitter {
|
||||
criterion.off('criterionUpdated', (obj) => this.handleCriterionUpdated(obj));
|
||||
criterion.off('telemetryIsStale', (obj) => this.handleStaleCriterion(obj));
|
||||
this.criteria.splice(found.index, 1, newCriterion);
|
||||
this.updateDescription();
|
||||
}
|
||||
}
|
||||
|
||||
@ -216,7 +213,6 @@ export default class Condition extends EventEmitter {
|
||||
});
|
||||
criterion.destroy();
|
||||
this.criteria.splice(found.index, 1);
|
||||
this.updateDescription();
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -228,7 +224,6 @@ export default class Condition extends EventEmitter {
|
||||
let found = this.findCriterion(criterion.id);
|
||||
if (found) {
|
||||
this.criteria[found.index] = criterion.data;
|
||||
this.updateDescription();
|
||||
}
|
||||
}
|
||||
|
||||
@ -254,8 +249,7 @@ export default class Condition extends EventEmitter {
|
||||
|
||||
description = `${description} ${criterion.getDescription()} ${(index < this.criteria.length - 1) ? triggerDescription.conjunction : ''}`;
|
||||
});
|
||||
this.description = description;
|
||||
this.conditionManager.updateConditionDescription(this);
|
||||
this.summary = description;
|
||||
}
|
||||
|
||||
getTriggerDescription() {
|
||||
|
@ -105,7 +105,14 @@ export default class ConditionManager extends EventEmitter {
|
||||
}
|
||||
|
||||
updateConditionTelemetryObjects() {
|
||||
this.conditions.forEach((condition) => condition.updateTelemetryObjects());
|
||||
this.conditions.forEach((condition) => {
|
||||
condition.updateTelemetryObjects();
|
||||
let index = this.conditionSetDomainObject.configuration.conditionCollection.findIndex(item => item.id === condition.id);
|
||||
if (index > -1) {
|
||||
//Only assign the summary, don't mutate the domain object
|
||||
this.conditionSetDomainObject.configuration.conditionCollection[index].summary = this.updateConditionDescription(condition);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
removeConditionTelemetryObjects() {
|
||||
@ -139,10 +146,17 @@ export default class ConditionManager extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
updateConditionDescription(condition) {
|
||||
condition.updateDescription();
|
||||
|
||||
return condition.summary;
|
||||
}
|
||||
|
||||
updateCondition(conditionConfiguration) {
|
||||
let condition = this.findConditionById(conditionConfiguration.id);
|
||||
if (condition) {
|
||||
condition.update(conditionConfiguration);
|
||||
conditionConfiguration.summary = this.updateConditionDescription(condition);
|
||||
}
|
||||
|
||||
let index = this.conditionSetDomainObject.configuration.conditionCollection.findIndex(item => item.id === conditionConfiguration.id);
|
||||
@ -152,16 +166,10 @@ export default class ConditionManager extends EventEmitter {
|
||||
}
|
||||
}
|
||||
|
||||
updateConditionDescription(condition) {
|
||||
const found = this.conditionSetDomainObject.configuration.conditionCollection.find(conditionConfiguration => (conditionConfiguration.id === condition.id));
|
||||
if (found.summary !== condition.description) {
|
||||
found.summary = condition.description;
|
||||
this.persistConditions();
|
||||
}
|
||||
}
|
||||
|
||||
initCondition(conditionConfiguration, index) {
|
||||
let condition = new Condition(conditionConfiguration, this.openmct, this);
|
||||
conditionConfiguration.summary = this.updateConditionDescription(condition);
|
||||
|
||||
if (index !== undefined) {
|
||||
this.conditions.splice(index + 1, 0, condition);
|
||||
} else {
|
||||
|
@ -33,8 +33,10 @@ export default class ConditionSetViewProvider {
|
||||
this.cssClass = 'icon-conditional';
|
||||
}
|
||||
|
||||
canView(domainObject) {
|
||||
return domainObject.type === 'conditionSet';
|
||||
canView(domainObject, objectPath) {
|
||||
const isConditionSet = domainObject.type === 'conditionSet';
|
||||
|
||||
return isConditionSet && this.openmct.router.isNavigatedObject(objectPath);
|
||||
}
|
||||
|
||||
canEdit(domainObject) {
|
||||
|
@ -244,7 +244,7 @@ export default {
|
||||
this.telemetryMetadataOptions = [];
|
||||
telemetryObjects.forEach(telemetryObject => {
|
||||
let telemetryMetadata = this.openmct.telemetry.getMetadata(telemetryObject);
|
||||
this.addMetaDataOptions(telemetryMetadata.values());
|
||||
this.addMetaDataOptions(telemetryMetadata ? telemetryMetadata.values() : []);
|
||||
});
|
||||
this.updateOperations();
|
||||
}
|
||||
|
@ -192,7 +192,11 @@ export default {
|
||||
this.telemetry.forEach((telemetryObject) => {
|
||||
const id = this.openmct.objects.makeKeyString(telemetryObject.identifier);
|
||||
let telemetryMetadata = this.openmct.telemetry.getMetadata(telemetryObject);
|
||||
this.telemetryMetadataOptions[id] = telemetryMetadata.values().slice();
|
||||
if (telemetryMetadata) {
|
||||
this.telemetryMetadataOptions[id] = telemetryMetadata.values().slice();
|
||||
} else {
|
||||
this.telemetryMetadataOptions[id] = [];
|
||||
}
|
||||
});
|
||||
},
|
||||
addTestInput(testInput) {
|
||||
|
@ -177,7 +177,7 @@ export default class AllTelemetryCriterion extends TelemetryCriterion {
|
||||
const timeSystem = this.openmct.time.timeSystem();
|
||||
|
||||
telemetryRequestsResults.forEach((results, index) => {
|
||||
const latestDatum = results.length ? results[results.length - 1] : {};
|
||||
const latestDatum = (Array.isArray(results) && results.length) ? results[results.length - 1] : {};
|
||||
const datumId = keys[index];
|
||||
const normalizedDatum = this.createNormalizedDatum(latestDatum, telemetryObjects[datumId]);
|
||||
|
||||
|
@ -167,6 +167,11 @@ export default class TelemetryCriterion extends EventEmitter {
|
||||
id: this.id,
|
||||
data: this.formatData(normalizedDatum)
|
||||
};
|
||||
}).catch((error) => {
|
||||
return {
|
||||
id: this.id,
|
||||
data: this.formatData()
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@ import StylesView from "./components/inspector/StylesView.vue";
|
||||
import Vue from 'vue';
|
||||
import {getApplicableStylesForItem} from "./utils/styleUtils";
|
||||
import ConditionManager from "@/plugins/condition/ConditionManager";
|
||||
import StyleRuleManager from "./StyleRuleManager";
|
||||
|
||||
describe('the plugin', function () {
|
||||
let conditionSetDefinition;
|
||||
@ -96,8 +97,12 @@ describe('the plugin', function () {
|
||||
|
||||
mockListener = jasmine.createSpy('mockListener');
|
||||
|
||||
openmct.router.isNavigatedObject = jasmine.createSpy().and.returnValue(true);
|
||||
|
||||
conditionSetDefinition.initialize(mockConditionSetDomainObject);
|
||||
|
||||
spyOn(openmct.objects, "save").and.returnValue(Promise.resolve(true));
|
||||
|
||||
openmct.on('start', done);
|
||||
openmct.startHeadless();
|
||||
});
|
||||
@ -126,21 +131,6 @@ describe('the plugin', function () {
|
||||
expect(mockConditionSetDomainObject.composition instanceof Array).toBeTrue();
|
||||
expect(mockConditionSetDomainObject.composition.length).toEqual(0);
|
||||
});
|
||||
|
||||
it('provides a view', () => {
|
||||
const testViewObject = {
|
||||
id: "test-object",
|
||||
type: "conditionSet",
|
||||
configuration: {
|
||||
conditionCollection: []
|
||||
}
|
||||
};
|
||||
|
||||
const applicableViews = openmct.objectViews.get(testViewObject, []);
|
||||
let conditionSetView = applicableViews.find((viewProvider) => viewProvider.key === 'conditionSet.view');
|
||||
expect(conditionSetView).toBeDefined();
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('the condition set usage for multiple display layout items', () => {
|
||||
@ -722,4 +712,124 @@ describe('the plugin', function () {
|
||||
expect(result[2]).toBeUndefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe('canView of ConditionSetViewProvider', () => {
|
||||
let conditionSetView;
|
||||
const testViewObject = {
|
||||
id: "test-object",
|
||||
type: "conditionSet",
|
||||
configuration: {
|
||||
conditionCollection: []
|
||||
}
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
const applicableViews = openmct.objectViews.get(testViewObject, []);
|
||||
conditionSetView = applicableViews.find((viewProvider) => viewProvider.key === 'conditionSet.view');
|
||||
});
|
||||
|
||||
it('provides a view', () => {
|
||||
expect(conditionSetView).toBeDefined();
|
||||
});
|
||||
|
||||
it('returns true for type `conditionSet` and is a navigated Object', () => {
|
||||
openmct.router.isNavigatedObject = jasmine.createSpy().and.returnValue(true);
|
||||
|
||||
const isCanView = conditionSetView.canView(testViewObject, []);
|
||||
|
||||
expect(isCanView).toBe(true);
|
||||
});
|
||||
|
||||
it('returns false for type `conditionSet` and is not a navigated Object', () => {
|
||||
openmct.router.isNavigatedObject = jasmine.createSpy().and.returnValue(false);
|
||||
|
||||
const isCanView = conditionSetView.canView(testViewObject, []);
|
||||
|
||||
expect(isCanView).toBe(false);
|
||||
});
|
||||
|
||||
it('returns false for type `notConditionSet` and is a navigated Object', () => {
|
||||
openmct.router.isNavigatedObject = jasmine.createSpy().and.returnValue(true);
|
||||
testViewObject.type = 'notConditionSet';
|
||||
const isCanView = conditionSetView.canView(testViewObject, []);
|
||||
|
||||
expect(isCanView).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe('The Style Rule Manager', () => {
|
||||
it('should subscribe to the conditionSet after the editor saves', async () => {
|
||||
const stylesObject = {
|
||||
"styles": [
|
||||
{
|
||||
"conditionId": "a8bf7d1a-c1bb-4fc7-936a-62056a51b5cd",
|
||||
"style": {
|
||||
"backgroundColor": "#38761d",
|
||||
"border": "",
|
||||
"color": "#073763",
|
||||
"isStyleInvisible": ""
|
||||
}
|
||||
},
|
||||
{
|
||||
"conditionId": "0558fa77-9bdc-4142-9f9a-7a28fe95182e",
|
||||
"style": {
|
||||
"backgroundColor": "#980000",
|
||||
"border": "",
|
||||
"color": "#ff9900",
|
||||
"isStyleInvisible": ""
|
||||
}
|
||||
}
|
||||
],
|
||||
"staticStyle": {
|
||||
"style": {
|
||||
"backgroundColor": "",
|
||||
"border": "",
|
||||
"color": ""
|
||||
}
|
||||
},
|
||||
"selectedConditionId": "0558fa77-9bdc-4142-9f9a-7a28fe95182e",
|
||||
"defaultConditionId": "0558fa77-9bdc-4142-9f9a-7a28fe95182e",
|
||||
"conditionSetIdentifier": {
|
||||
"namespace": "",
|
||||
"key": "035c589c-d98f-429e-8b89-d76bd8d22b29"
|
||||
}
|
||||
};
|
||||
openmct.$injector = jasmine.createSpyObj('$injector', ['get']);
|
||||
// const mockTransactionService = jasmine.createSpyObj(
|
||||
// 'transactionService',
|
||||
// ['commit']
|
||||
// );
|
||||
openmct.telemetry = jasmine.createSpyObj('telemetry', ['isTelemetryObject', "subscribe", "getMetadata", "getValueFormatter", "request"]);
|
||||
openmct.telemetry.isTelemetryObject.and.returnValue(true);
|
||||
openmct.telemetry.subscribe.and.returnValue(function () {});
|
||||
openmct.telemetry.getValueFormatter.and.returnValue({
|
||||
parse: function (value) {
|
||||
return value;
|
||||
}
|
||||
});
|
||||
openmct.telemetry.getMetadata.and.returnValue(testTelemetryObject.telemetry);
|
||||
openmct.telemetry.request.and.returnValue(Promise.resolve([]));
|
||||
|
||||
// mockTransactionService.commit = async () => {};
|
||||
const mockIdentifierService = jasmine.createSpyObj(
|
||||
'identifierService',
|
||||
['parse']
|
||||
);
|
||||
mockIdentifierService.parse.and.returnValue({
|
||||
getSpace: () => {
|
||||
return '';
|
||||
}
|
||||
});
|
||||
|
||||
openmct.$injector = jasmine.createSpyObj('$injector', ['get']);
|
||||
openmct.$injector.get.withArgs('identifierService').and.returnValue(mockIdentifierService);
|
||||
// .withArgs('transactionService').and.returnValue(mockTransactionService);
|
||||
|
||||
const styleRuleManger = new StyleRuleManager(stylesObject, openmct, null, true);
|
||||
spyOn(styleRuleManger, 'subscribeToConditionSet');
|
||||
openmct.editor.edit();
|
||||
await openmct.editor.save();
|
||||
expect(styleRuleManger.subscribeToConditionSet).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user