Show full event name in sidebar
Summary: Show info about the event which triggered a new changeset generation; in case of a state update, also show the name of the method which triggered the state update. Reviewed By: pasqualeanatriello Differential Revision: D17162202 fbshipit-source-id: ebf218f8ce71799e4dd452f54b1621af7f83cc51
This commit is contained in:
committed by
Facebook Github Bot
parent
0c307b7c27
commit
fc2b8db8cf
@@ -32,7 +32,9 @@ public class ChangesetDebug implements ChangesetDebugListener {
|
|||||||
|
|
||||||
public interface ChangesetListener {
|
public interface ChangesetListener {
|
||||||
void onChangesetApplied(
|
void onChangesetApplied(
|
||||||
String name,
|
String eventName,
|
||||||
|
String eventSource,
|
||||||
|
String updateStateMethodName,
|
||||||
boolean isAsync,
|
boolean isAsync,
|
||||||
String surfaceId,
|
String surfaceId,
|
||||||
String id,
|
String id,
|
||||||
@@ -90,8 +92,12 @@ public class ChangesetDebug implements ChangesetDebugListener {
|
|||||||
eventSourceSection = updatedStateSection == null ? "" : updatedStateSection.getSimpleName();
|
eventSourceSection = updatedStateSection == null ? "" : updatedStateSection.getSimpleName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final String stateUpdateMethodName = stateUpdateAttribution == null ? null : attribution;
|
||||||
|
|
||||||
sSectionsFlipperPlugin.onChangesetApplied(
|
sSectionsFlipperPlugin.onChangesetApplied(
|
||||||
eventSourceName + " " + eventSourceSection,
|
eventSourceName,
|
||||||
|
eventSourceSection,
|
||||||
|
stateUpdateMethodName,
|
||||||
isEventAsync(eventSource),
|
isEventAsync(eventSource),
|
||||||
surfaceId,
|
surfaceId,
|
||||||
sChangesetIdGenerator.incrementAndGet() + "-" + surfaceId,
|
sChangesetIdGenerator.incrementAndGet() + "-" + surfaceId,
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class SectionsFlipperPlugin implements FlipperPlugin, ChangesetListener {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param name Name of event
|
* @param eventName Name of event
|
||||||
* @param isAsync Whether the event was sync or async
|
* @param isAsync Whether the event was sync or async
|
||||||
* @param surfaceId SectionTree tag
|
* @param surfaceId SectionTree tag
|
||||||
* @param id Changeset generation unique id
|
* @param id Changeset generation unique id
|
||||||
@@ -54,7 +54,9 @@ public class SectionsFlipperPlugin implements FlipperPlugin, ChangesetListener {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void onChangesetApplied(
|
public void onChangesetApplied(
|
||||||
String name,
|
String eventName,
|
||||||
|
String eventSource,
|
||||||
|
String updateStateMethodName,
|
||||||
boolean isAsync,
|
boolean isAsync,
|
||||||
String surfaceId,
|
String surfaceId,
|
||||||
String id,
|
String id,
|
||||||
@@ -63,16 +65,26 @@ public class SectionsFlipperPlugin implements FlipperPlugin, ChangesetListener {
|
|||||||
if (mConnection == null) {
|
if (mConnection == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final String reason = eventName + " " + eventSource;
|
||||||
|
final FlipperObject.Builder eventPayloadBuilder = new FlipperObject.Builder();
|
||||||
|
eventPayloadBuilder.put("Event", eventName);
|
||||||
|
eventPayloadBuilder.put("Async", isAsync);
|
||||||
|
eventPayloadBuilder.put("Section", eventSource);
|
||||||
|
if (updateStateMethodName != null) {
|
||||||
|
eventPayloadBuilder.put("Update state method", updateStateMethodName);
|
||||||
|
}
|
||||||
|
|
||||||
mConnection.send(
|
mConnection.send(
|
||||||
"addEvent",
|
"addEvent",
|
||||||
new FlipperObject.Builder()
|
new FlipperObject.Builder()
|
||||||
.put("id", id)
|
.put("id", id)
|
||||||
.put("update_mode", isAsync ? 0 : 1)
|
.put("update_mode", isAsync ? 0 : 1)
|
||||||
.put("reason", name)
|
.put("reason", reason)
|
||||||
.put("surface_key", surfaceId)
|
.put("surface_key", surfaceId)
|
||||||
.put("tree_generation_timestamp", 10000) // TODO
|
.put("tree_generation_timestamp", 10000) // TODO
|
||||||
.put("stack_trace", new FlipperArray.Builder().build())
|
.put("stack_trace", new FlipperArray.Builder().build())
|
||||||
.put("payload", new FlipperObject.Builder().build())
|
.put("payload", eventPayloadBuilder.build())
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
mConnection.send(
|
mConnection.send(
|
||||||
@@ -82,7 +94,7 @@ public class SectionsFlipperPlugin implements FlipperPlugin, ChangesetListener {
|
|||||||
.put("hierarchy_generation_timestamp", 10000) // TODO
|
.put("hierarchy_generation_timestamp", 10000) // TODO
|
||||||
.put("hierarchy_generation_duration", 0) // TODO
|
.put("hierarchy_generation_duration", 0) // TODO
|
||||||
.put("tree", tree)
|
.put("tree", tree)
|
||||||
.put("reason", name)
|
.put("reason", eventName)
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
// Not sure both CHANGESET_GENERATED and CHANGESET_APPLIED need to sent here, need
|
// Not sure both CHANGESET_GENERATED and CHANGESET_APPLIED need to sent here, need
|
||||||
|
|||||||
Reference in New Issue
Block a user