Merge pull request '2657-zone_log' (#472) from 2657-zone_log into dev
gitea/salix/pipeline/head This commit looks good Details

Reviewed-on: #472
Reviewed-by: Joan Sanchez <joan@verdnatura.es>
This commit is contained in:
Joan Sanchez 2020-12-29 13:32:05 +00:00
commit beb6c85d58
11 changed files with 115 additions and 9 deletions

View File

@ -0,0 +1,18 @@
CREATE TABLE `vn`.`zoneLog` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`originFk` int(10) NOT NULL,
`userFk` int(10) unsigned DEFAULT NULL,
`action` set('insert','update','delete') COLLATE utf8_unicode_ci NOT NULL,
`creationDate` timestamp NULL DEFAULT current_timestamp(),
`description` text CHARACTER SET utf8 DEFAULT NULL,
`changedModel` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
`oldInstance` text COLLATE utf8_unicode_ci DEFAULT NULL,
`newInstance` text COLLATE utf8_unicode_ci DEFAULT NULL,
`changedModelId` int(11) DEFAULT NULL,
`changedModelValue` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `originFk` (`originFk`),
KEY `userFk` (`userFk`),
CONSTRAINT `zoneLog_ibfk_1` FOREIGN KEY (`originFk`) REFERENCES `vn`.`zone` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `zoneLog_ibfk_2` FOREIGN KEY (`userFk`) REFERENCES `account`.`user` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

View File

@ -31,5 +31,8 @@
}, },
"ZoneEstimatedDelivery": { "ZoneEstimatedDelivery": {
"dataSource": "vn" "dataSource": "vn"
},
"ZoneLog": {
"dataSource": "vn"
} }
} }

View File

@ -1,6 +1,10 @@
{ {
"name": "ZoneEvent", "name": "ZoneEvent",
"base": "VnModel", "base": "Loggable",
"log": {
"model":"ZoneLog",
"relation": "zone"
},
"options": { "options": {
"mysql": { "mysql": {
"table": "zoneEvent" "table": "zoneEvent"

View File

@ -1,6 +1,11 @@
{ {
"name": "ZoneIncluded", "name": "ZoneIncluded",
"base": "VnModel", "base": "Loggable",
"log": {
"model": "ZoneLog",
"relation": "zone",
"showField": "isIncluded"
},
"options": { "options": {
"mysql": { "mysql": {
"table": "zoneIncluded" "table": "zoneIncluded"

View File

@ -0,0 +1,58 @@
{
"name": "ZoneLog",
"base": "VnModel",
"options": {
"mysql": {
"table": "zoneLog"
}
},
"properties": {
"id": {
"id": true,
"type": "Number",
"forceId": false
},
"originFk": {
"type": "Number",
"required": true
},
"userFk": {
"type": "Number"
},
"action": {
"type": "String",
"required": true
},
"changedModel": {
"type": "String"
},
"oldInstance": {
"type": "Object"
},
"newInstance": {
"type": "Object"
},
"creationDate": {
"type": "Date"
},
"changedModelId": {
"type": "String"
},
"changedModelValue": {
"type": "String"
},
"description": {
"type": "String"
}
},
"relations": {
"user": {
"type": "belongsTo",
"model": "Account",
"foreignKey": "userFk"
}
},
"scope": {
"order": ["creationDate DESC", "id DESC"]
}
}

View File

@ -1,6 +1,10 @@
{ {
"name": "ZoneWarehouse", "name": "ZoneWarehouse",
"base": "VnModel", "base": "Loggable",
"log": {
"model":"ZoneLog",
"relation": "zone"
},
"options": { "options": {
"mysql": { "mysql": {
"table": "zoneWarehouse" "table": "zoneWarehouse"

View File

@ -1,6 +1,10 @@
{ {
"name": "Zone", "name": "Zone",
"base": "VnModel", "base": "Loggable",
"log": {
"model":"ZoneLog",
"showField": "name"
},
"options": { "options": {
"mysql": { "mysql": {
"table": "zone" "table": "zone"
@ -39,11 +43,6 @@
} }
}, },
"relations": { "relations": {
"geolocations": {
"type": "hasMany",
"model": "ZoneGeo",
"foreignKey": "zoneFk"
},
"agencyMode": { "agencyMode": {
"type": "belongsTo", "type": "belongsTo",
"model": "AgencyMode", "model": "AgencyMode",

View File

@ -16,3 +16,4 @@ import './calendar';
import './location'; import './location';
import './calendar'; import './calendar';
import './upcoming-deliveries'; import './upcoming-deliveries';
import './log';

View File

@ -0,0 +1 @@
<vn-log url="ZoneLogs" origin-id="$ctrl.$params.id"></vn-log>

View File

@ -0,0 +1,7 @@
import ngModule from '../module';
import Section from 'salix/components/section';
ngModule.vnComponent('vnZoneLog', {
template: require('./index.html'),
controller: Section,
});

View File

@ -14,6 +14,7 @@
{"state": "zone.card.basicData", "icon": "settings"}, {"state": "zone.card.basicData", "icon": "settings"},
{"state": "zone.card.location", "icon": "my_location"}, {"state": "zone.card.location", "icon": "my_location"},
{"state": "zone.card.warehouses", "icon": "home"}, {"state": "zone.card.warehouses", "icon": "home"},
{"state": "zone.card.log", "icon": "history"},
{"state": "zone.card.events", "icon": "today"} {"state": "zone.card.events", "icon": "today"}
] ]
}, },
@ -84,6 +85,11 @@
"params": { "params": {
"zone": "$ctrl.zone" "zone": "$ctrl.zone"
} }
}, {
"url" : "/log",
"state": "zone.card.log",
"component": "vn-zone-log",
"description": "Log"
} }
] ]
} }