1
1
<script setup lang="ts">
2
- import routeLinks from " @/router/routeLinks" ;
3
2
import { FieldNames , useAuditStore } from " @/stores/AuditStore" ;
4
3
import { storeToRefs } from " pinia" ;
5
- import Message , { MessageStatus } from " @/resources/Message" ;
6
4
import { useRoute , useRouter } from " vue-router" ;
7
5
import ResultsCount from " @/components/ResultsCount.vue" ;
8
- import { dotNetTimespanToMilliseconds , formatDotNetTimespan } from " @/composables/formatUtils" ;
9
6
import FiltersPanel from " @/components/audit/FiltersPanel.vue" ;
7
+ import AuditListItem from " @/components/audit/AuditListItem.vue" ;
10
8
import { onBeforeMount , onUnmounted , ref , watch } from " vue" ;
11
9
import RefreshConfig from " ../RefreshConfig.vue" ;
12
10
import useAutoRefresh from " @/composables/autoRefresh" ;
@@ -36,58 +34,6 @@ onUnmounted(() => {
36
34
dataRetriever .updateTimeout (null );
37
35
});
38
36
39
- function statusToName(messageStatus : MessageStatus ) {
40
- switch (messageStatus ) {
41
- case MessageStatus .Successful :
42
- return " Successful" ;
43
- case MessageStatus .ResolvedSuccessfully :
44
- return " Successful after retries" ;
45
- case MessageStatus .Failed :
46
- return " Failed" ;
47
- case MessageStatus .ArchivedFailure :
48
- return " Failed message deleted" ;
49
- case MessageStatus .RepeatedFailure :
50
- return " Repeated Failures" ;
51
- case MessageStatus .RetryIssued :
52
- return " Retry requested" ;
53
- }
54
- }
55
-
56
- function statusToIcon(messageStatus : MessageStatus ) {
57
- switch (messageStatus ) {
58
- case MessageStatus .Successful :
59
- return " fa successful" ;
60
- case MessageStatus .ResolvedSuccessfully :
61
- return " fa resolved-successfully" ;
62
- case MessageStatus .Failed :
63
- return " fa failed" ;
64
- case MessageStatus .ArchivedFailure :
65
- return " fa archived" ;
66
- case MessageStatus .RepeatedFailure :
67
- return " fa repeated-failure" ;
68
- case MessageStatus .RetryIssued :
69
- return " fa retry-issued" ;
70
- }
71
- }
72
-
73
- function hasWarning(message : Message ) {
74
- return (
75
- message .status === MessageStatus .ResolvedSuccessfully || //
76
- dotNetTimespanToMilliseconds (message .critical_time ) < 0 ||
77
- dotNetTimespanToMilliseconds (message .processing_time ) < 0 ||
78
- dotNetTimespanToMilliseconds (message .delivery_time ) < 0
79
- );
80
- }
81
-
82
- function navigateToMessage(message : Message ) {
83
- const query = router .currentRoute .value .query ;
84
-
85
- router .push ({
86
- path: message .status === MessageStatus .Successful || message .status === MessageStatus .ResolvedSuccessfully ? routeLinks .messages .successMessage .link (message .message_id , message .id ) : routeLinks .messages .failedMessage .link (message .id ),
87
- query: { ... query , ... { back: route .path } },
88
- });
89
- }
90
-
91
37
const firstLoad = ref (true );
92
38
93
39
onBeforeMount (() => {
@@ -167,20 +113,7 @@ watch(autoRefreshValue, (newValue) => dataRetriever.updateTimeout(newValue));
167
113
<div class =" row results-table" >
168
114
<LoadingSpinner v-if =" firstLoad" />
169
115
<template v-for =" message in messages " :key =" message .id " >
170
- <div class =" item" @click =" navigateToMessage(message)" >
171
- <div class =" status" >
172
- <div class =" status-container" v-tippy =" { content: statusToName(message.status) }" >
173
- <div class =" status-icon" :class =" statusToIcon(message.status)" ></div >
174
- <div v-if =" hasWarning(message)" class =" warning" ></div >
175
- </div >
176
- </div >
177
- <div class =" message-id" >{{ message.message_id }}</div >
178
- <div class =" message-type" >{{ message.message_type }}</div >
179
- <div class =" time-sent" ><span class =" label-name" >Time Sent:</span >{{ new Date(message.time_sent).toLocaleString() }}</div >
180
- <div class =" critical-time" ><span class =" label-name" >Critical Time:</span >{{ formatDotNetTimespan(message.critical_time) }}</div >
181
- <div class =" processing-time" ><span class =" label-name" >Processing Time:</span >{{ formatDotNetTimespan(message.processing_time) }}</div >
182
- <div class =" delivery-time" ><span class =" label-name" >Delivery Time:</span >{{ formatDotNetTimespan(message.delivery_time) }}</div >
183
- </div >
116
+ <AuditListItem :message =" message" />
184
117
</template >
185
118
</div >
186
119
</div >
@@ -204,99 +137,4 @@ watch(autoRefreshValue, (newValue) => dataRetriever.updateTimeout(newValue));
204
137
margin-bottom : 5rem ;
205
138
background-color : #ffffff ;
206
139
}
207
- .item {
208
- padding : 0.3rem 0.2rem ;
209
- border : 1px solid #ffffff ;
210
- border-bottom : 1px solid #eee ;
211
- display : grid ;
212
- grid-template-columns : 1.8em 1fr 1fr 1fr 1fr ;
213
- grid-template-rows : 1fr 1fr ;
214
- gap : 0.375rem ;
215
- grid-template-areas :
216
- " status message-type message-type message-type time-sent"
217
- " status message-id processing-time critical-time delivery-time" ;
218
- }
219
- .item :not (:first-child ) {
220
- border-top-color : #eee ;
221
- }
222
- .item :hover {
223
- border-color : #00a3c4 ;
224
- background-color : #edf6f7 ;
225
- cursor : pointer ;
226
- }
227
- .label-name {
228
- margin-right : 0.25rem ;
229
- color : #777f7f ;
230
- }
231
- .status {
232
- grid-area : status;
233
- }
234
- .message-id {
235
- grid-area : message-id;
236
- }
237
- .time-sent {
238
- grid-area : time-sent;
239
- }
240
- .message-type {
241
- grid-area : message-type;
242
- font-weight : bold ;
243
- overflow-wrap : break-word ;
244
- }
245
- .processing-time {
246
- grid-area : processing-time;
247
- }
248
- .critical-time {
249
- grid-area : critical-time;
250
- }
251
- .delivery-time {
252
- grid-area : delivery-time;
253
- }
254
- .status-container {
255
- color : white ;
256
- width : 1.4em ;
257
- height : 1.4em ;
258
- position : relative ;
259
- }
260
-
261
- .status-icon {
262
- background-position : center ;
263
- background-repeat : no-repeat ;
264
- height : 1.4em ;
265
- width : 1.4em ;
266
- }
267
-
268
- .warning {
269
- background-image : url (" @/assets/warning.svg" );
270
- background-position : bottom ;
271
- background-repeat : no-repeat ;
272
- height : 0.93em ;
273
- width : 0.93em ;
274
- position : absolute ;
275
- right : 0 ;
276
- bottom : 0 ;
277
- }
278
-
279
- .successful {
280
- background-image : url (" @/assets/status_successful.svg" );
281
- }
282
-
283
- .resolved-successfully {
284
- background-image : url (" @/assets/status_resolved.svg" );
285
- }
286
-
287
- .failed {
288
- background-image : url (" @/assets/status_failed.svg" );
289
- }
290
-
291
- .archived {
292
- background-image : url (" @/assets/status_archived.svg" );
293
- }
294
-
295
- .repeated-failure {
296
- background-image : url (" @/assets/status_repeated_failed.svg" );
297
- }
298
-
299
- .retry-issued {
300
- background-image : url (" @/assets/status_retry_issued.svg" );
301
- }
302
140
</style >
0 commit comments