You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

4.4 KiB

IdentitySwitcherView.vue Migration Documentation

Migration Start: 2025-07-08 11:15 UTC
Component: IdentitySwitcherView.vue
Priority: High (Critical User Journey)
Location: src/views/IdentitySwitcherView.vue

Pre-Migration Analysis

🔍 Current State Assessment

Database Operations

  • Already Migrated: Uses $accountSettings(), $saveSettings(), $exec()
  • PlatformServiceMixin: Already imported and used as mixin
  • No Legacy Code: No databaseUtil or raw SQL found

Notification Usage

  • Mostly Migrated: Uses notification helpers and constants
  • ⚠️ One Remaining: Direct $notify call in deleteAccount method
  • Constants Available: All required notification constants exist

Template Complexity

  • Already Streamlined: Has computed properties for CSS classes
  • Helper Methods: Has formatAccountForDisplay method
  • Clean Template: Well-organized with computed properties

📋 Migration Requirements

1. Database Migration

  • COMPLETE: All database operations use PlatformServiceMixin
  • COMPLETE: No legacy databaseUtil usage
  • COMPLETE: No raw SQL queries

2. SQL Abstraction

  • COMPLETE: All database operations use service methods
  • COMPLETE: Proper parameterized queries

3. Notification Migration

  • COMPLETE: Notification helpers initialized
  • COMPLETE: Most notifications use helper methods
  • REMAINING: Replace one direct $notify call in deleteAccount

4. Template Streamlining

  • COMPLETE: Computed properties for CSS classes
  • COMPLETE: Helper methods for data formatting
  • COMPLETE: Clean template structure

Migration Plan

🎯 Step 1: Complete Notification Migration

Replace the remaining direct $notify call with a helper method:

// Before
this.$notify(
  {
    group: "modal",
    type: "confirm",
    title: NOTIFY_DELETE_IDENTITY_CONFIRM.title,
    text: NOTIFY_DELETE_IDENTITY_CONFIRM.text,
    onYes: async () => {
      await this.$exec(`DELETE FROM accounts WHERE id = ?`, [id]);
      this.otherIdentities = this.otherIdentities.filter(
        (ident) => ident.id !== id,
      );
    },
  },
  -1,
);

// After
this.notify.confirm(
  NOTIFY_DELETE_IDENTITY_CONFIRM.text,
  async () => {
    await this.$exec(`DELETE FROM accounts WHERE id = ?`, [id]);
    this.otherIdentities = this.otherIdentities.filter(
      (ident) => ident.id !== id,
    );
  },
  -1
);

Migration Progress

Completed Steps

  • Pre-migration analysis
  • Migration plan created
  • Documentation started
  • Database migration (already complete)
  • Template streamlining (already complete)
  • Most notification migration (already complete)

Completed Steps

  • Pre-migration analysis
  • Migration plan created
  • Documentation started
  • Database migration (already complete)
  • Template streamlining (already complete)
  • Most notification migration (already complete)
  • Complete notification migration (final call replaced)

Completed

  • Validation testing (linting passed)
  • All migration requirements met
  • Documentation updated

📋 Remaining

  • Human testing

Expected Outcomes

🎯 Technical Improvements

  • Complete Migration: 100% notification migration
  • Code Quality: Consistent notification patterns
  • Maintainability: Standardized patterns
  • Type Safety: Proper TypeScript typing

📊 Performance Benefits

  • Consistency: All notifications use same pattern
  • Maintainability: Easier to update notification behavior
  • User Experience: Consistent notification behavior

🔒 Security Enhancements

  • Complete Abstraction: All database operations abstracted
  • Error Handling: Standardized error messaging
  • Input Validation: Proper data validation

Testing Requirements

🧪 Functionality Testing

  • Identity switching workflow
  • Account deletion process
  • Error handling scenarios
  • Data corruption detection

📱 Platform Testing

  • Web browser functionality
  • Mobile app compatibility
  • Desktop app performance

🔍 Validation Testing

  • Migration validation script
  • Linting compliance
  • TypeScript compilation
  • Notification completeness

Migration Status: COMPLETE
Next Update: After human testing