pull-requests: simplified the UI for pr view.

- hide some information we don't need all the time
- style the UI similar to upcomming UI overhaul of PRs
- less info == more readability
This commit is contained in:
Marcin Kuzminski 2019-12-13 12:10:10 +01:00
parent 7a7c9bd805
commit 241db30193
5 changed files with 553 additions and 467 deletions

View file

@ -101,12 +101,11 @@ class TestPullrequestsView(object):
for commit_id in pull_request.revisions: for commit_id in pull_request.revisions:
response.mustcontain(commit_id) response.mustcontain(commit_id)
assert pull_request.target_ref_parts.type in response response.mustcontain(pull_request.target_ref_parts.type)
assert pull_request.target_ref_parts.name in response response.mustcontain(pull_request.target_ref_parts.name)
target_clone_url = pull_request.target_repo.clone_url()
assert target_clone_url in response response.mustcontain('class="pull-request-merge"')
assert 'class="pull-request-merge"' in response
if pr_merge_enabled: if pr_merge_enabled:
response.mustcontain('Pull request reviewer approval is pending') response.mustcontain('Pull request reviewer approval is pending')
else: else:
@ -536,9 +535,9 @@ class TestPullrequestsView(object):
# Check generated diff contents # Check generated diff contents
response = response.follow() response = response.follow()
assert 'content_of_ancestor' not in response.body response.mustcontain(no=['content_of_ancestor'])
assert 'content_of_ancestor-child' not in response.body response.mustcontain(no=['content_of_ancestor-child'])
assert 'content_of_change' in response.body response.mustcontain('content_of_change')
def test_merge_pull_request_enabled(self, pr_util, csrf_token): def test_merge_pull_request_enabled(self, pr_util, csrf_token):
# Clear any previous calls to rcextensions # Clear any previous calls to rcextensions
@ -689,8 +688,8 @@ class TestPullrequestsView(object):
pull_request_id=pull_request.pull_request_id)) pull_request_id=pull_request.pull_request_id))
assert response.status_int == 200 assert response.status_int == 200
assert 'Pull request updated to' in response.body response.mustcontain('Pull request updated to')
assert 'with 1 added, 0 removed commits.' in response.body response.mustcontain('with 1 added, 0 removed commits.')
# check that we have now both revisions # check that we have now both revisions
pull_request = PullRequest.get(pull_request_id) pull_request = PullRequest.get(pull_request_id)
@ -752,8 +751,8 @@ class TestPullrequestsView(object):
repo_name=target.repo_name, repo_name=target.repo_name,
pull_request_id=pull_request.pull_request_id)) pull_request_id=pull_request.pull_request_id))
assert response.status_int == 200 assert response.status_int == 200
assert 'Pull request updated to' in response.body response.mustcontain('Pull request updated to')
assert 'with 1 added, 1 removed commits.' in response.body response.mustcontain('with 1 added, 1 removed commits.')
def test_update_target_revision_with_removal_of_1_commit_git(self, backend_git, csrf_token): def test_update_target_revision_with_removal_of_1_commit_git(self, backend_git, csrf_token):
backend = backend_git backend = backend_git
@ -994,12 +993,13 @@ class TestPullrequestsView(object):
pull_request_id=pull_request.pull_request_id)) pull_request_id=pull_request.pull_request_id))
assert response.status_int == 200 assert response.status_int == 200
origin = response.assert_response().get_element('.pr-origininfo .tag') source = response.assert_response().get_element('.pr-source-info')
origin_children = origin.getchildren() source_parent = source.getparent()
assert len(origin_children) == 1 assert len(source_parent) == 1
target = response.assert_response().get_element('.pr-targetinfo .tag')
target_children = target.getchildren() target = response.assert_response().get_element('.pr-target-info')
assert len(target_children) == 1 target_parent = target.getparent()
assert len(target_parent) == 1
expected_origin_link = route_path( expected_origin_link = route_path(
'repo_commits', 'repo_commits',
@ -1009,10 +1009,8 @@ class TestPullrequestsView(object):
'repo_commits', 'repo_commits',
repo_name=pull_request.target_repo.scm_instance().name, repo_name=pull_request.target_repo.scm_instance().name,
params=dict(branch='target')) params=dict(branch='target'))
assert origin_children[0].attrib['href'] == expected_origin_link assert source_parent.attrib['href'] == expected_origin_link
assert origin_children[0].text == 'branch: origin' assert target_parent.attrib['href'] == expected_target_link
assert target_children[0].attrib['href'] == expected_target_link
assert target_children[0].text == 'branch: target'
def test_bookmark_is_not_a_link(self, pr_util): def test_bookmark_is_not_a_link(self, pr_util):
pull_request = pr_util.create_pull_request() pull_request = pr_util.create_pull_request()
@ -1027,13 +1025,13 @@ class TestPullrequestsView(object):
pull_request_id=pull_request.pull_request_id)) pull_request_id=pull_request.pull_request_id))
assert response.status_int == 200 assert response.status_int == 200
origin = response.assert_response().get_element('.pr-origininfo .tag') source = response.assert_response().get_element('.pr-source-info')
assert origin.text.strip() == 'bookmark: origin' assert source.text.strip() == 'bookmark:origin'
assert origin.getchildren() == [] assert source.getparent().attrib.get('href') is None
target = response.assert_response().get_element('.pr-targetinfo .tag') target = response.assert_response().get_element('.pr-target-info')
assert target.text.strip() == 'bookmark: target' assert target.text.strip() == 'bookmark:target'
assert target.getchildren() == [] assert target.getparent().attrib.get('href') is None
def test_tag_is_not_a_link(self, pr_util): def test_tag_is_not_a_link(self, pr_util):
pull_request = pr_util.create_pull_request() pull_request = pr_util.create_pull_request()
@ -1048,13 +1046,13 @@ class TestPullrequestsView(object):
pull_request_id=pull_request.pull_request_id)) pull_request_id=pull_request.pull_request_id))
assert response.status_int == 200 assert response.status_int == 200
origin = response.assert_response().get_element('.pr-origininfo .tag') source = response.assert_response().get_element('.pr-source-info')
assert origin.text.strip() == 'tag: origin' assert source.text.strip() == 'tag:origin'
assert origin.getchildren() == [] assert source.getparent().attrib.get('href') is None
target = response.assert_response().get_element('.pr-targetinfo .tag') target = response.assert_response().get_element('.pr-target-info')
assert target.text.strip() == 'tag: target' assert target.text.strip() == 'tag:target'
assert target.getchildren() == [] assert target.getparent().attrib.get('href') is None
@pytest.mark.parametrize('mergeable', [True, False]) @pytest.mark.parametrize('mergeable', [True, False])
def test_shadow_repository_link( def test_shadow_repository_link(

View file

@ -726,7 +726,7 @@ import tzlocal
local_timezone = tzlocal.get_localzone() local_timezone = tzlocal.get_localzone()
def age_component(datetime_iso, value=None, time_is_local=False): def age_component(datetime_iso, value=None, time_is_local=False, tooltip=True):
title = value or format_date(datetime_iso) title = value or format_date(datetime_iso)
tzinfo = '+00:00' tzinfo = '+00:00'
@ -740,9 +740,11 @@ def age_component(datetime_iso, value=None, time_is_local=False):
tzinfo = '{}:{}'.format(offset[:-2], offset[-2:]) tzinfo = '{}:{}'.format(offset[:-2], offset[-2:])
return literal( return literal(
'<time class="timeago tooltip" ' '<time class="timeago {cls}" title="{tt_title}" datetime="{dt}{tzinfo}">{title}</time>'.format(
'title="{1}{2}" datetime="{0}{2}">{1}</time>'.format( cls='tooltip' if tooltip else '',
datetime_iso, title, tzinfo)) tt_title=('{title}{tzinfo}'.format(title=title, tzinfo=tzinfo)) if tooltip else '',
title=title, dt=datetime_iso, tzinfo=tzinfo
))
def _shorten_commit_id(commit_id, commit_len=None): def _shorten_commit_id(commit_id, commit_len=None):

View file

@ -379,8 +379,9 @@ ul.auth_plugins {
font-family: @text-bold; font-family: @text-bold;
} }
.pr-origininfo, .pr-targetinfo { .pr-commit-flow {
position: relative; position: relative;
font-weight: 600;
.tag { .tag {
display: inline-block; display: inline-block;
@ -413,7 +414,6 @@ ul.auth_plugins {
padding: 0 0; padding: 0 0;
} }
.pr-title-input { .pr-title-input {
width: 80%; width: 80%;
font-size: 1em; font-size: 1em;
@ -438,6 +438,19 @@ ul.auth_plugins {
} }
} }
.pr-title-closed-tag {
font-size: 16px;
}
#pr-desc {
padding: 10px 0;
.markdown-block {
padding: 0;
margin-bottom: -30px;
}
}
#pullrequest_title { #pullrequest_title {
width: 100%; width: 100%;
box-sizing: border-box; box-sizing: border-box;
@ -451,6 +464,31 @@ ul.auth_plugins {
overflow: hidden; overflow: hidden;
} }
.pr-details-title {
height: 16px
}
.pr-details-title-author-pref {
padding-right: 10px
}
.label-pr-detail {
display: table-cell;
width: 120px;
padding-top: 7.5px;
padding-bottom: 7.5px;
padding-right: 7.5px;
}
.source-details ul {
padding: 10px 16px;
}
.source-details-action {
color: @grey4;
font-size: 11px
}
.pr-submit-button { .pr-submit-button {
float: right; float: right;
margin: 0 0 0 5px; margin: 0 0 0 5px;
@ -469,6 +507,15 @@ ul.auth_plugins {
vertical-align: top; vertical-align: top;
} }
#close_edit_pullrequest {
padding-left: 1em
}
#delete_pullrequest {
clear: inherit;
padding: 0
}
.perms_section_head { .perms_section_head {
min-width: 625px; min-width: 625px;
@ -1880,9 +1927,10 @@ BIN_FILENODE = 7
.pr-versions { .pr-versions {
font-size: 1.1em; font-size: 1.1em;
padding: 7.5px;
table { table {
padding: 0px 5px;
} }
td { td {

View file

@ -557,6 +557,21 @@ VersionController = function () {
$(elem).html($(elem).data('toggleOff')) $(elem).html($(elem).data('toggleOff'))
} }
return false
};
this.toggleElement = function (elem, target) {
var $elem = $(elem);
var $target = $(target);
if ($target.is(':visible')) {
$target.hide();
$elem.html($elem.data('toggleOn'))
} else {
$target.show();
$elem.html($elem.data('toggleOff'))
}
return false return false
} }

File diff suppressed because it is too large Load diff