Add more fields on the Tree nodes

Summary:
Add fields for colouring the changeset operation that was performed on a node in the tree.
Changesets are not ordered by type of operation, they need to be displayed in order

Reviewed By: danielbuechele

Differential Revision: D16121158

fbshipit-source-id: 411557170b16ada9d1d72fb617b1aaf583e0f0e7
This commit is contained in:
Mihaela Ogrezeanu
2019-07-16 07:24:39 -07:00
committed by Facebook Github Bot
parent 1047ee6d48
commit 42c887e634
2 changed files with 55 additions and 28 deletions

View File

@@ -26,12 +26,16 @@ export type UpdateTreeGenerationHierarchyGenerationPayload = {|
id: string, id: string,
reason: string, reason: string,
tree?: Array<{ tree?: Array<{
didTriggerStateUpdate: boolean, didTriggerStateUpdate?: boolean,
identifier: string, identifier: string,
isDirty: boolean, isDirty?: boolean,
isReused: boolean, isReused?: boolean,
name: string, name: string,
parent: string | 0, parent: string | '',
inserted?: boolean,
removed?: boolean,
updated?: boolean,
unchanged?: boolean,
}>, }>,
|}; |};
@@ -40,15 +44,18 @@ export type UpdateTreeGenerationChangesetGenerationPayload = {|
tree_generation_id: string, tree_generation_id: string,
identifier: string, identifier: string,
type: string, type: string,
changeset: { changesets: {
inserted_items: {}, section_key: {
inserted_sections: {}, changesets: {
moved_items: {}, id: {
removed_sections: [], count: number,
updated_items: { index: number,
[key: string]: { toIndex?: number,
context: string, type: string,
model: string, render_infos?: Array<String>,
prev_data?: Array<String>,
next_data?: Array<String>,
},
}, },
}, },
}, },
@@ -56,14 +63,17 @@ export type UpdateTreeGenerationChangesetGenerationPayload = {|
export type UpdateTreeGenerationChangesetApplicationPayload = {| export type UpdateTreeGenerationChangesetApplicationPayload = {|
changeset: { changeset: {
inserted_items: {}, section_key: {
inserted_sections: {}, changesets: {
moved_items: {}, id: {
removed_sections: [], count: number,
updated_items: { index: number,
[key: string]: { toIndex?: number,
context: string, type: string,
model: string, render_infos?: Array<String>,
prev_data?: Array<String>,
next_data?: Array<String>,
},
}, },
}, },
}, },

View File

@@ -54,10 +54,14 @@ const Container = styled('div')({
type TreeData = Array<{ type TreeData = Array<{
identifier: string, identifier: string,
name: string, name: string,
parent: string | 0, parent: string | '',
didTriggerStateUpdate: boolean, didTriggerStateUpdate?: boolean,
isReused: boolean, isReused?: boolean,
isDirty: boolean, isDirty?: boolean,
inserted?: boolean,
removed?: boolean,
updated?: boolean,
unchanged?: boolean,
}>; }>;
type Props = { type Props = {
@@ -94,6 +98,16 @@ export default class extends PureComponent<Props, State> {
fill = colors.grape; fill = colors.grape;
} }
if (n.removed) {
fill = colors.light20;
} else if (n.inserted) {
fill = colors.pinkDark1;
} else if (n.updated) {
fill = colors.orangeTint15;
} else if (n.unchanged) {
fill = colors.teal;
}
return { return {
name: n.name, name: n.name,
children: [], children: [],
@@ -226,9 +240,12 @@ export default class extends PureComponent<Props, State> {
step="0.01" step="0.01"
/> />
<Spacer /> <Spacer />
<Legend color={colors.lemon}>triggered state update</Legend> <Legend color={colors.light20}>Item removed</Legend>
<Legend color={colors.teal}>is reused</Legend> <Legend color={colors.pinkDark1}>Item inserted</Legend>
<Legend color={colors.grape}>is dirty</Legend> <Legend color={colors.orangeTint15}>Item updated</Legend>
<Legend color={colors.teal}>Item/Section Reused</Legend>
<Legend color={colors.lemon}>Section triggered state update</Legend>
<Legend color={colors.grape}>Section is dirty</Legend>
</Toolbar> </Toolbar>
</Fragment> </Fragment>
); );