2
2
import routeLinks from " @/router/routeLinks" ;
3
3
import { useAuditStore } from " @/stores/AuditStore" ;
4
4
import { storeToRefs } from " pinia" ;
5
- import { MessageStatus } from " @/resources/Message" ;
5
+ import Message , { MessageStatus } from " @/resources/Message" ;
6
6
import moment from " moment" ;
7
7
import { useRoute } from " vue-router" ;
8
8
import FilterInput from " @/components/FilterInput.vue" ;
9
9
import ResultsCount from " @/components/ResultsCount.vue" ;
10
10
import DropDown from " @/components/DropDown.vue" ;
11
- import { computed } from " vue" ;
12
- import { formatDotNetTimespan , formatTypeName } from " @/composables/formatUtils.ts" ;
11
+ import { computed , ref , watch } from " vue" ;
12
+ import { dotNetTimespanToMilliseconds , formatDotNetTimespan , formatTypeName } from " @/composables/formatUtils.ts" ;
13
+ import EndpointSelector from " @/components/audit/EndpointSelector.vue" ;
13
14
14
15
const store = useAuditStore ();
15
16
const { messages, sortBy, totalCount, messageFilterString, selectedEndpointName, endpoints, itemsPerPage } = storeToRefs (store );
16
17
const route = useRoute ();
17
18
18
19
const endpointNames = computed (() => {
19
- return endpoints .value .map ((endpoint ) => ({
20
- text: endpoint .name ,
21
- value: endpoint .name ,
22
- }));
20
+ return [... new Set (endpoints .value .map ((endpoint ) => endpoint .name ))];
23
21
});
24
- const selectedEndpointItem = computed (() => ({ text: selectedEndpointName . value , value: selectedEndpointName . value }));
22
+
25
23
const sortByItems = [
26
24
{ text: " Latest sent" , value: " time_sent,desc" },
27
25
{ text: " Oldest sent" , value: " time_sent,asc" },
28
26
{ text: " Fastest processing" , value: " processing_time,asc" },
29
27
{ text: " Slowest processing" , value: " processing_time,desc" },
30
28
];
29
+ const numberOfItemsPerPage = [" 50" , " 100" , " 250" , " 500" ];
31
30
const selectedSortByItem = computed (() => sortByItems .find ((item ) => item .value === ` ${sortBy .value .property },${sortBy .value .isAscending ? " asc" : " desc" } ` ));
31
+ const selectedItemsPerPage = ref (itemsPerPage .value .toString ());
32
+
33
+ watch (selectedItemsPerPage , (newValue ) => {
34
+ itemsPerPage .value = Number (newValue );
35
+ });
32
36
33
37
function setSortBy(item : { text: string ; value: string }) {
34
38
const strings = item .value .split (" ," );
35
39
sortBy .value = { isAscending: strings [1 ] === " asc" , property: strings [0 ] };
36
40
}
41
+
37
42
function statusToName(messageStatus : MessageStatus ) {
38
43
switch (messageStatus ) {
39
44
case MessageStatus .Successful :
@@ -67,6 +72,26 @@ function statusToIcon(messageStatus: MessageStatus) {
67
72
return " fa retry-issued" ;
68
73
}
69
74
}
75
+
76
+ function hasWarning(message : Message ) {
77
+ if (message .status === MessageStatus .ResolvedSuccessfully ) {
78
+ return true ;
79
+ }
80
+
81
+ if (dotNetTimespanToMilliseconds (message .critical_time ) < 0 ) {
82
+ return true ;
83
+ }
84
+
85
+ if (dotNetTimespanToMilliseconds (message .processing_time ) < 0 ) {
86
+ return true ;
87
+ }
88
+
89
+ if (dotNetTimespanToMilliseconds (message .delivery_time ) < 0 ) {
90
+ return true ;
91
+ }
92
+
93
+ return false ;
94
+ }
70
95
</script >
71
96
72
97
<template >
@@ -77,33 +102,10 @@ function statusToIcon(messageStatus: MessageStatus) {
77
102
<FilterInput v-model =" messageFilterString" placeholder =" Search messages..." aria-label =" Search messages" />
78
103
</div >
79
104
<div >
80
- <DropDown
81
- label =" Filter by endpoint"
82
- :callback ="
83
- (item) => {
84
- selectedEndpointName = item.value;
85
- }
86
- "
87
- :select-item =" selectedEndpointItem"
88
- :items =" endpointNames"
89
- />
105
+ <EndpointSelector :items =" numberOfItemsPerPage" instructions =" Select how many result to display" v-model =" selectedItemsPerPage" item-name =" result" label =" Show" default-empty-text =" Any" :show-clear =" false" :show-filter =" false" />
90
106
</div >
91
107
<div >
92
- <DropDown
93
- label =" Show"
94
- :callback ="
95
- (item) => {
96
- itemsPerPage = parseInt(item.value, 10);
97
- }
98
- "
99
- :select-item =" { text: itemsPerPage.toString(), value: itemsPerPage.toString() }"
100
- :items =" [
101
- { text: '50', value: '50' },
102
- { text: '100', value: '100' },
103
- { text: '250', value: '250' },
104
- { text: '500', value: '500' },
105
- ]"
106
- />
108
+ <EndpointSelector :items =" endpointNames" instructions =" Select an endpoint" v-model =" selectedEndpointName" item-name =" endpoint" label =" Endpoint" default-empty-text =" Any" :show-clear =" true" :show-filter =" true" />
107
109
</div >
108
110
<div >
109
111
<DropDown label =" Sort by" :callback =" setSortBy" :select-item =" selectedSortByItem" :items =" sortByItems" />
@@ -114,13 +116,16 @@ function statusToIcon(messageStatus: MessageStatus) {
114
116
<ResultsCount :displayed =" messages.length" :total =" totalCount" />
115
117
</div >
116
118
<div class =" row results-table" >
117
- <section class = " section-table " role =" table" aria-label =" endpoint-instances" >
119
+ <section role =" table" aria-label =" endpoint-instances" >
118
120
<!-- Table rows-->
119
121
<!-- NOTE: currently the DataView pages on the client only: we need to make it server data aware (i.e. the total will be the count from the server, not the length of the data we have locally)-->
120
- <div class = " messages " role =" rowgroup" aria-label =" messages" >
122
+ <div role =" rowgroup" aria-label =" messages" >
121
123
<div role =" row" :aria-label =" message.message_id" class =" row grid-row" v-for =" message in messages" :key =" message.id" >
122
124
<div role =" cell" aria-label =" status" class =" status" :title =" statusToName(message.status)" >
123
- <div class =" status-icon" :class =" statusToIcon(message.status)" ></div >
125
+ <div class =" status-container" >
126
+ <div class =" status-icon" :class =" statusToIcon(message.status)" ></div >
127
+ <div v-if =" hasWarning(message)" class =" warning" ></div >
128
+ </div >
124
129
</div >
125
130
<div role =" cell" aria-label =" message-id" class =" col-3 message-id" >
126
131
<div class =" box-header" >
@@ -169,78 +174,58 @@ function statusToIcon(messageStatus: MessageStatus) {
169
174
gap : 1.1rem ;
170
175
}
171
176
172
- .section-table {
173
- overflow : auto ;
174
- flex : 1 ;
175
- display : flex ;
176
- flex-direction : column ;
177
- }
178
-
179
- .messages {
180
- flex : 1 ;
181
- overflow : auto ;
182
- }
183
-
184
177
.status {
185
178
width : 5em ;
186
179
text-align : center ;
187
180
}
188
181
189
- .status-icon {
182
+ .status-container {
190
183
color : white ;
191
- border-radius : 0.75 em ;
192
- width : 1.2 em ;
193
- height : 1.2 em ;
184
+ width : 20 px ;
185
+ height : 20 px ;
186
+ position : relative ;
194
187
}
195
188
196
- .status-icon ::before {
197
- vertical-align : middle ;
198
- font-size : 0.85em ;
189
+ .status-icon {
190
+ background-position : center ;
191
+ background-repeat : no-repeat ;
192
+ height : 20px ;
193
+ width : 20px ;
199
194
}
200
195
201
- .successful {
202
- background : #6cc63f ;
196
+ .warning {
197
+ background-image : url (" @/assets/warning.svg" );
198
+ background-position : bottom ;
199
+ background-repeat : no-repeat ;
200
+ height : 13px ;
201
+ width : 13px ;
202
+ position : absolute ;
203
+ right : 0 ;
204
+ bottom : 0 ;
203
205
}
204
- .successful ::before {
205
- content : " \f00c " ;
206
+
207
+ .successful {
208
+ background-image : url (" @/assets/status_successful.svg" );
206
209
}
207
210
208
211
.resolved-successfully {
209
- background : #3f881b ;
210
- }
211
- .resolved-successfully ::before {
212
- content : " \f01e " ;
212
+ background-image : url (" @/assets/status_resolved.svg" );
213
213
}
214
214
215
215
.failed {
216
- background : #c63f3f ;
217
- }
218
- .failed ::before {
219
- content : " \f00d " ;
216
+ background-image : url (" @/assets/status_failed.svg" );
220
217
}
221
218
222
219
.archived {
223
- background : #000000 ;
224
- }
225
- .archived ::before {
226
- content : " \f187 " ;
227
- font-size : 0.85em ;
220
+ background-image : url (" @/assets/status_archived.svg" );
228
221
}
229
222
230
223
.repeated-failure {
231
- background : #c63f3f ;
232
- }
233
- .repeated-failure ::before {
234
- content : " \f00d\f00d " ;
235
- font-size : 0.6em ;
224
+ background-image : url (" @/assets/status_repeated_failed.svg" );
236
225
}
237
226
238
227
.retry-issued {
239
- background : #cccccc ;
240
- color : #000000 ;
241
- }
242
- .retry-issued ::before {
243
- content : " \f01e " ;
228
+ background-image : url (" @/assets/status_retry_issued.svg" );
244
229
}
245
230
246
231
.grid-row {
0 commit comments