Merge branch 'change-screen'
* change-screen: Add put to NativeMap API Expose resetHtml in NavigationTable to all callers Fix NavigationTable bug allowing selection of invalid rows Create body widget in Screen constructor Expose ChangeList.addOptions for ChangeApi Add options to /changes/<id>/detail Change-Id: Id5481e2ebd8459f093cb59cd2d388ec851bf4c92
This commit is contained in:
@@ -364,6 +364,11 @@ Retrieves a change with link:#labels[labels], link:#detailed-labels[
|
||||
detailed labels], link:#detailed-accounts[detailed accounts], and
|
||||
link:#messages[messages].
|
||||
|
||||
Additional fields can be obtained by adding `o` parameters, each
|
||||
option requires more database lookups and slows down the query
|
||||
response time to the client so they are generally disabled by
|
||||
default. Fields are described in link:#list-changes[Query Changes].
|
||||
|
||||
.Request
|
||||
----
|
||||
GET /changes/myProject~master~I8473b95934b5732ac55d26311a706c9c2bde9940/detail HTTP/1.0
|
||||
|
@@ -34,7 +34,7 @@ public class ChangeList extends JsArray<ChangeInfo> {
|
||||
for (String q : queries) {
|
||||
call.addParameterRaw("q", KeyUtil.encode(q));
|
||||
}
|
||||
addOptions(call, ListChangesOption.LABELS);
|
||||
addOptions(call, EnumSet.of(ListChangesOption.LABELS));
|
||||
call.get(callback);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ChangeList extends JsArray<ChangeInfo> {
|
||||
if (limit > 0) {
|
||||
call.addParameter("n", limit);
|
||||
}
|
||||
addOptions(call, ListChangesOption.LABELS);
|
||||
addOptions(call, EnumSet.of(ListChangesOption.LABELS));
|
||||
if (!PagedSingleListScreen.MIN_SORTKEY.equals(sortkey)) {
|
||||
call.addParameter("P", sortkey);
|
||||
}
|
||||
@@ -59,16 +59,14 @@ public class ChangeList extends JsArray<ChangeInfo> {
|
||||
if (limit > 0) {
|
||||
call.addParameter("n", limit);
|
||||
}
|
||||
addOptions(call, ListChangesOption.LABELS);
|
||||
addOptions(call, EnumSet.of(ListChangesOption.LABELS));
|
||||
if (!PagedSingleListScreen.MAX_SORTKEY.equals(sortkey)) {
|
||||
call.addParameter("N", sortkey);
|
||||
}
|
||||
call.get(callback);
|
||||
}
|
||||
|
||||
private static void addOptions(
|
||||
RestApi call, ListChangesOption option1, ListChangesOption... options) {
|
||||
EnumSet<ListChangesOption> s = EnumSet.of(option1, options);
|
||||
static void addOptions(RestApi call, EnumSet<ListChangesOption> s) {
|
||||
call.addParameterRaw("O", Integer.toHexString(ListChangesOption.toBits(s)));
|
||||
}
|
||||
|
||||
|
@@ -80,6 +80,7 @@ public class NativeMap<T extends JavaScriptObject> extends JavaScriptObject {
|
||||
}
|
||||
|
||||
public final native T get(String n) /*-{ return this[n]; }-*/;
|
||||
public final native void put(String n, T v) /*-{ this[n] = v; }-*/;
|
||||
|
||||
public final native void copyKeysIntoChildren(String p)
|
||||
/*-{
|
||||
|
@@ -189,6 +189,10 @@ public abstract class NavigationTable<RowItem> extends FancyFlexTable<RowItem> {
|
||||
}
|
||||
|
||||
protected void movePointerTo(final int newRow, final boolean scroll) {
|
||||
if (getRowItem(newRow) == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final CellFormatter fmt = table.getCellFormatter();
|
||||
final boolean clear = 0 <= currentRow && currentRow < table.getRowCount();
|
||||
if (clear) {
|
||||
@@ -255,7 +259,7 @@ public abstract class NavigationTable<RowItem> extends FancyFlexTable<RowItem> {
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void resetHtml(SafeHtml body) {
|
||||
public void resetHtml(SafeHtml body) {
|
||||
currentRow = -1;
|
||||
super.resetHtml(body);
|
||||
}
|
||||
|
@@ -48,6 +48,7 @@ public abstract class Screen extends View {
|
||||
protected Screen() {
|
||||
initWidget(new FlowPanel());
|
||||
setStyleName(Gerrit.RESOURCES.css().screen());
|
||||
body = new FlowPanel();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -76,7 +77,7 @@ public abstract class Screen extends View {
|
||||
protected void onInitUI() {
|
||||
final FlowPanel me = (FlowPanel) getWidget();
|
||||
me.add(header = new Grid(1, Cols.values().length));
|
||||
me.add(body = new FlowPanel());
|
||||
me.add(body);
|
||||
|
||||
headerText = new InlineLabel();
|
||||
if (titleWidget == null) {
|
||||
|
@@ -19,9 +19,21 @@ import com.google.gerrit.extensions.restapi.RestReadView;
|
||||
import com.google.gwtorm.server.OrmException;
|
||||
import com.google.inject.Inject;
|
||||
|
||||
import org.kohsuke.args4j.Option;
|
||||
|
||||
public class GetDetail implements RestReadView<ChangeResource> {
|
||||
private final ChangeJson json;
|
||||
|
||||
@Option(name = "-o", multiValued = true, usage = "Output options")
|
||||
void addOption(ListChangesOption o) {
|
||||
json.addOption(o);
|
||||
}
|
||||
|
||||
@Option(name = "-O", usage = "Output option flags, in hex")
|
||||
void setOptionFlagsHex(String hex) {
|
||||
json.addOptions(ListChangesOption.fromBits(Integer.parseInt(hex, 16)));
|
||||
}
|
||||
|
||||
@Inject
|
||||
GetDetail(ChangeJson json) {
|
||||
this.json = json
|
||||
|
Reference in New Issue
Block a user