mirror of
https://github.com/nasa/openmct.git
synced 2025-06-06 01:11:41 +00:00
[Tables] Enabled auto-scroll by default fixes #1040
This commit is contained in:
parent
a3443d8077
commit
ee7c450e11
@ -5,6 +5,6 @@
|
|||||||
enableFilter="true"
|
enableFilter="true"
|
||||||
enableSort="true"
|
enableSort="true"
|
||||||
class="tabular-holder t-exportable"
|
class="tabular-holder t-exportable"
|
||||||
auto-scroll="autoScroll">
|
auto-scroll="true">
|
||||||
</mct-table>
|
</mct-table>
|
||||||
</div>
|
</div>
|
@ -38,30 +38,7 @@ define(
|
|||||||
function RealtimeTableController($scope, telemetryHandler, telemetryFormatter) {
|
function RealtimeTableController($scope, telemetryHandler, telemetryFormatter) {
|
||||||
TableController.call(this, $scope, telemetryHandler, telemetryFormatter);
|
TableController.call(this, $scope, telemetryHandler, telemetryFormatter);
|
||||||
|
|
||||||
$scope.autoScroll = false;
|
|
||||||
this.maxRows = 100000;
|
this.maxRows = 100000;
|
||||||
|
|
||||||
/*
|
|
||||||
* Determine if auto-scroll should be enabled. Is enabled
|
|
||||||
* automatically when telemetry type is string
|
|
||||||
*/
|
|
||||||
function hasStringTelemetry(domainObject) {
|
|
||||||
var telemetry = domainObject &&
|
|
||||||
domainObject.getCapability('telemetry'),
|
|
||||||
metadata = telemetry ? telemetry.getMetadata() : {},
|
|
||||||
ranges = metadata.ranges || [];
|
|
||||||
|
|
||||||
return ranges.some(function (range) {
|
|
||||||
return range.format === 'string';
|
|
||||||
});
|
|
||||||
}
|
|
||||||
$scope.$watch('domainObject', function (domainObject) {
|
|
||||||
//When a domain object becomes available, check whether the
|
|
||||||
// view should auto-scroll to the bottom.
|
|
||||||
if (domainObject && hasStringTelemetry(domainObject)) {
|
|
||||||
$scope.autoScroll = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
RealtimeTableController.prototype = Object.create(TableController.prototype);
|
RealtimeTableController.prototype = Object.create(TableController.prototype);
|
||||||
|
@ -155,13 +155,6 @@ define(
|
|||||||
expect(mockScope.rows[0].row).toBe(1);
|
expect(mockScope.rows[0].row).toBe(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('enables autoscroll for event telemetry', function () {
|
|
||||||
controller.subscribe();
|
|
||||||
mockScope.$watch.mostRecentCall.args[1](mockDomainObject);
|
|
||||||
expect(mockScope.autoScroll).toBe(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user