From 7fd220c177ea32435c020fd55f5cbba50a889d0e Mon Sep 17 00:00:00 2001 From: Sivin Varghese <64252451+iamsivin@users.noreply.github.com> Date: Thu, 8 Jun 2023 21:25:51 +0530 Subject: [PATCH] feat: Adds the ability to edit saved segments (#7254) * feat: Ability to edit saved filters * chore: Adds edit contact segment * chore: Minor fixes * fix: code climate * chore: Minor fixes * chore: Adds ability to custom view name * chore: Minor fixes * chore: Adds spec for helper * chore: Revert contact filter to split to new PR * Delete editSegmentMixin.js * chore: Revert fixes * Update app/javascript/dashboard/i18n/locale/en/advancedFilters.json Co-authored-by: Shivam Mishra * Update app/javascript/dashboard/i18n/locale/en/advancedFilters.json Co-authored-by: Shivam Mishra * chore: Moved from mixin to helper for reusing in segments * Delete editFolderMixin.js * chore: Fix specs and added new specs * chore: review comment fixes * chore: Minor fixes * fix: Not resetting applied filter * feat: Adds the ability to edit saved segments * feat: Adds specs for API part --------- Co-authored-by: Shivam Mishra --- .../dashboard/i18n/locale/en/contact.json | 1 + .../i18n/locale/en/contactFilters.json | 5 + .../components/ContactsAdvancedFilters.vue | 98 ++++++++++++++++--- .../contacts/components/ContactsView.vue | 77 ++++++++++++++- .../dashboard/contacts/components/Header.vue | 30 ++++-- 5 files changed, 184 insertions(+), 27 deletions(-) diff --git a/app/javascript/dashboard/i18n/locale/en/contact.json b/app/javascript/dashboard/i18n/locale/en/contact.json index 4d1736ed0..042a1c1fc 100644 --- a/app/javascript/dashboard/i18n/locale/en/contact.json +++ b/app/javascript/dashboard/i18n/locale/en/contact.json @@ -211,6 +211,7 @@ "FILTER_CONTACTS": "Filter", "FILTER_CONTACTS_SAVE": "Save filter", "FILTER_CONTACTS_DELETE": "Delete filter", + "FILTER_CONTACTS_EDIT": "Edit segment", "LIST": { "LOADING_MESSAGE": "Loading contacts...", "404": "No contacts matches your search 🔍", diff --git a/app/javascript/dashboard/i18n/locale/en/contactFilters.json b/app/javascript/dashboard/i18n/locale/en/contactFilters.json index 207381e12..09a543984 100644 --- a/app/javascript/dashboard/i18n/locale/en/contactFilters.json +++ b/app/javascript/dashboard/i18n/locale/en/contactFilters.json @@ -2,13 +2,18 @@ "CONTACTS_FILTER": { "TITLE": "Filter Contacts", "SUBTITLE": "Add filters below and hit 'Submit' to filter contacts.", + "EDIT_CUSTOM_SEGMENT": "Edit Segment", + "CUSTOM_VIEWS_SUBTITLE": "Add or remove filters and update your segment.", "ADD_NEW_FILTER": "Add Filter", "CLEAR_ALL_FILTERS": "Clear All Filters", "FILTER_DELETE_ERROR": "You should have atleast one filter to save", "SUBMIT_BUTTON_LABEL": "Submit", + "UPDATE_BUTTON_LABEL": "Update Segment", "CANCEL_BUTTON_LABEL": "Cancel", "CLEAR_BUTTON_LABEL": "Clear Filters", "EMPTY_VALUE_ERROR": "Value is required", + "SEGMENT_LABEL": "Segment Name", + "SEGMENT_QUERY_LABEL": "Segment Query", "TOOLTIP_LABEL": "Filter contacts", "QUERY_DROPDOWN_LABELS": { "AND": "AND", diff --git a/app/javascript/dashboard/routes/dashboard/contacts/components/ContactsAdvancedFilters.vue b/app/javascript/dashboard/routes/dashboard/contacts/components/ContactsAdvancedFilters.vue index 3e988e0a4..d214a7b01 100644 --- a/app/javascript/dashboard/routes/dashboard/contacts/components/ContactsAdvancedFilters.vue +++ b/app/javascript/dashboard/routes/dashboard/contacts/components/ContactsAdvancedFilters.vue @@ -1,9 +1,25 @@