#769 Log is now a component
This commit is contained in:
parent
a50a98668c
commit
5a52035dac
|
@ -7,83 +7,4 @@
|
|||
data="$ctrl.logs">
|
||||
</vn-crud-model>
|
||||
|
||||
<vn-vertical>
|
||||
<vn-card pad-large>
|
||||
<vn-vertical>
|
||||
<vn-title>History</vn-title>
|
||||
<vn-table model="model">
|
||||
<vn-thead>
|
||||
<vn-tr>
|
||||
<vn-th field="creationDate" default-order="DESC">Date</vn-th>
|
||||
<vn-th field="userFk" class="expendable">Changed by</vn-th>
|
||||
<vn-th field="changedModel" class="expendable">Model</vn-th>
|
||||
<vn-th field="action" class="expendable">Action</vn-th>
|
||||
<vn-th field="changedModelValue" class="expendable">Instance</vn-th>
|
||||
<vn-th>Before</vn-th>
|
||||
<vn-th>After</vn-th>
|
||||
</vn-tr>
|
||||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<vn-tr ng-repeat="clientLog in $ctrl.logs">
|
||||
<vn-td>
|
||||
{{::clientLog.creationDate | date:'dd/MM/yyyy HH:mm'}}
|
||||
<div class="changes">
|
||||
<div>
|
||||
<span translate class="label">Changed by</span><span class="label">: </span>
|
||||
<span translate class="value">{{::clientLog.user.name}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span translate class="label">Model</span><span class="label">: </span>
|
||||
<span translate class="value">{{::clientLog.changedModel}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span translate class="label">Action</span><span class="label">: </span>
|
||||
<span translate class="value">{{::clientLog.action}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span translate class="label">Instance</span><span class="label">: </span>
|
||||
<span translate class="value">{{::clientLog.changedModelValue}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</vn-td>
|
||||
<vn-td class="expendable">
|
||||
{{::clientLog.user.name}}
|
||||
</vn-td>
|
||||
<vn-td class="expendable">
|
||||
{{::clientLog.changedModel}}
|
||||
</vn-td>
|
||||
<vn-td translate class="expendable">
|
||||
{{::clientLog.action}}
|
||||
</vn-td>
|
||||
<vn-td class="expendable">
|
||||
{{::clientLog.changedModelValue}}
|
||||
</vn-td>
|
||||
<vn-td class="before">
|
||||
<vn-one ng-repeat="old in clientLog.oldProperties">
|
||||
<div>
|
||||
<span translate class="label">{{::old.key}}</span><span class="label">: </span>
|
||||
<span translate class="value">{{::old.value}}</span>
|
||||
</div>
|
||||
</vn-one>
|
||||
</vn-td>
|
||||
<vn-td class="after">
|
||||
<vn-one ng-repeat="new in clientLog.newProperties">
|
||||
<div>
|
||||
<span translate class="label">{{::new.key}}</span><span class="label">: </span>
|
||||
<span translate class="value">{{::new.value}}</span>
|
||||
</div>
|
||||
</vn-one>
|
||||
</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
<vn-empty-rows ng-if="model.data.length === 0" translate>
|
||||
No results
|
||||
</vn-empty-rows>
|
||||
</vn-table>
|
||||
</vn-vertical>
|
||||
<vn-pagination
|
||||
model="model"
|
||||
scroll-selector="ui-view">
|
||||
</vn-pagination>
|
||||
</vn-card>
|
||||
</vn-vertical>
|
||||
<vn-log model="model"></vn-log>
|
|
@ -1,5 +1,4 @@
|
|||
import ngModule from '../module';
|
||||
import './style.scss';
|
||||
|
||||
class Controller {
|
||||
constructor($scope, $stateParams) {
|
||||
|
@ -22,18 +21,17 @@ class Controller {
|
|||
set logs(value) {
|
||||
this._logs = value;
|
||||
|
||||
if (this.logs) {
|
||||
this.logs.forEach((log) => {
|
||||
if (this.logs)
|
||||
this.logs.forEach(log => {
|
||||
log.oldProperties = this.getInstance(log.oldInstance);
|
||||
log.newProperties = this.getInstance(log.newInstance);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
getInstance(instance) {
|
||||
const properties = [];
|
||||
|
||||
Object.keys(instance).forEach((property) => {
|
||||
Object.keys(instance).forEach(property => {
|
||||
properties.push({key: property, value: instance[property]});
|
||||
});
|
||||
|
||||
|
|
|
@ -42,3 +42,4 @@ import './chip';
|
|||
import './input-number';
|
||||
import './input-time';
|
||||
import './fetched-tags';
|
||||
import './log';
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
<vn-vertical>
|
||||
<vn-card pad-large>
|
||||
<vn-vertical>
|
||||
<vn-title>History</vn-title>
|
||||
<vn-table model="$ctrl.model">
|
||||
<vn-thead>
|
||||
<vn-tr>
|
||||
<vn-th field="creationDate" default-order="DESC">Date</vn-th>
|
||||
<vn-th field="userFk" class="expendable">Changed by</vn-th>
|
||||
<vn-th field="changedModel" class="expendable">Model</vn-th>
|
||||
<vn-th field="action" class="expendable">Action</vn-th>
|
||||
<vn-th field="changedModelValue" class="expendable">Instance</vn-th>
|
||||
<vn-th>Before</vn-th>
|
||||
<vn-th>After</vn-th>
|
||||
</vn-tr>
|
||||
</vn-thead>
|
||||
<vn-tbody>
|
||||
<vn-tr ng-repeat="log in $ctrl.model.data">
|
||||
<vn-td>
|
||||
{{::log.creationDate | date:'dd/MM/yyyy HH:mm'}}
|
||||
<div class="changes">
|
||||
<div>
|
||||
<span translate class="label">Changed by</span><span class="label">: </span>
|
||||
<span translate class="value">{{::log.user.name}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span translate class="label">Model</span><span class="label">: </span>
|
||||
<span translate class="value">{{::log.changedModel}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span translate class="label">Action</span><span class="label">: </span>
|
||||
<span translate class="value">{{::log.action}}</span>
|
||||
</div>
|
||||
<div>
|
||||
<span translate class="label">Instance</span><span class="label">: </span>
|
||||
<span translate class="value">{{::log.changedModelValue}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</vn-td>
|
||||
<vn-td class="expendable">
|
||||
{{::log.user.name}}
|
||||
</vn-td>
|
||||
<vn-td class="expendable">
|
||||
{{::log.changedModel}}
|
||||
</vn-td>
|
||||
<vn-td translate class="expendable">
|
||||
{{::log.action}}
|
||||
</vn-td>
|
||||
<vn-td class="expendable">
|
||||
{{::log.changedModelValue}}
|
||||
</vn-td>
|
||||
<vn-td class="before">
|
||||
<vn-one ng-repeat="old in log.oldProperties">
|
||||
<div>
|
||||
<span translate class="label">{{::old.key}}</span><span class="label">: </span>
|
||||
<span translate class="value">{{::old.value}}</span>
|
||||
</div>
|
||||
</vn-one>
|
||||
</vn-td>
|
||||
<vn-td class="after">
|
||||
<vn-one ng-repeat="new in log.newProperties">
|
||||
<div>
|
||||
<span translate class="label">{{::new.key}}</span><span class="label">: </span>
|
||||
<span translate class="value">{{::new.value}}</span>
|
||||
</div>
|
||||
</vn-one>
|
||||
</vn-td>
|
||||
</vn-tr>
|
||||
</vn-tbody>
|
||||
<vn-empty-rows ng-if="$ctrl.model.data.length === 0" translate>
|
||||
No results
|
||||
</vn-empty-rows>
|
||||
</vn-table>
|
||||
</vn-vertical>
|
||||
<vn-pagination
|
||||
model="$ctrl.model"
|
||||
scroll-selector="ui-view">
|
||||
</vn-pagination>
|
||||
</vn-card>
|
||||
</vn-vertical>
|
|
@ -0,0 +1,9 @@
|
|||
import ngModule from '../../module';
|
||||
import './style.scss';
|
||||
|
||||
ngModule.component('vnLog', {
|
||||
template: require('./index.html'),
|
||||
bindings: {
|
||||
model: '<'
|
||||
}
|
||||
});
|
|
@ -1,6 +1,6 @@
|
|||
@import 'colors';
|
||||
|
||||
vn-client-log {
|
||||
vn-log {
|
||||
vn-td {
|
||||
vertical-align: initial !important;
|
||||
}
|
Loading…
Reference in New Issue