mirror of
https://github.com/nasa/openmct.git
synced 2025-03-18 10:05:22 +00:00
[Time Conductor] Implement default sort, fix unpredictable positioning using % left, set TOI on conductor init. #1193
This commit is contained in:
parent
d12ae77d95
commit
b56ab0aac2
@ -99,7 +99,7 @@ define([
|
||||
"source": "generator",
|
||||
"domains": [
|
||||
{
|
||||
"key": "time",
|
||||
"key": "utc",
|
||||
"name": "Time"
|
||||
},
|
||||
{
|
||||
|
@ -61,7 +61,7 @@ define([
|
||||
"domains": [
|
||||
{
|
||||
"name": "Time",
|
||||
"key": "timestamp",
|
||||
"key": "utc",
|
||||
"format": "utc"
|
||||
}
|
||||
]
|
||||
|
@ -85,10 +85,9 @@
|
||||
|
||||
<!-- Holds data visualization, time of interest -->
|
||||
<div class="l-data-visualization-holder l-row-elem flex-elem"
|
||||
ng-controller="ConductorTOIController as toi"
|
||||
ng-click="toi.click($event)">
|
||||
ng-controller="ConductorTOIController as toi">
|
||||
<a class="l-page-button s-icon-button icon-pointer-left"></a>
|
||||
<div class="l-data-visualization">
|
||||
<div class="l-data-visualization" ng-click="toi.click($event)">
|
||||
<mct-include key="'time-of-interest'"
|
||||
class="l-toi-holder show-val"
|
||||
ng-class="{ pinned: toi.pinned, 'val-to-left': toi.left > 80 }"
|
||||
|
@ -45,6 +45,11 @@ define(
|
||||
this.conductorViewService.on('pan', this.setOffsetFromBounds);
|
||||
this.conductor.on('timeSystem', this.changeTimeSystem);
|
||||
|
||||
var timeOfInterest = this.conductor.timeOfInterest();
|
||||
if (timeOfInterest) {
|
||||
this.changeTimeOfInterest(timeOfInterest);
|
||||
}
|
||||
|
||||
$scope.$on('$destroy', this.destroy);
|
||||
|
||||
}
|
||||
|
@ -109,12 +109,12 @@ define([
|
||||
{
|
||||
"key": "HistoricalTableController",
|
||||
"implementation": HistoricalTableController,
|
||||
"depends": ["$scope", "telemetryHandler", "telemetryFormatter", "$timeout", "timeConductor"]
|
||||
"depends": ["$scope", "telemetryHandler", "telemetryFormatter", "$timeout", "timeConductor", "timeConductor"]
|
||||
},
|
||||
{
|
||||
"key": "RealtimeTableController",
|
||||
"implementation": RealtimeTableController,
|
||||
"depends": ["$scope", "telemetryHandler", "telemetryFormatter"]
|
||||
"depends": ["$scope", "telemetryHandler", "telemetryFormatter", "timeConductor"]
|
||||
},
|
||||
{
|
||||
"key": "TableOptionsController",
|
||||
|
@ -6,6 +6,7 @@
|
||||
rows="rows"
|
||||
enableFilter="true"
|
||||
enableSort="true"
|
||||
default-sort="defaultSort"
|
||||
on-row-click="tableController.onRowClick(event, rowIndex, sortColumn, sortDirection)"
|
||||
class="tabular-holder has-control-bar">
|
||||
</mct-table>
|
||||
|
@ -36,7 +36,7 @@ define(
|
||||
* @param telemetryFormatter
|
||||
* @constructor
|
||||
*/
|
||||
function HistoricalTableController($scope, telemetryHandler, telemetryFormatter, $timeout) {
|
||||
function HistoricalTableController($scope, telemetryHandler, telemetryFormatter, $timeout, conductor) {
|
||||
var self = this;
|
||||
|
||||
this.$timeout = $timeout;
|
||||
@ -49,7 +49,7 @@ define(
|
||||
}
|
||||
});
|
||||
|
||||
TableController.call(this, $scope, telemetryHandler, telemetryFormatter);
|
||||
TableController.call(this, $scope, telemetryHandler, telemetryFormatter, conductor);
|
||||
}
|
||||
|
||||
HistoricalTableController.prototype = Object.create(TableController.prototype);
|
||||
|
@ -89,19 +89,24 @@ define(
|
||||
$scope.$watchCollection('filters', function () {
|
||||
self.setRows($scope.rows);
|
||||
});
|
||||
$scope.$watch('headers', this.setHeaders.bind(this));
|
||||
$scope.$watch('rows', this.setRows.bind(this));
|
||||
$scope.$watch('headers', this.setHeaders);
|
||||
$scope.$watch('rows', this.setRows);
|
||||
|
||||
/*
|
||||
* Listen for rows added individually (eg. for real-time tables)
|
||||
*/
|
||||
$scope.$on('add:row', this.addRow.bind(this));
|
||||
$scope.$on('remove:row', this.removeRow.bind(this));
|
||||
$scope.$on('add:row', this.addRow);
|
||||
$scope.$on('remove:row', this.removeRow);
|
||||
|
||||
$scope.$watch('defaultSort', function (defaultSort) {
|
||||
$scope.sortColumn = defaultSort;
|
||||
$scope.sortDirection = 'asc';
|
||||
});
|
||||
|
||||
/*
|
||||
* Listen for resize events to trigger recalculation of table width
|
||||
*/
|
||||
$scope.resize = this.setElementSizes.bind(this);
|
||||
$scope.resize = this.setElementSizes;
|
||||
|
||||
// Time conductor integration
|
||||
$scope.$watch("timeColumns", function (timeColumns){
|
||||
|
@ -70,8 +70,25 @@ define(
|
||||
// Unsubscribe when the plot is destroyed
|
||||
this.$scope.$on("$destroy", this.destroy);
|
||||
this.$scope.timeColumns = [];
|
||||
|
||||
|
||||
this.sortByTimeSystem = this.sortByTimeSystem.bind(this);
|
||||
conductor.on('timeSystem', this.sortByTimeSystem);
|
||||
conductor.off('timeSystem', this.sortByTimeSystem);
|
||||
}
|
||||
|
||||
TelemetryTableController.prototype.sortByTimeSystem = function (timeSystem) {
|
||||
var scope = this.$scope;
|
||||
scope.defaultSort = undefined;
|
||||
if (timeSystem) {
|
||||
this.table.columns.forEach(function (column) {
|
||||
if (column.domainMetadata && column.domainMetadata.key === timeSystem.metadata.key) {
|
||||
scope.defaultSort = column.getTitle();
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @private
|
||||
*/
|
||||
@ -163,6 +180,11 @@ define(
|
||||
this.timeColumns.push(domainMetadata.name);
|
||||
}.bind(this));
|
||||
}.bind(this));
|
||||
|
||||
var timeSystem = this.conductor.timeSystem();
|
||||
if (timeSystem) {
|
||||
this.sortByTimeSystem(timeSystem);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -97,7 +97,8 @@ define(
|
||||
enableFilter: "=?",
|
||||
enableSort: "=?",
|
||||
autoScroll: "=?",
|
||||
timeColumns: "=?"
|
||||
timeColumns: "=?",
|
||||
defaultSort: "=?"
|
||||
}
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user