|
@ -1,11 +1,25 @@ |
|
|
<template> |
|
|
<template> |
|
|
<QuickNav selected="Contacts"></QuickNav> |
|
|
<QuickNav selected="Contacts"></QuickNav> |
|
|
<section id="Content" class="p-6 pb-24 max-w-3xl mx-auto"> |
|
|
<section id="Content" class="p-6 pb-24 max-w-3xl mx-auto"> |
|
|
|
|
|
<!-- Back --> |
|
|
|
|
|
<div class="text-lg text-center font-light relative px-7"> |
|
|
|
|
|
<h1 |
|
|
|
|
|
class="text-lg text-center px-2 py-1 absolute -left-2 -top-1" |
|
|
|
|
|
@click="$router.back()" |
|
|
|
|
|
> |
|
|
|
|
|
<fa icon="chevron-left" class="fa-fw"></fa> |
|
|
|
|
|
</h1> |
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
<!-- Heading --> |
|
|
<!-- Heading --> |
|
|
<h1 id="ViewHeading" class="text-4xl text-center font-light pt-4 mb-8"> |
|
|
<h1 id="ViewHeading" class="text-4xl text-center font-light pt-4 mb-8"> |
|
|
Contact Import |
|
|
Contact Import |
|
|
</h1> |
|
|
</h1> |
|
|
|
|
|
|
|
|
|
|
|
<span> |
|
|
|
|
|
Note that you will have to make them visible one-by-one in the list of |
|
|
|
|
|
Contacts. |
|
|
|
|
|
</span> |
|
|
<div v-if="sameCount > 0"> |
|
|
<div v-if="sameCount > 0"> |
|
|
{{ sameCount }} contact{{ sameCount == 1 ? "" : "s" }} are the same as |
|
|
{{ sameCount }} contact{{ sameCount == 1 ? "" : "s" }} are the same as |
|
|
existing contacts. |
|
|
existing contacts. |
|
@ -56,7 +70,7 @@ |
|
|
<fa icon="spinner" v-if="importing" class="animate-spin" /> |
|
|
<fa icon="spinner" v-if="importing" class="animate-spin" /> |
|
|
<button |
|
|
<button |
|
|
v-else |
|
|
v-else |
|
|
class="text-sm bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-2 py-1.5 rounded-l-md" |
|
|
class="bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-sm text-white mt-2 px-2 py-1.5 rounded" |
|
|
@click="importContacts" |
|
|
@click="importContacts" |
|
|
> |
|
|
> |
|
|
Import Selected Contacts |
|
|
Import Selected Contacts |
|
@ -146,13 +160,14 @@ export default class ContactImportView extends Vue { |
|
|
updatedCount = 0; |
|
|
updatedCount = 0; |
|
|
for (let i = 0; i < this.contactsImporting.length; i++) { |
|
|
for (let i = 0; i < this.contactsImporting.length; i++) { |
|
|
if (this.contactsSelected[i]) { |
|
|
if (this.contactsSelected[i]) { |
|
|
const contact = R.clone(this.contactsImporting[i]); // cloning to avoid the problem with a Proxy object |
|
|
const contact = this.contactsImporting[i]; |
|
|
const existingContact = this.contactsExisting[contact.did]; |
|
|
const existingContact = this.contactsExisting[contact.did]; |
|
|
if (existingContact) { |
|
|
if (existingContact) { |
|
|
await db.contacts.update(contact.did, contact); |
|
|
await db.contacts.update(contact.did, contact); |
|
|
updatedCount++; |
|
|
updatedCount++; |
|
|
} else { |
|
|
} else { |
|
|
await db.contacts.add(contact); |
|
|
// without explicit clone on the Proxy, we get: DataCloneError: Failed to execute 'add' on 'IDBObjectStore': #<Object> could not be cloned. |
|
|
|
|
|
await db.contacts.add(R.clone(contact)); |
|
|
importedCount++; |
|
|
importedCount++; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|