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
Next Next commit
Add prototype changes
  • Loading branch information
wojciech.blachowski committed Aug 14, 2019
commit db196a46180cb513eb12c4db91aa61e56ceac2db
1 change: 1 addition & 0 deletions report/src/main/webapp/app/app.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ require.config({
//sidepanel
'sidepanelDirective': 'layout/sidepanel/sidepanel.directive',
'sidepanelStatusFilterDirective': 'layout/sidepanel/sidepanelStatusFilter.directive',
'sidepanelOrderDirective': 'layout/sidepanel/sidepanelOrder.directive',
'sidepanelSearchDirective': 'layout/sidepanel/sidepanelSearch.directive',
'sidepanelToggleLinkDirective': 'layout/sidepanel/toggleLink.directive',
'sidepanelSaveChangesDirective': 'layout/sidepanel/saveChanges.directive',
Expand Down
1 change: 1 addition & 0 deletions report/src/main/webapp/app/app.module.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ define(['angularAMD',
// sidepanel
'sidepanelDirective',
'sidepanelStatusFilterDirective',
'sidepanelOrderDirective',
'sidepanelSearchDirective',
'sidepanelToggleLinkDirective',
'sidepanelSaveChangesDirective',
Expand Down
11 changes: 7 additions & 4 deletions report/src/main/webapp/app/components/hidePopovers.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,13 @@ define(['angularAMD'], function (angularAMD) {
restrict: 'A',
link: function (scope, $element) {
$element.on('click', function (e) {
if (!$(e.target).parents().hasClass('pop') && !$(
e.target).parents().hasClass('popover')) {
$('[data-toggle="popover"], .pop').popover('hide');
}
$('[data-toggle="popover"]').each(function () {
//the 'is' for buttons that trigger popups
//the 'has' for icons within a button that triggers a popup
if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) {
(($(this).popover('hide').data('bs.popover')||{}).inState||{}).click = false
}
});
});
}
};
Expand Down
2 changes: 1 addition & 1 deletion report/src/main/webapp/app/components/testSearch.filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ define(['angularAMD'], function (angularAMD) {
}

function matches(searchPhrase, name) {
return name && name.includes(searchPhrase);
return name && name.indexOf(searchPhrase) > 0;
}
}
});
22 changes: 21 additions & 1 deletion report/src/main/webapp/app/layout/sidepanel/sidepanel.view.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,26 @@
</div>
</div>
</div>
<div class="form-group">
<div data-aet-sidepanel-order data-toggle="popover">
<div class="filter-list">
<div class="filter-list-title">
<p ng-bind="$root.orderLabel"></p>
<div class="fontawesome">
<i class="fas fa-angle-down fa-lg"></i>
</div>
</div>
<form class="dropdown-menu">
<div class="dropdown-field">
<button data-ordering-attribute="name" class="dropdown-item">Order by name</button>
</div>
<div class="dropdown-field">
<button data-ordering-attribute="+" class="dropdown-item">Order by suite ordering</button>
</div>
</form>
</div>
</div>
</div>
</div>

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

<div class="aside-report-container" ng-class="sidepanel.thereAreChangesToSave() ? 'aside-report-container_short' : ''">
<div ng-repeat="test in sidepanel.tests | orderBy:'name'"
<div ng-repeat="test in sidepanel.tests | orderBy:$root.order"
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
@@ -0,0 +1,58 @@
/*
* AET
*
* Copyright (C) 2013 Cognifide Limited
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
define(['angularAMD'], function (angularAMD) {
'use strict';
angularAMD.directive('aetSidepanelOrder',
['$rootScope', '$timeout', SidepanelOrderDirective]);

function SidepanelOrderDirective($rootScope, $timeout) {
return {
restrict: 'AE',
link: init
};

function init(scope, $element) {
updateOrdering('name', 'Order by name');
$element.popover({
placement: 'bottom',
trigger: 'click',
content: function () {
return $element.find('.dropdown-menu').html();
},
html: true
}).parent().on('click', 'button', function (event) {
onOrderSelected(event, $element)
});
}

function onOrderSelected(event, $element) {
(($element.popover('hide').data('bs.popover')||{}).inState||{}).click = false;
var orderingAttribute = $(event.target).data("ordering-attribute");
var label = $(event.target).text();
updateOrdering(orderingAttribute, label);
}

function updateOrdering(orderingAttribute, labelText){
$timeout(function() {
$rootScope.order = orderingAttribute;
$rootScope.orderLabel = labelText;
$rootScope.$apply();
});
}
}
});
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ define(['angularAMD'], function (angularAMD) {
return {
getEndpoint: function () {
var config = {
'getUrl': '/api/'
//'getUrl': 'http://aet-vagrant/api/'
//'getUrl': '/api/'
'getUrl': 'http://aet-vagrant/api/'
};
return config;
}
Expand Down
10 changes: 9 additions & 1 deletion report/src/main/webapp/assets/sass/_filters.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
}

input,
.filter-list {
.filter-list, select {
background-color: $grayish;
border: 0 none;
color: $white;
Expand Down Expand Up @@ -106,6 +106,14 @@
color: $text-color;
display: inline;
}

button{
background: transparent;
border: none;
width: 100%;
height: 100%;
text-align: left;
}
}
}
}
Expand Down