-
Notifications
You must be signed in to change notification settings - Fork 0
Data Import Component
Sam Lombardo edited this page Apr 15, 2025
·
1 revision
Purpose:
- To serve as an intermediary step after data sync so the user can decide how to handle each new, unlinked object.
- To display all unlinked objects (those with no parent ID) and provide options for linking or creating new records.
User Goals:
- Identify which objects need attention.
- Choose to connect an object to an existing record (link) or treat it as a new object (add).
- Title: “Review Imported Objects”
-
Subtext: A brief explanation, e.g.,
“Below are the objects imported from your latest sync that are not yet linked to a local record. For each object, you can either link it to an existing entry or create a new record.”
-
Display Format:
Use a table (or card layout) to present the unlinked objects. For each row (or card), include:- Key Identifiers: Name, external ID, or any descriptor provided by the sync.
- Import Timestamp: When the object was added (optional but useful for context).
- Source: Indicate the integration platform if applicable.
-
Actions Per Object:
-
Link to Existing:
A button (or icon) that, when clicked, opens a modal dialog for selecting an existing local object. -
Add New Local:
A button that opens a form (inline or modal) with pre-populated details from the imported data and allows the user to complete any additional fields necessary for the new record.
-
Link to Existing:
-
Additional Features:
-
Search/Filter:
A search box or filters to help users quickly locate a particular object if the list is long. -
Bulk Actions (Optional):
Checkboxes might allow the user to perform linking or adding actions on several objects simultaneously if needed.
-
Search/Filter:
-
Contents:
-
Searchable List of Existing Local Objects:
Display the list of candidate local objects (which could be listings, properties, or another entity type depending on your domain). Include search, filter, or pagination if necessary. -
Selection Mechanism:
Allow the user to choose one and confirm the linking action. -
Feedback:
Once a link is confirmed, update the state of the unlinked object in the UI (possibly remove it from the list).
-
Searchable List of Existing Local Objects:
-
Form Modal/Page:
Present a form pre-populated with data from the unlinked sync object. -
Editable Fields:
Allow the user to adjust details (e.g., name, description, additional metadata) before saving. -
On Save:
Persist the new record and update the linkage in the database so that the imported object is now connected.
-
In your current integration sync handler:
After the sync API call completes successfully, navigate to the new import review route.// Example (Angular): this.integrationSyncService.syncIntegrationAsync(connection.integrationProvider.integrationId) .pipe(finalize(() => this.isIntegrationSyncing = false)) .subscribe({ next: () => { this.snackBar.open('Sync started successfully!', 'Close', { duration: 3000 }); // Navigate to the ImportReviewComponent when sync completes: this.router.navigate(['/import-review']); }, error: (error) => { console.error('Sync failed', error); this.snackBar.open('Sync failed. Please try again.', 'Close', { duration: 3000 }); } });
-
Fetching Data:
On initialization, call a service method (e.g.,ImportedDataService.getUnlinkedObjects()) to load all unlinked objects. -
Loading State:
Use a spinner or loading indicator while fetching data.
-
User clicks “Link to Existing”:
- Open the linking modal.
- In the modal, allow the user to search or browse existing local objects.
- On selection and confirmation, call a service endpoint (e.g.,
ImportedDataService.linkObject(importId, localObjectId)) to update the object’s linkage. - Refresh the list or remove the object from the unlinked list upon success.
-
User clicks “Add New Local”:
- Open the new object creation form (possibly in a modal).
- Pre-fill form fields with data from the imported object.
- On form submission, call a service endpoint (e.g.,
LocalObjectService.createFromImportedData(importData)) to create a new local record and update the linkage. - Update the UI to reflect the new link.
-
Fetching Unlinked Data:
- Create an endpoint (e.g.,
GET /api/imported/unlinked) that returns objects with a null parent ID.
- Create an endpoint (e.g.,
-
Linking Operation:
- Define an endpoint (e.g.,
POST /api/imported/{id}/link) which receives the selected local object’s ID and updates the imported record.
- Define an endpoint (e.g.,
-
New Object Creation:
- The new record creation endpoint should accept the imported data payload and create an object accordingly while marking it as linked.
-
Error Feedback:
Use snackbars or modal alerts to indicate errors in linking or adding new records. -
Success Feedback:
Notify the user upon successful linkage or creation.
-
Unit Tests:
Write tests for the component’s logic, including fetching, modal interactions, and service call responses. -
Integration Tests:
Verify end-to-end flows, ensuring that linking or adding a new object correctly updates both the UI and the backend (refer to your Testing Strategies document for setting up your test environments citeturn0file0).
-
Access Control:
Though the UI should be accessible by default, check whether linking and creating new records need any role validation. Ensure that the actions available are consistent with the RBAC model described in your Role‐Based-Access-Control documentation citeturn0file1.
-
Sync Flow:
- User clicks sync
- API call to sync objects
- On success, navigate to ImportReviewComponent
-
ImportReviewComponent:
- Header: “Review Imported Objects”
- List: Display all unlinked objects in table/card layout
- Row Actions: “Link to Existing” ➔ Opens modal, “Add New” ➔ Opens pre-filled form
-
Service Calls:
- Fetch unlinked data
- Update linking status
- Create new object from imported data
-
Modal & Form Interactions:
- Link Modal: Select existing object and confirm
- Add Form: Edit and submit new local object details