@7365admin1/layer-common 4.21.4-staging.348 → 4.23.0
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/CHANGELOG.md +32 -4
- package/components/AccessCardAddForm.vue +4 -5
- package/components/AccessCardAssignToUnitForm.vue +2 -3
- package/components/AccessCardPreviewDialog.vue +3 -4
- package/components/DocumentForm.vue +112 -407
- package/components/DocumentManagement.vue +12 -213
- package/components/EntryPass/QrTemplatePreview.vue +25 -21
- package/components/EntryPassInformation.vue +24 -119
- package/components/Facility/BookingSetup.vue +0 -63
- package/components/HidAccessLogDashboard.vue +5 -29
- package/components/HidIntercomManagement.vue +14 -148
- package/components/HidReaderManagement.vue +0 -26
- package/components/HidReaderUserRoster.vue +2 -32
- package/components/HidUserEnrollment.vue +152 -833
- package/components/InvitationClientForm.vue +1 -19
- package/components/VisitorManagement.vue +5 -267
- package/composables/useAccessManagement.ts +0 -5
- package/composables/useDocument.ts +0 -7
- package/composables/useFacility.ts +0 -11
- package/composables/useHidAmico.ts +0 -117
- package/composables/useHidNavigation.ts +1 -25
- package/composables/usePeople.ts +0 -19
- package/composables/useSiteEntryPassSettings.ts +0 -26
- package/composables/useWebUsb.ts +11 -14
- package/package.json +1 -1
- package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
- package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
- package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
- package/types/document.d.ts +0 -14
- package/types/facility.d.ts +0 -4
- package/types/people.d.ts +1 -4
- package/components/HidAccessPermissions.vue +0 -424
- package/components/HidProfileQrCode.vue +0 -323
- package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +0 -23
- package/utils/hid-permission-assignments.ts +0 -190
|
@@ -401,10 +401,7 @@ const exportForm = reactive({
|
|
|
401
401
|
});
|
|
402
402
|
|
|
403
403
|
const statusOptions = ["Authorized", "Not Authorized", "Unknown"];
|
|
404
|
-
const accessMethodFilterOptions = ["Facial", "QR Code", "ID and Password", "PIN", "Card"
|
|
405
|
-
|
|
406
|
-
/** The persisted event the resident app records when it opens a door on a call. */
|
|
407
|
-
const INTERCOM_DOOR_OPEN_EVENT = "intercom_door_open";
|
|
404
|
+
const accessMethodFilterOptions = ["Facial", "QR Code", "ID and Password", "PIN", "Card"];
|
|
408
405
|
const accessMethodOptions = ["All", ...accessMethodFilterOptions];
|
|
409
406
|
|
|
410
407
|
const readerOptions = computed(() =>
|
|
@@ -609,7 +606,7 @@ async function loadDashboard() {
|
|
|
609
606
|
resetDashboardData();
|
|
610
607
|
try {
|
|
611
608
|
const isVisitorTab = activeTab.value === "visitor";
|
|
612
|
-
const [logResponse,
|
|
609
|
+
const [logResponse, hidAccessLogResponse, visitorResponse, readerUserResponse] = await Promise.all([
|
|
613
610
|
loadDashboardSource(
|
|
614
611
|
getLogs(selectedReaderId.value, {
|
|
615
612
|
page: page.value,
|
|
@@ -618,20 +615,6 @@ async function loadDashboard() {
|
|
|
618
615
|
null,
|
|
619
616
|
"persisted access logs",
|
|
620
617
|
),
|
|
621
|
-
// Door opens from the resident app during an intercom call. The reader
|
|
622
|
-
// never logs a DTMF door open, so these exist only as persisted events
|
|
623
|
-
// and are fetched by type: the general page above is shared with every
|
|
624
|
-
// other event the reader emits and is dropped whenever the reader has
|
|
625
|
-
// live logs, which it always has.
|
|
626
|
-
loadDashboardSource(
|
|
627
|
-
getLogs(selectedReaderId.value, {
|
|
628
|
-
page: page.value,
|
|
629
|
-
limit,
|
|
630
|
-
type: INTERCOM_DOOR_OPEN_EVENT,
|
|
631
|
-
}),
|
|
632
|
-
null,
|
|
633
|
-
"intercom door-open logs",
|
|
634
|
-
),
|
|
635
618
|
loadDashboardSource(
|
|
636
619
|
getReaderAccessLogs(selectedReaderId.value, {
|
|
637
620
|
page: page.value,
|
|
@@ -698,14 +681,9 @@ async function loadDashboard() {
|
|
|
698
681
|
// identity metadata here: it can contain a stale photo from another user.
|
|
699
682
|
allIdentities.value = readerUsers;
|
|
700
683
|
identities.value = readerUsers;
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
? []
|
|
705
|
-
: logResponse?.items ?? logResponse?.data?.items ?? logResponse?.data?.logs ?? []),
|
|
706
|
-
// Always kept: the reader has no live counterpart for these.
|
|
707
|
-
...intercomItems,
|
|
708
|
-
];
|
|
684
|
+
logs.value = liveItems.length
|
|
685
|
+
? []
|
|
686
|
+
: logResponse?.items ?? logResponse?.data?.items ?? logResponse?.data?.logs ?? [];
|
|
709
687
|
liveAccessLogs.value = liveItems;
|
|
710
688
|
serverPages.value = Number(hidAccessLogResponse?.pages ?? hidAccessLogResponse?.data?.pages ?? 1);
|
|
711
689
|
serverPageRange.value = String(
|
|
@@ -841,8 +819,6 @@ function getAccessMethod(identity: HidAccessRecord, log?: HidAccessRecord) {
|
|
|
841
819
|
id_password: "ID and Password",
|
|
842
820
|
pin: "PIN",
|
|
843
821
|
card: "Card",
|
|
844
|
-
// Set by the API on intercom_door_open events; no reader field implies it.
|
|
845
|
-
intercom: "Intercom",
|
|
846
822
|
};
|
|
847
823
|
const normalizedMethod = String(payload.normalizedMethod || "");
|
|
848
824
|
if (normalizedMethodLabels[normalizedMethod]) return normalizedMethodLabels[normalizedMethod];
|
|
@@ -162,8 +162,11 @@
|
|
|
162
162
|
/>
|
|
163
163
|
<v-list-item class="screen-menu__item" title="Call Settings" prepend-icon="mdi-cog" @click="openCallDialog(item)" />
|
|
164
164
|
<v-list-item class="screen-menu__item" title="Dial Code" prepend-icon="mdi-dialpad" @click="openDialCodeDialog(item)" />
|
|
165
|
+
<v-list-item class="screen-menu__item" title="Make a call" prepend-icon="mdi-phone" @click="openMakeCallDialog(item)" />
|
|
166
|
+
<v-list-item class="screen-menu__item" title="Web call" prepend-icon="mdi-headset" @click="openWebPhoneDialog(item)" />
|
|
165
167
|
</v-list>
|
|
166
168
|
<v-list v-else density="compact" class="screen-menu">
|
|
169
|
+
<v-list-item class="screen-menu__item" title="Call" prepend-icon="mdi-phone" @click="openContactCall(item)" />
|
|
167
170
|
<v-list-item class="screen-menu__item" title="Check reader SIP status" prepend-icon="mdi-lan-check" @click="testContactSipStatus(item)" />
|
|
168
171
|
<v-list-item class="screen-menu__item" title="View" prepend-icon="mdi-eye" @click="openContactView(item)" />
|
|
169
172
|
<v-list-item class="screen-menu__item" title="Edit" prepend-icon="mdi-pencil" @click="openContactDialog(item)" />
|
|
@@ -586,31 +589,9 @@
|
|
|
586
589
|
:disabled="Boolean(contactForm.id)"
|
|
587
590
|
/>
|
|
588
591
|
<FieldLabel text="Name" required />
|
|
589
|
-
|
|
590
|
-
rather than typed, so a contact always names a person who holds an
|
|
591
|
-
extension. The model stays the plain name string the reader stores,
|
|
592
|
-
so `saveContact` is unchanged; an existing contact whose name is not
|
|
593
|
-
in the list still displays it (AppSelect falls back to the raw value). -->
|
|
594
|
-
<AppSelect
|
|
595
|
-
v-model="contactForm.name"
|
|
596
|
-
:items="sipAccountOptions"
|
|
597
|
-
:disabled="sipAccountsLoading"
|
|
598
|
-
:placeholder="sipAccountsLoading ? 'Loading SIP accounts…' : 'Name shown on calls'"
|
|
599
|
-
class="my-3"
|
|
600
|
-
@update:model-value="applySipAccountToContact"
|
|
601
|
-
/>
|
|
602
|
-
<p v-if="sipAccountsError" class="field-hint field-hint--error">{{ sipAccountsError }}</p>
|
|
603
|
-
<p v-else-if="!sipAccountsLoading && !sipAccounts.length" class="field-hint">
|
|
604
|
-
No SIP accounts on this site yet. An account is created the first time a user opens Web Call.
|
|
605
|
-
</p>
|
|
592
|
+
<AppField v-model="contactForm.name" placeholder="Name shown on calls" class="my-3" />
|
|
606
593
|
<FieldLabel text="Address" required />
|
|
607
|
-
|
|
608
|
-
and is never typed into. -->
|
|
609
|
-
<AppField
|
|
610
|
-
v-model="contactForm.serverAddress"
|
|
611
|
-
:placeholder="contactAddressPlaceholder"
|
|
612
|
-
disabled
|
|
613
|
-
/>
|
|
594
|
+
<AppField v-model="contactForm.serverAddress" :placeholder="contactAddressPlaceholder" />
|
|
614
595
|
<p class="field-hint">{{ contactAddressHint }}</p>
|
|
615
596
|
</v-card-text>
|
|
616
597
|
<v-card-actions class="dialog-actions pa-0">
|
|
@@ -655,8 +636,6 @@
|
|
|
655
636
|
</template>
|
|
656
637
|
|
|
657
638
|
<script setup lang="ts">
|
|
658
|
-
import type { HidSipAccountListItem } from "../composables/useHidAmico";
|
|
659
|
-
|
|
660
639
|
const props = defineProps({
|
|
661
640
|
org: {
|
|
662
641
|
type: String,
|
|
@@ -753,8 +732,6 @@ const {
|
|
|
753
732
|
makeIntercomCall,
|
|
754
733
|
finalizeIntercomCall,
|
|
755
734
|
ensureSipAccount,
|
|
756
|
-
getSipAccounts,
|
|
757
|
-
notifyIntercomCall,
|
|
758
735
|
} = useHidAmico();
|
|
759
736
|
|
|
760
737
|
const activeTab = ref<IntercomTab>("intercom");
|
|
@@ -783,11 +760,6 @@ const webPhoneActionLoading = ref(false);
|
|
|
783
760
|
const sipAccount = ref<SipAccount | null>(null);
|
|
784
761
|
const sipAccountLoading = ref(false);
|
|
785
762
|
const sipAccountError = ref("");
|
|
786
|
-
// The site's SIP account list for the contact dialog's name picker. Distinct
|
|
787
|
-
// from `sipAccount` above, which is the CALLER's own account for the web phone.
|
|
788
|
-
const sipAccounts = ref<HidSipAccountListItem[]>([]);
|
|
789
|
-
const sipAccountsLoading = ref(false);
|
|
790
|
-
const sipAccountsError = ref("");
|
|
791
763
|
const remoteVideoEl = ref<HTMLVideoElement | null>(null);
|
|
792
764
|
const remoteAudioEl = ref<HTMLAudioElement | null>(null);
|
|
793
765
|
const webPhone = useSipWebPhone();
|
|
@@ -892,31 +864,6 @@ const readerOptions = computed(() => readers.value.map((reader) => ({
|
|
|
892
864
|
value: reader._id,
|
|
893
865
|
})));
|
|
894
866
|
|
|
895
|
-
/**
|
|
896
|
-
* The contact name picker. `value` is the bare name because that is what the
|
|
897
|
-
* reader stores and what `saveContact` sends; the extension goes into the
|
|
898
|
-
* Address field, not the label. A name that already sits on the contact being
|
|
899
|
-
* edited but is no longer in the SIP list is kept as an option so the picker
|
|
900
|
-
* does not silently drop it.
|
|
901
|
-
*/
|
|
902
|
-
const sipAccountOptions = computed(() => {
|
|
903
|
-
const options: Array<{ title: string; value: string }> = sipAccounts.value
|
|
904
|
-
.filter((account: HidSipAccountListItem) => account.name)
|
|
905
|
-
.map((account: HidSipAccountListItem) => ({ title: account.name, value: account.name }));
|
|
906
|
-
const current = contactForm.name.trim();
|
|
907
|
-
if (current && !options.some((option) => option.value === current)) {
|
|
908
|
-
options.unshift({ title: current, value: current });
|
|
909
|
-
}
|
|
910
|
-
return options;
|
|
911
|
-
});
|
|
912
|
-
|
|
913
|
-
/** The SIP account behind the picked name, or null for a legacy / unpicked name. */
|
|
914
|
-
const selectedSipAccount = computed(() => {
|
|
915
|
-
const name = contactForm.name.trim();
|
|
916
|
-
const match = sipAccounts.value.find((account: HidSipAccountListItem) => account.name === name);
|
|
917
|
-
return (match ?? null) as HidSipAccountListItem | null;
|
|
918
|
-
});
|
|
919
|
-
|
|
920
867
|
const visibleRows = computed(() => activeTab.value === "intercom" ? filteredIntercomRows.value : filteredContacts.value);
|
|
921
868
|
const pages = computed(() => Math.max(1, Math.ceil(visibleRows.value.length / limit)));
|
|
922
869
|
const pageRange = computed(() => {
|
|
@@ -1029,11 +976,14 @@ const contactReaderRow = computed(() =>
|
|
|
1029
976
|
);
|
|
1030
977
|
const isContactReaderPeerToPeer = computed(() => contactReaderRow.value?.operatingMode === "Peer-to-Peer");
|
|
1031
978
|
const contactAddressPlaceholder = computed(() => (isContactReaderPeerToPeer.value ? "192.168.0.129" : "7100"));
|
|
1032
|
-
const contactAddressHint = computed(() =>
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
979
|
+
const contactAddressHint = computed(() => {
|
|
980
|
+
if (!contactReaderRow.value) {
|
|
981
|
+
return "Extension number (SIP Client) or local IP address (Peer-to-Peer), depending on the reader's operating mode.";
|
|
982
|
+
}
|
|
983
|
+
return isContactReaderPeerToPeer.value
|
|
984
|
+
? "Peer-to-Peer mode: enter the contact's local IP address."
|
|
985
|
+
: "SIP Client mode: enter the contact's extension number.";
|
|
986
|
+
});
|
|
1037
987
|
const areSipCredentialFieldsDisabled = computed(() => !sipForm.enabled || isPeerToPeerMode.value);
|
|
1038
988
|
const intercomDetailSections = computed(() => {
|
|
1039
989
|
const row = selectedRow.value;
|
|
@@ -1449,37 +1399,6 @@ async function loadSipAccount() {
|
|
|
1449
1399
|
}
|
|
1450
1400
|
}
|
|
1451
1401
|
|
|
1452
|
-
async function loadSipAccounts() {
|
|
1453
|
-
if (!props.org || !props.site) return;
|
|
1454
|
-
|
|
1455
|
-
sipAccountsLoading.value = true;
|
|
1456
|
-
sipAccountsError.value = "";
|
|
1457
|
-
try {
|
|
1458
|
-
const response = await getSipAccounts(props.site, props.org);
|
|
1459
|
-
const rows = toRecord(response).data;
|
|
1460
|
-
sipAccounts.value = Array.isArray(rows) ? rows as HidSipAccountListItem[] : [];
|
|
1461
|
-
// An existing contact opened before the list arrived: once its name is
|
|
1462
|
-
// matched to an account, show that account's extension in the locked field.
|
|
1463
|
-
applySipAccountToContact(contactForm.name.trim());
|
|
1464
|
-
} catch (error: unknown) {
|
|
1465
|
-
sipAccounts.value = [];
|
|
1466
|
-
sipAccountsError.value = getErrorMessage(error);
|
|
1467
|
-
} finally {
|
|
1468
|
-
sipAccountsLoading.value = false;
|
|
1469
|
-
}
|
|
1470
|
-
}
|
|
1471
|
-
|
|
1472
|
-
/**
|
|
1473
|
-
* Picking a SIP account sets the address to its extension. The Address field
|
|
1474
|
-
* is always disabled, so this is the only way it gets a value; a name that is
|
|
1475
|
-
* not an account (a legacy contact) leaves whatever address it already had.
|
|
1476
|
-
*/
|
|
1477
|
-
function applySipAccountToContact(name: string) {
|
|
1478
|
-
const account = sipAccounts.value.find((item: HidSipAccountListItem) => item.name === name);
|
|
1479
|
-
if (!account) return;
|
|
1480
|
-
contactForm.serverAddress = account.extension;
|
|
1481
|
-
}
|
|
1482
|
-
|
|
1483
1402
|
async function connectWebPhone() {
|
|
1484
1403
|
const account = sipAccount.value;
|
|
1485
1404
|
if (!account) {
|
|
@@ -1523,10 +1442,8 @@ async function disconnectWebPhone() {
|
|
|
1523
1442
|
|
|
1524
1443
|
async function startWebCall() {
|
|
1525
1444
|
webPhoneActionLoading.value = true;
|
|
1526
|
-
const destination = webPhoneForm.destination;
|
|
1527
1445
|
try {
|
|
1528
|
-
await webPhone.call(destination);
|
|
1529
|
-
void ringResidentPhone(destination);
|
|
1446
|
+
await webPhone.call(webPhoneForm.destination);
|
|
1530
1447
|
} catch (error: unknown) {
|
|
1531
1448
|
showMessage(getErrorMessage(error), "error");
|
|
1532
1449
|
} finally {
|
|
@@ -1534,50 +1451,6 @@ async function startWebCall() {
|
|
|
1534
1451
|
}
|
|
1535
1452
|
}
|
|
1536
1453
|
|
|
1537
|
-
/**
|
|
1538
|
-
* Wake the called resident's mobile so they are there to answer.
|
|
1539
|
-
*
|
|
1540
|
-
* Deliberately fired AFTER the INVITE and never awaited. The SIP leg is the
|
|
1541
|
-
* call: it is already ringing by the time this runs, and a resident whose
|
|
1542
|
-
* phone is asleep is the only thing this fixes. So a failure here is logged
|
|
1543
|
-
* and dropped rather than shown — telling the operator "call failed" for a
|
|
1544
|
-
* call that is ringing would be worse than a silent miss.
|
|
1545
|
-
*
|
|
1546
|
-
* A destination with no resident behind it (a staff extension, an external SIP
|
|
1547
|
-
* address) comes back `notified: false` with a reason and is not an error.
|
|
1548
|
-
*/
|
|
1549
|
-
async function ringResidentPhone(destination: string) {
|
|
1550
|
-
if (!props.org || !props.site) return;
|
|
1551
|
-
|
|
1552
|
-
try {
|
|
1553
|
-
// No `readerId`: this call came from the web phone, not a door station.
|
|
1554
|
-
// The reader selected in the table above is whatever the operator happens
|
|
1555
|
-
// to be looking at, and sending it would tell the resident's app the call
|
|
1556
|
-
// arrived at a door it never touched.
|
|
1557
|
-
await notifyIntercomCall(props.site, {
|
|
1558
|
-
orgId: props.org,
|
|
1559
|
-
destination,
|
|
1560
|
-
callId: createCallId(),
|
|
1561
|
-
});
|
|
1562
|
-
} catch (error: unknown) {
|
|
1563
|
-
console.warn("[intercom] could not send the incoming-call push", error);
|
|
1564
|
-
}
|
|
1565
|
-
}
|
|
1566
|
-
|
|
1567
|
-
/**
|
|
1568
|
-
* A per-call id, so a second push for the same call replaces the first on the
|
|
1569
|
-
* resident's lock screen rather than stacking a second ringing card.
|
|
1570
|
-
* `randomUUID` needs a secure context, which the web phone already requires —
|
|
1571
|
-
* getUserMedia does not run without one — but the fallback keeps a call from
|
|
1572
|
-
* failing on that account alone.
|
|
1573
|
-
*/
|
|
1574
|
-
function createCallId() {
|
|
1575
|
-
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
1576
|
-
return crypto.randomUUID();
|
|
1577
|
-
}
|
|
1578
|
-
return `call-${Date.now()}-${Math.random().toString(16).slice(2)}`;
|
|
1579
|
-
}
|
|
1580
|
-
|
|
1581
1454
|
async function answerWebCall() {
|
|
1582
1455
|
webPhoneActionLoading.value = true;
|
|
1583
1456
|
try {
|
|
@@ -1635,9 +1508,6 @@ function openContactDialog(contact?: ContactRow) {
|
|
|
1635
1508
|
contactForm.location = contact?.location === "N/A" ? "" : contact?.location || selectedReader?.location || "";
|
|
1636
1509
|
contactForm.serverAddress = contact?.serverAddress === "N/A" ? "" : contact?.serverAddress || "";
|
|
1637
1510
|
contactDialog.value = true;
|
|
1638
|
-
// Fetched on every open, not cached: an account is provisioned the first
|
|
1639
|
-
// time a user opens Web Call, so the list can grow between two dialogs.
|
|
1640
|
-
void loadSipAccounts();
|
|
1641
1511
|
}
|
|
1642
1512
|
|
|
1643
1513
|
function openContactView(contact: ContactRow) {
|
|
@@ -2226,10 +2096,6 @@ export default {
|
|
|
2226
2096
|
line-height: 1.4;
|
|
2227
2097
|
}
|
|
2228
2098
|
|
|
2229
|
-
.field-hint--error {
|
|
2230
|
-
color: var(--err);
|
|
2231
|
-
}
|
|
2232
|
-
|
|
2233
2099
|
.sip-settings-dialog .field-label {
|
|
2234
2100
|
margin-top: 14px;
|
|
2235
2101
|
}
|
|
@@ -87,7 +87,6 @@
|
|
|
87
87
|
|
|
88
88
|
<v-list density="compact" min-width="180">
|
|
89
89
|
<v-list-item title="View" @click="openView(item)" />
|
|
90
|
-
<v-list-item title="Access Permissions" @click="openPermissions(item)" />
|
|
91
90
|
<v-list-item title="Sync HID Reader" @click="openSyncConfirm(item)" />
|
|
92
91
|
<v-list-item title="Test Connection" @click="openTestConfirm(item)" />
|
|
93
92
|
<v-list-item title="Edit" @click="openEdit(item)" />
|
|
@@ -242,18 +241,6 @@
|
|
|
242
241
|
</v-card-actions>
|
|
243
242
|
</v-card>
|
|
244
243
|
</v-dialog>
|
|
245
|
-
|
|
246
|
-
<!-- Who may actually pass this reader. Enrolment makes a person
|
|
247
|
-
RECOGNISABLE; this is what puts them in the group the access rule is
|
|
248
|
-
attached to, and without it a recognised person is refused at the
|
|
249
|
-
door. Reloads the list on save so the reader's own counts stay true. -->
|
|
250
|
-
<HidAccessPermissions
|
|
251
|
-
v-model="permissionsDialog"
|
|
252
|
-
:site="props.site"
|
|
253
|
-
:org="props.org"
|
|
254
|
-
:reader="selectedReader"
|
|
255
|
-
@saved="loadReaders"
|
|
256
|
-
/>
|
|
257
244
|
</section>
|
|
258
245
|
</template>
|
|
259
246
|
|
|
@@ -335,13 +322,6 @@ const props = defineProps({
|
|
|
335
322
|
type: String,
|
|
336
323
|
required: true,
|
|
337
324
|
},
|
|
338
|
-
// The permission endpoints are org-scoped (`assertOrganizationSiteAccess`),
|
|
339
|
-
// and this component previously had no reason to know the org. Passed from
|
|
340
|
-
// the page, as `HidQrCodeConfiguration` already does.
|
|
341
|
-
org: {
|
|
342
|
-
type: String,
|
|
343
|
-
required: true,
|
|
344
|
-
},
|
|
345
325
|
});
|
|
346
326
|
|
|
347
327
|
const {
|
|
@@ -367,7 +347,6 @@ const viewDialog = ref(false);
|
|
|
367
347
|
const confirmDialog = ref(false);
|
|
368
348
|
const resultDialog = ref(false);
|
|
369
349
|
const selectedReader = ref<HidRecord | null>(null);
|
|
370
|
-
const permissionsDialog = ref(false);
|
|
371
350
|
const pendingAction = ref<"test" | "sync" | "delete" | null>(null);
|
|
372
351
|
const actionStage = ref<"confirm" | "review" | "loading">("confirm");
|
|
373
352
|
const resultSuccess = ref(true);
|
|
@@ -505,11 +484,6 @@ function openView(reader: HidRecord) {
|
|
|
505
484
|
viewDialog.value = true;
|
|
506
485
|
}
|
|
507
486
|
|
|
508
|
-
function openPermissions(reader: HidRecord) {
|
|
509
|
-
selectedReader.value = reader;
|
|
510
|
-
permissionsDialog.value = true;
|
|
511
|
-
}
|
|
512
|
-
|
|
513
487
|
function openTestConfirm(reader?: HidRecord | null) {
|
|
514
488
|
if (reader) selectedReader.value = reader;
|
|
515
489
|
pendingAction.value = "test";
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
v-model="search"
|
|
28
28
|
search
|
|
29
29
|
placeholder="Search Amico user, UID or registration"
|
|
30
|
-
@keyup.enter="
|
|
30
|
+
@keyup.enter="reloadFromFirstPage"
|
|
31
31
|
/>
|
|
32
32
|
<AppSelect
|
|
33
33
|
v-model="userType"
|
|
@@ -284,8 +284,6 @@ async function loadUsers() {
|
|
|
284
284
|
return;
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
const sequence = loadUsersSequence.value + 1;
|
|
288
|
-
loadUsersSequence.value = sequence;
|
|
289
287
|
loading.value = true;
|
|
290
288
|
try {
|
|
291
289
|
let clientFiltersUserType = false;
|
|
@@ -321,7 +319,6 @@ async function loadUsers() {
|
|
|
321
319
|
const pageItems = clientFiltersUserType
|
|
322
320
|
? matchingItems.slice(pageStart, pageStart + 10)
|
|
323
321
|
: matchingItems;
|
|
324
|
-
if (sequence !== loadUsersSequence.value) return;
|
|
325
322
|
users.value = pageItems.map(toReaderUser);
|
|
326
323
|
total.value = clientFiltersUserType
|
|
327
324
|
? matchingItems.length
|
|
@@ -333,15 +330,13 @@ async function loadUsers() {
|
|
|
333
330
|
? ""
|
|
334
331
|
: toText(response.pageRange ?? data.pageRange);
|
|
335
332
|
} catch (error: unknown) {
|
|
336
|
-
if (sequence !== loadUsersSequence.value) return;
|
|
337
333
|
users.value = [];
|
|
338
334
|
total.value = 0;
|
|
339
335
|
pages.value = 1;
|
|
340
336
|
serverPageRange.value = "";
|
|
341
337
|
showToast(getErrorMessage(error), "error");
|
|
342
338
|
} finally {
|
|
343
|
-
|
|
344
|
-
if (sequence === loadUsersSequence.value) loading.value = false;
|
|
339
|
+
loading.value = false;
|
|
345
340
|
}
|
|
346
341
|
}
|
|
347
342
|
|
|
@@ -355,31 +350,6 @@ function reloadFromFirstPage() {
|
|
|
355
350
|
loadUsers();
|
|
356
351
|
}
|
|
357
352
|
|
|
358
|
-
/**
|
|
359
|
-
* Typing is the search. It used to reload on `@keyup.enter` and on nothing
|
|
360
|
-
* else, so unless you guessed Enter was required the screen sent no request at
|
|
361
|
-
* all. Debounced, because each reload is a login/load/logout round trip to a
|
|
362
|
-
* reader over a VPN; Enter still works and skips the wait.
|
|
363
|
-
*/
|
|
364
|
-
const SEARCH_DEBOUNCE_MS = 400;
|
|
365
|
-
let searchDebounce: ReturnType<typeof setTimeout> | undefined;
|
|
366
|
-
|
|
367
|
-
function onSearchInput() {
|
|
368
|
-
clearTimeout(searchDebounce);
|
|
369
|
-
searchDebounce = setTimeout(reloadFromFirstPage, SEARCH_DEBOUNCE_MS);
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
function onSearchSubmit() {
|
|
373
|
-
clearTimeout(searchDebounce);
|
|
374
|
-
reloadFromFirstPage();
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
watch(search, onSearchInput);
|
|
378
|
-
onBeforeUnmount(() => clearTimeout(searchDebounce));
|
|
379
|
-
|
|
380
|
-
/** Discards a load whose answer arrives after a newer one started. */
|
|
381
|
-
const loadUsersSequence = ref(0);
|
|
382
|
-
|
|
383
353
|
function hasFacialData(user: HidReaderUser) {
|
|
384
354
|
return user.metadata?.facialEnrolled === true || Boolean(toText(user.metadata?.facialData));
|
|
385
355
|
}
|