mirror of
https://github.com/OneUptime/oneuptime
synced 2024-11-22 15:24:55 +00:00
Fix formatting issues and improve code readability
This commit is contained in:
parent
606c0cb69d
commit
3dcdb5f0c2
@ -98,7 +98,7 @@ export class Service extends DatabaseService<Model> {
|
||||
|
||||
if (
|
||||
UserNotificationEventType.IncidentCreated ===
|
||||
options.userNotificationEventType &&
|
||||
options.userNotificationEventType &&
|
||||
!options.triggeredByIncidentId
|
||||
) {
|
||||
throw new BadDataException(
|
||||
@ -277,20 +277,20 @@ export class Service extends DatabaseService<Model> {
|
||||
if (
|
||||
onCreate.createBy.miscDataProps &&
|
||||
(onCreate.createBy.miscDataProps['teams'] ||
|
||||
onCreate.createBy.miscDataProps['users'] ||
|
||||
onCreate.createBy.miscDataProps['users'] ||
|
||||
onCreate.createBy.miscDataProps['onCallSchedules'])
|
||||
|
||||
) {
|
||||
await this.addUsersTeamsAndSchedules(
|
||||
createdItem.projectId,
|
||||
createdItem.id,
|
||||
createdItem.onCallDutyPolicyId!,
|
||||
(onCreate.createBy.miscDataProps['users'] as Array<ObjectID>) ||
|
||||
[],
|
||||
[],
|
||||
(onCreate.createBy.miscDataProps['teams'] as Array<ObjectID>) ||
|
||||
[],
|
||||
(onCreate.createBy.miscDataProps['onCallSchedules'] as Array<ObjectID>) ||
|
||||
[],
|
||||
[],
|
||||
(onCreate.createBy.miscDataProps[
|
||||
'onCallSchedules'
|
||||
] as Array<ObjectID>) || [],
|
||||
onCreate.createBy.props
|
||||
);
|
||||
}
|
||||
@ -358,7 +358,6 @@ export class Service extends DatabaseService<Model> {
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public async addOnCallSchedules(
|
||||
projectId: ObjectID,
|
||||
escalationRuleId: ObjectID,
|
||||
|
@ -13,7 +13,8 @@ const OnCallDutyScheduleElement: FunctionComponent<ComponentProps> = (
|
||||
): ReactElement => {
|
||||
if (
|
||||
props.schedule._id &&
|
||||
(props.schedule.projectId || (props.schedule.project && props.schedule.project._id))
|
||||
(props.schedule.projectId ||
|
||||
(props.schedule.project && props.schedule.project._id))
|
||||
) {
|
||||
const projectId: string | undefined = props.schedule.projectId
|
||||
? props.schedule.projectId.toString()
|
||||
|
@ -23,7 +23,9 @@ const OnCallDutySchedulesElement: FunctionComponent<ComponentProps> = (
|
||||
schedule={schedule}
|
||||
onNavigateComplete={props.onNavigateComplete}
|
||||
/>
|
||||
{i !== props.schedules.length - 1 && <span>, </span>}
|
||||
{i !== props.schedules.length - 1 && (
|
||||
<span>, </span>
|
||||
)}
|
||||
</span>
|
||||
);
|
||||
})}
|
||||
|
@ -17,7 +17,9 @@ export interface ComponentProps {
|
||||
const OnCallDutyScheduleView: FunctionComponent<ComponentProps> = (
|
||||
props: ComponentProps
|
||||
): ReactElement => {
|
||||
const [schedules, setSchedules] = useState<Array<OnCallDutyPolicySchedule>>([]);
|
||||
const [schedules, setSchedules] = useState<Array<OnCallDutyPolicySchedule>>(
|
||||
[]
|
||||
);
|
||||
|
||||
const [isLoading, setIsLoading] = useState<boolean>(false);
|
||||
|
||||
@ -44,11 +46,14 @@ const OnCallDutyScheduleView: FunctionComponent<ComponentProps> = (
|
||||
{}
|
||||
);
|
||||
|
||||
const schedules: Array<OnCallDutyPolicySchedule> = onCallSchedules.data.map(
|
||||
(onCallUser: OnCallDutyPolicyEscalationRuleOnCallSchedule) => {
|
||||
return onCallUser.onCallDutyPolicySchedule!;
|
||||
}
|
||||
);
|
||||
const schedules: Array<OnCallDutyPolicySchedule> =
|
||||
onCallSchedules.data.map(
|
||||
(
|
||||
onCallUser: OnCallDutyPolicyEscalationRuleOnCallSchedule
|
||||
) => {
|
||||
return onCallUser.onCallDutyPolicySchedule!;
|
||||
}
|
||||
);
|
||||
|
||||
setSchedules(schedules);
|
||||
} catch (err) {
|
||||
|
Loading…
Reference in New Issue
Block a user