Kouhei Sutou
null+****@clear*****
Sun Jan 4 18:24:39 JST 2015
Kouhei Sutou 2015-01-04 18:24:39 +0900 (Sun, 04 Jan 2015) New Revision: f49919b9b14566bdcd84e5717eb647923081cd3a https://github.com/groonga/groonga-admin/commit/f49919b9b14566bdcd84e5717eb647923081cd3a Message: table search: reflect unit change Modified files: app/scripts/controllers/table-search-controller.js app/views/tables/search.html Modified: app/scripts/controllers/table-search-controller.js (+14 -7) =================================================================== --- app/scripts/controllers/table-search-controller.js 2015-01-04 15:38:43 +0900 (f0cbf72) +++ app/scripts/controllers/table-search-controller.js 2015-01-04 18:24:39 +0900 (2d125c2) @@ -327,20 +327,23 @@ angular.module('groongaAdminApp') }, syncToRange: function() { this.unit = TimeUnit.findByDateRange(this.start, this.end); - if (this.start && this.end) { + this.updateRangeByDateRange(this.start, this.end); + }, + updateRangeByDateRange: function(start, end) { + if (start && end) { this.range = [ - this.unit.dateToPercent(this.start) * 100, - this.unit.dateToPercent(this.end) * 100 + this.unit.dateToPercent(start) * 100, + this.unit.dateToPercent(end) * 100 ]; - } else if (this.start) { + } else if (start) { this.range = [ - this.unit.dateToPercent(this.start) * 100, + this.unit.dateToPercent(start) * 100, 100 ]; - } else if (this.end) { + } else if (end) { this.range = [ 0, - this.unit.dateToPercent(this.end) * 100 + this.unit.dateToPercent(end) * 100 ]; } else { this.range = [0, 0]; @@ -349,6 +352,10 @@ angular.module('groongaAdminApp') formater: function(value) { var date = timeColumnInfo.unit.percentToDate(value / 100); return date.toLocaleString(); + }, + onUnitChanged: function() { + timeColumnInfo.updateRangeByDateRange(timeColumnInfo.start, + timeColumnInfo.end); } }; $scope.table.timeColumns.push(timeColumnInfo); Modified: app/views/tables/search.html (+2 -1) =================================================================== --- app/views/tables/search.html 2015-01-04 15:38:43 +0900 (8b41988) +++ app/views/tables/search.html 2015-01-04 18:24:39 +0900 (a648331) @@ -119,7 +119,8 @@ tooltip="always" tooltipsplit="true"></slider> <select ng-options="unit.label for unit in orderedTimeColumnUnits" - ng-model="timeColumn.unit"></select> + ng-model="timeColumn.unit" + ng-change="timeColumn.onUnitChanged()"></select> </div> </div> </form> -------------- next part -------------- HTML����������������������������...Download