@dracul/audit-frontend 1.34.8 → 1.35.3

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.34.8",
3
+ "version": "1.35.3",
4
4
  "description": "Audit frontend",
5
5
  "author": "Cristian Incarnato <cristian.cdi@gmail.com>",
6
6
  "publishConfig": {
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "main": "./src/index.js",
14
14
  "dependencies": {
15
- "@dracul/common-frontend": "^1.34.7",
15
+ "@dracul/common-frontend": "^1.35.1",
16
16
  "@dracul/dayjs-frontend": "^1.34.0"
17
17
  },
18
18
  "devDependencies": {
@@ -38,5 +38,5 @@
38
38
  "type": "git",
39
39
  "url": "git+https://github.com/draculjs/modular-framework.git"
40
40
  },
41
- "gitHead": "53fa8926aa6630bf7ab5b18e8dee3dd7b65769ff"
41
+ "gitHead": "d55ebfdfdaab950fc7bae85a0710539c3093ff72"
42
42
  }
@@ -11,9 +11,11 @@ const i18nMessages = {
11
11
  labels: {
12
12
  user: 'User',
13
13
  action: 'Action',
14
- targetResource: 'Resource',
14
+ entity: 'Entity',
15
15
  createdAt: 'Date',
16
- description: 'Description'
16
+ details: 'Details',
17
+ role: 'Role',
18
+ changes: 'Changes'
17
19
  },
18
20
 
19
21
  userAudit: 'User audit',
@@ -25,6 +27,26 @@ const i18nMessages = {
25
27
  actionFor: 'Action For',
26
28
  action: 'Action',
27
29
 
30
+ actions: {
31
+ create: 'Crear',
32
+ read: 'Visualizar',
33
+ update: 'Modificar',
34
+ delete: 'Eliminar',
35
+
36
+ detailMessages: {
37
+ create: 'A resource with ID "{resourceID}" was created',
38
+ read: 'A resource with ID "{resourceID}" was visualized',
39
+ update: 'A resource with ID "{resourceID}" was updated',
40
+ delete: 'A resource with ID "{resourceID}" was deleted',
41
+ },
42
+
43
+ changes: {
44
+ field: 'Campo',
45
+ oldValue: 'Valor anterior',
46
+ newValue: 'Valor nuevo',
47
+ },
48
+ },
49
+
28
50
  today: 'Today',
29
51
  yesterday: 'Yesterday',
30
52
  userRecoveryPasswordChange: 'user {username} has recovered his password',
@@ -56,9 +78,11 @@ const i18nMessages = {
56
78
  labels: {
57
79
  user: 'Usuario',
58
80
  action: 'Acción',
59
- targetResource: 'Recurso',
81
+ entity: 'Entidad',
60
82
  createdAt: 'Fecha',
61
- description: 'Descripcion'
83
+ details: 'Detalles',
84
+ role: 'Rol',
85
+ changes: 'Cambios'
62
86
  },
63
87
 
64
88
  userAudit: 'Auditoria de usuario',
@@ -69,6 +93,26 @@ const i18nMessages = {
69
93
  actionFor: 'Acción Para',
70
94
  action: 'Acción',
71
95
 
96
+ actions: {
97
+ create: 'Crear',
98
+ read: 'Visualizar',
99
+ update: 'Modificar',
100
+ delete: 'Eliminar',
101
+
102
+ detailMessages: {
103
+ create: 'Se ha creado un recurso con ID "{resourceID}"',
104
+ read: 'Se ha visualizado un recurso con ID "{resourceID}"',
105
+ update: 'Se ha modificado un recurso con ID "{resourceID}"',
106
+ delete: 'Se ha eliminado un recurso con ID "{resourceID}"',
107
+ },
108
+
109
+ changes: {
110
+ field: 'Campo',
111
+ oldValue: 'Valor anterior',
112
+ newValue: 'Valor nuevo',
113
+ },
114
+ },
115
+
72
116
  today: 'Hoy',
73
117
  yesterday: 'ayer',
74
118
  userRecoveryPasswordChange: 'usuario {username} ha recuperado su contraseña',
@@ -100,9 +144,11 @@ const i18nMessages = {
100
144
  labels: {
101
145
  user: 'Nome do usuário',
102
146
  action: 'Açao',
103
- targetResource: 'Alvo',
147
+ entity: 'Entity',
104
148
  createdAt: 'Data',
105
- description: 'Description'
149
+ details: 'Details',
150
+ role: 'Rol',
151
+ changes: 'Changes'
106
152
  },
107
153
 
108
154
  userAudit: 'Auditoria de Usuário',
@@ -113,6 +159,26 @@ const i18nMessages = {
113
159
  actionFor: 'Ação Para',
114
160
  action: 'Ação',
115
161
 
162
+ actions: {
163
+ create: 'Crear',
164
+ read: 'Visualizar',
165
+ update: 'Modificar',
166
+ delete: 'Eliminar',
167
+
168
+ detailMessages: {
169
+ create: 'Se ha creado un recurso con ID "{resourceID}"',
170
+ read: 'Se ha visualizado un recurso con ID "{resourceID}"',
171
+ update: 'Se ha modificado un recurso con ID "{resourceID}"',
172
+ delete: 'Se ha eliminado un recurso con ID "{resourceID}"',
173
+ },
174
+
175
+ changes: {
176
+ field: 'Campo',
177
+ oldValue: 'Valor anterior',
178
+ newValue: 'Valor nuevo',
179
+ },
180
+ },
181
+
116
182
  today: 'hoje',
117
183
  yesterday: 'ontem',
118
184
  userRecoveryPasswordChange: 'O usuário {username} recuperou sua senha',
@@ -1,95 +1,98 @@
1
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">
2
+ <v-row>
3
+ <v-col cols="12">
4
+ <v-card-actions class="align-items">
6
5
  <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
6
 
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>
7
+ <v-col cols="12" md="4" sm="4">
8
+ <v-text-field
9
+ v-model="filters[0].value"
10
+ :label="$t('audit.action')"
11
+ prepend-icon="bolt"
12
+ color="secondary"
13
+ hide-details
14
+ clearable
15
+ />
16
+ </v-col>
31
17
 
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>
18
+ <v-col cols="12" md="4" sm="4">
19
+ <v-text-field
20
+ v-model="filters[2].value"
21
+ :label="$t('audit.labels.entity')"
22
+ prepend-icon="article"
23
+ color="secondary"
24
+ hide-details
25
+ clearable
26
+ />
43
27
  </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>
28
+
29
+ <v-col cols="12" md="4" sm="4">
30
+ <user-autocomplete
31
+ v-model="filters[1].value"
32
+ :label="$t('audit.filterByUser')"
33
+ clearable
34
+ hide-details
35
+ />
52
36
  </v-col>
53
37
  </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);
38
+ </v-card-actions>
39
+ </v-col>
40
+
41
+ <v-col cols="12" class="text-right pr-5">
42
+ <v-btn
43
+ small
44
+ text
45
+ color="secondary"
46
+ @click="cleanFilters()"
47
+ >
48
+ Limpiar filtros
49
+ </v-btn>
50
+
51
+ <v-btn
52
+ small
53
+ color="secondary"
54
+ @click="setFilters()"
55
+ >
56
+ Aplicar filtros
57
+ </v-btn>
58
+ </v-col>
59
+ </v-row>
60
+ </template>
61
+
62
+ <script>
63
+
64
+ import { UserAutocomplete } from '@dracul/user-frontend'
65
+ import { mapGetters } from 'vuex'
66
+
67
+
68
+ export default {
69
+ name: "AuditFilters",
70
+ components: { UserAutocomplete },
71
+ props: {
72
+ value: Array
73
+ },
74
+ computed: {
75
+ ...mapGetters([
76
+ 'me'
77
+ ]),
78
+ filters: {
79
+ get() { return this.value },
80
+ set(val) {
81
+ this.$emit('input', val)
91
82
  }
83
+ }
84
+ },
85
+ data() {
86
+ return {
87
+ }
88
+ },
89
+ methods: {
90
+ setFilters() {
91
+ this.$emit("updateFilters", this.filters);
92
92
  },
93
- };
94
- </script>
95
-
93
+ cleanFilters() {
94
+ this.$emit("clearFilter", this.filters);
95
+ }
96
+ },
97
+ };
98
+ </script>
@@ -1,172 +1,248 @@
1
1
  <template>
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>
2
+ <v-container fluid>
3
+ <v-card class="mb-5">
4
+ <v-card-title>
5
+ {{ this.$t('audit.title') }}
6
+ </v-card-title>
20
7
 
8
+ <v-row style="height: 90%;">
9
+ <v-col cols="12" sm="12">
10
+ <audit-filters @updateFilters="setFilters" @clearFilter="cleanFilters" v-model="filters">
11
+ </audit-filters>
21
12
  </v-col>
13
+ </v-row>
14
+
15
+ </v-card>
16
+
17
+ <v-card>
18
+ <v-col cols="12" sm="12" class="fill-height">
19
+ <v-card>
20
+ <v-skeleton-loader v-if="loading" class="mx-auto" type="table"/>
21
+
22
+ <v-data-table v-else
23
+ :headers="headers"
24
+ :items="items"
25
+
26
+ :search="search"
27
+ :page.sync="pageNumber"
28
+ :server-items-length="totalItems"
29
+ :items-per-page.sync="itemsPerPage"
30
+
31
+ :sort-by.sync="orderBy"
32
+ :sort-desc.sync="orderDesc"
33
+
34
+ :single-expand="false"
35
+ :loading="loading"
36
+
37
+ @update:page="fetch"
38
+ @update:sort-by="fetch"
39
+ @update:sort-desc="fetch"
40
+ @update:items-per-page="fetch"
41
+
42
+ :footer-props="{ itemsPerPageOptions: [5, 10, 25, 50] }"
43
+ >
22
44
 
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 }">
45
+ <template v-slot:[`item.role`]="{ item }">
46
+ {{ item.user && item.user.role ? item.user.role.name : '' }}
47
+ </template>
48
+
49
+ <template v-slot:[`item.user`]="{ item }">
46
50
  {{ item.user ? item.user.username : '' }}
47
- </template>
48
-
49
- <template v-slot:item.createdAt="{ item }">
51
+ </template>
52
+
53
+ <template v-slot:[`item.action`]="{ item }">
54
+ <v-chip
55
+ label
56
+ outlined
57
+ class="rounded-0"
58
+ :color=getActionLabelColor(item.action)
59
+ >
60
+ {{ $t(`audit.actions.${item.action.toLowerCase()}`) }}
61
+ </v-chip>
62
+ </template>
63
+
64
+ <template v-slot:[`item.createdAt`]="{ item }">
50
65
  {{ 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
+ </template>
67
+
68
+ <template v-slot:[`item.changes`]="{ item }">
69
+ <v-menu
70
+ bottom
71
+ left
72
+ >
73
+ <template v-slot:activator="{ on, attrs }">
74
+ <v-btn
75
+ text
76
+ color="secondary"
77
+ outlined
78
+ tile
79
+
80
+ v-bind="attrs"
81
+ v-on="on"
82
+ :disabled="item.action !== 'UPDATE'"
83
+ >
84
+ {{ item.changes.length }}
85
+ </v-btn>
86
+ </template>
87
+
88
+ <v-data-table
89
+ :headers=changeHeaders
90
+ :items="item.changes"
91
+ :hide-default-footer="true"
92
+ ></v-data-table>
93
+ </v-menu>
94
+
95
+ </template>
96
+
97
+
98
+ <template v-slot:[`item.details`]="{ item }">
99
+ {{ $t(`audit.actions.detailMessages.${item.action.toLowerCase()}`, {resourceID: item.details}) }}
100
+ </template>
101
+
102
+ <template slot="no-data">
103
+ <div class="text-xs-center" v-t="'common.noData'"></div>
104
+ </template>
105
+
106
+ <template slot="loading">
107
+ <div class="text-xs-center" v-t="'common.loading'"></div>
108
+ </template>
109
+ </v-data-table>
110
+ </v-card>
111
+
112
+ </v-col>
66
113
  </v-card>
114
+
115
+ </v-container>
67
116
  </template>
68
-
117
+
69
118
  <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"
75
-
76
-
77
- export default {
78
- name: "AuditList",
79
- // SearchInput,
80
- components: {AuditFilters},
81
- mixins: [DayjsMixin],
82
- data() {
83
- return {
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
- ]
109
- }
110
- },
111
- computed: {
112
- headers () {
113
- return [
114
- //Entity Headers
115
- {text: this.$t('audit.labels.createdAt'), value: 'createdAt'},
116
- {text: this.$t('audit.labels.user'), value: 'user'},
117
- {text: this.$t('audit.labels.action'), value: 'action'},
118
- {text: this.$t('audit.labels.targetResource'), value: 'resource'},
119
- {text: this.$t('audit.labels.description'), value: 'description'},
120
- //Actions
121
- ]
122
- },
123
- getOrderBy(){
124
- return (Array.isArray(this.orderBy)) ? this.orderBy[0]: this.orderBy
125
- },
126
- getOrderDesc(){
127
- return (Array.isArray(this.orderDesc)) ? this.orderDesc[0]: this.orderDesc
128
- }
129
- },
130
- created() {
131
- this.fetch()
132
- },
133
- methods:{
134
- performSearch(){
135
- this.pageNumber = 1
136
- this.fetch()
137
- },
138
- fetch() {
139
- this.loading = true
140
- AuditProvider.paginateAudit(
141
- this.pageNumber,
142
- this.itemsPerPage,
143
- this.search,
144
- this.filters,
145
- this.getOrderBy,
146
- this.getOrderDesc
147
- ).then(r => {
148
- console.log('paginate audit', r)
149
- this.items = r.data.paginateAudit.items
150
- this.totalItems = r.data.paginateAudit.totalItems
151
- }).catch(err => {
152
- console.error(err)
153
- }).finally(() => this.loading = false)
154
- },
155
- setFilters(auditFilters) {
156
- console.log('auditFilters', auditFilters)
157
- this.filters = auditFilters
158
- this.fetch()
119
+ import AuditProvider from "../../providers/AuditProvider";
120
+ import AuditFilters from "./AuditFilters.vue";
121
+
122
+ // import { SearchInput} from "@dracul/common-frontend"
123
+ import { DayjsMixin } from "@dracul/dayjs-frontend"
124
+
125
+
126
+ export default {
127
+ name: "AuditList",
128
+ // SearchInput,
129
+ components: { AuditFilters },
130
+ mixins: [DayjsMixin],
131
+ data() {
132
+ return {
133
+ items: [],
134
+ totalItems: null,
135
+ loading: false,
136
+ orderBy: null,
137
+ orderDesc: false,
138
+ itemsPerPage: 5,
139
+ pageNumber: 1,
140
+ search: '',
141
+ filters: [
142
+ {
143
+ field: 'action',
144
+ operator: '$regex',
145
+ value: null
146
+ },
147
+ {
148
+ field: 'user',
149
+ operator: '$eq',
150
+ value: null
159
151
  },
160
- cleanFilters() {
161
- this.filters.forEach(filter => {
162
- filter.value = null
163
- })
164
- this.fetch()
152
+ {
153
+ field: 'resource',
154
+ operator: '$regex',
155
+ value: null
165
156
  }
166
- }
167
-
168
- }
169
- </script>
170
-
171
-
172
-
157
+ ]
158
+ }
159
+ },
160
+ computed: {
161
+ headers() {
162
+ return [
163
+ //Entity Headers
164
+ { text: this.$t('audit.labels.createdAt'), value: 'createdAt' },
165
+ { text: this.$t('audit.labels.role'), value: 'role' },
166
+ { text: this.$t('audit.labels.user'), value: 'user' },
167
+ { text: this.$t('audit.labels.entity'), value: 'entity' },
168
+ { text: this.$t('audit.labels.action'), value: 'action' },
169
+ { text: this.$t('audit.labels.details'), value: 'details' },
170
+ //Actions
171
+ { text: this.$t('audit.labels.changes'), value: 'changes' },
172
+ ]
173
+ },
174
+ changeHeaders() {
175
+ return [
176
+ { text: this.$t('audit.actions.changes.field'), value: 'field' },
177
+ { text: this.$t('audit.actions.changes.oldValue'), value: 'oldValue' },
178
+ { text: this.$t('audit.actions.changes.newValue'), value: 'newValue' },
179
+ ]
180
+ },
181
+ getOrderBy() {
182
+ return (Array.isArray(this.orderBy)) ? this.orderBy[0] : this.orderBy
183
+ },
184
+ getOrderDesc() {
185
+ return (Array.isArray(this.orderDesc)) ? this.orderDesc[0] : this.orderDesc
186
+ }
187
+ },
188
+ created() {
189
+ this.fetch()
190
+ },
191
+ methods: {
192
+ getActionLabelColor(action){
193
+ const actionColors = {
194
+ CREATE:'primary',
195
+ READ:'secondary',
196
+ UPDATE:'secondary',
197
+ DELETE:'error',
198
+ }
199
+
200
+ return actionColors[action]
201
+ },
202
+ performSearch() {
203
+ this.pageNumber = 1
204
+ this.fetch()
205
+ },
206
+ fetch() {
207
+ this.loading = true
208
+ AuditProvider.paginateAudit(
209
+ this.pageNumber,
210
+ this.itemsPerPage,
211
+ this.search,
212
+ this.filters,
213
+ this.getOrderBy,
214
+ this.getOrderDesc
215
+ ).then(r => {
216
+ console.log('paginate audit', r)
217
+ // r.data.paginateAudit.items.forEach((item) => item.changes = 1)
218
+ this.items = r.data.paginateAudit.items
219
+ this.totalItems = r.data.paginateAudit.totalItems
220
+ }).catch(err => {
221
+ console.error(err)
222
+ }).finally(() => this.loading = false)
223
+ },
224
+ setFilters(auditFilters) {
225
+ console.log('auditFilters', auditFilters)
226
+ this.filters = auditFilters
227
+ this.fetch()
228
+ },
229
+ cleanFilters() {
230
+ this.filters.forEach(filter => {
231
+ filter.value = null
232
+ })
233
+ this.fetch()
234
+ },
235
+ visualizeAuditChanges(audit){
236
+ console.log(audit)
237
+ }
238
+ }
239
+
240
+ }
241
+ </script>
242
+
243
+ <style>
244
+ .v-data-table-header th {
245
+ white-space: nowrap !important;
246
+ align-self: center
247
+ }
248
+ </style>
@@ -0,0 +1,45 @@
1
+ <template>
2
+ <v-container fluid>
3
+ <v-card class="mb-5">
4
+ <v-card-title>
5
+ {{ this.$t('audit.title') }}
6
+ </v-card-title>
7
+
8
+ <v-card-actions>
9
+ <v-btn color="primary" @click="createNewAudit">Create audit</v-btn>
10
+ <v-btn color="secondary" @click="updateAudit">Update audit</v-btn>
11
+ <v-btn color="warning" @click="deleteAudit">Delete audit</v-btn>
12
+ </v-card-actions>
13
+
14
+ </v-card>
15
+ </v-container>
16
+ </template>
17
+
18
+ <script>
19
+ import AuditProvider from "../../providers/AuditProvider";
20
+ export default {
21
+ name: "AuditTest",
22
+ methods: {
23
+ createNewAudit() {
24
+ AuditProvider.createAudit('CREATE', 'AUDIT', 'ksdf63ksdf923.123123')
25
+ },
26
+ updateAudit() {
27
+ AuditProvider.createAudit('UPDATE', 'AUDIT', 'ksdf63ksdf923.123123', [
28
+ { field: 'status', oldValue: 'inactive', newValue: 'active' }
29
+ ])
30
+ },
31
+ deleteAudit() {
32
+ AuditProvider.createAudit('DELETE', 'AUDIT', '123123')
33
+ },
34
+
35
+ }
36
+
37
+ }
38
+ </script>
39
+
40
+ <style>
41
+ .v-data-table-header th {
42
+ white-space: nowrap !important;
43
+ align-self: center
44
+ }
45
+ </style>
@@ -41,10 +41,10 @@ class AuditProvider {
41
41
  })
42
42
  }
43
43
 
44
- createAudit(action, resource, description){
44
+ createAudit(action, entity, details, changes){
45
45
  return this.getGraphqlClient().mutate({
46
46
  mutation: require('./gql/Audit/createAudit.graphql'),
47
- variables: {action, resource, description},
47
+ variables: {action, entity, details, changes},
48
48
  fetchPolicy: "no-cache"
49
49
  })
50
50
  }
@@ -1,12 +1,21 @@
1
- mutation createAudit($action: String!, $resource: String!, $description: String){
2
- createAudit(action: $action, resource: $resource, description: $description){
1
+ mutation createAudit(
2
+ $action: String!,
3
+ $entity: String!,
4
+ $details: String,
5
+ $changes: [ChangesInput]
6
+ ) {
7
+ createAudit(action: $action, entity: $entity, details: $details, changes: $changes) {
3
8
  id
4
- user{
5
- id
6
- username
7
- }
9
+ user {
10
+ username
11
+ }
8
12
  action
9
- resource
13
+ entity
14
+ details
15
+ changes {
16
+ field
17
+ oldValue
18
+ newValue
19
+ }
10
20
  }
11
21
  }
12
-
@@ -8,10 +8,19 @@ query paginateAudit( $pageNumber: Int, $itemsPerPage:Int, $search: String, $filt
8
8
  user{
9
9
  id
10
10
  username
11
+ role{
12
+ id
13
+ name
14
+ }
11
15
  }
12
16
  action
13
- resource
14
- description
17
+ entity
18
+ details
19
+ changes {
20
+ field
21
+ oldValue
22
+ newValue
23
+ }
15
24
  }
16
25
  }
17
26
  }
@@ -1,4 +1,5 @@
1
1
  import AuditPage from '../pages/AuditPage/index.vue'
2
+ import AuditTest from '../pages/TestingPage/index.vue'
2
3
 
3
4
  const routes = [
4
5
 
@@ -10,6 +11,15 @@ const routes = [
10
11
  requiresAuth: true,
11
12
  permission: "AUDIT_SHOW"
12
13
  }
14
+ },
15
+ {
16
+ name: 'AuditTest',
17
+ path: '/auditTesting',
18
+ component: AuditTest,
19
+ meta: {
20
+ requiresAuth: true,
21
+ permission: "AUDIT_SHOW"
22
+ }
13
23
  }
14
24
  ]
15
25