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

Add possibility to scroll side panel to currently opened test/url #221

Merged
merged 7 commits into from
Feb 15, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,20 @@ define([], function () {
vm.showAcceptButton = patternsMayBeUpdated;
vm.showRevertButton = patternsMarkedForUpdateMayBeReverted;
vm.displayCommentModal = displayCommentModal;
vm.scrollSidepanel = scrollSidepanel;

$rootScope.$on('metadata:changed', updateToolbar);
$scope.$watch('viewMode', function() {
setTimeout(function() {
$('[data-toggle="popover"]').not('.pre-initialized-popover').popover({
placement: 'bottom'
});
}, 0);
});

$('[data-toggle="popover"]').popover({
placement: 'bottom'
});
}).addClass('pre-initialized-popover');

updateToolbar();

Expand Down Expand Up @@ -110,6 +119,20 @@ define([], function () {
});
}

function scrollSidepanel(findParentGroup) {
var element = $('a.test-name.is-active, a.test-url.is-active');
var reportGroup;

if (findParentGroup) {
reportGroup = element.closest('.aside-report.is-visible');
element = reportGroup.find('.test-name');
element.click();
reportGroup.addClass('is-expanded');
}

element[0].scrollIntoView({behavior: 'smooth', block: 'center', inline: 'nearest'});
}

/***************************************
*********** SUITE VIEW PART *********
***************************************/
Expand Down Expand Up @@ -141,8 +164,11 @@ define([], function () {
*********** URL VIEW PART *********
***************************************/
function setupUrlToolbarModel() {
var testName = $stateParams.test;

vm.model = metadataAccessService.getUrl($stateParams.test,
$stateParams.url);
vm.model.testGroupName = metadataAccessService.getTest(testName).name;
vm.updatePatterns = function () {
patternsService.updateUrl($stateParams.test, $stateParams.url, true);
};
Expand Down
30 changes: 23 additions & 7 deletions report/src/main/webapp/app/layout/toolbar/toolbarBottom.view.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,31 @@
<div class="toolbar-bottom">
<div class="toolbar-link">
<h4 class="toolbar-link-header ellipsis">
<span class="preformatted">{{toolbarBottom.viewMode}}:</span>
<span ng-if="toolbarBottom.viewMode != 'url'">{{toolbarBottom.model.name}}</span>
<a ng-if="toolbarBottom.viewMode == 'url'"
href="{{toolbarBottom.model.domain + toolbarBottom.model.url}}" target="_blank"
<i class="glyphicon glyphicon-screenshot"
data-toggle="popover"
data-content="Localize the currently opened url on side panel"
data-trigger="hover"
data-container="body"
data-ng-click="toolbarBottom.scrollSidepanel(false)"></i>
<span class="preformatted">{{toolbarBottom.viewMode}}:</span>
<span ng-if="toolbarBottom.viewMode != 'url'">{{toolbarBottom.model.name}}</span>
<a ng-if="toolbarBottom.viewMode == 'url'"
href="{{toolbarBottom.model.domain + toolbarBottom.model.url}}" target="_blank"
data-toggle="popover"
data-content="Click to open: {{toolbarBottom.model.domain + toolbarBottom.model.url}}"
data-trigger="hover"
data-container="body">{{toolbarBottom.model.name}}</a>
</h4>
<h5 ng-if="toolbarBottom.viewMode == 'url'">
<i class="glyphicon glyphicon-screenshot"
data-toggle="popover"
data-content="Click to open: {{toolbarBottom.model.domain + toolbarBottom.model.url}}"
data-content="Localize the test group of the currently opened url on side panel"
data-trigger="hover"
data-container="body">{{toolbarBottom.model.name}}</a>
</h4>
data-container="body"
data-ng-click="toolbarBottom.scrollSidepanel(true)"></i>
</i>
<span class="preformatted">test:</span><span>{{toolbarBottom.model.testGroupName}}</span>
</h5>
</div>
<div class="toolbar-blocks">
<div class="toolbar-btns is-absolute">
Expand Down
35 changes: 32 additions & 3 deletions report/src/main/webapp/assets/sass/_toolbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,16 @@
padding: 0 20px;
background: $white;

h4 {
font-size: 24px;
h4, h5 {
font-weight: normal;
color: $gray_darker;
padding-right: 20px;
line-height: 54px;

.glyphicon-screenshot {
position: relative;
cursor: pointer;
}

a {
color: $gray_darker;

Expand All @@ -113,6 +117,31 @@
}
}
}

h4 {
font-size: 24px;
line-height: 54px;

.glyphicon-screenshot {
top: 4px;
}

&:not(:last-child) {
margin-bottom: 0;
}
}

h5 {
margin-top: 0;
margin-bottom: 26px;
padding-left: 4px;
font-size: 16px;
line-height: 18px;

.glyphicon-screenshot {
top: 3px;
}
}
}

&-nav {
Expand Down