Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/1246 allow reordering complex form components #1385

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

myieye
Copy link
Contributor

@myieye myieye commented Jan 16, 2025

Notable changes:

  • Deleted: backend/FwLite/FwDataMiniLcmBridge.Tests/UpdateComplexFormsTests.cs, because I'm pretty sure they're out of date and have been replaced by tests that use the cleaner Api.
  • I moved away from using a tuple of 3 Guids to compare ComplexEntryComponents, so that I didn't need to make BetweenPosition generic. You actually only need 1 Guid. If you're comparing complex-forms then you can use the complex-form ID. If you're comparing components then you use componentSenseId ?? componentEntryId, so you get the most specific one. For CRDTs it can be mapped back to the ComplexEntryComponent.Id before entering the API.
  • I added GetDataFormat() to the MiniLcmApi in order to distinguish the two cases ☝️
  • CanInsertComplexFormComponentViaSync proved to be a super valuable test. What cases passed and failed changed constantly as I was fleshing out the Fw implementation.

Copy link

github-actions bot commented Jan 16, 2025

C# Unit Tests

104 tests  ±0   104 ✅ ±0   5s ⏱️ ±0s
 16 suites ±0     0 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 0a031e5. ± Comparison against base commit 8dd28ee.

♻️ This comment has been updated with latest results.

Copy link

UI unit Tests

12 tests  ±0   12 ✅ ±0   0s ⏱️ ±0s
 4 suites ±0    0 💤 ±0 
 1 files   ±0    0 ❌ ±0 

Results for commit a299fa5. ± Comparison against base commit bb51178.

@myieye myieye force-pushed the feat/1246-allow-reordering-complex-form-components branch from a299fa5 to de7e10e Compare January 17, 2025 07:58
@myieye myieye marked this pull request as ready for review January 17, 2025 09:15
private class SensesDiffApi(IMiniLcmApi api, Guid entryId) : IOrderableCollectionDiffApi<Sense>
private class ComplexFormComponentsDiffApi(Entry afterEntry, IMiniLcmApi api) : IOrderableCollectionDiffApi<ComplexFormComponent>
{
private readonly bool supportsEntityIds = api.GetDataFormat() == ProjectDataFormat.Harmony;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I really don't like this (and the code which is conditional on this). What if we used Id everywhere, and the Fw version set the component Id to the right thing based on context? eg: either the ComponentSense??EntryId or ComplexFormEntryId.

{
if (supportsEntityIds) between = MapBackToEntityIds(between);
var componentId = supportsEntityIds ? component.Id : component.ComponentSenseId ?? component.ComponentEntryId;
await api.MoveComplexFormComponent(afterEntry.Id, componentId, between);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah this won't work. Imagine a client (fw lite, or FLExTools) calling MoveComplexFormComponent directly. What does it pass in to the 2nd arg? component.Id? or component.ComponentEntryId? It depends on GetDataFormat, that really sucks. See my comment above for how we might fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants