Bugs table factored in a single partial template.

This commit is contained in:
Kevin Gaudin 2013-05-12 23:37:39 +02:00
parent daa40c96c7
commit 060700e500
7 changed files with 69 additions and 72 deletions

View File

@ -23,38 +23,9 @@
<span ng-show="hideSolvedBugs">Show solved bugs</span> <span ng-show="hideSolvedBugs">Show solved bugs</span>
</button> </button>
<div class="loader" ng-show="loading"><img src="img/loader.gif"/></div> <div class="loader" ng-show="loading"><img src="img/loader.gif"/></div>
<div ng-hide="loading" id="bugs-list" class="div-table table table-condensed">
<div class="div-table-row"> <ng-include src="'partials/bugs-table.html'"></ng-include>
<div class="div-table-cell"></div>
<div class="div-table-cell"><i class="icon-time"></i></div>
<div class="div-table-cell"><i class="icon-th-list"></i></div>
<div class="div-table-cell"><i class="icon-gift"></i></div>
<div class="div-table-cell exceptions"><i class="icon-fire"></i></div>
</div>
<div class="div-table-row"
ng-repeat="bug in pageItems()"
ng-animate="{ enter: 'example-repeat-enter',
leave: 'example-repeat-leave',
move: 'example-repeat-move'}">
<div class="div-table-cell">
<a ng-click="toggleSolved(bug)">
<span title="Unsolved bug" ng-hide="bug.value.solved"><i class="icon-bug-unsolved"></i></span>
<span title="Solved bug" ng-show="bug.value.solved"><i class="icon-bug-solved"></i></span>
</a>
<a ng-click="displayBugDetails(bug)">
<i class="icon-search" ng-hide="bug.id == selectedBug.id" title="Display details"></i>
<i class="icon-asterisk" ng-show="bug.id == selectedBug.id" title="Current selection"></i>
</a>
</div>
<div title="Latest report" class="div-table-cell label label-info">{{bug.latest}}</div>
<div title="Number of reports" class="div-table-cell label">{{bug.value.count}}</div>
<div title="Application version code" class="div-table-cell label label-warning">{{bug.key[0]}}</div>
<div class="div-table-cell exceptions">
<span title="Exception" class="label label-important">{{bug.key[1]}}</span><br/>
<span title="Root exception" class="label label-inverse" ng-show="bug.key[2]">Caused by: {{bug.key[2]}}</span>
</div>
</div>
</div>
<span paginator items="bugsList | filter:shouldBeDisplayed | orderBy:'value.latest':true" pageSize="bugsCount"></span> <span paginator items="bugsList | filter:shouldBeDisplayed | orderBy:'value.latest':true" pageSize="bugsCount"></span>
<bug-details bug="selectedBug" acralyzer="acralyzer"></bug-details> <bug-details bug="selectedBug" acralyzer="acralyzer"></bug-details>
</div> </div>

View File

@ -0,0 +1,32 @@
<div ng-hide="loading" class="div-table table table-condensed">
<div class="div-table-row">
<div class="div-table-cell"></div>
<div class="div-table-cell"><i class="icon-time"></i></div>
<div class="div-table-cell"><i class="icon-th-list"></i></div>
<div class="div-table-cell"><i class="icon-gift"></i></div>
<div class="div-table-cell exceptions"><i class="icon-fire"></i></div>
</div>
<div class="div-table-row"
ng-repeat="bug in pageItems()"
ng-animate="{ enter: 'example-repeat-enter',
leave: 'example-repeat-leave',
move: 'example-repeat-move'}">
<div class="div-table-cell actions">
<a ng-click="displayBugDetails(bug)">
<i class="icon-search" ng-hide="bug.id == selectedBug.id" title="Display details"></i>
<i class="icon-asterisk" ng-show="bug.id == selectedBug.id" title="Current selection"></i>
</a>
<a ng-click="toggleSolved(bug)">
<span title="Unsolved bug" ng-hide="bug.value.solved"><i class="icon-bug-unsolved"></i></span>
<span title="Solved bug" ng-show="bug.value.solved"><i class="icon-bug-solved"></i></span>
</a>
</div>
<div title="Latest report" class="div-table-cell label label-info">{{bug.latest}}</div>
<div title="Number of reports" class="div-table-cell label">{{bug.value.count}}</div>
<div title="Application version code" class="div-table-cell label label-warning">{{bug.key[0]}}</div>
<div class="div-table-cell exceptions">
<span title="Exception" class="label label-important">{{bug.key[1]}}</span><br/>
<span title="Root exception" class="label label-inverse" ng-show="bug.key[2]">Caused by: {{bug.key[2]}}</span>
</div>
</div>
</div>

View File

@ -34,32 +34,9 @@
<span ng-hide="hideSolvedBugs">Hide solved bugs</span> <span ng-hide="hideSolvedBugs">Hide solved bugs</span>
<span ng-show="hideSolvedBugs">Show solved bugs</span> <span ng-show="hideSolvedBugs">Show solved bugs</span>
</button> </button>
<div id="bugs-list" class="div-table table table-condensed">
<div class="div-table-row"> <ng-include src="'partials/bugs-table.html'"></ng-include>
<div class="div-table-cell"></div>
<div class="div-table-cell"><i class="icon-time"></i></div>
<div class="div-table-cell"><i class="icon-th-list"></i></div>
<div class="div-table-cell"><i class="icon-gift"></i></div>
<div class="div-table-cell exceptions"><i class="icon-fire"></i></div>
</div>
<div class="div-table-row"
ng-repeat="bug in bugs | filter:shouldBeDisplayed | orderBy:'value.latest':true | limitTo:bugsLimit"
ng-animate="{ enter: 'example-repeat-enter',
leave: 'example-repeat-leave',
move: 'example-repeat-move'}">
<div class="div-table-cell" ng-click="toggleSolved(bug)">
<span title="Unsolved bug" ng-hide="bug.value.solved"><i class="icon-bug-unsolved"></i></span>
<span title="Solved bug" ng-show="bug.value.solved"><i class="icon-bug-solved"></i></span>
</div>
<div title="Latest report" class="div-table-cell label label-info">{{bug.latest}}</div>
<div title="Number of reports" class="div-table-cell label">{{bug.value.count}}</div>
<div title="Application version code" class="div-table-cell label label-warning">{{bug.key[0]}}</div>
<div class="div-table-cell exceptions">
<span title="Exception" class="label label-important">{{bug.key[1]}}</span><br/>
<span title="Root exception" class="label label-inverse" ng-show="bug.key[2]">Caused by: {{bug.key[2]}}</span>
</div>
</div>
</div>
</div> </div>
</pane> </pane>
</tabs> </tabs>

View File

@ -1,6 +1,6 @@
<div class="div-table" ng-hide="loading"> <div class="div-table" ng-hide="loading">
<div class="div-table-row"> <div class="div-table-row">
<div class="div-table-cell"/> <div class="div-table-cell"></div>
<div class="div-table-cell"><i class="icon-time"></i></div> <div class="div-table-cell"><i class="icon-time"></i></div>
<div class="div-table-cell"><i class="icon-gift"></i></div> <div class="div-table-cell"><i class="icon-gift"></i></div>
<div class="div-table-cell"><i class="icon-bugdroid"></i></div> <div class="div-table-cell"><i class="icon-bugdroid"></i></div>
@ -9,11 +9,11 @@
</div> </div>
<div class="div-table-row" ng-repeat="report in reports | filter:search" ng-class-odd="'odd'" ng-class-even="'even'" ng-cloak> <div class="div-table-row" ng-repeat="report in reports | filter:search" ng-class-odd="'odd'" ng-class-even="'even'" ng-cloak>
<div class="div-table-cell actions"> <div class="div-table-cell actions">
<a ng-click="loadReport(report)" class="action"> <a ng-click="loadReport(report)">
<i class="icon-search" ng-hide="report.id == selectedReport._id" title="Display details"></i> <i class="icon-search" ng-hide="report.id == selectedReport._id" title="Display details"></i>
<i class="icon-asterisk" ng-show="report.id == selectedReport._id" title="Current selection"></i> <i class="icon-asterisk" ng-show="report.id == selectedReport._id" title="Current selection"></i>
</a> </a>
<a ng-click="deleteReport(report)" class="action"> <a ng-click="deleteReport(report)">
<i class="icon-trash" title="Delete permanently"></i> <i class="icon-trash" title="Delete permanently"></i>
</a> </a>
</div> </div>

View File

@ -84,7 +84,7 @@
$scope.getData(); $scope.getData();
} }
function BugsCtrl($scope, ReportsStore) { function BugsCtrl($scope, ReportsStore, $filter) {
$scope.selectedBug = ""; $scope.selectedBug = "";
$scope.bugsLimit = 10; $scope.bugsLimit = 10;
$scope.hideSolvedBugs = true; $scope.hideSolvedBugs = true;
@ -149,6 +149,20 @@
} }
}; };
$scope.pageItems = function() {
var filtFilter = $filter("filter"); // First remove unnecessary items
var filtOrderBy = $filter("orderBy"); // Order by latest occurence
var filtLimitTo = $filter("limitTo"); // Limit to X items
return filtLimitTo(
filtOrderBy(
filtFilter(
$scope.bugs, $scope.shouldBeDisplayed
), 'value.latest', true
), $scope.bugsLimit
);
};
$scope.$on(acralyzerEvents.LOGGED_IN, $scope.getData); $scope.$on(acralyzerEvents.LOGGED_IN, $scope.getData);
$scope.$on(acralyzerEvents.APP_CHANGED, $scope.getData); $scope.$on(acralyzerEvents.APP_CHANGED, $scope.getData);
$scope.$on(acralyzerEvents.NEW_DATA, $scope.getData); $scope.$on(acralyzerEvents.NEW_DATA, $scope.getData);
@ -561,6 +575,6 @@
acralyzer.controller('PieChartsCtrl', ["$scope", "ReportsStore", "$user", PieChartsCtrl]); acralyzer.controller('PieChartsCtrl', ["$scope", "ReportsStore", "$user", PieChartsCtrl]);
acralyzer.controller('DashboardCtrl', ["$scope", "$routeParams", DashboardCtrl]); acralyzer.controller('DashboardCtrl', ["$scope", "$routeParams", DashboardCtrl]);
acralyzer.controller('CrashReportsCtrl', ["$scope", "ReportsStore", CrashReportsCtrl]); acralyzer.controller('CrashReportsCtrl', ["$scope", "ReportsStore", CrashReportsCtrl]);
acralyzer.controller('BugsCtrl', ["$scope", "ReportsStore", BugsCtrl]); acralyzer.controller('BugsCtrl', ["$scope", "ReportsStore", "$filter", BugsCtrl]);
})(window.acralyzerConfig,window.angular,window.acralyzer,window.acralyzerEvents,window.jQuery); })(window.acralyzerConfig,window.angular,window.acralyzer,window.acralyzerEvents,window.jQuery);

View File

@ -1,30 +1,33 @@
.example-repeat-enter-setup, .example-repeat-enter-setup,
.example-repeat-leave-setup, .example-repeat-leave-setup,
.example-repeat-move-setup { .example-repeat-move-setup {
-webkit-transition:all linear 0.5s; -webkit-transition:all linear 0.25s;
-moz-transition:all linear 0.5s; -moz-transition:all linear 0.25s;
-ms-transition:all linear 0.5s; -ms-transition:all linear 0.25s;
-o-transition:all linear 0.5s; -o-transition:all linear 0.25s;
transition:all linear 0.5s; transition:all linear 0.25s;
} }
.example-repeat-enter-setup { .example-repeat-enter-setup {
line-height:0; line-height:0;
opacity:0; opacity:0;
} }
.example-repeat-enter-setup.example-repeat-enter-start { .example-repeat-enter-start {
line-height:100%; line-height:100%;
opacity:1; opacity:1;
} }
.example-repeat-enter-setup.example-repeat-enter-start { }
.example-repeat-leave-setup { .example-repeat-leave-setup {
opacity:1; opacity:1;
line-height:100%; line-height:100%;
} }
.example-repeat-leave-setup.example-repeat-leave-start { .example-repeat-leave-start {
opacity:0; opacity:0;
line-height:0; line-height:0;
} }
.example-repeat-leave-setup.example-repeat-leave-start { }
.example-repeat-move-setup { } .example-repeat-move-setup { }
.example-repeat-move-setup.example-repeat-move-start { } .example-repeat-move-setup.example-repeat-move-start { }

View File

@ -177,11 +177,11 @@ table td {
background-color: #fff; background-color: #fff;
} }
.action:hover { .actions a:hover {
text-decoration: none; text-decoration: none;
} }
.action { .actions a {
cursor: pointer; cursor: pointer;
} }