Merge pull request 'refs #5667 UI improved, filter by record' (!1600) from test into dev
gitea/salix/pipeline/head There was a failure building this commit Details

Reviewed-on: #1600
This commit is contained in:
Juan Ferrer 2023-06-09 06:31:47 +00:00
commit d083ba795d
9 changed files with 76 additions and 46 deletions

View File

@ -1,4 +1,11 @@
@import "./variables";
@import "./effects";
@mixin mobile {
@media screen and (max-width: $mobile-width) {
@content;
}
}
@mixin browser($browser) { @mixin browser($browser) {
html[data-browser*="#{$browser}"] & { html[data-browser*="#{$browser}"] & {
@content; @content;

View File

@ -1,5 +1,3 @@
@import "./util";
$font-size: 11pt; $font-size: 11pt;
$menu-width: 256px; $menu-width: 256px;
$topbar-height: 56px; $topbar-height: 56px;

View File

@ -1,4 +1,4 @@
@import "variables"; @import "util";
@keyframes fadein { @keyframes fadein {
from { from {
@ -16,7 +16,7 @@ vn-background {
background-color: black; background-color: black;
z-index: 14; z-index: 14;
@media screen and (max-width: $mobile-width) { @include mobile {
&.shown { &.shown {
display: block; display: block;
opacity: .3; opacity: .3;

View File

@ -1,4 +1,4 @@
@import "effects"; @import "util";
vn-layout { vn-layout {
& > vn-topbar { & > vn-topbar {
@ -134,7 +134,7 @@ vn-layout {
border-radius: 50%; border-radius: 50%;
} }
} }
@media screen and (max-width: $mobile-width) { @include mobile {
& > vn-topbar { & > vn-topbar {
& > .start > .logo { & > .start > .logo {
display: none; display: none;

View File

@ -16,7 +16,7 @@
</vn-crud-model> </vn-crud-model>
<vn-data-viewer <vn-data-viewer
model="model" model="model"
class="vn-w-sm vn-px-sm"> class="vn-w-sm vn-px-sm vn-pb-xl">
<div class="change vn-mb-sm" ng-repeat="log in $ctrl.logs"> <div class="change vn-mb-sm" ng-repeat="log in $ctrl.logs">
<div class="left"> <div class="left">
<vn-avatar class="vn-mt-xs" <vn-avatar class="vn-mt-xs"
@ -33,17 +33,6 @@
</div> </div>
<vn-card class="detail"> <vn-card class="detail">
<div class="header vn-pa-sm"> <div class="header vn-pa-sm">
<div
class="action-date text-secondary text-caption vn-mr-sm"
title="{{::log.creationDate | date:'dd/MM/yyyy HH:mm:ss'}}">
<vn-icon
class="action vn-mr-xs"
ng-class="::$ctrl.actionsClass[log.action]"
icon="{{::$ctrl.actionsIcon[log.action]}}"
translate-attr="::{title: $ctrl.actionsText[log.action]}">
</vn-icon>
{{::$ctrl.relativeDate(log.creationDate)}}
</div>
<div class="action-model"> <div class="action-model">
<span class="model-name" <span class="model-name"
ng-if="::$ctrl.showModelName && log.changedModel" ng-if="::$ctrl.showModelName && log.changedModel"
@ -52,10 +41,26 @@
{{::log.changedModelI18n}} {{::log.changedModelI18n}}
</span> </span>
</div> </div>
<div
class="action-date text-secondary text-caption vn-ml-sm"
title="{{::log.creationDate | date:'dd/MM/yyyy HH:mm:ss'}}">
{{::$ctrl.relativeDate(log.creationDate)}}
<vn-icon
class="action vn-ml-xs"
ng-class="::$ctrl.actionsClass[log.action]"
icon="{{::$ctrl.actionsIcon[log.action]}}"
translate-attr="::{title: $ctrl.actionsText[log.action]}">
</vn-icon>
</div>
</div> </div>
<div class="model vn-pb-sm vn-px-sm" <div class="model vn-pb-sm vn-px-sm"
ng-if="::log.changedModelId || log.changedModelValue"> ng-if="::$ctrl.showModelName">
<span class="model-id" ng-if="::log.changedModelId">#{{::log.changedModelId}}</span> <span class="model-id" ng-if="::log.changedModelId">#{{::log.changedModelId}}</span>
<vn-icon
icon="filter_alt"
translate-attr="{title: 'Show all record changes'}"
ng-click="$ctrl.filterByEntity(log)">
</vn-icon>
<span class="model-value" title="{{::log.changedModelValue}}">{{::log.changedModelValue}}</span> <span class="model-value" title="{{::log.changedModelValue}}">{{::log.changedModelValue}}</span>
</div> </div>
<div class="changes vn-pa-sm" <div class="changes vn-pa-sm"
@ -94,6 +99,13 @@
</div> </div>
</div> </div>
</vn-data-viewer> </vn-data-viewer>
<vn-float-button
ng-if="model.userFilter"
icon="filter_alt_off"
translate-attr="{title: 'Quit filter'}"
ng-click="$ctrl.resetFilter()"
fixed-bottom-right>
</vn-float-button>
<vn-side-menu side="right"> <vn-side-menu side="right">
<form vn-vertical <form vn-vertical
ng-model-options="{updateOn: 'change blur'}" ng-model-options="{updateOn: 'change blur'}"
@ -198,18 +210,6 @@
label="To" label="To"
ng-model="filter.to"> ng-model="filter.to">
</vn-date-picker> </vn-date-picker>
<vn-button-bar vn-vertical>
<vn-button
label="Filter"
ng-click="$ctrl.applyFilter(filter)">
</vn-button>
<vn-button
label="Reset"
class="flat"
ng-click="$ctrl.resetFilter()"
ng-if="model.userFilter">
</vn-button>
</vn-button-bar>
</form> </form>
</vn-side-menu> </vn-side-menu>
<vn-worker-descriptor-popover vn-id="workerDescriptor"> <vn-worker-descriptor-popover vn-id="workerDescriptor">

View File

@ -165,11 +165,10 @@ export default class Controller extends Section {
switch (prop) { switch (prop) {
case 'search': case 'search':
const or = []; const or = [];
if (/^[\w_-]+$/.test(value)) if (/^\s*[0-9]+\s*$/.test(value))
or.push({changedModelId: value}); return {changedModelId: value.trim()};
if (!/^[0-9]+$/.test(value)) else
or.push({changedModelValue: {like: `%${value}%`}}); return {changedModelValue: {like: `%${value}%`}};
return or.length ? {or} : null;
case 'changes': case 'changes':
return {or: [ return {or: [
{oldJson: {like: `%${value}%`}}, {oldJson: {like: `%${value}%`}},
@ -222,6 +221,14 @@ export default class Controller extends Section {
return this.$.model.applyFilter(lbFilter); return this.$.model.applyFilter(lbFilter);
} }
filterByEntity(log) {
this.$.filter = {
who: 'all',
search: log.changedModelId,
changedModel: log.changedModel
};
}
searchUser(search) { searchUser(search) {
if (/^[0-9]+$/.test(search)) { if (/^[0-9]+$/.test(search)) {
return {id: search}; return {id: search};

View File

@ -3,8 +3,8 @@ Concept: Concepto
Search: Buscar Search: Buscar
Search by id or concept: Buscar por identificador o concepto Search by id or concept: Buscar por identificador o concepto
Search by changes: | Search by changes: |
Buscar por cambios realizados. Los atributos deben buscarse por su nombre Buscar por cambios. Los atributos deben buscarse por su nombre interno,
interno, para obtenerlo situar el cursor sobre el nombre. para obtenerlo situar el cursor sobre el atributo.
Entity: Entidad Entity: Entidad
Action: Acción Action: Acción
Author: Autor Author: Autor
@ -16,9 +16,12 @@ Creates: Crea
Edits: Modifica Edits: Modifica
Deletes: Elimina Deletes: Elimina
Accesses: Accede Accesses: Accede
All: Todo
System: Sistema System: Sistema
Details: Detalles Details: Detalles
note: nota note: nota
Changes: Cambios Changes: Cambios
today: hoy today: hoy
yesterday: ayer yesterday: ayer
Show all record changes: Mostrar todos los cambios realizados en el registro
Quit filter: Quitar filtro

View File

@ -1,5 +1,4 @@
@import "variables"; @import "util";
@import "effects";
vn-log { vn-log {
.change { .change {
@ -77,7 +76,7 @@ vn-log {
border-radius: 50%; border-radius: 50%;
width: 24px; width: 24px;
height: 24px; height: 24px;
font-size: 1.4em; font-size: 18px;
&.notice { &.notice {
background-color: $color-notice-medium background-color: $color-notice-medium
@ -98,16 +97,33 @@ vn-log {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
white-space: nowrap; white-space: nowrap;
max-height: 18px;
& > vn-icon {
@extend %clickable-light;
vertical-align: middle;
padding: 2px;
margin: -2px;
font-size: 18px;
color: $color-font-secondary;
float: right;
display: none;
@include mobile {
display: initial;
}
}
& > .model-value { & > .model-value {
font-style: italic; font-style: italic;
} }
& > .model-id { & > .model-id {
color: $color-font-secondary; color: $color-font-secondary;
font-size: .9rem; font-size: .9rem;
float: right;
} }
} }
&:hover > .model > vn-icon {
display: initial;
}
} }
} }
.changes { .changes {

View File

@ -1,5 +1,4 @@
@import "./variables"; @import "./util";
@import "./effects";
form vn-horizontal { form vn-horizontal {
align-items: center; align-items: center;
@ -22,7 +21,7 @@ form vn-horizontal {
} }
} }
@media screen and (max-width: $mobile-width) { @include mobile {
flex-direction: column; flex-direction: column;
align-items: initial; align-items: initial;