@7365admin1/layer-common 3.2.2-staging.104 → 3.2.2-staging.106
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.
|
@@ -63,7 +63,6 @@
|
|
|
63
63
|
<tr>
|
|
64
64
|
<th>Name</th>
|
|
65
65
|
<th>Facial Data</th>
|
|
66
|
-
<th>Unit</th>
|
|
67
66
|
<th>Last Access Method</th>
|
|
68
67
|
<th>Last access time</th>
|
|
69
68
|
<th>Status</th>
|
|
@@ -72,14 +71,20 @@
|
|
|
72
71
|
</thead>
|
|
73
72
|
<tbody>
|
|
74
73
|
<tr v-for="row in paginatedRows" :key="row.key">
|
|
75
|
-
<td>
|
|
74
|
+
<td>
|
|
75
|
+
<div class="name-cell">
|
|
76
|
+
{{ row.name }}
|
|
77
|
+
<v-tooltip v-if="row.name && row.name !== 'N/A'" activator="parent" location="top">
|
|
78
|
+
{{ row.name }}
|
|
79
|
+
</v-tooltip>
|
|
80
|
+
</div>
|
|
81
|
+
</td>
|
|
76
82
|
<td>
|
|
77
83
|
<v-avatar v-if="row.faceImage" size="34" rounded="lg" class="hid-face-avatar">
|
|
78
84
|
<v-img :src="row.faceImage" cover />
|
|
79
85
|
</v-avatar>
|
|
80
86
|
<span v-else>{{ row.facialData }}</span>
|
|
81
87
|
</td>
|
|
82
|
-
<td>{{ row.unit }}</td>
|
|
83
88
|
<td>{{ row.method }}</td>
|
|
84
89
|
<td>{{ row.lastAccessTime }}</td>
|
|
85
90
|
<td>
|
|
@@ -87,9 +92,12 @@
|
|
|
87
92
|
size="small"
|
|
88
93
|
variant="flat"
|
|
89
94
|
class="status-chip"
|
|
90
|
-
:class="row.status
|
|
95
|
+
:class="getAuthorizationChipClass(row.status)"
|
|
91
96
|
>
|
|
92
97
|
{{ row.status }}
|
|
98
|
+
<v-tooltip v-if="row.authorizationReason" activator="parent" location="top">
|
|
99
|
+
{{ row.authorizationReason }}
|
|
100
|
+
</v-tooltip>
|
|
93
101
|
</v-chip>
|
|
94
102
|
</td>
|
|
95
103
|
<td class="text-right">
|
|
@@ -159,6 +167,7 @@
|
|
|
159
167
|
<th>Reader Location</th>
|
|
160
168
|
<th>Access Method</th>
|
|
161
169
|
<th>Access Date and Time</th>
|
|
170
|
+
<th>Status</th>
|
|
162
171
|
</tr>
|
|
163
172
|
</thead>
|
|
164
173
|
<tbody>
|
|
@@ -168,6 +177,19 @@
|
|
|
168
177
|
<td>{{ row.readerLocation }}</td>
|
|
169
178
|
<td>{{ row.method }}</td>
|
|
170
179
|
<td>{{ row.lastAccessTime }}</td>
|
|
180
|
+
<td>
|
|
181
|
+
<v-chip
|
|
182
|
+
size="small"
|
|
183
|
+
variant="flat"
|
|
184
|
+
class="status-chip"
|
|
185
|
+
:class="getAuthorizationChipClass(row.status)"
|
|
186
|
+
>
|
|
187
|
+
{{ row.status }}
|
|
188
|
+
<v-tooltip v-if="row.authorizationReason" activator="parent" location="top">
|
|
189
|
+
{{ row.authorizationReason }}
|
|
190
|
+
</v-tooltip>
|
|
191
|
+
</v-chip>
|
|
192
|
+
</td>
|
|
171
193
|
</tr>
|
|
172
194
|
</tbody>
|
|
173
195
|
</v-table>
|
|
@@ -324,6 +346,7 @@ const props = defineProps({
|
|
|
324
346
|
});
|
|
325
347
|
|
|
326
348
|
type AccessTab = "resident" | "visitor" | "administrator";
|
|
349
|
+
type AuthorizationStatus = "Authorized" | "Not Authorized" | "Unknown";
|
|
327
350
|
type AccessRow = {
|
|
328
351
|
key: string;
|
|
329
352
|
identityKey: string;
|
|
@@ -337,7 +360,8 @@ type AccessRow = {
|
|
|
337
360
|
lastAccessTime: string;
|
|
338
361
|
lastAccessDate?: Date;
|
|
339
362
|
readerLocation: string;
|
|
340
|
-
status:
|
|
363
|
+
status: AuthorizationStatus;
|
|
364
|
+
authorizationReason?: string;
|
|
341
365
|
};
|
|
342
366
|
|
|
343
367
|
type PdfAccessRow = {
|
|
@@ -365,7 +389,7 @@ const activeTab = ref<AccessTab>("resident");
|
|
|
365
389
|
const search = ref("");
|
|
366
390
|
const status = ref("Status");
|
|
367
391
|
const page = ref(1);
|
|
368
|
-
const limit =
|
|
392
|
+
const limit = 10;
|
|
369
393
|
const loading = ref(false);
|
|
370
394
|
const loadSequence = ref(0);
|
|
371
395
|
const exportDialog = ref(false);
|
|
@@ -383,7 +407,7 @@ const exportForm = reactive({
|
|
|
383
407
|
status: "Status",
|
|
384
408
|
});
|
|
385
409
|
|
|
386
|
-
const statusOptions = ["Status", "
|
|
410
|
+
const statusOptions = ["Status", "Authorized", "Not Authorized", "Unknown"];
|
|
387
411
|
const accessMethodOptions = ["All", "Facial", "QR Code", "ID and Password", "PIN", "Card"];
|
|
388
412
|
|
|
389
413
|
const readerOptions = computed(() =>
|
|
@@ -448,7 +472,7 @@ const selectedHistoryRows = computed<AccessRow[]>(() => {
|
|
|
448
472
|
lastAccessTime: formatDate(getLogAccessDateValue(log)),
|
|
449
473
|
lastAccessDate: parseDate(getLogAccessDateValue(log)),
|
|
450
474
|
readerLocation: getLogReaderLocation(log),
|
|
451
|
-
|
|
475
|
+
...getAuthorizationStatus(log.payload || log, log),
|
|
452
476
|
}));
|
|
453
477
|
|
|
454
478
|
const liveRows = matchedLiveLogs.map((log, index) => ({
|
|
@@ -462,7 +486,7 @@ const selectedHistoryRows = computed<AccessRow[]>(() => {
|
|
|
462
486
|
lastAccessTime: formatDate(getAccessLogTime(log, {})),
|
|
463
487
|
lastAccessDate: parseDate(getAccessLogTime(log, {})),
|
|
464
488
|
readerLocation: selectedReader.value?.location || "N/A",
|
|
465
|
-
|
|
489
|
+
...getAuthorizationStatus(log, {}),
|
|
466
490
|
}));
|
|
467
491
|
|
|
468
492
|
return [...historyRows, ...liveRows].sort((a, b) => {
|
|
@@ -1198,10 +1222,56 @@ function mapAccessLogToRow(rawLog: Record<string, any>, event: Record<string, an
|
|
|
1198
1222
|
lastAccessTime: formatDate(rawAccessTime),
|
|
1199
1223
|
lastAccessDate: parseDate(rawAccessTime),
|
|
1200
1224
|
readerLocation: getLogReaderLocation(event),
|
|
1201
|
-
|
|
1225
|
+
...getAuthorizationStatus(rawLog, event),
|
|
1226
|
+
};
|
|
1227
|
+
}
|
|
1228
|
+
|
|
1229
|
+
function getAuthorizationStatus(
|
|
1230
|
+
rawLog: Record<string, any>,
|
|
1231
|
+
event: Record<string, any>,
|
|
1232
|
+
): Pick<AccessRow, "status" | "authorizationReason"> {
|
|
1233
|
+
const authorization = event.payload?.authorization || rawLog.authorization;
|
|
1234
|
+
if (typeof authorization?.granted === "boolean") {
|
|
1235
|
+
return {
|
|
1236
|
+
status: authorization.granted ? "Authorized" : "Not Authorized",
|
|
1237
|
+
authorizationReason: String(
|
|
1238
|
+
authorization.reason || (authorization.granted ? "Access granted" : "Access denied"),
|
|
1239
|
+
),
|
|
1240
|
+
};
|
|
1241
|
+
}
|
|
1242
|
+
|
|
1243
|
+
const eventCode = Number(
|
|
1244
|
+
rawLog.event ?? rawLog.event_id ?? rawLog.eventId ?? event.payload?.event,
|
|
1245
|
+
);
|
|
1246
|
+
if (eventCode === 7) {
|
|
1247
|
+
return { status: "Authorized", authorizationReason: "Access granted by HID authorization." };
|
|
1248
|
+
}
|
|
1249
|
+
if (eventCode === 6) {
|
|
1250
|
+
return { status: "Not Authorized", authorizationReason: "Access denied by HID authorization." };
|
|
1251
|
+
}
|
|
1252
|
+
|
|
1253
|
+
const eventLabel = String(
|
|
1254
|
+
getConfigurationLabel("event_types", eventCode) || rawLog.event_name || rawLog.eventName || "",
|
|
1255
|
+
).toLowerCase();
|
|
1256
|
+
if (/not authorized|unauthori[sz]ed|access denied|denied|rejected/.test(eventLabel)) {
|
|
1257
|
+
return { status: "Not Authorized", authorizationReason: eventLabel };
|
|
1258
|
+
}
|
|
1259
|
+
if (/authorized|access granted|granted|released|opened/.test(eventLabel)) {
|
|
1260
|
+
return { status: "Authorized", authorizationReason: eventLabel };
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
return {
|
|
1264
|
+
status: "Unknown",
|
|
1265
|
+
authorizationReason: "This access log does not include an authorization result.",
|
|
1202
1266
|
};
|
|
1203
1267
|
}
|
|
1204
1268
|
|
|
1269
|
+
function getAuthorizationChipClass(status: AuthorizationStatus) {
|
|
1270
|
+
if (status === "Authorized") return "mapped-chip";
|
|
1271
|
+
if (status === "Not Authorized") return "unmapped-chip";
|
|
1272
|
+
return "unknown-chip";
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1205
1275
|
function findIdentityForAccessLog(rawLog: Record<string, any>, event: Record<string, any>) {
|
|
1206
1276
|
const eventIdentityId = event.payload?.identity?._id;
|
|
1207
1277
|
if (eventIdentityId) {
|
|
@@ -1643,7 +1713,7 @@ function escapeHtml(value: unknown) {
|
|
|
1643
1713
|
.table-card :deep(table) {
|
|
1644
1714
|
table-layout: fixed;
|
|
1645
1715
|
width: 100%;
|
|
1646
|
-
min-width:
|
|
1716
|
+
min-width: 880px;
|
|
1647
1717
|
}
|
|
1648
1718
|
|
|
1649
1719
|
.table-card :deep(th),
|
|
@@ -1653,37 +1723,40 @@ function escapeHtml(value: unknown) {
|
|
|
1653
1723
|
|
|
1654
1724
|
.table-card :deep(th:nth-child(1)),
|
|
1655
1725
|
.table-card :deep(td:nth-child(1)) {
|
|
1656
|
-
width:
|
|
1726
|
+
width: 25%;
|
|
1657
1727
|
}
|
|
1658
1728
|
|
|
1659
1729
|
.table-card :deep(th:nth-child(2)),
|
|
1660
1730
|
.table-card :deep(td:nth-child(2)) {
|
|
1661
|
-
width:
|
|
1731
|
+
width: 13%;
|
|
1662
1732
|
}
|
|
1663
1733
|
|
|
1664
1734
|
.table-card :deep(th:nth-child(3)),
|
|
1665
1735
|
.table-card :deep(td:nth-child(3)) {
|
|
1666
|
-
width:
|
|
1736
|
+
width: 21%;
|
|
1667
1737
|
}
|
|
1668
1738
|
|
|
1669
1739
|
.table-card :deep(th:nth-child(4)),
|
|
1670
1740
|
.table-card :deep(td:nth-child(4)) {
|
|
1671
|
-
width:
|
|
1741
|
+
width: 21%;
|
|
1672
1742
|
}
|
|
1673
1743
|
|
|
1674
1744
|
.table-card :deep(th:nth-child(5)),
|
|
1675
1745
|
.table-card :deep(td:nth-child(5)) {
|
|
1676
|
-
width:
|
|
1746
|
+
width: 14%;
|
|
1677
1747
|
}
|
|
1678
1748
|
|
|
1679
1749
|
.table-card :deep(th:nth-child(6)),
|
|
1680
1750
|
.table-card :deep(td:nth-child(6)) {
|
|
1681
|
-
width:
|
|
1751
|
+
width: 6%;
|
|
1682
1752
|
}
|
|
1683
1753
|
|
|
1684
|
-
.
|
|
1685
|
-
|
|
1686
|
-
width:
|
|
1754
|
+
.name-cell {
|
|
1755
|
+
display: block;
|
|
1756
|
+
min-width: 0;
|
|
1757
|
+
overflow: hidden;
|
|
1758
|
+
text-overflow: ellipsis;
|
|
1759
|
+
white-space: nowrap;
|
|
1687
1760
|
}
|
|
1688
1761
|
|
|
1689
1762
|
.history-dialog {
|
|
@@ -1776,6 +1849,11 @@ function escapeHtml(value: unknown) {
|
|
|
1776
1849
|
}
|
|
1777
1850
|
|
|
1778
1851
|
.unmapped-chip {
|
|
1852
|
+
background: #fde8e8 !important;
|
|
1853
|
+
color: #b42318 !important;
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
.unknown-chip {
|
|
1779
1857
|
background: #fff0cc !important;
|
|
1780
1858
|
color: #9a6700 !important;
|
|
1781
1859
|
}
|
|
@@ -1402,31 +1402,26 @@ function getHidErrorMessage(error: any) {
|
|
|
1402
1402
|
|
|
1403
1403
|
.table-card :deep(th:nth-child(1)),
|
|
1404
1404
|
.table-card :deep(td:nth-child(1)) {
|
|
1405
|
-
width:
|
|
1405
|
+
width: 28%;
|
|
1406
1406
|
}
|
|
1407
1407
|
|
|
1408
1408
|
.table-card :deep(th:nth-child(2)),
|
|
1409
1409
|
.table-card :deep(td:nth-child(2)) {
|
|
1410
|
-
width:
|
|
1410
|
+
width: 22%;
|
|
1411
1411
|
}
|
|
1412
1412
|
|
|
1413
1413
|
.table-card :deep(th:nth-child(3)),
|
|
1414
1414
|
.table-card :deep(td:nth-child(3)) {
|
|
1415
|
-
width:
|
|
1415
|
+
width: 25%;
|
|
1416
1416
|
}
|
|
1417
1417
|
|
|
1418
1418
|
.table-card :deep(th:nth-child(4)),
|
|
1419
1419
|
.table-card :deep(td:nth-child(4)) {
|
|
1420
|
-
width:
|
|
1420
|
+
width: 17%;
|
|
1421
1421
|
}
|
|
1422
1422
|
|
|
1423
1423
|
.table-card :deep(th:nth-child(5)),
|
|
1424
1424
|
.table-card :deep(td:nth-child(5)) {
|
|
1425
|
-
width: 16%;
|
|
1426
|
-
}
|
|
1427
|
-
|
|
1428
|
-
.table-card :deep(th:nth-child(6)),
|
|
1429
|
-
.table-card :deep(td:nth-child(6)) {
|
|
1430
1425
|
width: 8%;
|
|
1431
1426
|
}
|
|
1432
1427
|
|