Skip to content

Commit

Permalink
Merge pull request #963 from geonetwork/ME/success-notification-delete
Browse files Browse the repository at this point in the history
[Editor]: Add a success notification when a record is deleted
  • Loading branch information
cmoinier authored Aug 21, 2024
2 parents 3c29707 + 751ecdc commit d5b28b1
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/metadata-editor-e2e/src/e2e/delete.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ describe('delete', () => {
cy.get('[data-cy="table-row"]')
.contains('My new record')
.should('have.length', 0)
cy.get('gn-ui-notification').should('contain', 'Delete success')
cy.get('[data-cy="dashboard-drafts-count"]').should('contain', '0')
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ describe('ResultsTableContainerComponent', () => {
expect(recordsRepository.deleteRecord).toHaveBeenCalled()
expect(recordsRepository.clearRecordDraft).toHaveBeenCalled()
expect(searchFacade.requestNewResults).toHaveBeenCalled()
expect(notificationsService.showNotification).toHaveBeenCalledWith(
{
type: 'success',
title: 'editor.record.deleteSuccess.title',
text: 'editor.record.deleteSuccess.body',
},
2500
)
})
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ export class ResultsTableContainerComponent implements OnDestroy {
next: () => {
this.recordsRepository.clearRecordDraft(uniqueIdentifier)
this.searchFacade.requestNewResults()
this.notificationsService.showNotification(
{
type: 'success',
title: this.translateService.instant(
'editor.record.deleteSuccess.title'
),
text: `${this.translateService.instant(
'editor.record.deleteSuccess.body'
)}`,
},
2500
)
},
error: (error) => {
this.notificationsService.showNotification({
Expand Down
2 changes: 2 additions & 0 deletions translations/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@
"editor.record.deleteError.body": "Der Datensatz konnte nicht gelöscht werden:",
"editor.record.deleteError.closeMessage": "Verstanden",
"editor.record.deleteError.title": "Fehler beim Löschen des Datensatzes",
"editor.record.deleteSuccess.body": "",
"editor.record.deleteSuccess.title": "",
"editor.record.form.bottomButtons.comeBackLater": "",
"editor.record.form.bottomButtons.next": "",
"editor.record.form.bottomButtons.previous": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@
"editor.record.deleteError.body": "The record could not be deleted:",
"editor.record.deleteError.closeMessage": "Understood",
"editor.record.deleteError.title": "Error deleting record",
"editor.record.deleteSuccess.body": "The record was successfully deleted !",
"editor.record.deleteSuccess.title": "Delete success",
"editor.record.form.bottomButtons.comeBackLater": "Come back later",
"editor.record.form.bottomButtons.next": "Next",
"editor.record.form.bottomButtons.previous": "Previous",
Expand Down
2 changes: 2 additions & 0 deletions translations/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@
"editor.record.deleteError.body": "",
"editor.record.deleteError.closeMessage": "",
"editor.record.deleteError.title": "",
"editor.record.deleteSuccess.body": "",
"editor.record.deleteSuccess.title": "",
"editor.record.form.bottomButtons.comeBackLater": "",
"editor.record.form.bottomButtons.next": "",
"editor.record.form.bottomButtons.previous": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@
"editor.record.deleteError.body": "La fiche n'a pas pu être supprimée :",
"editor.record.deleteError.closeMessage": "Compris",
"editor.record.deleteError.title": "Erreur lors de la suppression",
"editor.record.deleteSuccess.body": "La fiche a bien été supprimée !",
"editor.record.deleteSuccess.title": "Suppression réussie",
"editor.record.form.bottomButtons.comeBackLater": "Revenir plus tard",
"editor.record.form.bottomButtons.next": "Suivant",
"editor.record.form.bottomButtons.previous": "Précédent",
Expand Down
2 changes: 2 additions & 0 deletions translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@
"editor.record.deleteError.body": "",
"editor.record.deleteError.closeMessage": "",
"editor.record.deleteError.title": "",
"editor.record.deleteSuccess.body": "",
"editor.record.deleteSuccess.title": "",
"editor.record.form.bottomButtons.comeBackLater": "",
"editor.record.form.bottomButtons.next": "",
"editor.record.form.bottomButtons.previous": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@
"editor.record.deleteError.body": "",
"editor.record.deleteError.closeMessage": "",
"editor.record.deleteError.title": "",
"editor.record.deleteSuccess.body": "",
"editor.record.deleteSuccess.title": "",
"editor.record.form.bottomButtons.comeBackLater": "",
"editor.record.form.bottomButtons.next": "",
"editor.record.form.bottomButtons.previous": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@
"editor.record.deleteError.body": "",
"editor.record.deleteError.closeMessage": "",
"editor.record.deleteError.title": "",
"editor.record.deleteSuccess.body": "",
"editor.record.deleteSuccess.title": "",
"editor.record.form.bottomButtons.comeBackLater": "",
"editor.record.form.bottomButtons.next": "",
"editor.record.form.bottomButtons.previous": "",
Expand Down
2 changes: 2 additions & 0 deletions translations/sk.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@
"editor.record.deleteError.body": "",
"editor.record.deleteError.closeMessage": "",
"editor.record.deleteError.title": "",
"editor.record.deleteSuccess.body": "",
"editor.record.deleteSuccess.title": "",
"editor.record.form.bottomButtons.comeBackLater": "",
"editor.record.form.bottomButtons.next": "",
"editor.record.form.bottomButtons.previous": "",
Expand Down

0 comments on commit d5b28b1

Please sign in to comment.