Zone.getLeaves() refactor
gitea/salix/master This commit looks good Details

This commit is contained in:
Juan Ferrer 2019-09-19 17:49:46 +02:00
parent 05fec10cf2
commit 40c555702d
3 changed files with 8 additions and 10 deletions

View File

@ -4,9 +4,10 @@ module.exports = Self => {
description: 'Returns the nodes for a zone',
accepts: [
{
arg: 'zoneFk',
arg: 'id',
type: 'Number',
required: true,
http: {source: 'path'},
required: true
}, {
arg: 'parentFk',
type: 'Number',
@ -22,15 +23,15 @@ module.exports = Self => {
root: true
},
http: {
path: `/getLeaves`,
path: `/:id/getLeaves`,
verb: 'GET'
}
});
Self.getLeaves = async(zoneFk, parentFk = null, search) => {
Self.getLeaves = async(id, parentFk = null, search) => {
let [res] = await Self.rawSql(
`CALL zone_getLeaves(?, ?, ?)`,
[zoneFk, parentFk, search]
[id, parentFk, search]
);
let map = new Map();

View File

@ -1,8 +1,7 @@
<vn-crud-model
vn-id="model"
url="/agency/api/Zones/getLeaves"
url="/api/Zones/{{$ctrl.$stateParams.id}}/getLeaves"
filter="::$ctrl.filter"
params="{zoneFk: $ctrl.$stateParams.id}"
auto-load="false">
</vn-crud-model>
<div class="main-with-right-menu">

View File

@ -2,11 +2,9 @@ import ngModule from '../module';
class Controller {
constructor($, $http, $stateParams) {
this.$stateParams = $stateParams;
this.$ = $;
this.$http = $http;
this.searchValue = '';
this.filter = {};
this.$stateParams = $stateParams;
}
onSearch(params) {