Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests sorting #525

Merged
merged 18 commits into from
Aug 6, 2020
Prev Previous commit
Next Next commit
Add functional sorting in webapp (to be refactored and styled)
  • Loading branch information
wojciech.blachowski committed Sep 24, 2019
commit 88edad04d1b1f58c53037c9918ab57f4056b19cd
19 changes: 16 additions & 3 deletions report/src/main/webapp/app/layout/sidepanel/sidepanel.view.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,11 @@
</div>
</div>
</div>
<div class="form-group">
<div data-aet-sidepanel-order data-toggle="popover">
<!--
Ordering
-->
<div class="form-group" style="position: static">
<div style="position: relative; width: calc(100% - 26px - 8px);float:left;" data-aet-sidepanel-order data-toggle="popover">
<div class="filter-list">
<div>
<p ng-bind="$root.orderLabel"></p>
Expand All @@ -115,6 +118,16 @@
</form>
</div>
</div>
<div style="width:26px; height:12px; color:white;float:right;">
<div class="fontawesome" style="position:static;cursor: pointer" ng-click="changeSortingOrder()">
<div ng-if="$root.isReverse">
<i class="fas fa-lg fa-sort-amount-down"></i>
</div>
<div ng-if="!$root.isReverse">
<i class="fas fa-lg fa-sort-amount-up"></i>
</div>
</div>
</div>
</div>
</div>

Expand Down Expand Up @@ -146,7 +159,7 @@
</div>

<div class="aside-report-container" ng-class="sidepanel.thereAreChangesToSave() ? 'aside-report-container_short' : ''">
<div ng-repeat="test in sidepanel.tests | orderBy:$root.order"
<div ng-repeat="test in sidepanel.tests | orderBy:$root.order:$root.isReverse"
class="aside-report {{filteredUrls.length > 0 ? 'is-visible' : 'is-hidden'}}">
<a ui-sref="test({'suite':$root.params.project, 'test':test.name})" ui-sref-active="is-active"
class="test-name {{filteredUrls.length > 0 ? 'is-visible' : 'is-hidden'}}" aet-toggle-link
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ define(['angularAMD'], function (angularAMD) {
function SidepanelOrderDirective($rootScope, $timeout) {
return {
restrict: 'AE',
link: init
link: init,
controller: function ($scope) {
$scope.changeSortingOrder = changeSortingOrder;
}
};

function init(scope, $element) {
Expand All @@ -50,8 +53,14 @@ define(['angularAMD'], function (angularAMD) {
function updateOrdering(orderingAttribute, labelText){
$timeout(function() {
$rootScope.order = orderingAttribute;
$rootScope.isReverse = false;
$rootScope.orderLabel = labelText;
$rootScope.$apply();
});
}

function changeSortingOrder(event) {
$timeout(function() {
$rootScope.isReverse = !$rootScope.isReverse;
});
}
}
Expand Down