Skip to content

Issue 2191 - added option to select facilities to import at the account level#2237

Merged
rmroot merged 5 commits intodevelopfrom
issue-2191
Feb 25, 2026
Merged

Issue 2191 - added option to select facilities to import at the account level#2237
rmroot merged 5 commits intodevelopfrom
issue-2191

Conversation

@jamlokim
Copy link
Copy Markdown
Contributor

@jamlokim jamlokim commented Feb 9, 2026

connects #2191

This pull request introduces a major enhancement to the facility import process in the backup modal, enabling selective facility import from backup files. The changes include new UI elements for selecting facilities, logic updates for handling selective imports, and additional checks for data differences and duplicate selections. The update improves user control and feedback during the import process.

Selective Facility Import Feature:

  • Added option in the account import dropdown to "Select Facilities to Import", allowing users to choose specific facilities from the backup for import.
  • Introduced a facility selection table in the modal UI, enabling users to pick facilities, decide between creating new or replacing existing, and view differences in imported data.
  • Disabled the import button if no facilities are selected for selective import, preventing accidental incomplete imports.

Logic and State Management Updates:

  • Updated component state to support selective import, including new properties for selected facilities, import options, and duplicate facility error handling.
  • Added logic to initialize facility selections, detect duplicate replacement choices, and check for differences between backup and account data.

Import Workflow Enhancements:

  • Modified import logic to handle selective facility import, including deleting replaced facilities and importing only the chosen ones from the backup file.
  • Updated loading messages and context to reflect the selective facility import process.

UI and Styling Improvements:

  • Added new CSS classes for facility selection table and checkboxes, improving the visual layout and usability of the modal.

Dependency and Service Integration:

  • Integrated additional services and models for utility meter groups, meters, predictor data, and facility management to support the new import workflow.

These changes collectively make the facility import process more flexible, user-friendly, and robust.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds selective facility import support when importing an account backup, enabling users to choose specific facilities to import/replace and surfacing differences to guide decisions.

Changes:

  • Adds a “Select Facilities to Import” option and corresponding selection/differences UI in the import-backup modal.
  • Updates import workflow to delete chosen replacement facilities and import only selected facilities.
  • Extends supporting services (facility import return value, facility delete loading suppression, loading UI tracking).

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
src/app/shared/helper-services/backup-data.service.ts Changes facility import API to return facility + progress index for multi-facility imports.
src/app/indexedDB/db-changes.service.ts Adds optional showLoading flag to facility deletion for batch operations.
src/app/core-components/loading/loading.component.html Adjusts @for tracking for loading messages.
src/app/core-components/import-backup-modal/import-backup-modal.component.ts Implements selective facility import logic, state, duplicate checks, and “differences” calculation.
src/app/core-components/import-backup-modal/import-backup-modal.component.html Adds facility selection table UI and disables import when no facilities are selected.
src/app/core-components/import-backup-modal/import-backup-modal.component.css Adds styling for the selection table/checkboxes and adjusts modal sizing/scroll behavior.
Comments suppressed due to low confidence (1)

src/app/core-components/import-backup-modal/import-backup-modal.component.ts:218

  • overwriteData is a boolean | 'selective_import', but the facility-import path treats it as a boolean truthy check (if (this.overwriteData)). If the user previously selected selective import and then loads a facility backup without resetting overwriteData, the code will incorrectly take the overwrite path and delete/overwrite a facility. Reset overwriteData when a new file is loaded and/or use explicit checks (overwriteData === true) in the facility import branch.
      } else {
        if (this.overwriteData) {
          await this.importExistingFacility(tmpBackupFile);
        } else {
          await this.importNewFacility(tmpBackupFile)
        }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jamlokim jamlokim requested a review from rmroot February 25, 2026 19:46
@rmroot rmroot merged commit 2df7311 into develop Feb 25, 2026
3 checks passed
@jamlokim jamlokim deleted the issue-2191 branch March 25, 2026 20:56
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.

3 participants