@dracul/audit-frontend 1.16.0 → 1.16.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dracul/audit-frontend",
3
- "version": "1.16.0",
3
+ "version": "1.16.9",
4
4
  "description": "Audit frontend",
5
5
  "author": "Cristian Incarnato <cristian.cdi@gmail.com>",
6
6
  "scripts": {
@@ -11,8 +11,8 @@
11
11
  },
12
12
  "main": "./src/index.js",
13
13
  "dependencies": {
14
- "@dracul/common-frontend": "^1.15.13",
15
- "@dracul/dayjs-frontend": "^1.15.5"
14
+ "@dracul/common-frontend": "^1.16.3",
15
+ "@dracul/dayjs-frontend": "^1.16.3"
16
16
  },
17
17
  "devDependencies": {
18
18
  "@babel/core": "^7.12.3",
@@ -66,5 +66,5 @@
66
66
  "type": "git",
67
67
  "url": "git+https://github.com/draculjs/modular-framework.git"
68
68
  },
69
- "gitHead": "2b334b78436bb1ef95342ef941ac9a6f1dc082c3"
69
+ "gitHead": "8e0742ac01f310ccfbced2420587b74771750d62"
70
70
  }
@@ -4,9 +4,8 @@ const i18nMessages = {
4
4
  name: 'Audit',
5
5
  title: 'Audit management',
6
6
  subtitle: 'View, search, create, edit and delete Audit',
7
- creating: 'Creating Audit',
8
- editing: 'Editing Audit',
9
- deleting: 'Deleting Audit',
7
+ filters: "Audit filters",
8
+ filterByUser: 'Realized by user',
10
9
  showing: 'Showing Audit',
11
10
  menu: 'Audit',
12
11
  labels: {
@@ -20,6 +19,8 @@ const i18nMessages = {
20
19
  userAudit: 'User audit',
21
20
 
22
21
  when: 'When',
22
+ from: 'from',
23
+ until: 'until',
23
24
  actionBy: 'Action By',
24
25
  actionFor: 'Action For',
25
26
  action: 'Action',
@@ -46,11 +47,10 @@ const i18nMessages = {
46
47
  es: {
47
48
  audit: {
48
49
  name: 'Auditorias',
49
- title: 'Administración de Auditorias',
50
- subtitle: 'Ver, buscar, crear, editar, y borrar Auditorias',
51
- creating: 'Creando Auditoria',
52
- editing: 'Modificando Auditoria',
53
- deleting: 'Eliminando Auditoria',
50
+ title: 'Visualizacion de Auditorias',
51
+ subtitle: 'Ver y buscar Auditorias',
52
+ filters: "Filtros de auditoria",
53
+ filterByUser: 'Realizada por usuario',
54
54
  showing: 'Detalles de Auditoria',
55
55
  menu: 'Auditoria',
56
56
  labels: {
@@ -63,6 +63,8 @@ const i18nMessages = {
63
63
 
64
64
  userAudit: 'Auditoria de usuario',
65
65
  when: 'Cuando',
66
+ from: 'Desde',
67
+ until: 'Hasta',
66
68
  actionBy: 'Acción Por',
67
69
  actionFor: 'Acción Para',
68
70
  action: 'Acción',
@@ -91,9 +93,8 @@ const i18nMessages = {
91
93
  name: 'Audit',
92
94
  title: 'Administração de Audit',
93
95
  subtitle: 'Ver, buscar, criar, editar e usar Audit',
94
- creating: 'Criando Audit',
95
- editing: 'Edição Audit',
96
- deleting: 'Apagando Audit',
96
+ filters: "filtros de audit",
97
+ filterByUser: 'Realizada por usuario',
97
98
  showing: 'Detalhes do Audit',
98
99
  menu: 'Audit',
99
100
  labels: {
@@ -106,6 +107,8 @@ const i18nMessages = {
106
107
 
107
108
  userAudit: 'Auditoria de Usuário',
108
109
  when: 'Quando',
110
+ from: 'Desde',
111
+ until: 'Hasta',
109
112
  actionBy: 'Ação por',
110
113
  actionFor: 'Ação Para',
111
114
  action: 'Ação',
@@ -0,0 +1,95 @@
1
+ <template>
2
+ <v-card flat>
3
+ <v-card-title>{{$t('audit.filters')}}</v-card-title>
4
+
5
+ <v-card-text class="pt-0 mt-0">
6
+ <v-row>
7
+ <v-col cols="12" class="py-0">
8
+ <v-row>
9
+
10
+ <v-col cols="12" md="4" sm="4">
11
+ <v-text-field
12
+ v-model="filters[0].value"
13
+ :label="$t('audit.action')"
14
+ prepend-icon="bolt"
15
+ color="secondary"
16
+ hide-details
17
+ clearable
18
+ />
19
+ </v-col>
20
+
21
+ <v-col cols="12" md="4" sm="4">
22
+ <v-text-field
23
+ v-model="filters[2].value"
24
+ :label="$t('audit.labels.targetResource')"
25
+ prepend-icon="article"
26
+ color="secondary"
27
+ hide-details
28
+ clearable
29
+ />
30
+ </v-col>
31
+
32
+ <v-col cols="12" md="4" sm="4">
33
+ <user-autocomplete
34
+ v-model="filters[1].value"
35
+ :label="$t('audit.filterByUser')"
36
+ solo
37
+ clearable
38
+ chips
39
+ class="elevation-0"
40
+ />
41
+ </v-col>
42
+ </v-row>
43
+ </v-col>
44
+ <v-col cols="12" class="text-right">
45
+ <v-btn small text color="secondary" @click="cleanFilters()">{{
46
+ "Limpiar filtros"
47
+ }}</v-btn>
48
+
49
+ <v-btn small color="secondary" @click="setFilters()">{{
50
+ "Aplicar filtros"
51
+ }}</v-btn>
52
+ </v-col>
53
+ </v-row>
54
+ </v-card-text>
55
+ </v-card>
56
+ </template>
57
+
58
+ <script>
59
+
60
+ import { UserAutocomplete} from '@dracul/user-frontend'
61
+ import { mapGetters } from 'vuex'
62
+
63
+
64
+ export default {
65
+ name: "AuditFilters",
66
+ components: { UserAutocomplete },
67
+ props: {
68
+ value: Array
69
+ },
70
+ computed: {
71
+ ...mapGetters([
72
+ 'me'
73
+ ]),
74
+ filters: {
75
+ get() {return this.value},
76
+ set(val) {
77
+ this.$emit('input', val)
78
+ }
79
+ }
80
+ },
81
+ data() {
82
+ return {
83
+ }
84
+ },
85
+ methods: {
86
+ setFilters() {
87
+ this.$emit("updateFilters", this.filters);
88
+ },
89
+ cleanFilters() {
90
+ this.$emit("clearFilter", this.filters);
91
+ }
92
+ },
93
+ };
94
+ </script>
95
+
@@ -1,90 +1,111 @@
1
1
  <template>
2
- <v-row row wrap>
3
-
4
- <v-col cols="12" >
5
- <v-row justify="space-between">
6
- <v-col cols="12" sm="6" md="8">
7
- <!-- FILTERS HERE -->
8
- </v-col>
9
- <v-col cols="12" sm="6" md="4">
10
- <search-input @search="performSearch" v-model="search" label="audit.auditFilterByUser"/>
11
- </v-col>
12
- </v-row>
13
- </v-col>
14
-
15
- <v-col cols="12">
16
-
17
- <v-data-table
18
- class="mt-3"
19
- :headers="headers"
20
- :items="items"
21
- :search="search"
22
- :single-expand="false"
23
- :server-items-length="totalItems"
24
- :loading="loading"
25
- :page.sync="pageNumber"
26
- :items-per-page.sync="itemsPerPage"
27
- :sort-by.sync="orderBy"
28
- :sort-desc.sync="orderDesc"
29
- :footer-props="{ itemsPerPageOptions: [5, 10, 25, 50] }"
30
- @update:page="fetch"
31
- @update:sort-by="fetch"
32
- @update:sort-desc="fetch"
33
- @update:items-per-page="fetch"
34
- >
35
-
36
-
37
- <template v-slot:item.user="{ item }">
38
- {{ item.user ? item.user.username : '' }}
39
- </template>
40
-
41
- <template v-slot:item.createdAt="{ item }">
42
- {{ getDateTimeFormat(item.createdAt) }}
43
- </template>
44
-
45
-
46
- <template slot="no-data">
47
- <div class="text-xs-center" v-t="'common.noData'"></div>
48
- </template>
49
-
50
- <template slot="loading">
51
- <div class="text-xs-center" v-t="'common.loading'"></div>
52
- </template>
53
-
54
-
55
- </v-data-table>
56
- </v-col>
57
- </v-row>
58
- </template>
59
-
60
- <script>
61
- import AuditProvider from "../../providers/AuditProvider";
62
-
63
- import { SearchInput} from "@dracul/common-frontend"
64
- import { DayjsMixin} from "@dracul/dayjs-frontend"
2
+ <v-card class="fill-height">
3
+ <v-card-title>
4
+ {{ this.$t('audit.title') }}
5
+ </v-card-title>
6
+
7
+ <v-card-subtitle>
8
+ {{ this.$t('audit.subtitle') }}
9
+ </v-card-subtitle>
10
+
11
+ <v-row align-content="space-between" justify="space-between" style="height: 90%;">
12
+
13
+ <v-col cols="12" >
14
+ <audit-filters
15
+ @updateFilters="setFilters"
16
+ @clearFilter="cleanFilters"
17
+ v-model="filters"
18
+ >
19
+ </audit-filters>
20
+
21
+ </v-col>
22
+
23
+
24
+ <v-col cols="12" fill-height>
25
+
26
+ <v-data-table
27
+ :headers="headers"
28
+ :items="items"
29
+ :search="search"
30
+ :single-expand="false"
31
+ :server-items-length="totalItems"
32
+ :loading="loading"
33
+ :page.sync="pageNumber"
34
+ :items-per-page.sync="itemsPerPage"
35
+ :sort-by.sync="orderBy"
36
+ :sort-desc.sync="orderDesc"
37
+ :footer-props="{ itemsPerPageOptions: [5, 10, 25, 50] }"
38
+ @update:page="fetch"
39
+ @update:sort-by="fetch"
40
+ @update:sort-desc="fetch"
41
+ @update:items-per-page="fetch"
42
+ >
43
+
44
+
45
+ <template v-slot:item.user="{ item }">
46
+ {{ item.user ? item.user.username : '' }}
47
+ </template>
48
+
49
+ <template v-slot:item.createdAt="{ item }">
50
+ {{ getDateTimeFormat(item.createdAt) }}
51
+ </template>
52
+
53
+
54
+ <template slot="no-data" fill-height>
55
+ <div class="text-xs-center" v-t="'common.noData'"></div>
56
+ </template>
57
+
58
+ <template slot="loading" fill-height>
59
+ <div class="text-xs-center" v-t="'common.loading'"></div>
60
+ </template>
61
+
62
+
63
+ </v-data-table>
64
+ </v-col>
65
+ </v-row>
66
+ </v-card>
67
+ </template>
68
+
69
+ <script>
70
+ import AuditProvider from "../../providers/AuditProvider";
71
+ import AuditFilters from "./AuditFilters.vue";
72
+
73
+ // import { SearchInput} from "@dracul/common-frontend"
74
+ import { DayjsMixin} from "@dracul/dayjs-frontend"
65
75
 
66
76
 
67
77
  export default {
68
78
  name: "AuditList",
69
- components: {SearchInput},
79
+ // SearchInput,
80
+ components: {AuditFilters},
70
81
  mixins: [DayjsMixin],
71
82
  data() {
72
83
  return {
73
- items: [],
74
- totalItems: null,
75
- loading: false,
76
- orderBy: null,
77
- orderDesc: false,
78
- itemsPerPage: 5,
79
- pageNumber: 1,
80
- search: '',
81
- filters: [
82
- /*{
83
- field: '',
84
- operator: 'eq', //(eq|contain|regex|gt|lt|lte|gte)
85
- value: ''
86
- }*/
87
- ]
84
+ items: [],
85
+ totalItems: null,
86
+ loading: false,
87
+ orderBy: null,
88
+ orderDesc: false,
89
+ itemsPerPage: 5,
90
+ pageNumber: 1,
91
+ search: '',
92
+ filters: [
93
+ {
94
+ field: 'action',
95
+ operator: '$regex',
96
+ value: null
97
+ },
98
+ {
99
+ field: 'user',
100
+ operator: '$eq',
101
+ value: null
102
+ },
103
+ {
104
+ field: 'resource',
105
+ operator: '$regex',
106
+ value: null
107
+ }
108
+ ]
88
109
  }
89
110
  },
90
111
  computed: {
@@ -124,12 +145,24 @@
124
145
  this.getOrderBy,
125
146
  this.getOrderDesc
126
147
  ).then(r => {
148
+ console.log('paginate audit', r)
127
149
  this.items = r.data.paginateAudit.items
128
150
  this.totalItems = r.data.paginateAudit.totalItems
129
151
  }).catch(err => {
130
152
  console.error(err)
131
153
  }).finally(() => this.loading = false)
132
- }
154
+ },
155
+ setFilters(auditFilters) {
156
+ console.log('auditFilters', auditFilters)
157
+ this.filters = auditFilters
158
+ this.fetch()
159
+ },
160
+ cleanFilters() {
161
+ this.filters.forEach(filter => {
162
+ filter.value = null
163
+ })
164
+ this.fetch()
165
+ }
133
166
  }
134
167
 
135
168
  }