diff --git a/modules/route/front/descriptor/index.js b/modules/route/front/descriptor/index.js
index 2dc512b67..aa47044b1 100644
--- a/modules/route/front/descriptor/index.js
+++ b/modules/route/front/descriptor/index.js
@@ -34,6 +34,14 @@ class Controller extends Descriptor {
});
}
+ deleteCurrentRoute() {
+ this.$http.delete(`Routes/${this.id}`)
+ .then(() => {
+ this.vnApp.showSuccess(this.$t('Route deleted'));
+ this.$state.go('route.index');
+ });
+ }
+
loadData() {
const filter = {
fields: [
diff --git a/modules/route/front/descriptor/index.spec.js b/modules/route/front/descriptor/index.spec.js
index ab996d9b0..f43666c8b 100644
--- a/modules/route/front/descriptor/index.spec.js
+++ b/modules/route/front/descriptor/index.spec.js
@@ -23,4 +23,20 @@ describe('vnRouteDescriptorPopover', () => {
expect(controller.route).toEqual(response);
});
});
+
+ describe('deleteCurrentRoute()', () => {
+ it(`should perform a delete query to delete the current route`, () => {
+ const id = 1;
+
+ jest.spyOn(controller.vnApp, 'showSuccess');
+
+ controller._id = id;
+ $httpBackend.expectDELETE(`Routes/${id}`).respond(200);
+ controller.deleteCurrentRoute();
+ $httpBackend.flush();
+
+ expect(controller.route).toBeUndefined();
+ expect(controller.vnApp.showSuccess).toHaveBeenCalledWith('Route deleted');
+ });
+ });
});
diff --git a/modules/route/front/descriptor/locale/es.yml b/modules/route/front/descriptor/locale/es.yml
index 63fa7202b..23068fbf8 100644
--- a/modules/route/front/descriptor/locale/es.yml
+++ b/modules/route/front/descriptor/locale/es.yml
@@ -4,4 +4,6 @@ Send route report: Enviar informe de ruta
Show route report: Ver informe de ruta
Update volume: Actualizar volumen
Volume updated: Volumen actualizado
+Delete route: Borrar ruta
+Route deleted: Ruta borrada
Are you sure you want to update the volume?: Estas seguro que quieres actualizar el volumen?
\ No newline at end of file