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>
|
translate>
|
||||||
Update volume
|
Update volume
|
||||||
</vn-item>
|
</vn-item>
|
||||||
|
<vn-item
|
||||||
|
ng-click="$ctrl.deleteCurrentRoute()"
|
||||||
|
vn-acl="deliveryBoss"
|
||||||
|
vn-acl-action="remove"
|
||||||
|
translate>
|
||||||
|
Delete route
|
||||||
|
</vn-item>
|
||||||
</slot-menu>
|
</slot-menu>
|
||||||
<slot-body>
|
<slot-body>
|
||||||
<div class="attributes">
|
<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() {
|
loadData() {
|
||||||
const filter = {
|
const filter = {
|
||||||
fields: [
|
fields: [
|
||||||
|
|
|
@ -23,4 +23,20 @@ describe('vnRouteDescriptorPopover', () => {
|
||||||
expect(controller.route).toEqual(response);
|
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
|
Show route report: Ver informe de ruta
|
||||||
Update volume: Actualizar volumen
|
Update volume: Actualizar volumen
|
||||||
Volume updated: Volumen actualizado
|
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?
|
Are you sure you want to update the volume?: Estas seguro que quieres actualizar el volumen?
|
Loading…
Reference in New Issue