fix(mobile): повторный enroll и удаление устройств в UI (0.9.10).
При повторной привязке Seaca переиспользуется запись device_uuid вместо INSERT.
Добавлены POST /devices/{id}/revoke и DELETE для полного удаления записи в настройках SAC.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<template>
|
||||
<template>
|
||||
<div class="settings-page">
|
||||
<h1>Настройки</h1>
|
||||
<p class="settings-intro">
|
||||
@@ -190,6 +190,7 @@
|
||||
<tr>
|
||||
<th>Имя</th>
|
||||
<th>Пользователь</th>
|
||||
<th>Статус</th>
|
||||
<th>FCM</th>
|
||||
<th>Последняя активность</th>
|
||||
<th>Действия</th>
|
||||
@@ -199,6 +200,7 @@
|
||||
<tr v-for="device in mobileDevices" :key="device.id">
|
||||
<td>{{ device.display_name }}</td>
|
||||
<td>{{ device.username }}</td>
|
||||
<td>{{ device.is_active ? "активно" : "отключено" }}</td>
|
||||
<td>{{ device.has_fcm_token ? "да" : "нет" }}</td>
|
||||
<td>{{ device.last_seen_at || device.enrolled_at }}</td>
|
||||
<td class="settings-mobile-actions">
|
||||
@@ -219,6 +221,13 @@
|
||||
>
|
||||
Отключить
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
class="danger"
|
||||
@click="deleteDevice(device.id)"
|
||||
>
|
||||
Удалить
|
||||
</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -428,6 +437,7 @@ import {
|
||||
fetchMobileSettings,
|
||||
fetchUsers,
|
||||
revokeMobileDevice,
|
||||
deleteMobileDevice,
|
||||
revokeMobileEnrollmentCode,
|
||||
testMobileDevicePush,
|
||||
updateMobileSettings,
|
||||
@@ -781,6 +791,23 @@ async function revokeDevice(deviceId: number) {
|
||||
}
|
||||
}
|
||||
|
||||
async function deleteDevice(deviceId: number) {
|
||||
const device = mobileDevices.value.find((item) => item.id === deviceId);
|
||||
const label = device?.display_name || `#${deviceId}`;
|
||||
if (!window.confirm(`Удалить запись устройства «${label}» из базы? Повторная привязка потребует новый код enroll.`)) {
|
||||
return;
|
||||
}
|
||||
error.value = "";
|
||||
success.value = "";
|
||||
try {
|
||||
await deleteMobileDevice(deviceId);
|
||||
mobileDevices.value = await fetchMobileDevices();
|
||||
success.value = "Запись устройства удалена.";
|
||||
} catch (e) {
|
||||
error.value = e instanceof Error ? e.message : "Ошибка";
|
||||
}
|
||||
}
|
||||
|
||||
async function testDevicePush(deviceId: number) {
|
||||
error.value = "";
|
||||
success.value = "";
|
||||
|
||||
Reference in New Issue
Block a user