Skip to content

Commit

Permalink
Adding confirmations
Browse files Browse the repository at this point in the history
  • Loading branch information
EricTendian committed Sep 26, 2024
1 parent 879c1ac commit 678a629
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
5 changes: 5 additions & 0 deletions app/components/notification-channel-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
Expand Down
3 changes: 3 additions & 0 deletions app/components/notification-subscription-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down
22 changes: 17 additions & 5 deletions app/components/transcript-search.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ')}`);
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 678a629

Please sign in to comment.