@@ -5,8 +5,9 @@ import { storeToRefs } from "pinia";
5
5
import Message , { MessageStatus } from " @/resources/Message" ;
6
6
import { useRoute , useRouter } from " vue-router" ;
7
7
import ResultsCount from " @/components/ResultsCount.vue" ;
8
- import { dotNetTimespanToMilliseconds , formatDotNetTimespan } from " @/composables/formatUtils" ;
8
+ import { formatDotNetTimespan } from " @/composables/formatUtils" ;
9
9
import FiltersPanel from " @/components/audit/FiltersPanel.vue" ;
10
+ import MessageStatusIcon from " @/components/audit/MessageStatusIcon.vue" ;
10
11
import { onBeforeMount , onUnmounted , ref , watch } from " vue" ;
11
12
import RefreshConfig from " ../RefreshConfig.vue" ;
12
13
import useAutoRefresh from " @/composables/autoRefresh" ;
@@ -36,49 +37,6 @@ onUnmounted(() => {
36
37
dataRetriever .updateTimeout (null );
37
38
});
38
39
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
40
function navigateToMessage(message : Message ) {
83
41
const query = router .currentRoute .value .query ;
84
42
@@ -169,10 +127,7 @@ watch(autoRefreshValue, (newValue) => dataRetriever.updateTimeout(newValue));
169
127
<template v-for =" message in messages " :key =" message .id " >
170
128
<div class =" item" @click =" navigateToMessage(message)" >
171
129
<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 >
130
+ <MessageStatusIcon :message =" message" />
176
131
</div >
177
132
<div class =" message-id" >{{ message.message_id }}</div >
178
133
<div class =" message-type" >{{ message.message_type }}</div >
@@ -251,52 +206,4 @@ watch(autoRefreshValue, (newValue) => dataRetriever.updateTimeout(newValue));
251
206
.delivery-time {
252
207
grid-area : delivery-time;
253
208
}
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
209
</style >
0 commit comments