feat: add emergency incident workspace
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import EmergencyPage from "../../emergency/page";
|
||||
|
||||
export default function ScopedEmergencyPage(): React.ReactElement {
|
||||
export default async function ScopedEmergencyPage(): Promise<React.ReactElement> {
|
||||
return EmergencyPage();
|
||||
}
|
||||
|
||||
@@ -1,15 +1,26 @@
|
||||
import { ShieldAlert } from "lucide-react";
|
||||
import { redirect } from "next/navigation";
|
||||
|
||||
import { ModulePage } from "@/modules/shared/components/ModulePage";
|
||||
import { getCurrentAuthContext } from "@/modules/core/server/auth";
|
||||
import { hasPermission } from "@/modules/core/server/permissions";
|
||||
import { EmergencyWorkspaceClient } from "@/modules/emergency/components/EmergencyWorkspaceClient";
|
||||
import { listEmergencyIncidentData } from "@/modules/emergency/server/operations";
|
||||
import { getWorkspaceHref } from "@/modules/shared/lib/workspace-routing";
|
||||
|
||||
export default function EmergencyPage(): React.ReactElement {
|
||||
return (
|
||||
<ModulePage
|
||||
title="安全应急"
|
||||
eyebrow="紧急呼叫与事件处理"
|
||||
description="待接入紧急呼叫、接警派发、事件处理、完成归档和通知数据源。"
|
||||
icon={ShieldAlert}
|
||||
phase="待接入"
|
||||
/>
|
||||
);
|
||||
export default async function EmergencyPage(): Promise<React.ReactElement> {
|
||||
const context = await getCurrentAuthContext();
|
||||
if (!context) {
|
||||
redirect("/login");
|
||||
}
|
||||
|
||||
if (!hasPermission(context.permissions, "incident:read")) {
|
||||
redirect(getWorkspaceHref(context.organization?.slug, "/dashboard"));
|
||||
}
|
||||
|
||||
const organizationId = context.organization?.id;
|
||||
if (!organizationId) {
|
||||
redirect(getWorkspaceHref(context.organization?.slug, "/dashboard"));
|
||||
}
|
||||
|
||||
const data = await listEmergencyIncidentData(organizationId);
|
||||
return <EmergencyWorkspaceClient canManage={hasPermission(context.permissions, "incident:manage")} initialData={data} />;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user