Merge changes from topic 'bot-comments-ui-gh16'

* changes:
  Hide "HideBotComments" if no bot comment is present in the history tab
  Add show / hide bot comments button to ChangeScreen
This commit is contained in:
Dave Borowitz
2016-09-22 08:06:40 +00:00
committed by Gerrit Code Review
3 changed files with 49 additions and 1 deletions

View File

@@ -458,7 +458,8 @@ public class ChangeInfo extends JavaScriptObject {
public final native AccountInfo author() /*-{ return this.author; }-*/;
public final native String message() /*-{ return this.message; }-*/;
public final native int _revisionNumber() /*-{ return this._revision_number || 0; }-*/;
private native String dateRaw() /*-{ return this.date; }-*/;
public final native String tag() /*-{ return this.tag; }-*/;
private final native String dateRaw() /*-{ return this.date; }-*/;
public final Timestamp date() {
return JavaSqlTimestamp_JsonSerializer.parseTimestamp(dateRaw());

View File

@@ -225,6 +225,8 @@ public class ChangeScreen extends Screen {
@UiField Button renameFile;
@UiField Button expandAll;
@UiField Button collapseAll;
@UiField Button hideTaggedComments;
@UiField Button showTaggedComments;
@UiField QuickApprove quickApprove;
private ReplyAction replyAction;
@@ -300,6 +302,13 @@ public class ChangeScreen extends Screen {
.defaultBaseForMerges().getBase();
}
loadConfigInfo(info, base);
JsArray<MessageInfo> mAr = info.messages();
for (int i = 0; i < mAr.length(); i++) {
if (mAr.get(i).tag() != null) {
hideTaggedComments.setVisible(true);
break;
}
}
}
});
group.done();
@@ -908,6 +917,30 @@ public class ChangeScreen extends Screen {
}
}
@UiHandler("showTaggedComments")
void onShowTaggedComments(@SuppressWarnings("unused") ClickEvent e) {
showTaggedComments.setVisible(false);
hideTaggedComments.setVisible(true);
int n = history.getWidgetCount();
for (int i = 0; i < n; i++) {
Message m = ((Message) history.getWidget(i));
m.setVisible(true);
}
}
@UiHandler("hideTaggedComments")
void onHideTaggedComments(@SuppressWarnings("unused") ClickEvent e) {
hideTaggedComments.setVisible(false);
showTaggedComments.setVisible(true);
int n = history.getWidgetCount();
for (int i = 0; i < n; i++) {
Message m = ((Message) history.getWidget(i));
if (m.getMessageInfo().tag() != null) {
m.setVisible(false);
}
}
}
@UiHandler("expandAll")
void onExpandAll(@SuppressWarnings("unused") ClickEvent e) {
int n = history.getWidgetCount();

View File

@@ -606,6 +606,20 @@ limitations under the License.
<ui:attribute name='title'/>
<div><ui:msg>Collapse All</ui:msg></div>
</g:Button>
<g:Button ui:field='hideTaggedComments'
styleName=''
visible='false'
title='Hide tagged comments'>
<ui:attribute name='title'/>
<div><ui:msg>Hide tagged comments</ui:msg></div>
</g:Button>
<g:Button ui:field='showTaggedComments'
styleName=''
visible='false'
title='Show tagged comments'>
<ui:attribute name='title'/>
<div><ui:msg>Show tagged comments</ui:msg></div>
</g:Button>
<g:SimplePanel ui:field='historyExtensionRight' styleName='{style.historyExtension}'/>
</div>
</div>