Tweak gr-thread-list
- Styling changes - Removes path logic as it was moved to gr-diff-comment-thread Change-Id: Iee3bcb09d163e532fce72a6065b94f45e64c13db
This commit is contained in:
@@ -17,13 +17,36 @@ limitations under the License.
|
||||
<link rel="import" href="../../../bower_components/polymer/polymer.html">
|
||||
<link rel="import" href="../../../bower_components/paper-toggle-button/paper-toggle-button.html">
|
||||
<link rel="import" href="../../../styles/shared-styles.html">
|
||||
<link rel="import" href="../../core/gr-navigation/gr-navigation.html">
|
||||
<link rel="import" href="../../diff/gr-diff-comment-thread/gr-diff-comment-thread.html">
|
||||
|
||||
|
||||
<dom-module id="gr-thread-list">
|
||||
<template>
|
||||
<style include="shared-styles">
|
||||
#threads {
|
||||
display: block;
|
||||
min-height: 20rem;
|
||||
padding: 1rem;
|
||||
}
|
||||
gr-diff-comment-thread {
|
||||
display: block;
|
||||
margin-bottom: .5rem;
|
||||
max-width: 80ch;
|
||||
}
|
||||
.header {
|
||||
align-items: center;
|
||||
background-color: #fafafa;
|
||||
border-bottom: 1px solid #ddd;
|
||||
border-top: 1px solid #ddd;
|
||||
display: flex;
|
||||
justify-content: left;
|
||||
min-height: 3.2em;
|
||||
padding: .5em var(--default-horizontal-margin);
|
||||
}
|
||||
.toggleItem {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
margin-right: 1rem;
|
||||
}
|
||||
.draftsOnly gr-diff-comment-thread,
|
||||
.unresolvedOnly gr-diff-comment-thread {
|
||||
display: none
|
||||
@@ -34,22 +57,34 @@ limitations under the License.
|
||||
display: block
|
||||
}
|
||||
</style>
|
||||
<div id="threads">
|
||||
<div>
|
||||
<div class="header">
|
||||
<div class="toggleItem">
|
||||
<paper-toggle-button
|
||||
id="unresolvedToggle"
|
||||
on-change="_toggleUnresolved"></paper-toggle-button>Only Unresolved threads
|
||||
on-change="_toggleUnresolved"></paper-toggle-button>
|
||||
Only Unresolved threads</div>
|
||||
<div class="toggleItem">
|
||||
<paper-toggle-button
|
||||
id="draftToggle"
|
||||
on-change="_toggleDrafts"></paper-toggle-button>Only threads with drafts
|
||||
</div>
|
||||
on-change="_toggleDrafts"></paper-toggle-button>
|
||||
Only threads with drafts</div>
|
||||
</div>
|
||||
<div id="threads">
|
||||
<template is="dom-if" if="[[!threads.length]]">
|
||||
There are no inline comment threads on any diff for this change.
|
||||
</template>
|
||||
<template is="dom-repeat" items="[[threads]]" as="thread">
|
||||
<a href$="[[_getDiffUrlForComment(change, thread.path, thread.patchNum, thread.line)]]">[[thread.path]]</a>
|
||||
<gr-diff-comment-thread
|
||||
comments="[[thread.comments]]"
|
||||
comment-side="[[thread.commentSide]]"
|
||||
patch-num="[[thread.patchNum]]"
|
||||
path="[[thread.path]]"></gr-diff-comment-thread>
|
||||
<gr-diff-comment-thread
|
||||
show-file-path
|
||||
change-num="[[changeNum]]"
|
||||
comments="[[thread.comments]]"
|
||||
comment-side="[[thread.commentSide]]"
|
||||
project-name="[[change.project]]"
|
||||
is-on-parent="[[_isOnParent(thread.commentSide)]]"
|
||||
line-num="[[thread.line]]"
|
||||
patch-num="[[thread.patchNum]]"
|
||||
path="[[thread.path]]"
|
||||
root-id="[[thread.rootId]]"></gr-diff-comment-thread>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -21,6 +21,14 @@
|
||||
change: Object,
|
||||
threads: Array,
|
||||
changeNum: String,
|
||||
ignoreChanges: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
},
|
||||
},
|
||||
|
||||
_isOnParent(side) {
|
||||
return !!side;
|
||||
},
|
||||
|
||||
_toggleUnresolved() {
|
||||
@@ -30,9 +38,5 @@
|
||||
_toggleDrafts() {
|
||||
this.$.threads.classList.toggle('draftsOnly');
|
||||
},
|
||||
|
||||
_getDiffUrlForComment(change, path, patchNum, lineNum) {
|
||||
return Gerrit.Nav.getUrlForDiff(change, path, patchNum, null, lineNum);
|
||||
},
|
||||
});
|
||||
})();
|
||||
|
||||
@@ -165,16 +165,5 @@ limitations under the License.
|
||||
flushAsynchronousOperations();
|
||||
assert.equal(computeVisibleNumber(threadsElements), 1);
|
||||
});
|
||||
|
||||
test('_getDiffUrlForComment', () => {
|
||||
sandbox.stub(Gerrit.Nav, 'getUrlForDiff');
|
||||
const change = {_number: 123, project: 'demo-project'};
|
||||
const path = '/path';
|
||||
const patchNum = 2;
|
||||
const lineNum = 5;
|
||||
element._getDiffUrlForComment(change, path, patchNum, lineNum);
|
||||
assert.isTrue(Gerrit.Nav.getUrlForDiff.lastCall.calledWithExactly(
|
||||
change, path, patchNum, null, lineNum));
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user