Skip to content

refactor(angular): deduplicate services/components — misc shrinks - #692

Merged
nitrobass24 merged 1 commit into
developfrom
refactor/angular-dedup
Aug 25, 2026
Merged

nitrobass24 merged 1 commit into
developfrom
refactor/angular-dedup

Conversation

@nitrobass24

@nitrobass24 nitrobass24 commented Aug 24, 2026 •

Copy link
Copy Markdown
Owner

Closes #676. Part of #682. No user-visible behavior change. Net 542 insertions / 908 deletions, 35 files.

Applied

# Item Notes
1 DEFAULT_* section consts Collapsed into one DEFAULT_CONFIG literal (no other consumers).
2 IntegrationsService/PathPairsService New CollectionService<T> base (services/settings/collection.service.ts) with refresh/createItem/updateItem/removeItem; both services are thin typed wrappers. The one real difference — PathPairs clears to [] on a failed refresh, Integrations keeps the last list — is a ctor flag. CLAUDE.md's reference-implementation pointer updated.
3 Filter criteria classes ViewFileFilterCriteria is now (f: ViewFile) => boolean; And is &&. Specs adjusted from {meetsCriteria} literals to plain predicates.
4 settings-page applyDisableRules is an exported pure function in options-list.ts (specs import it directly — no more statics cast); one rebuildContexts() with the full active-flag set; 8 template aliases → OPTIONS map; OVERRIDE_NOTE field removed.
5 Double-click confirm ×4 common/double-click-confirm.ts (DoubleClickConfirm<K>) replaces the copies in file, bulk-action-bar, path-pairs, and integrations (a 4th copy the issue didn't list). Components keep confirmingDelete/confirmingDeleteId as getters so templates and specs are untouched. onExpire → cdr.markForCheck() per the OnPush rule.
6 testDiscord/testTelegram NotificationsService.test(channel); settings-page has testing/results records and one onTest; template loops NOTIFICATION_CHANNELS. Shared TestResult + failureFromHttpError (services/utils/test-result.ts) also used by IntegrationsService.test.
7 LoggerService Four one-line console getters (kept as getters so console spies still work).
8 logs-page trackBy Identity trackBy; WeakMaps/counters dropped. Existing stability/collision specs pass unchanged.
9 ROUTES Derived from ROUTE_INFOS.
10 mapState DEFAULT branch + cast, with an Object.values guard so the "unknown state → DEFAULT" spec still holds.
11 STATE_LOOKUP/LEVEL_LOOKUP Enum[k as keyof typeof Enum] ?? DEFAULT.
12 Small ones All applied: disconnectedStatus() factory, ArrInstanceCreate = Omit<…>, shared result type, NotificationRule.level field, inline URL templates, Localization const object, fetchHistory Object.entries loop + dead before param removed.

Skipped

  • 10b — merging isExtractable/isLocallyDeletable into one flag: 18 spec sites construct ViewFile literals with both fields plus the file.component template/API; the churn outweighs ~6 lines. Left as-is.

Test plan

  • npx ng lint clean
  • npx ng test — 562 passed
  • npx ng build --configuration production (bundle budget warning is pre-existing on develop)
  • CI incl. Playwright e2e

🤖 Generated with Claude Code

- config.ts: single DEFAULT_CONFIG literal.
- CollectionService base for IntegrationsService/PathPairsService.
- View-file filter: predicate functions instead of criteria classes.
- settings-page: applyDisableRules moved to options-list; one rebuild
  path; OPTIONS map for the template; notification test parameterized
  by channel.
- DoubleClickConfirm helper replaces four copies of the confirm state.
- LoggerService reduced to console bindings; logs-page tracks by identity.
- ROUTES derived from ROUTE_INFOS; mapState collapsed; enum lookups via
  keyof; server-status factory; ArrInstanceCreate = Omit; shared
  TestResult + failureFromHttpError; header rule level as field; inline
  URL templates; Localization as const object; fetchHistory param loop.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@nitrobass24
nitrobass24 force-pushed the refactor/angular-dedup branch from 32d9c5d to bf0fc6e Compare August 24, 2026 22:45
@coderabbitai

coderabbitai Bot commented Aug 24, 2026 •

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

Next included review available in 57 minutes.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 53b68af6-c8d8-4968-b294-6903abda4b9b

📥 Commits

Reviewing files that changed from the base of the PR and between c59fede and bf0fc6e.

📒 Files selected for processing (35)
  • CLAUDE.md
  • src/angular/src/app/common/double-click-confirm.ts
  • src/angular/src/app/models/arr-instance.ts
  • src/angular/src/app/models/config.ts
  • src/angular/src/app/models/localization.ts
  • src/angular/src/app/models/log-record.ts
  • src/angular/src/app/models/model-file.ts
  • src/angular/src/app/pages/files/bulk-action-bar.component.ts
  • src/angular/src/app/pages/files/file.component.ts
  • src/angular/src/app/pages/logs/logs-page.component.ts
  • src/angular/src/app/pages/main/header.component.ts
  • src/angular/src/app/pages/settings/integrations.component.ts
  • src/angular/src/app/pages/settings/options-list.ts
  • src/angular/src/app/pages/settings/path-pairs.component.ts
  • src/angular/src/app/pages/settings/settings-page.component.html
  • src/angular/src/app/pages/settings/settings-page.component.spec.ts
  • src/angular/src/app/pages/settings/settings-page.component.ts
  • src/angular/src/app/pages/settings/settings-page.disable-rules.spec.ts
  • src/angular/src/app/routes.ts
  • src/angular/src/app/services/autoqueue/autoqueue.service.ts
  • src/angular/src/app/services/files/view-file-capabilities.ts
  • src/angular/src/app/services/files/view-file-filter.service.spec.ts
  • src/angular/src/app/services/files/view-file-filter.service.ts
  • src/angular/src/app/services/files/view-file.service.spec.ts
  • src/angular/src/app/services/files/view-file.service.ts
  • src/angular/src/app/services/logs/log.service.ts
  • src/angular/src/app/services/server/server-status.service.ts
  • src/angular/src/app/services/settings/collection.service.ts
  • src/angular/src/app/services/settings/config.service.ts
  • src/angular/src/app/services/settings/integrations.service.ts
  • src/angular/src/app/services/settings/notifications.service.spec.ts
  • src/angular/src/app/services/settings/notifications.service.ts
  • src/angular/src/app/services/settings/path-pairs.service.ts
  • src/angular/src/app/services/utils/logger.service.ts
  • src/angular/src/app/services/utils/test-result.ts
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/angular-dedup

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

refactor(angular): deduplicate services/components — misc shrinks

1 participant