Skip to content

Commit

Permalink
add collections to advanced diff
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanKiral committed Sep 3, 2024
1 parent 7840cac commit 8b8e980
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/modules/sync/utils/diffTemplate.html
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ <h2>Compared environments</h2>
<h2>Modified entities</h2>
<div>state from <strong>{{datetime_generated}}</strong></div>
{{types_section}} {{snippets_section}} {{taxonomies_section}}
{{web_spotlight_section}}
{{web_spotlight_section}} {{collections_section}}
</div>
</div>
<script>
Expand Down
17 changes: 16 additions & 1 deletion src/modules/sync/utils/htmlRenderers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ type Operation = PatchOperation["op"];
type TypeOrSnippet = ContentTypeModels.IAddContentTypeData | ContentTypeSnippetModels.IAddContentTypeSnippetData;
type ElementOrTerm = ContentTypeElements.Element | TaxonomyModels.IAddTaxonomyRequestModel;
type RenderFunction<T extends PatchOperation> = (patchOp: T) => string;
type EntityType = "taxonomies" | "types" | "snippets";
type EntityType = "taxonomies" | "types" | "snippets" | "collections";
type EntityActionType = "added" | "updated" | "deleted";
type AdvancedDiffParams =
& Readonly<{
Expand Down Expand Up @@ -470,6 +470,21 @@ const rendererMap: ReadonlyMap<string, (data: DiffData) => string> = new Map([
"{{web_spotlight_section}}",
({ webSpotlight }: DiffData) => renderWebSpotlightSection(webSpotlight),
],
[
"{{collections_section}}",
({ collections }: DiffData) =>
collections.length
? renderSection({
id: "collections-section",
header: "<div>Collections</div>",
content: renderUpdatedEntitySection("collections"),
})
: "<h3>No changes to collections</h3>",
],
[
"{{updated_collections}}",
({ collections }: DiffData) => renderUpdatedEntity(["collections", collections]),
],
]);

const patchOpRendererMap: ReadonlyMap<
Expand Down

0 comments on commit 8b8e980

Please sign in to comment.