IndexedDB migration: fix loading of data, fix object comparisons, add unmodified, etc

This commit is contained in:
2025-06-19 16:19:00 -06:00
parent 84f2d5c3a7
commit 4e215914a3
5 changed files with 224 additions and 169 deletions

View File

@@ -74,7 +74,7 @@
</div>
<div>
<p v-if="downloadMnemonic" class="text-green-500">
Here is your seed. Write it down!
Here is your seed for account {{ downloadMnemonicAddress?.substring('did:ethr:0x'.length).substring(0, 3) }} -- write it down!
<br />
{{ downloadMnemonic }}
</p>
@@ -506,15 +506,15 @@
>
<div class="flex items-center">
<IconRenderer
icon-name="edit"
icon-name="check"
svg-class="h-5 w-5 text-yellow-600 mr-2"
/>
<span class="text-sm font-medium text-yellow-900"
>Modify</span
>Unmodified</span
>
</div>
<span class="text-sm font-bold text-yellow-900">{{
comparison.differences.accounts.modified.length
comparison.differences.accounts.unmodified.length
}}</span>
</div>
@@ -559,48 +559,44 @@
</div>
</div>
<!-- Modify Accounts -->
<!-- Unmodified Accounts -->
<div
v-if="comparison.differences.accounts.modified.length > 0"
v-if="comparison.differences.accounts.unmodified.length > 0"
class="mt-4"
>
<h4 class="text-sm font-medium text-gray-900 mb-2">
Modify Accounts ({{ comparison.differences.accounts.modified.length }}):
Unmodified Accounts ({{ comparison.differences.accounts.unmodified.length }}):
</h4>
<div class="space-y-1">
<div
v-for="account in comparison.differences.accounts.modified"
:key="account.id"
class="text-xs text-gray-600 bg-gray-50 p-2 rounded"
>
<div class="font-medium">ID: {{ account.id }}</div>
<div class="text-gray-500">{{ account.did }}</div>
<div class="text-gray-400">Created: {{ account.dateCreated }}</div>
<div class="text-gray-400">Has Identity: {{ getAccountHasIdentity(account) ? 'Yes' : 'No' }}</div>
<div class="text-gray-400">Has Mnemonic: {{ getAccountHasMnemonic(account) ? 'Yes' : 'No' }}</div>
</div>
</div>
<div class="space-y-1">
<div
v-for="account in comparison.differences.accounts.unmodified"
:key="account.id"
class="text-xs text-gray-600 bg-gray-50 p-2 rounded"
>
<div class="font-medium">ID: {{ account.id }}</div>
<div class="text-gray-500">{{ account.did }}</div>
<div class="text-gray-400">Created: {{ account.dateCreated }}</div>
<div class="text-gray-400">Has Identity: {{ getAccountHasIdentity(account) ? 'Yes' : 'No' }}</div>
<div class="text-gray-400">Has Mnemonic: {{ getAccountHasMnemonic(account) ? 'Yes' : 'No' }}</div>
</div>
</div>
<!-- Keep Accounts -->
<div
v-if="comparison.differences.accounts.missing.filter(a => a.did).length > 0"
v-if="comparison.differences.accounts.missing.filter(a => a).length > 0"
class="mt-4"
>
<h4 class="text-sm font-medium text-gray-900 mb-2">
Keep Accounts ({{ comparison.differences.accounts.missing.filter(a => a.did).length }}):
Keep Accounts ({{ comparison.differences.accounts.missing.filter(a => a).length }}):
</h4>
<div class="space-y-1">
<div
v-for="account in comparison.differences.accounts.missing.filter(a => a.did)"
:key="account.id"
v-for="did in comparison.differences.accounts.missing.filter(a => a)"
:key="did"
class="text-xs text-gray-600 bg-gray-50 p-2 rounded"
>
<div class="font-medium">ID: {{ account.id }}</div>
<div class="text-gray-500">{{ account.did }}</div>
<div class="text-gray-400">Created: {{ account.dateCreated }}</div>
<div class="text-gray-400">Has Identity: {{ getAccountHasIdentity(account) ? 'Yes' : 'No' }}</div>
<div class="text-gray-400">Has Mnemonic: {{ getAccountHasMnemonic(account) ? 'Yes' : 'No' }}</div>
<div class="text-gray-500">{{ did }}</div>
</div>
</div>
</div>
@@ -647,6 +643,23 @@
}}</span>
</div>
<div
class="flex items-center justify-between p-3 bg-yellow-50 rounded-lg"
>
<div class="flex items-center">
<IconRenderer
icon-name="check"
svg-class="h-5 w-5 text-yellow-600 mr-2"
/>
<span class="text-sm font-medium text-yellow-900"
>Unmodified</span
>
</div>
<span class="text-sm font-bold text-yellow-900">{{
comparison.differences.settings.unmodified.length
}}</span>
</div>
<div
class="flex items-center justify-between p-3 bg-red-50 rounded-lg"
>
@@ -707,6 +720,27 @@
</div>
</div>
<!-- Unmodified Settings -->
<div
v-if="comparison.differences.settings.unmodified.length > 0"
class="mt-4"
>
<h4 class="text-sm font-medium text-gray-900 mb-2">
Unmodified Settings ({{ comparison.differences.settings.unmodified.length }}):
</h4>
</div>
<div class="space-y-1">
<div
v-for="setting in comparison.differences.settings.unmodified"
:key="setting.id"
class="text-xs text-gray-600 bg-gray-50 p-2 rounded"
>
<div class="font-medium">{{ getSettingDisplayName(setting) }}</div>
<div class="text-gray-500">ID: {{ setting.id }}</div>
<div class="text-gray-400">Registered: {{ setting.isRegistered ? 'Yes' : 'No' }}</div>
</div>
</div>
<!-- Keep Settings -->
<div
v-if="comparison.differences.settings.missing.filter(s => s.accountDid || s.activeDid).length > 0"
@@ -770,6 +804,23 @@
}}</span>
</div>
<div
class="flex items-center justify-between p-3 bg-yellow-50 rounded-lg"
>
<div class="flex items-center">
<IconRenderer
icon-name="check"
svg-class="h-5 w-5 text-yellow-600 mr-2"
/>
<span class="text-sm font-medium text-yellow-900"
>Unmodified</span
>
</div>
<span class="text-sm font-bold text-yellow-900">{{
comparison.differences.contacts.unmodified.length
}}</span>
</div>
<div
class="flex items-center justify-between p-3 bg-red-50 rounded-lg"
>
@@ -830,6 +881,27 @@
</div>
</div>
<!-- Unmodified Contacts -->
<div
v-if="comparison.differences.contacts.unmodified.length > 0"
class="mt-4"
>
<h4 class="text-sm font-medium text-gray-900 mb-2">
Unmodified Contacts ({{ comparison.differences.contacts.unmodified.length }}):
</h4>
</div>
<div class="space-y-1">
<div
v-for="contact in comparison.differences.contacts.unmodified"
:key="contact.did"
class="text-xs text-gray-600 bg-gray-50 p-2 rounded"
>
<div class="font-medium">{{ contact.name || '<empty>' }}</div>
<div class="text-gray-500">{{ contact.did }}</div>
<div class="text-gray-400">{{ contact.contactMethods?.length || 0 }} contact methods</div>
</div>
</div>
<!-- Keep Contacts -->
<div
v-if="comparison.differences.contacts.missing.filter(c => c.did).length > 0"
@@ -871,7 +943,6 @@
</template>
<script lang="ts">
import { ref } from "vue";
import { Component, Vue } from "vue-facing-decorator";
import { useClipboard } from "@vueuse/core";
@@ -923,6 +994,7 @@ export default class DatabaseMigration extends Vue {
private cannotfindMainAccount = false;
private downloadSettingsContactsBlob?: Blob;
private downloadMnemonic?: string;
private downloadMnemonicAddress?: string;
private hasMultipleMnemonics = false;
private isLoading = false;
private loadingMessage = "";
@@ -1024,6 +1096,7 @@ export default class DatabaseMigration extends Vue {
}
if (primaryAccount) {
this.downloadMnemonic = primaryAccount.mnemonic;
this.downloadMnemonicAddress = primaryAccount.did;
}
}