-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: implement FetchMonitors, FetchMonitorStatuses, and FetchOnCallP…
…olicies components; update Field interface for summary element handling
- Loading branch information
Showing
15 changed files
with
659 additions
and
201 deletions.
There are no files selected for viewing
19 changes: 11 additions & 8 deletions
19
Common/Server/Infrastructure/Postgres/SchemaMigrations/1737997557974-MigrationName.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
import { MigrationInterface, QueryRunner } from "typeorm"; | ||
|
||
export class MigrationName1737997557974 implements MigrationInterface { | ||
public name = 'MigrationName1737997557974' | ||
public name = "MigrationName1737997557974"; | ||
|
||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`CREATE INDEX "IDX_4d5e62631b2b63aaecb00950ef" ON "MonitorTest" ("isInQueue") `); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query(`DROP INDEX "public"."IDX_4d5e62631b2b63aaecb00950ef"`); | ||
} | ||
public async up(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`CREATE INDEX "IDX_4d5e62631b2b63aaecb00950ef" ON "MonitorTest" ("isInQueue") `, | ||
); | ||
} | ||
|
||
public async down(queryRunner: QueryRunner): Promise<void> { | ||
await queryRunner.query( | ||
`DROP INDEX "public"."IDX_4d5e62631b2b63aaecb00950ef"`, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
Dashboard/src/Components/IncidentSeverity/FetchIncidentSeverity.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import IncidentSeverity from "Common/Models/DatabaseModels/IncidentSeverity"; | ||
import React, { FunctionComponent, ReactElement, useEffect } from "react"; | ||
import ObjectID from "Common/Types/ObjectID"; | ||
import API from "Common/UI/Utils/API/API"; | ||
import ModelAPI from "Common/UI/Utils/ModelAPI/ModelAPI"; | ||
import Includes from "Common/Types/BaseDatabase/Includes"; | ||
import { LIMIT_PER_PROJECT } from "Common/Types/Database/LimitMax"; | ||
import SortOrder from "Common/Types/BaseDatabase/SortOrder"; | ||
import ListResult from "Common/UI/Utils/BaseDatabase/ListResult"; | ||
import ErrorMessage from "Common/UI/Components/ErrorMessage/ErrorMessage"; | ||
import ComponentLoader from "Common/UI/Components/ComponentLoader/ComponentLoader"; | ||
import IncidentSeveritiesElement from "./IncidentSeveritiesElement"; | ||
|
||
export interface ComponentProps { | ||
onCallDutyPolicyIds: Array<ObjectID>; | ||
} | ||
|
||
const FetchIncidentSeverities: FunctionComponent<ComponentProps> = ( | ||
props: ComponentProps, | ||
): ReactElement => { | ||
const [isLoading, setIsLoading] = React.useState<boolean>(true); | ||
const [error, setError] = React.useState<string>(""); | ||
const [incidentSeverities, setIncidentSeverities] = React.useState<Array<IncidentSeverity>>([]); | ||
|
||
const fetchIncidentSeverities = async () => { | ||
setIsLoading(true); | ||
setError(""); | ||
|
||
try { | ||
const incidentSeverities: ListResult<IncidentSeverity> = await ModelAPI.getList({ | ||
modelType: IncidentSeverity, | ||
query: { | ||
_id: new Includes(props.onCallDutyPolicyIds), | ||
}, | ||
skip: 0, | ||
limit: LIMIT_PER_PROJECT, | ||
select: { | ||
name: true, | ||
_id: true, | ||
}, | ||
sort: { | ||
name: SortOrder.Ascending, | ||
}, | ||
}); | ||
|
||
setIncidentSeverities(incidentSeverities.data); | ||
} catch (err) { | ||
setError(API.getFriendlyMessage(err)); | ||
} | ||
|
||
setIsLoading(false); | ||
}; | ||
|
||
useEffect(() => { | ||
fetchIncidentSeverities().catch((err) => { | ||
setError(API.getFriendlyMessage(err)); | ||
}); | ||
}, []); | ||
|
||
if (error) { | ||
return <ErrorMessage message={error} />; | ||
} | ||
|
||
if (isLoading) { | ||
return <ComponentLoader />; | ||
} | ||
|
||
return <IncidentSeveritiesElement incidentSeverities={incidentSeverities} />; | ||
}; | ||
|
||
export default FetchIncidentSeverities; |
31 changes: 31 additions & 0 deletions
31
Dashboard/src/Components/IncidentSeverity/IncidentSeveritiesElement.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import IncidentSeverityElement from "./IncidentSeverityElement"; | ||
import TableColumnListComponent from "Common/UI/Components/TableColumnList/TableColumnListComponent"; | ||
import IncidentSeverity from "Common/Models/DatabaseModels/IncidentSeverity"; | ||
import React, { FunctionComponent, ReactElement } from "react"; | ||
|
||
export interface ComponentProps { | ||
incidentSeverities: Array<IncidentSeverity>; | ||
onNavigateComplete?: (() => void) | undefined; | ||
} | ||
|
||
const IncidentSeveritiesElement: FunctionComponent<ComponentProps> = ( | ||
props: ComponentProps, | ||
): ReactElement => { | ||
return ( | ||
<TableColumnListComponent | ||
items={props.incidentSeverities} | ||
moreText="more Incident Severities" | ||
getEachElement={(incidentSeverity: IncidentSeverity) => { | ||
return ( | ||
<IncidentSeverityElement | ||
incidentSeverity={incidentSeverity} | ||
onNavigateComplete={props.onNavigateComplete} | ||
/> | ||
); | ||
}} | ||
noItemsMessage="No Incident Severities." | ||
/> | ||
); | ||
}; | ||
|
||
export default IncidentSeveritiesElement; |
23 changes: 23 additions & 0 deletions
23
Dashboard/src/Components/IncidentSeverity/IncidentSeverityElement.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import IncidentSeverity from "Common/Models/DatabaseModels/IncidentSeverity"; | ||
import React, { FunctionComponent, ReactElement } from "react"; | ||
import { Black } from "Common/Types/BrandColors"; | ||
import Pill from "Common/UI/Components/Pill/Pill"; | ||
|
||
export interface ComponentProps { | ||
incidentSeverity: IncidentSeverity; | ||
onNavigateComplete?: (() => void) | undefined; | ||
showIcon?: boolean | undefined; | ||
} | ||
|
||
const IncidentSeverityElement: FunctionComponent<ComponentProps> = ( | ||
props: ComponentProps, | ||
): ReactElement => { | ||
return ( | ||
<Pill | ||
color={props.incidentSeverity.color || Black} | ||
text={props.incidentSeverity.name || "Unknown"} | ||
/> | ||
); | ||
}; | ||
|
||
export default IncidentSeverityElement; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.