Track HiveGrid Cloud planning reference
This commit is contained in:
1 parent
b3d5ea6764
commit
e341c5938a
5784 files changed
+1104929
-3
No files matched your search
@@ -0,0 +1,50 @@
|
||||
import { LoaderFunctionArgs, redirect, useLoaderData } from "react-router";
|
||||
import { useParams } from "react-router";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import EventDetails from "~/modules/events/components/EventDetails";
|
||||
import EditPageLayout from "~/components/ui/layouts/EditPageLayout";
|
||||
import UrlUtils from "~/utils/app/UrlUtils";
|
||||
import { EventWithDetails, getEvent } from "~/modules/events/db/events.db.server";
|
||||
import { getTenantIdFromUrl } from "~/utils/services/.server/urlService";
|
||||
import { verifyUserHasPermission } from "~/utils/helpers/.server/PermissionsService";
|
||||
import EventUtils from "~/modules/events/utils/EventUtils";
|
||||
|
||||
type LoaderData = {
|
||||
item: EventWithDetails;
|
||||
};
|
||||
export const loader = async ({ request, params }: LoaderFunctionArgs) => {
|
||||
const tenantId = await getTenantIdFromUrl(params);
|
||||
await verifyUserHasPermission(request, "app.settings.auditTrails.view", tenantId);
|
||||
const item = await getEvent(params.id ?? "", tenantId);
|
||||
if (!item) {
|
||||
throw redirect(UrlUtils.getModulePath(params, "logs/events"));
|
||||
}
|
||||
|
||||
const data: LoaderData = {
|
||||
item,
|
||||
};
|
||||
return data;
|
||||
};
|
||||
|
||||
export default function AppEventDetailsRoute() {
|
||||
const { t } = useTranslation();
|
||||
const data = useLoaderData<LoaderData>();
|
||||
const params = useParams();
|
||||
return (
|
||||
<EditPageLayout
|
||||
title={t("models.event.object")}
|
||||
withHome={false}
|
||||
menu={[
|
||||
{
|
||||
title: t("models.event.plural"),
|
||||
routePath: UrlUtils.getModulePath(params, "logs/events"),
|
||||
},
|
||||
{
|
||||
title: EventUtils.parseName(data.item.name, t),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<EventDetails item={data.item} />
|
||||
</EditPageLayout>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user