From 678a62989308d6228975385ed8d115bb94584119 Mon Sep 17 00:00:00 2001 From: Eric Tendian Date: Wed, 25 Sep 2024 22:16:32 -0500 Subject: [PATCH] Adding confirmations --- app/components/notification-channel-list.js | 5 +++++ .../notification-subscription-list.js | 3 +++ app/components/transcript-search.js | 22 ++++++++++++++----- 3 files changed, 25 insertions(+), 5 deletions(-) diff --git a/app/components/notification-channel-list.js b/app/components/notification-channel-list.js index 6713310..f5f7f77 100644 --- a/app/components/notification-channel-list.js +++ b/app/components/notification-channel-list.js @@ -18,6 +18,11 @@ export default class NotificationChannelListComponent extends Component { @action async deleteChannel(channel) { + if ( + !confirm('Are you sure you want to delete this notification channel?') + ) { + return; + } await channel.destroyRecord(); set(this, 'channels', await this.store.findAll('notification-channel')); } diff --git a/app/components/notification-subscription-list.js b/app/components/notification-subscription-list.js index 15f789e..2f232fa 100644 --- a/app/components/notification-subscription-list.js +++ b/app/components/notification-subscription-list.js @@ -28,6 +28,9 @@ export default class NotificationSubscriptionListComponent extends Component { @action async deleteSubscription(subscription) { + if (!confirm('Are you sure you want to delete this subscription?')) { + return; + } await subscription.destroyRecord(); await this.initData(); } diff --git a/app/components/transcript-search.js b/app/components/transcript-search.js index 7fd2579..94d69c1 100644 --- a/app/components/transcript-search.js +++ b/app/components/transcript-search.js @@ -347,14 +347,20 @@ export default class TranscriptSearchComponent extends Component { getSearchFilters() { const filters = []; - const refinementItems = document.querySelectorAll('.ais-CurrentRefinements-item'); + const refinementItems = document.querySelectorAll( + '.ais-CurrentRefinements-item', + ); for (const item of refinementItems) { - const label = item.querySelector('.ais-CurrentRefinements-label').innerText; + const label = item.querySelector( + '.ais-CurrentRefinements-label', + ).innerText; if (label.startsWith('Call Time')) { continue; } const values = []; - for (const value of item.querySelectorAll('.ais-CurrentRefinements-category .ais-CurrentRefinements-categoryLabel')) { + for (const value of item.querySelectorAll( + '.ais-CurrentRefinements-category .ais-CurrentRefinements-categoryLabel', + )) { values.push(value.innerText); } filters.push(`${label} ${values.join(', ')}`); @@ -386,9 +392,15 @@ export default class TranscriptSearchComponent extends Component { async updateSavedSearch(search) { const filters = this.getSearchFilters(); if (!filters) { - alert('No filters to save, make sure to open the saved search and then choose new filters before updating.'); + alert( + 'No filters to save, make sure to open the saved search and then choose new filters before updating.', + ); } - const shouldUpdate = confirm('New filters:\n' + filters.join('\n') + '\n\nAre you sure you want to update this search?'); + const shouldUpdate = confirm( + 'New filters:\n' + + filters.join('\n') + + '\n\nAre you sure you want to update this search?', + ); if (shouldUpdate) { search.url = this.createSavedSearchUrl(); search.save();