mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-21 22:59:07 +00:00
add filter views to other tables
This commit is contained in:
parent
f1dda4a7b3
commit
1b3cde35f3
@ -1,3 +1,4 @@
|
||||
import Includes from "../../../Types/BaseDatabase/Includes";
|
||||
import Button, { ButtonStyleType } from "../Button/Button";
|
||||
import { DropdownOption } from "../Dropdown/Dropdown";
|
||||
import ErrorMessage from "../ErrorMessage/ErrorMessage";
|
||||
@ -291,6 +292,10 @@ const FilterComponent: FilterComponentFunction = <T extends GenericObject>(
|
||||
items = [items];
|
||||
}
|
||||
|
||||
if (items instanceof Includes) {
|
||||
items = items.values as Array<string>;
|
||||
}
|
||||
|
||||
const isMoreItems: boolean = items.length > 1;
|
||||
|
||||
if (items && items instanceof Array) {
|
||||
@ -316,6 +321,10 @@ const FilterComponent: FilterComponentFunction = <T extends GenericObject>(
|
||||
})
|
||||
.join(", ");
|
||||
|
||||
if (!entityNames) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
<span className="font-medium">{data.filter.title}</span>
|
||||
|
@ -5,7 +5,10 @@ import { Black } from "Common/Types/BrandColors";
|
||||
import { JSONObject } from "Common/Types/JSON";
|
||||
import FormValues from "Common/UI/Components/Forms/Types/FormValues";
|
||||
import ConfirmModal from "Common/UI/Components/Modal/ConfirmModal";
|
||||
import { ModalTableBulkDefaultActions } from "Common/UI/Components/ModelTable/BaseModelTable";
|
||||
import {
|
||||
ModalTableBulkDefaultActions,
|
||||
SaveFilterProps,
|
||||
} from "Common/UI/Components/ModelTable/BaseModelTable";
|
||||
import ModelTable from "Common/UI/Components/ModelTable/ModelTable";
|
||||
import Pill from "Common/UI/Components/Pill/Pill";
|
||||
import FieldType from "Common/UI/Components/Types/FieldType";
|
||||
@ -26,6 +29,7 @@ export interface ComponentProps {
|
||||
title?: string | undefined;
|
||||
description?: string | undefined;
|
||||
createInitialValues?: FormValues<Alert> | undefined;
|
||||
saveFilterProps?: SaveFilterProps | undefined;
|
||||
}
|
||||
|
||||
const AlertsTable: FunctionComponent<ComponentProps> = (
|
||||
@ -66,6 +70,7 @@ const AlertsTable: FunctionComponent<ComponentProps> = (
|
||||
noItemsMessage={props.noItemsMessage || "No alerts found."}
|
||||
showRefreshButton={true}
|
||||
showViewIdButton={true}
|
||||
saveFilterProps={props.saveFilterProps}
|
||||
viewPageRoute={RouteUtil.populateRouteParams(RouteMap[PageMap.ALERTS]!)}
|
||||
filters={[
|
||||
{
|
||||
|
@ -14,7 +14,10 @@ import BasicFormModal from "Common/UI/Components/FormModal/BasicFormModal";
|
||||
import FormFieldSchemaType from "Common/UI/Components/Forms/Types/FormFieldSchemaType";
|
||||
import FormValues from "Common/UI/Components/Forms/Types/FormValues";
|
||||
import ConfirmModal from "Common/UI/Components/Modal/ConfirmModal";
|
||||
import { ModalTableBulkDefaultActions } from "Common/UI/Components/ModelTable/BaseModelTable";
|
||||
import {
|
||||
ModalTableBulkDefaultActions,
|
||||
SaveFilterProps,
|
||||
} from "Common/UI/Components/ModelTable/BaseModelTable";
|
||||
import ModelTable from "Common/UI/Components/ModelTable/ModelTable";
|
||||
import Pill from "Common/UI/Components/Pill/Pill";
|
||||
import FieldType from "Common/UI/Components/Types/FieldType";
|
||||
@ -44,6 +47,7 @@ export interface ComponentProps {
|
||||
description?: string | undefined;
|
||||
createInitialValues?: FormValues<Incident> | undefined;
|
||||
disableCreate?: boolean | undefined;
|
||||
saveFilterProps?: SaveFilterProps | undefined;
|
||||
}
|
||||
|
||||
const IncidentsTable: FunctionComponent<ComponentProps> = (
|
||||
@ -191,6 +195,7 @@ const IncidentsTable: FunctionComponent<ComponentProps> = (
|
||||
setInitialValuesForIncident({});
|
||||
}}
|
||||
modelType={Incident}
|
||||
saveFilterProps={props.saveFilterProps}
|
||||
id="incidents-table"
|
||||
isDeleteable={false}
|
||||
showCreateForm={Object.keys(initialValuesForIncident).length > 0}
|
||||
|
@ -36,6 +36,7 @@ import FormValues from "Common/UI/Components/Forms/Types/FormValues";
|
||||
import { CustomElementProps } from "Common/UI/Components/Forms/Types/Field";
|
||||
import RecurringArrayFieldElement from "Common/UI/Components/Events/RecurringArrayFieldElement";
|
||||
import Recurring from "Common/Types/Events/Recurring";
|
||||
import { SaveFilterProps } from "Common/UI/Components/ModelTable/BaseModelTable";
|
||||
|
||||
export interface ComponentProps {
|
||||
query?: Query<ScheduledMaintenance> | undefined;
|
||||
@ -45,6 +46,7 @@ export interface ComponentProps {
|
||||
description?: string | undefined;
|
||||
disableCreate?: boolean | undefined;
|
||||
createInitialValues?: FormValues<ScheduledMaintenance> | undefined;
|
||||
saveFilterProps?: SaveFilterProps | undefined;
|
||||
}
|
||||
|
||||
const ScheduledMaintenancesTable: FunctionComponent<ComponentProps> = (
|
||||
@ -203,6 +205,7 @@ const ScheduledMaintenancesTable: FunctionComponent<ComponentProps> = (
|
||||
isEditable={false}
|
||||
isCreateable={true}
|
||||
isViewable={true}
|
||||
saveFilterProps={props.saveFilterProps}
|
||||
showCreateForm={
|
||||
Object.keys(initialValuesForScheduledMaintenance).length > 0
|
||||
}
|
||||
|
@ -9,6 +9,9 @@ const AlertsPage: FunctionComponent<PageComponentProps> = (): ReactElement => {
|
||||
query={{
|
||||
projectId: DashboardNavigation.getProjectId()!,
|
||||
}}
|
||||
saveFilterProps={{
|
||||
tableId: "all-alerts-table",
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -11,6 +11,9 @@ const IncidentsPage: FunctionComponent<
|
||||
query={{
|
||||
projectId: DashboardNavigation.getProjectId()!,
|
||||
}}
|
||||
saveFilterProps={{
|
||||
tableId: "all-incidents-table",
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -19,7 +19,7 @@ const MonitorPage: FunctionComponent<PageComponentProps> = (): ReactElement => {
|
||||
projectId: DashboardNavigation.getProjectId()!,
|
||||
}}
|
||||
saveFilterProps={{
|
||||
tableId: "main-monitor-table",
|
||||
tableId: "all-monitors-table",
|
||||
}}
|
||||
/>
|
||||
</Fragment>
|
||||
|
@ -16,6 +16,9 @@ const ScheduledMaintenancesPage: FunctionComponent<
|
||||
query={{
|
||||
projectId: projectObjectId,
|
||||
}}
|
||||
saveFilterProps={{
|
||||
tableId: "all-incidents-table",
|
||||
}}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
@ -76,6 +76,9 @@ const StatusPages: FunctionComponent<PageComponentProps> = (): ReactElement => {
|
||||
placeholder: "Description",
|
||||
},
|
||||
]}
|
||||
saveFilterProps={{
|
||||
tableId: "all-status-pages-table",
|
||||
}}
|
||||
showRefreshButton={true}
|
||||
viewPageRoute={Navigation.getCurrentRoute()}
|
||||
filters={[
|
||||
|
Loading…
Reference in New Issue
Block a user