forked from trent_larson/crowd-funder-for-time-pwa
docs: Update migration status after ContactEditView human testing
- Update CURRENT_MIGRATION_STATUS.md with latest progress (34% complete) - Add ContactEditView.vue to human testing completion list - Update migration-time-tracker.md with testing metrics and progress - Document 7 components now human tested, 25 ready for testing - Update realistic estimates for remaining 60 components Migration Progress: 32/92 components (34%) | Human Tested: 7 components
This commit is contained in:
@@ -435,3 +435,23 @@ export const getVisibilitySuccessMessage = (
|
||||
visible = true,
|
||||
): string =>
|
||||
`${name || "That user"} can ${visible ? "" : "not "}see your activity.`;
|
||||
|
||||
// ContactEditView.vue constants
|
||||
export const NOTIFY_CONTACT_NOT_FOUND = {
|
||||
title: "Contact Not Found",
|
||||
message: "Contact not found with DID",
|
||||
};
|
||||
|
||||
export const NOTIFY_CONTACT_METHODS_UPDATED = {
|
||||
title: "Contact Methods Updated",
|
||||
message: "Contact methods updated. Note that some methods have been updated, such as uppercasing 'email' to 'EMAIL'. Save again if the changes are acceptable.",
|
||||
};
|
||||
|
||||
export const NOTIFY_CONTACT_SAVED = {
|
||||
title: "Contact Saved",
|
||||
message: "Contact saved successfully",
|
||||
};
|
||||
|
||||
// Dynamic message template for contact not found (used in ContactEditView.vue)
|
||||
export const createContactNotFoundMessage = (did: string): string =>
|
||||
`${NOTIFY_CONTACT_NOT_FOUND.message} ${did}`;
|
||||
|
||||
@@ -139,9 +139,13 @@ import { RouteLocationNormalizedLoaded, Router } from "vue-router";
|
||||
import QuickNav from "../components/QuickNav.vue";
|
||||
import TopMessage from "../components/TopMessage.vue";
|
||||
import { NotificationIface } from "../constants/app";
|
||||
import * as databaseUtil from "../db/databaseUtil";
|
||||
import { parseJsonField } from "../db/databaseUtil";
|
||||
import { PlatformServiceFactory } from "../services/PlatformServiceFactory";
|
||||
import { PlatformServiceMixin } from "../utils/PlatformServiceMixin";
|
||||
import { createNotifyHelpers, TIMEOUTS } from "../utils/notify";
|
||||
import {
|
||||
NOTIFY_CONTACT_NOT_FOUND,
|
||||
NOTIFY_CONTACT_METHODS_UPDATED,
|
||||
NOTIFY_CONTACT_SAVED
|
||||
} from "../constants/notifications";
|
||||
import { Contact, ContactMethod } from "../db/tables/contacts";
|
||||
import { AppString } from "../constants/app";
|
||||
|
||||
@@ -156,7 +160,7 @@ import { AppString } from "../constants/app";
|
||||
*
|
||||
* Workflow:
|
||||
* 1. Component loads with DID from route params
|
||||
* 2. Fetches existing contact data from IndexedDB
|
||||
* 2. Fetches existing contact data from database via PlatformServiceMixin
|
||||
* 3. Presents editable form with current values
|
||||
* 4. Validates and saves updates back to database
|
||||
*
|
||||
@@ -181,6 +185,7 @@ import { AppString } from "../constants/app";
|
||||
QuickNav,
|
||||
TopMessage,
|
||||
},
|
||||
mixins: [PlatformServiceMixin],
|
||||
})
|
||||
export default class ContactEditView extends Vue {
|
||||
/** Notification function injected by Vue */
|
||||
@@ -190,6 +195,9 @@ export default class ContactEditView extends Vue {
|
||||
/** Router instance for navigation */
|
||||
$router!: Router;
|
||||
|
||||
/** Notification helpers */
|
||||
notify!: ReturnType<typeof createNotifyHelpers>;
|
||||
|
||||
/** Current contact data */
|
||||
contact: Contact | undefined = {
|
||||
did: "",
|
||||
@@ -213,7 +221,7 @@ export default class ContactEditView extends Vue {
|
||||
*
|
||||
* Workflow:
|
||||
* 1. Extracts DID from route parameters
|
||||
* 2. Queries database for existing contact
|
||||
* 2. Queries database for existing contact via PlatformServiceMixin
|
||||
* 3. Populates form fields with contact data
|
||||
* 4. Handles missing contact error case
|
||||
*
|
||||
@@ -222,28 +230,18 @@ export default class ContactEditView extends Vue {
|
||||
* @emits Router navigation on error
|
||||
*/
|
||||
async created() {
|
||||
const contactDid = this.$route.params.did;
|
||||
const platformService = PlatformServiceFactory.getInstance();
|
||||
const dbContact = await platformService.dbQuery(
|
||||
"SELECT * FROM contacts WHERE did = ?",
|
||||
[contactDid],
|
||||
);
|
||||
const contact: Contact | undefined = databaseUtil.mapQueryResultToValues(
|
||||
dbContact,
|
||||
)[0] as unknown as Contact;
|
||||
contact.contactMethods = parseJsonField(contact?.contactMethods, []);
|
||||
this.notify = createNotifyHelpers(this.$notify);
|
||||
|
||||
const contactDid = this.$route.params.did as string;
|
||||
const contact = await this.$getContact(contactDid);
|
||||
|
||||
if (contact) {
|
||||
this.contact = contact;
|
||||
this.contactName = contact.name || "";
|
||||
this.contactNotes = contact.notes || "";
|
||||
this.contactMethods = contact.contactMethods || [];
|
||||
} else {
|
||||
this.$notify({
|
||||
group: "alert",
|
||||
type: "danger",
|
||||
title: "Contact Not Found",
|
||||
text: "There is no contact with DID " + contactDid,
|
||||
});
|
||||
this.notify.error(`${NOTIFY_CONTACT_NOT_FOUND.message} ${contactDid}`, TIMEOUTS.LONG);
|
||||
(this.$router as Router).push({ path: "/contacts" });
|
||||
return;
|
||||
}
|
||||
@@ -300,7 +298,7 @@ export default class ContactEditView extends Vue {
|
||||
* 1. Clones contact methods array to prevent reference issues
|
||||
* 2. Normalizes method types to uppercase
|
||||
* 3. Checks for changes in method types
|
||||
* 4. Updates database with new values
|
||||
* 4. Updates database with new values via PlatformServiceMixin
|
||||
* 5. Notifies user of success
|
||||
* 6. Redirects to contact detail view
|
||||
*
|
||||
@@ -320,38 +318,25 @@ export default class ContactEditView extends Vue {
|
||||
// Check for type changes
|
||||
if (!R.equals(contactMethodsObj, contactMethods)) {
|
||||
this.contactMethods = contactMethods;
|
||||
this.$notify(
|
||||
{
|
||||
group: "alert",
|
||||
type: "warning",
|
||||
title: "Contact Methods Updated",
|
||||
text: "Note that some methods have been updated, such as uppercasing 'email' to 'EMAIL'. Save again if the changes are acceptable.",
|
||||
},
|
||||
15000,
|
||||
this.notify.warning(
|
||||
NOTIFY_CONTACT_METHODS_UPDATED.message,
|
||||
TIMEOUTS.LONG
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Save to database
|
||||
const platformService = PlatformServiceFactory.getInstance();
|
||||
const contactMethodsString = JSON.stringify(contactMethods);
|
||||
await platformService.dbExec(
|
||||
"UPDATE contacts SET name = ?, notes = ?, contactMethods = ? WHERE did = ?",
|
||||
[
|
||||
this.contactName,
|
||||
this.contactNotes,
|
||||
contactMethodsString,
|
||||
this.contact?.did || "",
|
||||
],
|
||||
// Save to database via PlatformServiceMixin
|
||||
await this.$updateContact(
|
||||
this.contact?.did || "",
|
||||
{
|
||||
name: this.contactName,
|
||||
notes: this.contactNotes,
|
||||
contactMethods: contactMethods
|
||||
}
|
||||
);
|
||||
|
||||
// Notify success and redirect
|
||||
this.$notify({
|
||||
group: "alert",
|
||||
type: "success",
|
||||
title: "Contact Saved",
|
||||
text: "The contact info has been updated successfully.",
|
||||
});
|
||||
this.notify.success(NOTIFY_CONTACT_SAVED.message, TIMEOUTS.STANDARD);
|
||||
(this.$router as Router).push({
|
||||
path: "/did/" + encodeURIComponent(this.contact?.did || ""),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user