mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
feat: Refactor routing and add ActiveIncidents and ActiveAlerts components
This commit is contained in:
@@ -186,12 +186,12 @@ const ProjectInvitations: React.LazyExoticComponent<
|
||||
const ActiveIncidents: React.LazyExoticComponent<
|
||||
React.FunctionComponent<PageComponentProps>
|
||||
> = lazy(() => {
|
||||
return import("./Pages/Global/NewIncidents");
|
||||
return import("./Pages/Global/ActiveIncidents");
|
||||
});
|
||||
const ActiveAlerts: React.LazyExoticComponent<
|
||||
React.FunctionComponent<PageComponentProps>
|
||||
> = lazy(() => {
|
||||
return import("./Pages/Global/NewAlerts");
|
||||
return import("./Pages/Global/ActiveAlerts");
|
||||
});
|
||||
const UserSettingsRoutes: React.LazyExoticComponent<
|
||||
React.FunctionComponent<PageComponentProps>
|
||||
@@ -661,21 +661,21 @@ const App: () => JSX.Element = () => {
|
||||
/>
|
||||
|
||||
<PageRoute
|
||||
path={RouteMap[PageMap.NEW_INCIDENTS]?.toString() || ""}
|
||||
path={RouteMap[PageMap.ACTIVE_INCIDENTS]?.toString() || ""}
|
||||
element={
|
||||
<ActiveIncidents
|
||||
{...commonPageProps}
|
||||
pageRoute={RouteMap[PageMap.NEW_INCIDENTS] as Route}
|
||||
pageRoute={RouteMap[PageMap.ACTIVE_INCIDENTS] as Route}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
<PageRoute
|
||||
path={RouteMap[PageMap.NEW_ALERTS]?.toString() || ""}
|
||||
path={RouteMap[PageMap.ACTIVE_ALERTS]?.toString() || ""}
|
||||
element={
|
||||
<ActiveAlerts
|
||||
{...commonPageProps}
|
||||
pageRoute={RouteMap[PageMap.NEW_ALERTS] as Route}
|
||||
pageRoute={RouteMap[PageMap.ACTIVE_ALERTS] as Route}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
|
||||
@@ -433,7 +433,7 @@ const DashboardHeader: FunctionComponent<ComponentProps> = (
|
||||
onClick={() => {
|
||||
Navigation.navigate(
|
||||
RouteUtil.populateRouteParams(
|
||||
RouteMap[PageMap.NEW_INCIDENTS]!,
|
||||
RouteMap[PageMap.ACTIVE_INCIDENTS]!,
|
||||
),
|
||||
);
|
||||
}}
|
||||
@@ -458,7 +458,7 @@ const DashboardHeader: FunctionComponent<ComponentProps> = (
|
||||
onClick={() => {
|
||||
Navigation.navigate(
|
||||
RouteUtil.populateRouteParams(
|
||||
RouteMap[PageMap.NEW_ALERTS]!,
|
||||
RouteMap[PageMap.ACTIVE_ALERTS]!,
|
||||
),
|
||||
);
|
||||
}}
|
||||
|
||||
@@ -21,30 +21,30 @@ import Alert from "Common/Models/DatabaseModels/Alert";
|
||||
import Project from "Common/Models/DatabaseModels/Project";
|
||||
import React, { FunctionComponent, ReactElement } from "react";
|
||||
|
||||
const NewAlerts: FunctionComponent<PageComponentProps> = (): ReactElement => {
|
||||
const ActiveAlerts: FunctionComponent<PageComponentProps> = (): ReactElement => {
|
||||
return (
|
||||
<Page
|
||||
title={"New Alerts"}
|
||||
title={"Active Alerts"}
|
||||
breadcrumbLinks={[
|
||||
{
|
||||
title: "Home",
|
||||
to: RouteUtil.populateRouteParams(RouteMap[PageMap.HOME] as Route),
|
||||
},
|
||||
{
|
||||
title: "New Alerts",
|
||||
title: "Active Alerts",
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[PageMap.NEW_ALERTS] as Route,
|
||||
RouteMap[PageMap.ACTIVE_ALERTS] as Route,
|
||||
),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<ModelTable<Alert>
|
||||
modelType={Alert}
|
||||
name="New Alerts"
|
||||
id="new-alerts-table"
|
||||
userPreferencesKey="new-alerts-table"
|
||||
name="Active Alerts"
|
||||
id="active-alerts-table"
|
||||
userPreferencesKey="active-alerts-table"
|
||||
saveFilterProps={{
|
||||
tableId: "new-alerts-table",
|
||||
tableId: "active-alerts-table",
|
||||
}}
|
||||
isDeleteable={false}
|
||||
query={{
|
||||
@@ -66,13 +66,13 @@ const NewAlerts: FunctionComponent<PageComponentProps> = (): ReactElement => {
|
||||
isViewable={true}
|
||||
showViewIdButton={true}
|
||||
cardProps={{
|
||||
title: "New Alerts",
|
||||
title: "Active Alerts",
|
||||
description:
|
||||
"Here is a list of new alerts for all of the projects you are a part of.",
|
||||
"Here is a list of active alerts for all of the projects you are a part of.",
|
||||
}}
|
||||
noItemsMessage={"No alert found."}
|
||||
singularName="New Alert"
|
||||
pluralName="New Alerts"
|
||||
singularName="Active Alert"
|
||||
pluralName="Active Alerts"
|
||||
onViewPage={(item: Alert): Promise<Route> => {
|
||||
return Promise.resolve(
|
||||
new Route(
|
||||
@@ -255,4 +255,4 @@ const NewAlerts: FunctionComponent<PageComponentProps> = (): ReactElement => {
|
||||
);
|
||||
};
|
||||
|
||||
export default NewAlerts;
|
||||
export default ActiveAlerts;
|
||||
@@ -21,30 +21,30 @@ import Incident from "Common/Models/DatabaseModels/Incident";
|
||||
import Project from "Common/Models/DatabaseModels/Project";
|
||||
import React, { FunctionComponent, ReactElement } from "react";
|
||||
|
||||
const Home: FunctionComponent<PageComponentProps> = (): ReactElement => {
|
||||
const ActiveIncidents: FunctionComponent<PageComponentProps> = (): ReactElement => {
|
||||
return (
|
||||
<Page
|
||||
title={"New Incidents"}
|
||||
title={"Active Incidents"}
|
||||
breadcrumbLinks={[
|
||||
{
|
||||
title: "Home",
|
||||
to: RouteUtil.populateRouteParams(RouteMap[PageMap.HOME] as Route),
|
||||
},
|
||||
{
|
||||
title: "New Incidents",
|
||||
title: "Active Incidents",
|
||||
to: RouteUtil.populateRouteParams(
|
||||
RouteMap[PageMap.NEW_INCIDENTS] as Route,
|
||||
RouteMap[PageMap.ACTIVE_INCIDENTS] as Route,
|
||||
),
|
||||
},
|
||||
]}
|
||||
>
|
||||
<ModelTable<Incident>
|
||||
modelType={Incident}
|
||||
name="New Incidents"
|
||||
id="new-incidents-table"
|
||||
userPreferencesKey="new-incidents-table"
|
||||
name="Active Incidents"
|
||||
id="active-incidents-table"
|
||||
userPreferencesKey="active-incidents-table"
|
||||
saveFilterProps={{
|
||||
tableId: "new-incidents-table",
|
||||
tableId: "active-incidents-table",
|
||||
}}
|
||||
isDeleteable={false}
|
||||
query={{
|
||||
@@ -66,13 +66,13 @@ const Home: FunctionComponent<PageComponentProps> = (): ReactElement => {
|
||||
isViewable={true}
|
||||
showViewIdButton={true}
|
||||
cardProps={{
|
||||
title: "New Incidents",
|
||||
title: "Active Incidents",
|
||||
description:
|
||||
"Here is a list of new incidents for all of the projects you are a part of.",
|
||||
"Here is a list of active incidents for all of the projects you are a part of.",
|
||||
}}
|
||||
noItemsMessage={"No incident found."}
|
||||
singularName="New Incident"
|
||||
pluralName="New Incidents"
|
||||
singularName="Active Incident"
|
||||
pluralName="Active Incidents"
|
||||
onViewPage={(item: Incident): Promise<Route> => {
|
||||
return Promise.resolve(
|
||||
new Route(
|
||||
@@ -252,4 +252,4 @@ const Home: FunctionComponent<PageComponentProps> = (): ReactElement => {
|
||||
);
|
||||
};
|
||||
|
||||
export default Home;
|
||||
export default ActiveIncidents;
|
||||
@@ -390,8 +390,8 @@ enum PageMap {
|
||||
USER_PROFILE_PICTURE = "USER_PROFILE_PICTURE",
|
||||
USER_TWO_FACTOR_AUTH = "USER_TWO_FACTOR_AUTH",
|
||||
USER_PROFILE_DELETE = "USER_PROFILE_DELETE",
|
||||
NEW_INCIDENTS = "NEW_INCIDENTS",
|
||||
NEW_ALERTS = "NEW_ALERTS",
|
||||
ACTIVE_INCIDENTS = "ACTIVE_INCIDENTS",
|
||||
ACTIVE_ALERTS = "ACTIVE_ALERTS",
|
||||
PROJECT_INVITATIONS = "PROJECT_INVITATIONS",
|
||||
|
||||
// WORKFLOW
|
||||
|
||||
@@ -913,9 +913,9 @@ const RouteMap: Dictionary<Route> = {
|
||||
`/dashboard/user-profile/delete-account`,
|
||||
),
|
||||
|
||||
[PageMap.NEW_INCIDENTS]: new Route(`/dashboard/new-incidents`),
|
||||
[PageMap.ACTIVE_INCIDENTS]: new Route(`/dashboard/active-incidents`),
|
||||
|
||||
[PageMap.NEW_ALERTS]: new Route(`/dashboard/new-alerts`),
|
||||
[PageMap.ACTIVE_ALERTS]: new Route(`/dashboard/active-alerts`),
|
||||
|
||||
[PageMap.PROJECT_INVITATIONS]: new Route(`/dashboard/project-invitations`),
|
||||
|
||||
@@ -2348,7 +2348,7 @@ export class RouteUtil {
|
||||
route.toString() === RouteMap[PageMap.USER_PROFILE_PICTURE]?.toString() ||
|
||||
route.toString() === RouteMap[PageMap.USER_PROFILE_DELETE]?.toString() ||
|
||||
route.toString() === RouteMap[PageMap.PROJECT_INVITATIONS]?.toString() ||
|
||||
route.toString() === RouteMap[PageMap.NEW_INCIDENTS]?.toString()
|
||||
route.toString() === RouteMap[PageMap.ACTIVE_INCIDENTS]?.toString()
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user