Skip to content

Commit 282289a

Browse files
authored
Added delete work flow for error. Fixed side-by-side toggle. Reverted… (#189)
- Reverted colors of squares in property inspector ![image](https://github.com/user-attachments/assets/87dd64b1-4ac5-440f-9765-bf59c1bb02bb) - Fixed job error and re-run logic - Fixed side-by-side toggle not present in the property comparison table ![image](https://github.com/user-attachments/assets/61d8d41e-e433-4e8c-8e79-186fdcfedca3)
1 parent 7e663ea commit 282289a

4 files changed

Lines changed: 53 additions & 36 deletions

File tree

.changeset/many-spies-attend.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"@itwin/changed-elements-react": patch
3+
---
4+
5+
- Reverted colors of squares in property inspector
6+
- Fixed job error and re-run logic
7+
- Fixed side-by-side toggle not present in property comparison table

packages/changed-elements-react/src/NamedVersionSelector/useComparisonJobs.ts

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -174,36 +174,46 @@ interface PostOrGetComparisonJobParams {
174174
async function postOrGetComparisonJob(args: PostOrGetComparisonJobParams): Promise<ComparisonJob> {
175175
const numRetries = 3;
176176
const delayInMilliseconds = 5000;
177-
178177
const { comparisonJobClient, iTwinId, iModelId, startChangesetId, endChangesetId, signal } = args;
178+
const jobId = `${startChangesetId}-${endChangesetId}`;
179179
signal?.throwIfAborted();
180180

181-
const response = await tryXTimes(
182-
async () => getComparisonJob({
183-
comparisonJobClient,
184-
iTwinId,
185-
iModelId,
186-
jobId: `${startChangesetId}-${endChangesetId}`,
187-
signal,
188-
}),
189-
numRetries,
190-
delayInMilliseconds,
191-
signal,
192-
);
181+
const runGetDeletePostJobWorkflow = async () => {
182+
const response = await getComparisonJob({
183+
comparisonJobClient,
184+
iTwinId,
185+
iModelId,
186+
jobId: jobId,
187+
signal,
188+
})
193189

194-
return response ?? tryXTimes(
195-
() => comparisonJobClient.postComparisonJob({
196-
iTwinId,
197-
iModelId,
198-
startChangesetId: startChangesetId,
199-
endChangesetId: endChangesetId,
200-
headers: { "Content-Type": "application/json" },
201-
signal,
202-
}),
203-
numRetries,
204-
delayInMilliseconds,
205-
signal,
206-
);
190+
if (response?.comparisonJob?.status === "Failed") {
191+
await args.comparisonJobClient.deleteComparisonJob({
192+
iTwinId: iTwinId,
193+
iModelId: iModelId,
194+
jobId: jobId,
195+
});
196+
return comparisonJobClient.postComparisonJob({
197+
iTwinId,
198+
iModelId,
199+
startChangesetId: startChangesetId,
200+
endChangesetId: endChangesetId,
201+
headers: { "Content-Type": "application/json" },
202+
signal,
203+
});
204+
}
205+
206+
return response ??
207+
comparisonJobClient.postComparisonJob({
208+
iTwinId,
209+
iModelId,
210+
startChangesetId: startChangesetId,
211+
endChangesetId: endChangesetId,
212+
headers: { "Content-Type": "application/json" },
213+
signal,
214+
});
215+
};
216+
return tryXTimes(() => runGetDeletePostJobWorkflow(), numRetries, delayInMilliseconds, signal);
207217
}
208218

209219
interface GetComparisonJobArgs {

packages/changed-elements-react/src/contentviews/PropertyComparisonTable.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export function PropertyComparisonTable(props: PropertyComparisonTableProps): Re
9696
}
9797
<div className="settings">
9898
{
99-
displaySideBySideToggle &&
99+
(displaySideBySideToggle ?? true) &&
100100
<SideBySideToggle
101101
manager={manager}
102102
selection={selection}

packages/changed-elements-react/src/widgets/ChangedElementsInspector.scss

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,15 @@
284284
}
285285

286286
.added {
287-
color: var(--iui-color-background-positive-hover);
287+
color: RGB(86, 170, 28);
288288
}
289289

290290
.modified {
291-
color: var(--iui-color-background-informational-hover);
291+
color: RGB(0, 139, 225);
292292
}
293293

294294
.deleted {
295-
color: var(--iui-color-background-negative-hover);
295+
color: RGB(204, 0, 0);
296296
}
297297

298298
.unchanged {
@@ -307,8 +307,8 @@
307307

308308
&-modified {
309309
@extend .change-square;
310-
background-color: var(--iui-color-background-informational-hover);
311-
border-color: var(--iui-color-background-informational-hover);
310+
background-color: RGB(0, 139, 225);
311+
border-color: RGB(0, 139, 225);
312312
}
313313

314314
&-indirect {
@@ -318,14 +318,14 @@
318318

319319
&-added {
320320
@extend .change-square;
321-
background-color: var(--iui-color-background-positive-hover);
322-
border-color: var(--iui-color-background-positive-hover);
321+
background-color: RGB(86, 170, 28);
322+
border-color: RGB(86, 170, 28);
323323
}
324324

325325
&-deleted {
326326
@extend .change-square;
327-
background-color: var(--iui-color-background-negative-hover);
328-
border-color: var(--iui-color-background-negative-hover);
327+
background-color: RGB(204, 0, 0);
328+
border-color: RGB(204, 0, 0);
329329
}
330330
}
331331

0 commit comments

Comments
 (0)