mirror of
https://github.com/nasa/openmct.git
synced 2025-04-22 18:11:23 +00:00
[Tables] #793 Added fix for tables not appearing on refresh
Fixed failing tests
This commit is contained in:
parent
012a38cccd
commit
a4b79cdb5b
platform/features/table
src/controllers
test/controllers
@ -82,27 +82,28 @@ define(
|
||||
var datum,
|
||||
row,
|
||||
self = this;
|
||||
if (this.handle) {
|
||||
this.handle.getTelemetryObjects().forEach(function (telemetryObject) {
|
||||
datum = self.handle.getDatum(telemetryObject);
|
||||
if (datum) {
|
||||
row = self.table.getRowValues(telemetryObject, datum);
|
||||
if (!self.$scope.rows) {
|
||||
self.$scope.rows = [row];
|
||||
self.$scope.$digest();
|
||||
} else {
|
||||
self.$scope.rows.push(row);
|
||||
|
||||
this.handle.getTelemetryObjects().forEach(function (telemetryObject){
|
||||
datum = self.handle.getDatum(telemetryObject);
|
||||
if (datum) {
|
||||
row = self.table.getRowValues(telemetryObject, datum);
|
||||
if (!self.$scope.rows){
|
||||
self.$scope.rows = [row];
|
||||
self.$scope.$digest();
|
||||
} else {
|
||||
self.$scope.rows.push(row);
|
||||
if (self.$scope.rows.length > self.maxRows) {
|
||||
self.$scope.$broadcast('remove:row', 0);
|
||||
self.$scope.rows.shift();
|
||||
}
|
||||
|
||||
if (self.$scope.rows.length > self.maxRows) {
|
||||
self.$scope.$broadcast('remove:row', 0);
|
||||
self.$scope.rows.shift();
|
||||
self.$scope.$broadcast('add:row',
|
||||
self.$scope.rows.length - 1);
|
||||
}
|
||||
|
||||
self.$scope.$broadcast('add:row',
|
||||
self.$scope.rows.length - 1);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
return RTTelemetryTableController;
|
||||
|
@ -66,7 +66,7 @@ define(
|
||||
if (!domainObject)
|
||||
return;
|
||||
|
||||
self.subscribe();
|
||||
self.subscribe(domainObject);
|
||||
self.registerChangeListeners();
|
||||
});
|
||||
|
||||
@ -80,6 +80,8 @@ define(
|
||||
* @private
|
||||
*/
|
||||
TelemetryTableController.prototype.registerChangeListeners = function () {
|
||||
var self = this;
|
||||
|
||||
this.changeListeners.forEach(function (listener) {
|
||||
return listener && listener();
|
||||
});
|
||||
@ -87,7 +89,11 @@ define(
|
||||
// When composition changes, re-subscribe to the various
|
||||
// telemetry subscriptions
|
||||
this.changeListeners.push(this.$scope.$watchCollection(
|
||||
'domainObject.getModel().composition', this.subscribe.bind(this)));
|
||||
'domainObject.getModel().composition', function(composition, oldComposition) {
|
||||
if (composition!== oldComposition) {
|
||||
self.subscribe();
|
||||
}
|
||||
}));
|
||||
|
||||
//Change of bounds in time conductor
|
||||
this.changeListeners.push(this.$scope.$on('telemetry:display:bounds',
|
||||
@ -112,6 +118,7 @@ define(
|
||||
TelemetryTableController.prototype.subscribe = function () {
|
||||
var self = this;
|
||||
this.initialized = false;
|
||||
this.$scope.rows = undefined;
|
||||
|
||||
if (this.handle) {
|
||||
this.handle.unsubscribe();
|
||||
@ -121,13 +128,12 @@ define(
|
||||
function update(){
|
||||
if(!self.initialized){
|
||||
self.setup();
|
||||
self.initialized = true;
|
||||
}
|
||||
self.updateRealtime();
|
||||
}
|
||||
|
||||
this.handle = this.$scope.domainObject && this.telemetryHandler.handle(
|
||||
this.$scope.domainObject,
|
||||
self.$scope.domainObject,
|
||||
update,
|
||||
true // Lossless
|
||||
);
|
||||
@ -172,6 +178,7 @@ define(
|
||||
table = this.table,
|
||||
self = this;
|
||||
|
||||
//Is metadata available yet?
|
||||
if (handle) {
|
||||
table.buildColumns(handle.getMetadata());
|
||||
|
||||
@ -183,6 +190,7 @@ define(
|
||||
'domainObject.getModel().configuration.table.columns',
|
||||
self.filterColumns.bind(self)
|
||||
));
|
||||
self.initialized = true;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -103,6 +103,7 @@ define(
|
||||
mockScope.domainObject = mockDomainObject;
|
||||
|
||||
mockTelemetryHandle = jasmine.createSpyObj('telemetryHandle', [
|
||||
'request',
|
||||
'getMetadata',
|
||||
'unsubscribe',
|
||||
'getDatum',
|
||||
@ -113,6 +114,7 @@ define(
|
||||
// used by mocks
|
||||
mockTelemetryHandle.getTelemetryObjects.andReturn([{}]);
|
||||
mockTelemetryHandle.promiseTelemetryObjects.andReturn(promise(undefined));
|
||||
mockTelemetryHandle.request.andReturn(promise(undefined));
|
||||
mockTelemetryHandle.getDatum.andReturn({});
|
||||
|
||||
mockTelemetryHandler = jasmine.createSpyObj('telemetryHandler', [
|
||||
|
@ -203,7 +203,7 @@ define(
|
||||
' object composition changes', function () {
|
||||
controller.registerChangeListeners();
|
||||
expect(watches['domainObject.getModel().composition']).toBeDefined();
|
||||
watches['domainObject.getModel().composition']();
|
||||
watches['domainObject.getModel().composition'](["one"], ["two"]);
|
||||
expect(controller.subscribe).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user