Skip to content

Commit

Permalink
IFC-264 - Diff refresh fix in branch details view (#4193)
Browse files Browse the repository at this point in the history
* fix branch props for branch view

* display kind if no label provided

* manually adds label for schema items
  • Loading branch information
pa-lem authored Aug 27, 2024
1 parent 5c78e2b commit 51e70f4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
7 changes: 6 additions & 1 deletion frontend/app/src/decorators/withSchemaContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,12 @@ export const withSchemaContext = (AppComponent: any) => (props: any) => {
...profiles.map((s) => s.label),
];
const schemaKindNameTuples = R.zip(schemaKinds, schemaNames);
const schemaKindNameMap = R.fromPairs(schemaKindNameTuples);
const schemaKindNameMap = {
...R.fromPairs(schemaKindNameTuples),
SchemaAttribute: "Attribute",
SchemaRelationship: "Relationship",
SchemaNode: "Node",
};

const schemaLabels = [...schema.map((s) => s.label), ...generics.map((s) => s.label)];
const schemaKindLabelTuples = R.zip(schemaKinds, schemaLabels);
Expand Down
8 changes: 2 additions & 6 deletions frontend/app/src/screens/diff/node-diff/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export const NodeDiff = ({ filters }: NodeDiffProps) => {
return (
<div className="flex flex-col items-center justify-center">
<NoDataFound message="No diff to display. Try to manually load the latest changes." />
<PcDiffUpdateButton size="sm" sourceBranch={proposedChangesDetails?.source_branch?.value} />
<PcDiffUpdateButton size="sm" sourceBranch={branch} />
</div>
);
}
Expand All @@ -104,11 +104,7 @@ export const NodeDiff = ({ filters }: NodeDiffProps) => {

{!!nodes?.length && (
<div className="pl-2 ">
<PcDiffUpdateButton
size="sm"
time={data?.DiffTree?.to_time}
sourceBranch={proposedChangesDetails?.source_branch?.value}
/>
<PcDiffUpdateButton size="sm" time={data?.DiffTree?.to_time} sourceBranch={branch} />
</div>
)}
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/src/screens/diff/node-diff/node.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const DiffNode = ({ sourceBranch, destinationBranch, node }: DiffNodeProp
<div className="flex w-full items-center justify-between gap-2 justify-self-start">
<div className="flex items-center gap-2">
<DiffBadge status={node.status} hasConflicts={node.contains_conflict} />
<Badge variant="white">{schemaKindName[node.kind]}</Badge>
<Badge variant="white">{schemaKindName[node.kind] ?? node.kind}</Badge>
<span className="text-gray-800 font-medium px-2 py-1">{node.label}</span>
</div>

Expand Down

0 comments on commit 51e70f4

Please sign in to comment.