feat: add group filter to send logs view

- Add groupId query param to GET /api/logs endpoint
- Add group filter dropdown in SendLogs component
- Pass groups list and filter state from admin.vue
- Update useLogs.ts to accept optional groupId parameter
- Add groupId to SendRecord type
- Add i18n keys and CSS for filter UI
This commit is contained in:
RhenCloud 2026-08-08 23:09:06 +08:00
parent 03eef7ae89
commit 589558a20d
7 changed files with 94 additions and 16 deletions

View file

@ -156,7 +156,15 @@
<span>{{ logsLoading ? t("status.loading") : t("status.connected") }}</span>
</div>
</section>
<SendLogs :logs="logs" :loading="logsLoading" @refresh="loadLogs" />
<SendLogs
:logs="logs"
:loading="logsLoading"
:groups="groups"
:selected-group-id="logFilterGroup"
@refresh="loadLogs"
@filter="loadLogs"
@update:selected-group-id="logFilterGroup = $event"
/>
</template>
</template>
</template>
@ -214,19 +222,21 @@ const groupEditorOpen = ref(false);
const editingGroup = ref<Group | null>(null);
const savingGroup = ref(false);
const logFilterGroup = ref("");
onMounted(() => {
if (typeof window !== "undefined") {
const params = new URLSearchParams(window.location.search);
forbidden.value = params.get("error") === "forbidden";
}
loadGroups();
loadLogs();
loadLogs(50, logFilterGroup.value || undefined);
});
function switchView(next: "groups" | "logs"): void {
view.value = next;
if (next === "groups") loadGroups();
if (next === "logs") loadLogs();
if (next === "logs") loadLogs(50, logFilterGroup.value || undefined);
}
function enterGroup(group: Group): void {