[Time Conductor] Implement default sort, fix unpredictable positioning using % left, set TOI on conductor init. #1193

This commit is contained in:
Henry 2016-10-19 16:30:26 -07:00
parent d12ae77d95
commit b56ab0aac2
10 changed files with 48 additions and 15 deletions

View File

@ -99,7 +99,7 @@ define([
"source": "generator", "source": "generator",
"domains": [ "domains": [
{ {
"key": "time", "key": "utc",
"name": "Time" "name": "Time"
}, },
{ {

View File

@ -61,7 +61,7 @@ define([
"domains": [ "domains": [
{ {
"name": "Time", "name": "Time",
"key": "timestamp", "key": "utc",
"format": "utc" "format": "utc"
} }
] ]

View File

@ -85,10 +85,9 @@
<!-- Holds data visualization, time of interest --> <!-- Holds data visualization, time of interest -->
<div class="l-data-visualization-holder l-row-elem flex-elem" <div class="l-data-visualization-holder l-row-elem flex-elem"
ng-controller="ConductorTOIController as toi" ng-controller="ConductorTOIController as toi">
ng-click="toi.click($event)">
<a class="l-page-button s-icon-button icon-pointer-left"></a> <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'" <mct-include key="'time-of-interest'"
class="l-toi-holder show-val" class="l-toi-holder show-val"
ng-class="{ pinned: toi.pinned, 'val-to-left': toi.left > 80 }" ng-class="{ pinned: toi.pinned, 'val-to-left': toi.left > 80 }"

View File

@ -45,6 +45,11 @@ define(
this.conductorViewService.on('pan', this.setOffsetFromBounds); this.conductorViewService.on('pan', this.setOffsetFromBounds);
this.conductor.on('timeSystem', this.changeTimeSystem); this.conductor.on('timeSystem', this.changeTimeSystem);
var timeOfInterest = this.conductor.timeOfInterest();
if (timeOfInterest) {
this.changeTimeOfInterest(timeOfInterest);
}
$scope.$on('$destroy', this.destroy); $scope.$on('$destroy', this.destroy);
} }

View File

@ -109,12 +109,12 @@ define([
{ {
"key": "HistoricalTableController", "key": "HistoricalTableController",
"implementation": HistoricalTableController, "implementation": HistoricalTableController,
"depends": ["$scope", "telemetryHandler", "telemetryFormatter", "$timeout", "timeConductor"] "depends": ["$scope", "telemetryHandler", "telemetryFormatter", "$timeout", "timeConductor", "timeConductor"]
}, },
{ {
"key": "RealtimeTableController", "key": "RealtimeTableController",
"implementation": RealtimeTableController, "implementation": RealtimeTableController,
"depends": ["$scope", "telemetryHandler", "telemetryFormatter"] "depends": ["$scope", "telemetryHandler", "telemetryFormatter", "timeConductor"]
}, },
{ {
"key": "TableOptionsController", "key": "TableOptionsController",

View File

@ -6,6 +6,7 @@
rows="rows" rows="rows"
enableFilter="true" enableFilter="true"
enableSort="true" enableSort="true"
default-sort="defaultSort"
on-row-click="tableController.onRowClick(event, rowIndex, sortColumn, sortDirection)" on-row-click="tableController.onRowClick(event, rowIndex, sortColumn, sortDirection)"
class="tabular-holder has-control-bar"> class="tabular-holder has-control-bar">
</mct-table> </mct-table>

View File

@ -36,7 +36,7 @@ define(
* @param telemetryFormatter * @param telemetryFormatter
* @constructor * @constructor
*/ */
function HistoricalTableController($scope, telemetryHandler, telemetryFormatter, $timeout) { function HistoricalTableController($scope, telemetryHandler, telemetryFormatter, $timeout, conductor) {
var self = this; var self = this;
this.$timeout = $timeout; 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); HistoricalTableController.prototype = Object.create(TableController.prototype);

View File

@ -89,19 +89,24 @@ define(
$scope.$watchCollection('filters', function () { $scope.$watchCollection('filters', function () {
self.setRows($scope.rows); self.setRows($scope.rows);
}); });
$scope.$watch('headers', this.setHeaders.bind(this)); $scope.$watch('headers', this.setHeaders);
$scope.$watch('rows', this.setRows.bind(this)); $scope.$watch('rows', this.setRows);
/* /*
* Listen for rows added individually (eg. for real-time tables) * Listen for rows added individually (eg. for real-time tables)
*/ */
$scope.$on('add:row', this.addRow.bind(this)); $scope.$on('add:row', this.addRow);
$scope.$on('remove:row', this.removeRow.bind(this)); $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 * Listen for resize events to trigger recalculation of table width
*/ */
$scope.resize = this.setElementSizes.bind(this); $scope.resize = this.setElementSizes;
// Time conductor integration // Time conductor integration
$scope.$watch("timeColumns", function (timeColumns){ $scope.$watch("timeColumns", function (timeColumns){

View File

@ -70,8 +70,25 @@ define(
// Unsubscribe when the plot is destroyed // Unsubscribe when the plot is destroyed
this.$scope.$on("$destroy", this.destroy); this.$scope.$on("$destroy", this.destroy);
this.$scope.timeColumns = []; 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 * @private
*/ */
@ -163,6 +180,11 @@ define(
this.timeColumns.push(domainMetadata.name); this.timeColumns.push(domainMetadata.name);
}.bind(this)); }.bind(this));
}.bind(this)); }.bind(this));
var timeSystem = this.conductor.timeSystem();
if (timeSystem) {
this.sortByTimeSystem(timeSystem);
}
}; };
/** /**

View File

@ -97,7 +97,8 @@ define(
enableFilter: "=?", enableFilter: "=?",
enableSort: "=?", enableSort: "=?",
autoScroll: "=?", autoScroll: "=?",
timeColumns: "=?" timeColumns: "=?",
defaultSort: "=?"
} }
}; };
} }