Merge pull request 'Closes #4767 - route.index delete route' (!1154) from 4767-route.index-delete-route into dev
gitea/salix/pipeline/head This commit looks good
Details
gitea/salix/pipeline/head This commit looks good
Details
Reviewed-on: #1154 Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
commit
6711593a87
|
@ -20,6 +20,13 @@
|
|||
translate>
|
||||
Update volume
|
||||
</vn-item>
|
||||
<vn-item
|
||||
ng-click="$ctrl.deleteCurrentRoute()"
|
||||
vn-acl="deliveryBoss"
|
||||
vn-acl-action="remove"
|
||||
translate>
|
||||
Delete route
|
||||
</vn-item>
|
||||
</slot-menu>
|
||||
<slot-body>
|
||||
<div class="attributes">
|
||||
|
|
|
@ -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: [
|
||||
|
|
|
@ -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');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -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?
|
Loading…
Reference in New Issue