Merge "Add a proper message for no threads in findings tab."

This commit is contained in:
Dhruv Srivastava
2020-02-06 13:46:02 +00:00
committed by Gerrit Code Review
3 changed files with 22 additions and 1 deletions

View File

@@ -637,6 +637,7 @@ limitations under the License.
threads="[[_commentThreads]]" threads="[[_commentThreads]]"
change="[[_change]]" change="[[_change]]"
change-num="[[_changeNum]]" change-num="[[_changeNum]]"
comment-tab="[[_currentView]]"
logged-in="[[_loggedIn]]" logged-in="[[_loggedIn]]"
only-show-robot-comments-with-human-reply only-show-robot-comments-with-human-reply
on-thread-list-modified="_handleReloadDiffComments"></gr-thread-list> on-thread-list-modified="_handleReloadDiffComments"></gr-thread-list>
@@ -654,6 +655,7 @@ limitations under the License.
change="[[_change]]" change="[[_change]]"
change-num="[[_changeNum]]" change-num="[[_changeNum]]"
logged-in="[[_loggedIn]]" logged-in="[[_loggedIn]]"
comment-tab="[[_currentView]]"
hide-toggle-buttons hide-toggle-buttons
on-thread-list-modified="_handleReloadDiffComments"></gr-thread-list> on-thread-list-modified="_handleReloadDiffComments"></gr-thread-list>
</template> </template>

View File

@@ -76,7 +76,7 @@ limitations under the License.
</template> </template>
<div id="threads"> <div id="threads">
<template is="dom-if" if="[[!threads.length]]"> <template is="dom-if" if="[[!threads.length]]">
There are no inline comment threads on any diff for this change. [[_computeNoThreadsMessage(commentTab)]]
</template> </template>
<template <template
is="dom-repeat" is="dom-repeat"

View File

@@ -23,6 +23,17 @@
* @event thread-list-modified * @event thread-list-modified
* @extends Polymer.Element * @extends Polymer.Element
*/ */
const NO_THREADS_MESSAGE = 'There are no inline comment threads on any diff '
+ 'for this change.';
const NO_ROBOT_COMMENTS_THREADS_MESSAGE = 'There are no findings for this ' +
'patchset.';
const CommentTabs = {
CHANGE_LOG: 0,
COMMENT_THREADS: 1,
ROBOT_COMMENTS: 2,
};
class GrThreadList extends Polymer.GestureEventListeners( class GrThreadList extends Polymer.GestureEventListeners(
Polymer.LegacyElementMixin( Polymer.LegacyElementMixin(
Polymer.Element)) { Polymer.Element)) {
@@ -62,6 +73,7 @@
type: Boolean, type: Boolean,
value: false, value: false,
}, },
commentTab: Number,
}; };
} }
@@ -71,6 +83,13 @@
return loggedIn ? 'show' : ''; return loggedIn ? 'show' : '';
} }
_computeNoThreadsMessage(commentTab) {
if (commentTab === CommentTabs.ROBOT_COMMENTS) {
return NO_ROBOT_COMMENTS_THREADS_MESSAGE;
}
return NO_THREADS_MESSAGE;
}
/** /**
* Order as follows: * Order as follows:
* - Unresolved threads with drafts (reverse chronological) * - Unresolved threads with drafts (reverse chronological)