{"version":3,"sources":["src/app/models/incident.ts","src/app/store/incidents/incidents.service.ts","src/app/store/tasks/tasks.actions.ts","src/app/store/tasks/tasks.service.ts","src/app/store/tasks/tasks.state.ts","src/app/models/events.ts","src/app/store/incidents/incidentDetails.state.ts"],"sourcesContent":["import { Alert } from './alert';\nimport { BroadcastChannel } from './broadcast-channel';\nimport { IncidentImpact } from './incident-impact';\nimport {\n IncidentSchemaPriority,\n IncidentSchemaState,\n IncidentSchemaVersion,\n} from './incident-schema';\nimport { OrganizationMemberMetadata } from './organization';\nimport { Service } from './service';\nimport { Task, TaskStatus } from './task';\n\nexport interface Incident {\n id: number;\n schemaVersion: IncidentSchemaVersion;\n title: string;\n summary: string;\n priority: IncidentSchemaPriority;\n state: IncidentSchemaState;\n createdAt: Date;\n affectedServices?: AffectedService[];\n statuspageLinks?: IncidentStatuspageLink[];\n roles?: IncidentRoleWithAssignment[];\n events?: {\n events: IncidentEvent[];\n totalSize: number;\n nextPageToken: string;\n };\n timings: IncidentTimings;\n broadcastMessages?: BroadcastMessage[];\n tasks: {\n linkId: string;\n taskId: string;\n }[];\n}\n\nexport interface IncidentRelatedAlertList {\n alerts: Alert[];\n totalSize: number;\n}\n\nexport interface IncidentSpec {\n schemaVersionId: string;\n priorityId: string;\n title: string;\n summary: string;\n affectedServiceIds: number[];\n statuspageIds: number[];\n}\n\nexport interface AffectedService {\n service: Service;\n impact: IncidentImpact;\n}\n\nexport interface IncidentStatuspageLink {\n statuspage: {\n id: number;\n name: string;\n customDomain?: string;\n domain: string;\n slug: string;\n };\n impact?: IncidentImpact;\n}\n\nexport interface IncidentStatuspageLinkOptions {\n notifySubscribers: boolean;\n}\n\nexport interface IncidentRoleWithAssignment {\n role: IncidentRole;\n assignments: IncidentRoleAssignment[];\n}\n\nexport interface IncidentRoleAssignment {\n id: string;\n memberId: string;\n user?: {\n firstname: string;\n lastname: string;\n avatar: string;\n };\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface IncidentTimings {\n scheduledAt?: Date;\n startedAt?: Date;\n acknowledgedAt?: Date;\n resolvedAt?: Date;\n closedAt?: Date;\n}\n\nexport enum IncidentEventActor {\n SYSTEM = 'system',\n USER = 'user',\n}\n\nexport interface IncidentEvent {\n id: string;\n type: string;\n payload:\n | IncidentEventPayloadRole\n | IncidentEventPayloadFieldUpdated\n | IncidentEventPayloadComment\n | IncidentEventPayloadAffectedService\n | IncidentEventPayloadStatuspage\n | IncidentEventPayloadTask\n | IncidentEventPayloadTaskStatus\n | IncidentEventPayloadTaskAssigned\n | IncidentEventPayloadEmpty;\n createdAt: Date;\n actor: {\n type: IncidentEventActor;\n user?: {\n firstname: string;\n lastname: string;\n avatar: string;\n };\n name?: string;\n };\n}\n\nexport interface IncidentEventPayloadRole {\n role: IncidentRole;\n assignee: {\n firstname: string;\n lastname: string;\n avatar: string;\n };\n}\n\nexport interface IncidentEventPayloadResponder {\n responder: {\n firstname: string;\n lastname: string;\n avatar: string;\n };\n}\n\nexport interface IncidentEventPayloadFieldUpdated {\n field: string;\n oldValue: FieldValue;\n newValue: FieldValue;\n}\n\nexport interface IncidentEventPayloadStateUpdated {\n oldState: IncidentSchemaState;\n newState: IncidentSchemaState;\n}\n\nexport interface IncidentEventPayloadPriorityUpdated {\n oldPriority: IncidentSchemaState;\n newPriority: IncidentSchemaState;\n}\n\nexport interface FieldValue {\n stringValue?: string;\n intValue?: number;\n}\n\nexport interface IncidentEventPayloadComment {\n comment: string;\n}\n\nexport interface IncidentEventPayloadAffectedService {\n service: Service;\n}\n\nexport interface IncidentEventPayloadAffectedServiceImpactChanged {\n service: Service;\n oldImpact: IncidentImpact;\n newImpact: IncidentImpact;\n}\n\nexport interface IncidentEventPayloadStatuspage {\n statuspage: {\n name: string;\n };\n}\n\nexport interface IncidentEventPayloadStatuspageImpactUpdated {\n oldStatuspageImpact?: IncidentImpact;\n newStatuspageImpact?: IncidentImpact;\n statuspage: {\n name: string;\n };\n}\n\nexport interface IncidentEventPayloadRelatedAlert {\n alert: Alert;\n}\n\nexport interface IncidentEventPayloadTask {\n task: Pick;\n}\n\nexport interface IncidentEventPayloadTaskStatus {\n task: Pick;\n oldStatus: TaskStatus;\n newStatus: TaskStatus;\n}\n\nexport interface IncidentEventPayloadTaskAssigned {\n task: Pick;\n assignee: Pick<\n OrganizationMemberMetadata,\n 'firstname' | 'lastname' | 'avatar'\n >;\n}\n\nexport type IncidentEventPayloadEmpty = object;\n\nexport interface IncidentRole {\n id: string;\n name: string;\n description: string;\n createdAt: Date;\n updatedAt: Date;\n}\n\nexport interface BroadcastMessage {\n id: string;\n channel: BroadcastChannel;\n}\n\nexport interface IncidentTaskLink {\n linkId: string;\n task: Task;\n}\n","import { inject, Injectable } from '@angular/core';\nimport { Apollo, gql } from 'apollo-angular';\nimport { map, Observable } from 'rxjs';\nimport {\n mapGQLResponse,\n toIdentifiableEntities,\n} from 'src/app/helpers/graphql';\nimport { Alert } from 'src/app/models/alert';\nimport {\n Incident,\n IncidentEvent,\n IncidentEventActor,\n IncidentRoleAssignment,\n IncidentSpec,\n IncidentStatuspageLinkOptions,\n IncidentTaskLink,\n IncidentTimings,\n} from 'src/app/models/incident';\nimport {\n CursorPaginationOptions,\n OffsetPaginatedRespose,\n OffsetPaginationOptions,\n} from 'src/app/store/common/pagination';\nimport { IdentifiableEntities } from '../common/list-entity';\n\nexport enum ImpactTimings {\n Scheduled = 'scheduledAt',\n Started = 'startedAt',\n Acknowledged = 'acknowledgedAt',\n Resolved = 'resolvedAt',\n Closed = 'closedAt',\n}\n\nexport const EVENT_FIELDS = `\n id\n type\n createdAt\n payload {\n ... on IncidentEventPayloadComment {\n comment\n }\n ... on IncidentEventPayloadState {\n oldState {\n id\n name\n color\n icon\n }\n newState {\n id\n name\n color\n icon\n }\n }\n ... on IncidentEventPayloadPriority {\n oldPriority {\n id\n name\n color\n icon\n }\n newPriority {\n id\n name\n color\n icon\n }\n }\n ... on IncidentEventPayloadResponder {\n responder {\n firstname\n lastname\n avatar\n }\n }\n ... on IncidentEventPayloadRole {\n role {\n id\n name\n description\n }\n assignee {\n firstname\n lastname\n avatar\n }\n }\n ... on IncidentEventPayloadFieldUpdated {\n field\n oldValue {\n ... on FieldStringValue {\n stringValue\n }\n ... on FieldIntValue {\n intValue\n }\n }\n newValue {\n ... on FieldStringValue {\n stringValue\n }\n ... on FieldIntValue {\n intValue\n }\n }\n }\n ... on IncidentEventPayloadAffectedService {\n service {\n name\n description\n isDeleted\n deletedAt\n }\n }\n ... on IncidentEventPayloadAffectedServiceImpactChanged {\n service {\n name\n description\n isDeleted\n deletedAt\n }\n oldImpact {\n id\n name\n color\n icon\n }\n newImpact {\n id\n name\n color\n icon\n }\n }\n ... on IncidentEventPayloadStatuspage {\n statuspage {\n name\n }\n }\n ... on IncidentEventPayloadStatuspageImpactChanged {\n statuspage {\n name\n }\n oldStatuspageImpact {\n id\n name\n color\n icon\n }\n newStatuspageImpact {\n id\n name\n color\n icon\n }\n }\n ... on IncidentEventPayloadRelatedAlert {\n alert {\n name\n }\n }\n ... on IncidentEventPayloadTask {\n task {\n id\n name\n description\n }\n }\n ... on IncidentEventPayloadTaskStatus {\n task {\n id\n name\n description\n }\n oldStatus\n newStatus\n }\n ... on IncidentEventPayloadTaskAssigned {\n task {\n id\n name\n description\n }\n assignee {\n firstname\n lastname\n avatar\n }\n }\n }\n actor {\n ... on OrgMemberActor {\n user{\n firstname\n lastname\n avatar\n }\n }\n ... on ServiceAccountActor {\n name\n }\n }\n`;\n\nexport const EVENTS_FRAGMENT = gql`\n fragment EventFields on IncidentEventList {\n events {\n ${EVENT_FIELDS}\n }\n }\n`;\n\nexport const LIST_INCIDENTS_QUERY = gql`\n query GetIncidents(\n $organizationUUID: ID!\n $listIncidentsRequest: ListIncidentsRequest\n ) {\n incidents(\n organizationUUID: $organizationUUID\n listIncidentsRequest: $listIncidentsRequest\n ) {\n totalSize\n incidents {\n id\n title\n summary\n createdAt\n schemaVersion {\n id\n version\n schema {\n id\n name\n type\n createdAt\n }\n states {\n id\n name\n order\n color\n icon\n isDefault\n isResolved\n }\n priorities {\n id\n name\n order\n color\n icon\n }\n }\n priority {\n id\n name\n order\n color\n icon\n }\n state {\n id\n name\n order\n color\n icon\n isDefault\n isResolved\n }\n statuspageLinks {\n statuspage {\n id\n name\n customDomain\n domain\n slug\n }\n impact {\n id\n name\n order\n color\n icon\n }\n }\n affectedServices {\n service {\n name\n }\n }\n }\n }\n }\n`;\n\nexport const GET_INCIDENT_QUERY = gql`\n ${EVENTS_FRAGMENT}\n query GetIncident(\n $organizationUUID: ID!\n $id: Int!\n $listEventOptions: ListEventOptions\n ) {\n incident(organizationUUID: $organizationUUID, id: $id) {\n id\n schemaVersion {\n id\n version\n schema {\n id\n name\n type\n createdAt\n }\n states {\n id\n name\n order\n color\n icon\n isDefault\n isResolved\n }\n priorities {\n id\n name\n order\n color\n icon\n }\n impactLinks {\n id\n impact {\n name\n order\n color\n icon\n scope\n }\n }\n }\n title\n priority {\n id\n name\n order\n color\n icon\n }\n createdAt\n summary\n state {\n id\n name\n order\n color\n icon\n isDefault\n isResolved\n }\n affectedServices {\n service {\n id\n name\n isDeleted\n deletedAt\n }\n impact {\n id\n name\n order\n color\n icon\n }\n }\n statuspageLinks {\n statuspage {\n id\n name\n customDomain\n domain\n slug\n }\n impact {\n id\n name\n order\n color\n icon\n }\n }\n timings {\n scheduledAt\n startedAt\n acknowledgedAt\n resolvedAt\n closedAt\n }\n roles {\n role {\n id\n name\n description\n createdAt\n updatedAt\n }\n assignments {\n id\n memberId\n user {\n firstname\n lastname\n avatar\n }\n createdAt\n updatedAt\n }\n }\n broadcastMessages {\n id\n channel {\n endpoint {\n providerType\n config {\n ... on ProviderChannelMetadata {\n name\n }\n }\n }\n }\n }\n events(listOptions: $listEventOptions) {\n nextPageToken\n totalSize\n ...EventFields\n }\n tasks {\n linkId\n taskId\n }\n }\n }\n`;\n\nexport const GET_INCIDENT_RELATED_ALERTS = gql`\n query GetIncidentRelatedAlerts(\n $organizationUUID: ID!\n $id: Int!\n $listRelatedAlertsOptions: ListRelatedAlertsOptions\n ) {\n incident(organizationUUID: $organizationUUID, id: $id) {\n relatedAlerts(listOptions: $listRelatedAlertsOptions) {\n totalSize\n alerts {\n id\n state\n name\n description\n metadata {\n labels\n annotations\n }\n alertedAt\n startedAt\n resolvedAt\n createdAt\n }\n }\n }\n }\n`;\n\nconst UPDATE_INCIDENT_TITLE_MUTATION = gql`\n mutation UpdateIncidentTitle(\n $organizationUUID: ID!\n $incidentId: Int!\n $newTitle: String!\n ) {\n updateIncidentTitle(\n organizationUUID: $organizationUUID\n updateIncidentTitleSpec: { incidentId: $incidentId, newTitle: $newTitle }\n ) {\n title\n }\n }\n`;\n\nconst CREATE_INCIDENT_MUTATION = gql`\n mutation CreateIncident($organizationUUID: ID!, $spec: NewIncidentRequest!) {\n createIncident(\n organizationUUID: $organizationUUID\n newIncidentSpec: $spec\n ) {\n id\n }\n }\n`;\n\nconst UPDATE_INCIDENT_SUMMARY_MUTATION = gql`\n mutation UpdateIncidentSummary(\n $organizationUUID: ID!\n $incidentId: Int!\n $newSummary: String!\n ) {\n updateIncidentSummary(\n organizationUUID: $organizationUUID\n updateIncidentSummarySpec: {\n incidentId: $incidentId\n newSummary: $newSummary\n }\n ) {\n summary\n }\n }\n`;\n\nconst UPDATE_INCIDENT_PRIORITY_MUTATION = gql`\n mutation UpdateIncidentPriority(\n $organizationUUID: ID!\n $incidentId: Int!\n $newPriorityId: ID!\n ) {\n updateIncidentPriority(\n organizationUUID: $organizationUUID\n updateIncidentPrioritySpec: {\n incidentId: $incidentId\n newPriorityId: $newPriorityId\n }\n ) {\n priority {\n id\n name\n order\n color\n icon\n }\n }\n }\n`;\n\nconst UPDATE_INCIDENT_STATE_MUTATION = gql`\n mutation UpdateIncidentState(\n $organizationUUID: ID!\n $incidentId: Int!\n $newStateId: ID!\n ) {\n updateIncidentState(\n organizationUUID: $organizationUUID\n updateIncidentStateSpec: {\n incidentId: $incidentId\n newStateId: $newStateId\n }\n ) {\n state {\n id\n name\n order\n color\n icon\n isDefault\n isResolved\n }\n }\n }\n`;\n\nconst UPDATE_INCIDENT_SERVICE_IMPACT_MUTATION = gql`\n mutation UpdateIncidentServiceImpact(\n $organizationUUID: ID!\n $incidentId: Int!\n $serviceId: Int!\n $newImpactLinkId: ID!\n ) {\n updateServiceImpact(\n organizationUUID: $organizationUUID\n updateServiceImpactSpec: {\n incidentId: $incidentId\n serviceId: $serviceId\n newImpactLinkId: $newImpactLinkId\n }\n ) {\n affectedServices {\n service {\n id\n name\n }\n impact {\n id\n name\n order\n color\n icon\n }\n }\n }\n }\n`;\n\nconst LINK_SERVICE_MUTATION = gql`\n mutation LinkService(\n $organizationUUID: ID!\n $incidentId: Int!\n $serviceId: Int!\n ) {\n linkService(\n organizationUUID: $organizationUUID\n linkServiceSpec: { incidentId: $incidentId, serviceId: $serviceId }\n ) {\n affectedServices {\n service {\n id\n name\n }\n impact {\n id\n name\n order\n color\n icon\n }\n }\n }\n }\n`;\n\nconst UNLINK_SERVICE_MUTATION = gql`\n mutation UnLinkService(\n $organizationUUID: ID!\n $incidentId: Int!\n $serviceId: Int!\n ) {\n unLinkService(\n organizationUUID: $organizationUUID\n unLinkServiceSpec: { incidentId: $incidentId, serviceId: $serviceId }\n ) {\n affectedServices {\n service {\n id\n name\n }\n impact {\n id\n name\n order\n color\n icon\n }\n }\n }\n }\n`;\n\nconst LINK_STATUSPAGE_MUTATION = gql`\n mutation LinkStatuspage(\n $organizationUUID: ID!\n $incidentId: Int!\n $publicStatuspageId: Int!\n $notifySubscribers: Boolean\n ) {\n linkStatuspage(\n organizationUUID: $organizationUUID\n linkStatuspageSpec: {\n incidentId: $incidentId\n statuspageId: $publicStatuspageId\n notifySubscribers: $notifySubscribers\n }\n ) {\n statuspageLinks {\n statuspage {\n id\n name\n customDomain\n domain\n slug\n }\n impact {\n id\n name\n order\n color\n icon\n }\n }\n }\n }\n`;\n\nconst UNLINK_STATUSPAGE_MUTATION = gql`\n mutation UnlinkStatuspage(\n $organizationUUID: ID!\n $incidentId: Int!\n $publicStatuspageId: Int!\n ) {\n unlinkStatuspage(\n organizationUUID: $organizationUUID\n unlinkStatuspageSpec: {\n incidentId: $incidentId\n statuspageId: $publicStatuspageId\n }\n ) {\n statuspageLinks {\n statuspage {\n id\n name\n customDomain\n domain\n slug\n }\n impact {\n id\n name\n order\n color\n icon\n }\n }\n }\n }\n`;\n\nconst UPDATE_STATUSPAGE_LINK_IMPACT_MUTATION = gql`\n mutation UpdateStatuspageLinkImpact(\n $organizationUUID: ID!\n $incidentId: Int!\n $publicStatuspageId: Int!\n $newSchemaImpactId: ID\n ) {\n updateStatuspageLinkImpact(\n organizationUUID: $organizationUUID\n updateStatuspageLinkImpactSpec: {\n incidentId: $incidentId\n statuspageId: $publicStatuspageId\n newSchemaImpactId: $newSchemaImpactId\n }\n ) {\n statuspageLinks {\n statuspage {\n id\n name\n customDomain\n domain\n slug\n }\n impact {\n id\n name\n order\n color\n icon\n }\n }\n }\n }\n`;\n\nconst ADD_COMMENT_TO_INCIDENT_MUTATION = gql`\n mutation AddComment(\n $organizationUUID: ID!\n $incidentId: Int!\n $comment: String!\n ) {\n addCommentToIncident(\n organizationUUID: $organizationUUID\n incidentId: $incidentId\n commentSpec: { comment: $comment }\n ) {\n id\n }\n }\n`;\n\nconst ASSIGN_RESPONDER_ROLE_MUTATION = gql`\n mutation AssignResponderRole(\n $organizationUUID: ID!\n $memberId: ID!\n $incidentId: Int!\n $roleId: ID!\n ) {\n assignResponderRole(\n organizationUUID: $organizationUUID\n memberId: $memberId\n incidentId: $incidentId\n roleId: $roleId\n ) {\n id\n memberId\n user {\n firstname\n lastname\n avatar\n }\n createdAt\n updatedAt\n }\n }\n`;\n\nconst UNASSIGN_RESPONDER_ROLE_MUTATION = gql`\n mutation UnAssignResponderRole(\n $organizationUUID: ID!\n $incidentId: Int!\n $assignmentId: ID!\n ) {\n unAssignResponderRole(\n organizationUUID: $organizationUUID\n incidentId: $incidentId\n assignmentId: $assignmentId\n )\n }\n`;\n\nconst DELETE_EVENT_MUTATION = gql`\n mutation DeleteIncidentEvent(\n $organizationUUID: ID!\n $incidentId: Int!\n $eventId: ID!\n ) {\n deleteIncidentEvent(\n organizationUUID: $organizationUUID\n incidentId: $incidentId\n eventId: $eventId\n )\n }\n`;\n\nconst DELETE_INCIDENT_MUTATION = gql`\n mutation DeleteIncident($organizationUUID: ID!, $incidentId: Int!) {\n deleteIncident(organizationUUID: $organizationUUID, incidentId: $incidentId)\n }\n`;\n\nexport const GET_INCIDENT_TASKS_QUERY = gql`\n query GetIncidentTasks($organizationUUID: ID!, $id: Int!) {\n incident(organizationUUID: $organizationUUID, id: $id) {\n tasks {\n linkId\n task {\n id\n name\n description\n status\n createdAt\n updatedAt\n assigneeId\n assignee {\n firstname\n lastname\n avatar\n }\n }\n }\n }\n }\n`;\n\n@Injectable()\nexport class IncidentsService {\n private apollo = inject(Apollo);\n\n listIncidents(\n organizationId: string,\n pagination: OffsetPaginationOptions,\n query?: string\n ): Observable> {\n return this.apollo\n .query<{ incidents: { incidents: Incident[]; totalSize: number } }>({\n query: LIST_INCIDENTS_QUERY,\n variables: {\n organizationUUID: organizationId,\n listIncidentsRequest: {\n page: pagination.page,\n pageSize: pagination.pageSize,\n query: query,\n },\n },\n })\n .pipe(\n map(data => {\n const res = {\n items: toIdentifiableEntities(\n data.data.incidents.incidents.map(incident => {\n return {\n ...incident,\n timings: this.mapIncidentTimings(incident),\n createdAt: new Date(\n Date.parse(incident.createdAt as unknown as string)\n ),\n };\n }),\n 'id'\n ),\n totalSize: data.data.incidents.totalSize,\n };\n\n return res;\n })\n );\n }\n\n loadIncident(\n organizationId: string,\n publicIncidentId: number,\n eventPagination?: CursorPaginationOptions\n ): Observable {\n return this.apollo\n .query<{ incident: Incident }>({\n query: GET_INCIDENT_QUERY,\n variables: {\n organizationUUID: organizationId,\n id: publicIncidentId,\n listEventOptions: {\n pageSize: eventPagination?.pageSize || 10,\n pageToken: eventPagination?.pageToken || '',\n },\n },\n })\n .pipe(\n map(data => {\n const res = mapGQLResponse<{ incident: Incident }>(data, 'incident');\n\n if (res.events) {\n res.events = {\n ...res.events,\n events: res.events\n ? res.events.events.map(this.mapEventPayload)\n : [],\n };\n }\n\n res.timings = this.mapIncidentTimings(data.data!.incident);\n\n return res;\n })\n );\n }\n\n loadIncidentTasks(\n organizationId: string,\n publicIncidentId: number\n ): Observable> {\n return this.apollo\n .query<{ incident: { tasks: IncidentTaskLink[] } }>({\n query: GET_INCIDENT_TASKS_QUERY,\n variables: {\n organizationUUID: organizationId,\n id: publicIncidentId,\n },\n })\n .pipe(\n map(data => {\n const res = mapGQLResponse<{\n incident: { tasks: IncidentTaskLink[] };\n }>(data, 'incident');\n\n return toIdentifiableEntities(res.tasks, 'linkId');\n })\n );\n }\n\n loadRelatedAlerts(\n organizationId: string,\n publicIncidentId: number,\n relatedAlertPagination?: OffsetPaginationOptions\n ): Observable> {\n return this.apollo\n .query<{\n incident: { relatedAlerts: { alerts: Alert[]; totalSize: number } };\n }>({\n query: GET_INCIDENT_RELATED_ALERTS,\n variables: {\n organizationUUID: organizationId,\n id: publicIncidentId,\n listRelatedAlertsOptions: {\n pageSize: relatedAlertPagination?.pageSize || 5,\n page: relatedAlertPagination?.page || 1,\n },\n },\n })\n .pipe(\n map(data => {\n const res = mapGQLResponse<{\n incident: { relatedAlerts: { alerts: Alert[]; totalSize: number } };\n }>(data, 'incident');\n\n return {\n items: toIdentifiableEntities(res.relatedAlerts!.alerts, 'id'),\n totalSize: res.relatedAlerts!.totalSize,\n };\n })\n );\n }\n\n createIncident(\n organizationId: string,\n spec: IncidentSpec\n ): Observable {\n return this.apollo\n .mutate<{ createIncident: { id: number } }>({\n mutation: CREATE_INCIDENT_MUTATION,\n variables: {\n organizationUUID: organizationId,\n spec: {\n schemaVersionId: spec.schemaVersionId,\n priorityId: spec.priorityId,\n title: spec.title,\n summary: spec.summary,\n affectedServiceIds: spec.affectedServiceIds,\n statuspageIds: spec.statuspageIds,\n },\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.createIncident.id;\n })\n );\n }\n\n updateIncidentTitle(\n organizationId: string,\n publicIncidentId: number,\n newTitle: string\n ): Observable> {\n return this.apollo\n .mutate<{ updateIncidentTitle: Incident }>({\n mutation: UPDATE_INCIDENT_TITLE_MUTATION,\n variables: {\n organizationUUID: organizationId,\n incidentId: publicIncidentId,\n newTitle: newTitle,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.updateIncidentTitle;\n })\n );\n }\n\n updateIncidentSummary(\n organizationId: string,\n publicIncidentId: number,\n newSummary: string\n ): Observable> {\n return this.apollo\n .mutate<{ updateIncidentSummary: Incident }>({\n mutation: UPDATE_INCIDENT_SUMMARY_MUTATION,\n variables: {\n organizationUUID: organizationId,\n incidentId: publicIncidentId,\n newSummary: newSummary,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.updateIncidentSummary;\n })\n );\n }\n\n updateIncidentPriority(\n organizationId: string,\n publicIncidentId: number,\n newPriorityId: string\n ): Observable> {\n return this.apollo\n .mutate<{ updateIncidentPriority: Incident }>({\n mutation: UPDATE_INCIDENT_PRIORITY_MUTATION,\n variables: {\n organizationUUID: organizationId,\n incidentId: publicIncidentId,\n newPriorityId: newPriorityId,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.updateIncidentPriority;\n })\n );\n }\n\n updateIncidentState(\n organizationId: string,\n publicIncidentId: number,\n newStateId: string\n ): Observable> {\n return this.apollo\n .mutate<{ updateIncidentState: Incident }>({\n mutation: UPDATE_INCIDENT_STATE_MUTATION,\n variables: {\n organizationUUID: organizationId,\n incidentId: publicIncidentId,\n newStateId: newStateId,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.updateIncidentState;\n })\n );\n }\n\n updateIncidentServiceImpact(\n organizationId: string,\n publicIncidentId: number,\n serviceId: number,\n newImpactLinkId: string\n ): Observable> {\n return this.apollo\n .mutate<{ updateServiceImpact: Incident }>({\n mutation: UPDATE_INCIDENT_SERVICE_IMPACT_MUTATION,\n variables: {\n organizationUUID: organizationId,\n incidentId: publicIncidentId,\n serviceId: serviceId,\n newImpactLinkId: newImpactLinkId,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.updateServiceImpact;\n })\n );\n }\n\n updateIncidentImpactTiming(\n organizationId: string,\n publicIncidentId: number,\n timing: ImpactTimings,\n datetime: Date,\n setNull = false\n ): Observable> {\n return this.apollo\n .mutate<{ updateIncidentTimings: Incident }>({\n mutation: gql`\n mutation UpdateIncidentImpactTimings(\n $organizationUUID: ID!\n $incidentId: Int!\n ${!setNull ? '$datetime: Time' : ''}\n ) {\n updateIncidentTimings(\n organizationUUID: $organizationUUID\n updateIncidentTimingsSpec: {\n incidentId: $incidentId\n ${timing}: {\n ${setNull ? 'setNull: true' : ''}\n ${!setNull ? 'datetime: $datetime' : ''}\n }\n }\n ) {\n timings {\n scheduledAt\n startedAt\n acknowledgedAt\n resolvedAt\n closedAt\n }\n }\n }\n `,\n variables: {\n organizationUUID: organizationId,\n incidentId: publicIncidentId,\n datetime: datetime,\n setNull: setNull,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return this.mapIncidentTimings(\n data.data!.updateIncidentTimings\n ) as Pick;\n })\n );\n }\n\n linkService(\n organizationId: string,\n publicIncidentId: number,\n serviceId: number\n ): Observable> {\n return this.apollo\n .mutate<{ linkService: Incident }>({\n mutation: LINK_SERVICE_MUTATION,\n variables: {\n organizationUUID: organizationId,\n incidentId: publicIncidentId,\n serviceId: serviceId,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.linkService;\n })\n );\n }\n\n unLinkService(\n organizationId: string,\n publicIncidentId: number,\n serviceId: number\n ): Observable> {\n return this.apollo\n .mutate<{ unLinkService: Incident }>({\n mutation: UNLINK_SERVICE_MUTATION,\n variables: {\n organizationUUID: organizationId,\n incidentId: publicIncidentId,\n serviceId: serviceId,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.unLinkService;\n })\n );\n }\n\n linkStatuspage(\n organizationId: string,\n publicIncidentId: number,\n publicStatuspageId: number,\n linkOptions: IncidentStatuspageLinkOptions\n ): Observable> {\n return this.apollo\n .mutate<{ linkStatuspage: Incident }>({\n mutation: LINK_STATUSPAGE_MUTATION,\n variables: {\n organizationUUID: organizationId,\n incidentId: publicIncidentId,\n publicStatuspageId: publicStatuspageId,\n notifySubscribers: linkOptions.notifySubscribers,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.linkStatuspage;\n })\n );\n }\n\n unlinkStatuspage(\n organizationId: string,\n publicIncidentId: number,\n publicStatuspageId: number\n ): Observable> {\n return this.apollo\n .mutate<{ unlinkStatuspage: Incident }>({\n mutation: UNLINK_STATUSPAGE_MUTATION,\n variables: {\n organizationUUID: organizationId,\n incidentId: publicIncidentId,\n publicStatuspageId: publicStatuspageId,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.unlinkStatuspage;\n })\n );\n }\n\n updateStatuspageLinkImpact(\n organizationId: string,\n publicIncidentId: number,\n publicStatuspageId: number,\n newSchemaImpactId?: string\n ): Observable> {\n return this.apollo\n .mutate<{ updateStatuspageLinkImpact: Incident }>({\n mutation: UPDATE_STATUSPAGE_LINK_IMPACT_MUTATION,\n variables: {\n organizationUUID: organizationId,\n incidentId: publicIncidentId,\n publicStatuspageId: publicStatuspageId,\n newSchemaImpactId: newSchemaImpactId,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.updateStatuspageLinkImpact;\n })\n );\n }\n\n addCommentToIncident(\n organizationId: string,\n publicIncidentId: number,\n comment: string\n ): Observable {\n return this.apollo\n .mutate<{ addCommentToIncident: IncidentEvent }>({\n mutation: ADD_COMMENT_TO_INCIDENT_MUTATION,\n variables: {\n organizationUUID: organizationId,\n incidentId: publicIncidentId,\n comment: comment,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.addCommentToIncident;\n })\n );\n }\n\n assignResponderRole(\n organizationId: string,\n publicIncidentId: number,\n memberId: string,\n roleId: string\n ): Observable {\n return this.apollo\n .mutate<{ assignResponderRole: IncidentRoleAssignment }>({\n mutation: ASSIGN_RESPONDER_ROLE_MUTATION,\n variables: {\n organizationUUID: organizationId,\n incidentId: publicIncidentId,\n memberId: memberId,\n roleId: roleId,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.assignResponderRole;\n })\n );\n }\n\n unassignResponderRole(\n organizationId: string,\n publicIncidentId: number,\n assignmentId: string\n ): Observable {\n return this.apollo\n .mutate<{ unAssignResponderRole: boolean }>({\n mutation: UNASSIGN_RESPONDER_ROLE_MUTATION,\n variables: {\n organizationUUID: organizationId,\n incidentId: publicIncidentId,\n assignmentId: assignmentId,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.unAssignResponderRole;\n })\n );\n }\n\n deleteIncidentEvent(\n organizationId: string,\n publicIncidentId: number,\n eventId: string\n ): Observable {\n return this.apollo\n .mutate<{ deleteIncidentEvent: boolean }>({\n mutation: DELETE_EVENT_MUTATION,\n variables: {\n organizationUUID: organizationId,\n incidentId: publicIncidentId,\n eventId: eventId,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.deleteIncidentEvent;\n })\n );\n }\n\n deleteIncident(\n organizationId: string,\n publicIncidentId: number\n ): Observable {\n return this.apollo\n .mutate<{ deleteIncident: boolean }>({\n mutation: DELETE_INCIDENT_MUTATION,\n variables: {\n organizationUUID: organizationId,\n incidentId: publicIncidentId,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.deleteIncident;\n })\n );\n }\n\n private mapEventPayload(gqlData: any): IncidentEvent {\n return {\n id: gqlData.id,\n type: gqlData.type,\n payload: gqlData.payload,\n createdAt: new Date(Date.parse(gqlData.createdAt)),\n actor: {\n type:\n gqlData.actor['__typename'] === 'ServiceAccountActor'\n ? IncidentEventActor.SYSTEM\n : IncidentEventActor.USER,\n ...gqlData.actor,\n },\n };\n }\n\n private mapIncidentTimings(gqlData: any): IncidentTimings {\n const timings = gqlData.timings;\n\n if (!timings) {\n return {};\n }\n\n return {\n scheduledAt: timings.scheduledAt\n ? new Date(timings.scheduledAt)\n : undefined,\n startedAt: timings.startedAt ? new Date(timings.startedAt) : undefined,\n acknowledgedAt: timings.acknowledgedAt\n ? new Date(timings.acknowledgedAt)\n : undefined,\n resolvedAt: timings.resolvedAt ? new Date(timings.resolvedAt) : undefined,\n closedAt: timings.closedAt ? new Date(timings.closedAt) : undefined,\n };\n }\n}\n","import { TaskStatus } from 'src/app/models/task';\n\nexport class LoadTasksForIncidentAction {\n static readonly type = '[Tasks] Load for incident';\n constructor(public incidentId: number) {}\n}\n\nexport class UpdateTaskStatusAction {\n static readonly type = '[Tasks] Update status';\n constructor(\n public taskId: string,\n public status: TaskStatus\n ) {}\n}\n\nexport class AssignTaskAction {\n static readonly type = '[Tasks] Assign';\n constructor(\n public taskId: string,\n public assigneeId: string\n ) {}\n}\n","import { inject, Injectable } from '@angular/core';\nimport { Apollo, gql } from 'apollo-angular';\nimport { map, Observable } from 'rxjs';\nimport { Task, TaskStatus } from 'src/app/models/task';\n\nconst UPDATE_TASK_STATUS_MUTATION = gql`\n mutation UpdateTaskStatus(\n $organizationId: ID!\n $taskId: ID!\n $status: TaskStatus!\n ) {\n updateTaskStatus(\n organizationId: $organizationId\n taskId: $taskId\n status: $status\n ) {\n status\n }\n }\n`;\nconst ASSIGN_TASK_MUTATION = gql`\n mutation AssignTask($organizationId: ID!, $taskId: ID!, $assigneeId: ID!) {\n assignTask(\n organizationId: $organizationId\n taskId: $taskId\n assigneeId: $assigneeId\n ) {\n assigneeId\n assignee {\n firstname\n lastname\n avatar\n }\n }\n }\n`;\n\n@Injectable()\nexport class TasksService {\n private apollo = inject(Apollo);\n\n updateTaskStatus(\n organizationId: string,\n taskId: string,\n status: TaskStatus\n ): Observable {\n return this.apollo\n .mutate<{ updateTaskStatus: Task }>({\n mutation: UPDATE_TASK_STATUS_MUTATION,\n variables: {\n organizationId: organizationId,\n taskId: taskId,\n status: status,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.updateTaskStatus;\n })\n );\n }\n\n assignTask(\n organizationId: string,\n taskId: string,\n assigneeId: string\n ): Observable {\n return this.apollo\n .mutate<{ assignTask: Task }>({\n mutation: ASSIGN_TASK_MUTATION,\n variables: {\n organizationId: organizationId,\n taskId: taskId,\n assigneeId: assigneeId,\n },\n })\n .pipe(\n map(data => {\n if (data.errors) {\n throw new Error(data.errors[0].message);\n }\n return data.data!.assignTask;\n })\n );\n }\n}\n","import { inject, Injectable } from '@angular/core';\nimport {\n Action,\n createSelector,\n Selector,\n State,\n StateContext,\n Store,\n} from '@ngxs/store';\nimport { catchError, map } from 'rxjs';\nimport { toIdentifiableEntities } from 'src/app/helpers/graphql';\nimport { Task, TaskStatus } from 'src/app/models/task';\nimport { ToastService } from 'src/app/services/toast/toast.service';\nimport {\n IteratableListEntities,\n ListEntities,\n ListEntitiesToIterable,\n loadEntities,\n NewListEntities,\n updateListEntity,\n} from '../common/list-entity';\nimport { IncidentsService } from '../incidents/incidents.service';\nimport { UserState } from '../user/user.state';\nimport {\n AssignTaskAction,\n LoadTasksForIncidentAction,\n UpdateTaskStatusAction,\n} from './tasks.actions';\nimport { TasksService } from './tasks.service';\n\nexport interface TasksStateModel {\n tasks: ListEntities;\n}\n\n@State({\n name: 'tasks',\n defaults: {\n tasks: NewListEntities(),\n },\n})\n@Injectable()\nexport class TasksState {\n store = inject(Store);\n\n private incidentService = inject(IncidentsService);\n private tasksService = inject(TasksService);\n private toast = inject(ToastService);\n\n @Selector()\n static tasks(state: TasksStateModel): IteratableListEntities {\n return ListEntitiesToIterable(state.tasks);\n }\n\n static tasksInStatus(status: TaskStatus[]) {\n return createSelector([TasksState], (state: TasksStateModel) => {\n if (!state.tasks) return [];\n\n return Object.values(state.tasks.entities).filter(task =>\n status.includes(task.data!.status)\n );\n });\n }\n\n static tasksByIds(ids: string[]) {\n return createSelector([TasksState], (state: TasksStateModel) => {\n if (!state.tasks) return [];\n\n return ids\n .map(id => state.tasks.entities[id])\n .filter(task => task !== undefined);\n });\n }\n\n @Action(LoadTasksForIncidentAction)\n loadTasksForIncident(\n ctx: StateContext,\n { incidentId }: LoadTasksForIncidentAction\n ) {\n const organizationID = this.store.selectSnapshot(\n UserState.getCurrentOrganizationID\n );\n\n if (!organizationID) throw new Error('No organization ID set');\n\n return loadEntities(\n ctx,\n 'tasks',\n this.incidentService.loadIncidentTasks(organizationID, incidentId).pipe(\n map(tasks => {\n return toIdentifiableEntities(\n Object.values(tasks).map(task => {\n return task.data!.task;\n }),\n 'id'\n );\n })\n )\n );\n }\n\n @Action(UpdateTaskStatusAction)\n updateTaskStatus(\n ctx: StateContext,\n { taskId, status }: UpdateTaskStatusAction\n ) {\n const organizationID = this.store.selectSnapshot(\n UserState.getCurrentOrganizationID\n );\n\n if (!organizationID) throw new Error('No organization ID set');\n\n return updateListEntity(\n ctx,\n 'tasks',\n taskId,\n this.tasksService.updateTaskStatus(organizationID, taskId, status),\n true\n ).pipe(\n catchError(err => {\n this.toast.showError(err);\n throw err;\n })\n );\n }\n\n @Action(AssignTaskAction)\n assignTask(\n ctx: StateContext,\n { taskId, assigneeId }: AssignTaskAction\n ) {\n const organizationID = this.store.selectSnapshot(\n UserState.getCurrentOrganizationID\n );\n\n if (!organizationID) throw new Error('No organization ID set');\n\n return updateListEntity(\n ctx,\n 'tasks',\n taskId,\n this.tasksService.assignTask(organizationID, taskId, assigneeId),\n true\n ).pipe(\n catchError(err => {\n this.toast.showError(err);\n throw err;\n })\n );\n }\n}\n","import { IncidentEvent, IncidentEventPayloadFieldUpdated } from './incident';\n\nexport const EventActionMappings = new Map([\n ['CREATED', 'incidentEvents.created'],\n ['FIELD_UPDATED', 'incidentEvents.fieldUpdated'],\n ['STATE_UPDATED', 'incidentEvents.stateUpdated'],\n ['PRIORITY_UPDATED', 'incidentEvents.priorityUpdated'],\n ['RESPONDER_ADDED', 'incidentEvents.responderAdded'],\n ['AFFECTED_SERVICE_ADDED', 'incidentEvents.affectedServiceAdded'],\n ['AFFECTED_SERVICE_REMOVED', 'incidentEvents.affectedServiceRemoved'],\n [\n 'AFFECTED_SERVICE_IMPACT_CHANGED',\n 'incidentEvents.affectedServiceImpactChanged',\n ],\n [\n 'COMMUNICATION_CHANNEL_CREATED',\n 'incidentEvents.communicationChannelCreated',\n ],\n ['COMMENT_ADDED', 'incidentEvents.commentAdded'],\n ['ROLE_ASSIGNED', 'incidentEvents.roleAssigned'],\n ['ROLE_UNASSIGNED', 'incidentEvents.roleUnassigned'],\n ['STATUSPAGE_LINKED', 'incidentEvents.statuspageLinked'],\n ['STATUSPAGE_UNLINKED', 'incidentEvents.statuspageUnlinked'],\n ['TIMINGS_UPDATED', 'incidentEvents.timingsUpdated'],\n ['RELATED_ALERT_ADDED', 'incidentEvents.relatedAlertAdded'],\n ['TASK_CREATED', 'incidentEvents.taskCreated'],\n ['TASK_STATUS_UPDATED', 'incidentEvents.taskStatusUpdated'],\n ['TASK_ASSIGNED', 'incidentEvents.taskAssigned'],\n]);\n\nexport const EventFieldMappings = new Map([\n ['state', 'incidentEvents.fieldMappings.state'],\n ['summary', 'incidentEvents.fieldMappings.summary'],\n ['priority', 'incidentEvents.fieldMappings.priority'],\n ['title', 'incidentEvents.fieldMappings.title'],\n]);\n\nexport const EventTypeToHeader = (event: IncidentEvent): string => {\n if (event.type === 'FIELD_UPDATED') {\n const payload = event.payload as IncidentEventPayloadFieldUpdated;\n return EventFieldMappings.get(payload.field) || '';\n }\n\n return EventActionMappings.get(event.type) || '';\n};\n","import { Injectable, inject } from '@angular/core';\nimport { TranslateService } from '@ngx-translate/core';\nimport {\n Action,\n Selector,\n State,\n StateContext,\n Store,\n createSelector,\n} from '@ngxs/store';\nimport { patch } from '@ngxs/store/operators';\nimport {\n Observable,\n catchError,\n forkJoin,\n map,\n of,\n tap,\n throwError,\n} from 'rxjs';\nimport { toIdentifiableEntities } from 'src/app/helpers/graphql';\nimport { Alert } from 'src/app/models/alert';\nimport { EventTypeToHeader } from 'src/app/models/events';\nimport {\n Incident,\n IncidentEvent,\n IncidentEventActor,\n IncidentEventPayloadFieldUpdated,\n IncidentRoleWithAssignment,\n} from 'src/app/models/incident';\nimport { Service } from 'src/app/models/service';\nimport { OrganizationMembership } from 'src/app/models/user';\nimport { ToastService } from 'src/app/services/toast/toast.service';\nimport {\n Entity,\n NewEntity,\n loadEntity,\n saveEntity,\n} from 'src/app/store/common/entity';\nimport {\n IdentifiableEntities,\n ListEntities,\n addListEntity,\n removeListEntity,\n} from 'src/app/store/common/list-entity';\nimport {\n PaginatedListEntities,\n PaginatedListEntitiesState,\n} from 'src/app/store/common/paginated-list-entity';\nimport {\n CursorPagination,\n CursorPaginationState,\n OffsetPagination,\n OffsetPaginationState,\n} from 'src/app/store/common/pagination';\nimport { UserState } from 'src/app/store/user/user.state';\nimport { ServicesState } from '../services/services.state';\nimport { LoadTasksForIncidentAction } from '../tasks/tasks.actions';\nimport { TasksState, TasksStateModel } from '../tasks/tasks.state';\nimport {\n AddCommentToIncidentAction,\n AddIncidentEventAction,\n AssignResponderRoleAction,\n DeleteIncidentEventAction,\n LinkServiceToIncident,\n LinkStatuspageToIncident,\n LoadIncidentDetailsAction,\n LoadIncidentRelatedAlertsAction,\n UnLinkServiceFromIncident,\n UnassignResponderRoleAction,\n UnlinkStatuspageFromIncident,\n UpdateSelectedIncidentPriority,\n UpdateSelectedIncidentServiceImpact,\n UpdateSelectedIncidentState,\n UpdateSelectedIncidentSummary,\n UpdateSelectedIncidentTiming,\n UpdateSelectedIncidentTitle,\n UpdateStatuspageLinkImpactAction,\n} from './incidents.actions';\nimport { IncidentsService } from './incidents.service';\n\nexport interface IncidentDetailsStateModel {\n incident: Entity;\n events: PaginatedListEntitiesState;\n relatedAlerts: PaginatedListEntitiesState;\n}\n\n@State({\n name: 'incidentDetails',\n defaults: {\n incident: NewEntity(),\n events: CursorPagination.GetDefaultState(),\n relatedAlerts: OffsetPagination.GetDefaultState(4),\n },\n})\n@Injectable()\nexport class IncidentDetailsState {\n store = inject(Store);\n incidentsService = inject(IncidentsService);\n toast = inject(ToastService);\n translate = inject(TranslateService);\n\n eventPagination = new PaginatedListEntities<\n IncidentDetailsStateModel,\n CursorPagination\n >('events', new CursorPagination());\n\n relatedAlertsPagination = new PaginatedListEntities<\n IncidentDetailsStateModel,\n OffsetPagination\n >('relatedAlerts', new OffsetPagination());\n\n @Selector()\n static incidentDetails(state: IncidentDetailsStateModel): Entity {\n return state.incident;\n }\n\n @Selector()\n static schemaVersion(state: IncidentDetailsStateModel) {\n return state.incident.data?.schemaVersion;\n }\n\n @Selector()\n static events(\n state: IncidentDetailsStateModel\n ): PaginatedListEntitiesState {\n return state.events;\n }\n\n @Selector()\n static relatedAlerts(\n state: IncidentDetailsStateModel\n ): PaginatedListEntitiesState {\n return state.relatedAlerts;\n }\n\n @Selector([IncidentDetailsState, UserState.membership])\n static getOwnAssignedRoles(\n state: IncidentDetailsStateModel,\n membership: OrganizationMembership | undefined\n ) {\n if (!state.incident.data?.roles || !membership) return [];\n\n return state.incident?.data?.roles?.filter(role => {\n const assignment = role.assignments.find(assignment => {\n return assignment.memberId === membership.id;\n });\n return assignment !== undefined;\n });\n }\n\n @Selector([IncidentDetailsState, ServicesState.services])\n static availableServices(\n state: IncidentDetailsStateModel,\n allServices: ListEntities\n ): Service[] {\n const selectedServices = state.incident?.data?.affectedServices?.map(\n s => s.service.id\n );\n\n return allServices.entities\n ? Object.values(allServices.entities)\n .filter(s => !selectedServices?.includes(s.data!.id))\n .map(entity => entity.data!)\n : [];\n }\n\n @Selector()\n static taskIds(state: IncidentDetailsStateModel) {\n return state.incident.data?.tasks.map(task => task.taskId) ?? [];\n }\n\n static tasks() {\n return createSelector(\n [IncidentDetailsState.taskIds, TasksState],\n (taskIds: string[], taskState: TasksStateModel) => {\n if (!taskIds) return [];\n return TasksState.tasksByIds(taskIds)(taskState);\n }\n );\n }\n\n static ownTasks() {\n return createSelector(\n [IncidentDetailsState.taskIds, TasksState, UserState.membership],\n (taskIds: string[], taskState: TasksStateModel, membership) => {\n if (!taskIds) return [];\n\n return TasksState.tasksByIds(taskIds)(taskState).filter(task => {\n return task.data?.assigneeId === membership?.id;\n });\n }\n );\n }\n\n @Action(LoadIncidentDetailsAction)\n loadIncidentDetails(\n ctx: StateContext,\n { id, eventPagination }: LoadIncidentDetailsAction\n ) {\n const organizationID = this.store.selectSnapshot(\n UserState.getCurrentOrganizationID\n );\n\n if (!organizationID) throw new Error('No organization ID set');\n\n let refresh = false;\n if (ctx.getState().incident.data?.id === id) {\n refresh = true;\n }\n\n if (!eventPagination) {\n if (refresh) {\n eventPagination = ctx.getState().events.pagination;\n } else {\n eventPagination = CursorPagination.GetDefaultState().pagination;\n }\n }\n\n const observable = this.incidentsService.loadIncident(\n organizationID,\n id,\n eventPagination\n );\n\n return forkJoin([\n loadEntity(ctx, 'incident', observable, refresh),\n this.eventPagination.loadEntititesPaginated(\n ctx,\n eventPagination!,\n observable.pipe(\n map((incident: Incident) => {\n let events: IdentifiableEntities = {};\n if (incident.events) {\n events = toIdentifiableEntities(\n incident.events.events.map(event => {\n return event;\n }),\n 'id'\n );\n\n // check if there were any errors when loading the event payload\n events = Object.fromEntries(\n Object.entries(events).map(([key, val]) => {\n const payload = Object.values(val.data!.payload)[0];\n\n if (payload instanceof Error) {\n val.loadingError = payload.message;\n }\n\n return [key, val];\n })\n );\n }\n\n return {\n items: events,\n totalSize: incident.events?.totalSize ?? 0,\n nextPageToken: incident.events?.nextPageToken,\n };\n })\n ),\n refresh\n ),\n ]);\n }\n\n @Action(LoadIncidentRelatedAlertsAction)\n loadRelatedAlerts(\n ctx: StateContext,\n { id, relatedAlertsPagination }: LoadIncidentRelatedAlertsAction\n ) {\n const organizationID = this.store.selectSnapshot(\n UserState.getCurrentOrganizationID\n );\n\n if (!organizationID) throw new Error('No organization ID set');\n\n let refresh = false;\n if (ctx.getState().incident.data?.id === id) {\n refresh = true;\n }\n\n if (!relatedAlertsPagination) {\n if (refresh) {\n relatedAlertsPagination = ctx.getState().relatedAlerts.pagination;\n } else {\n relatedAlertsPagination =\n OffsetPagination.GetDefaultState(4).pagination;\n }\n }\n\n return this.relatedAlertsPagination.loadEntititesPaginated(\n ctx,\n relatedAlertsPagination!,\n this.incidentsService.loadRelatedAlerts(\n organizationID,\n id,\n relatedAlertsPagination\n ),\n refresh\n );\n }\n\n @Action(UpdateSelectedIncidentTitle)\n updateIncidentTitle(\n ctx: StateContext,\n { newTitle }: UpdateSelectedIncidentTitle\n ) {\n return this.execute(\n ctx,\n this.incidentsService.updateIncidentTitle.bind(this.incidentsService),\n newTitle\n );\n }\n\n @Action(UpdateSelectedIncidentSummary)\n updateIncidentSummary(\n ctx: StateContext,\n { newSummary }: UpdateSelectedIncidentSummary\n ) {\n return this.execute(\n ctx,\n this.incidentsService.updateIncidentSummary.bind(this.incidentsService),\n newSummary\n );\n }\n\n @Action(UpdateSelectedIncidentPriority)\n updateIncidentPriority(\n ctx: StateContext,\n { newPriorityId }: UpdateSelectedIncidentPriority\n ) {\n return this.execute(\n ctx,\n this.incidentsService.updateIncidentPriority.bind(this.incidentsService),\n newPriorityId\n );\n }\n\n @Action(UpdateSelectedIncidentState)\n updateIncidentState(\n ctx: StateContext,\n { newStateId }: UpdateSelectedIncidentState\n ) {\n return this.execute(\n ctx,\n this.incidentsService.updateIncidentState.bind(this.incidentsService),\n newStateId\n );\n }\n\n @Action(UpdateSelectedIncidentServiceImpact)\n updateIncidentServiceImpact(\n ctx: StateContext,\n { service, newImpactLinkId }: UpdateSelectedIncidentServiceImpact\n ) {\n return this.execute(\n ctx,\n this.incidentsService.updateIncidentServiceImpact.bind(\n this.incidentsService\n ),\n service,\n newImpactLinkId\n );\n }\n\n @Action(UpdateSelectedIncidentTiming)\n updateIncidentTiming(\n ctx: StateContext,\n { timing, datetime, setNull }: UpdateSelectedIncidentTiming\n ) {\n return this.execute(\n ctx,\n this.incidentsService.updateIncidentImpactTiming.bind(\n this.incidentsService\n ),\n timing,\n datetime,\n setNull\n );\n }\n\n @Action(LinkServiceToIncident)\n linkServiceToIncident(\n ctx: StateContext,\n { publicServiceId }: LinkServiceToIncident\n ) {\n return this.execute(\n ctx,\n this.incidentsService.linkService.bind(this.incidentsService),\n publicServiceId\n );\n }\n\n @Action(UnLinkServiceFromIncident)\n unLinkServiceFromIncident(\n ctx: StateContext,\n { publicServiceId }: UnLinkServiceFromIncident\n ) {\n return this.execute(\n ctx,\n this.incidentsService.unLinkService.bind(this.incidentsService),\n publicServiceId\n );\n }\n\n @Action(LinkStatuspageToIncident)\n linkStatuspageToIncident(\n ctx: StateContext,\n { publicStatuspageId, linkOptions }: LinkStatuspageToIncident\n ) {\n return this.execute(\n ctx,\n this.incidentsService.linkStatuspage.bind(this.incidentsService),\n publicStatuspageId,\n linkOptions\n );\n }\n\n @Action(UnlinkStatuspageFromIncident)\n unlinkStatuspageToIncident(\n ctx: StateContext,\n { publicStatuspageId }: UnlinkStatuspageFromIncident\n ) {\n return this.execute(\n ctx,\n this.incidentsService.unlinkStatuspage.bind(this.incidentsService),\n publicStatuspageId\n );\n }\n\n @Action(UpdateStatuspageLinkImpactAction)\n updateStatuspageLinkImpact(\n ctx: StateContext,\n { publicStatuspageId, newSchemaImpactId }: UpdateStatuspageLinkImpactAction\n ) {\n return this.execute(\n ctx,\n this.incidentsService.updateStatuspageLinkImpact.bind(\n this.incidentsService\n ),\n publicStatuspageId,\n newSchemaImpactId === 'automatic' ? undefined : newSchemaImpactId\n );\n }\n\n @Action(AddCommentToIncidentAction)\n addCommentToIncident(\n ctx: StateContext,\n { comment }: AddCommentToIncidentAction\n ) {\n const organizationID = this.store.selectSnapshot(\n UserState.getCurrentOrganizationID\n );\n\n if (!organizationID) throw new Error('No organization ID set');\n\n const state = ctx.getState();\n\n if (!state.incident.data) throw new Error('No incident selected');\n\n return this.incidentsService.addCommentToIncident(\n organizationID,\n state.incident.data.id,\n comment\n );\n }\n\n @Action(AssignResponderRoleAction)\n assignIdentityToIncidentRole(\n ctx: StateContext,\n { memberId, roleId }: AssignResponderRoleAction\n ) {\n const organizationID = this.store.selectSnapshot(\n UserState.getCurrentOrganizationID\n );\n\n if (!organizationID) throw new Error('No organization ID set');\n\n const state = ctx.getState();\n\n if (!state.incident.data) throw new Error('No incident selected');\n\n return this.incidentsService\n .assignResponderRole(\n organizationID,\n state.incident.data.id,\n memberId,\n roleId\n )\n .pipe(\n tap(incidentRoleAssignment => {\n // deep copy the roles array\n const roles = Object.assign(\n [],\n state.incident.data!.roles!\n ) as IncidentRoleWithAssignment[];\n\n // find the role that was assigned\n for (const role of roles) {\n if (role.role.id === roleId) {\n role.assignments.push(incidentRoleAssignment);\n }\n }\n\n ctx.setState(\n patch({\n incident: patch>({\n data: patch({\n roles: roles,\n }),\n }),\n })\n );\n }),\n catchError(error => {\n this.toast.showError(error);\n\n return throwError(() => error);\n })\n );\n }\n\n @Action(UnassignResponderRoleAction)\n unassignIdentityFromIncidentRole(\n ctx: StateContext,\n { roleId, assignmentId, memberId }: UnassignResponderRoleAction\n ) {\n const organizationID = this.store.selectSnapshot(\n UserState.getCurrentOrganizationID\n );\n\n if (!organizationID) throw new Error('No organization ID set');\n\n const state = ctx.getState();\n\n if (!state.incident.data) throw new Error('No incident selected');\n\n return this.incidentsService\n .unassignResponderRole(\n organizationID,\n state.incident.data.id,\n assignmentId\n )\n .pipe(\n tap(() => {\n const roles = Object.assign(\n [],\n state.incident.data!.roles!\n ) as IncidentRoleWithAssignment[];\n for (const role of roles) {\n if (role.role.id === roleId) {\n role.assignments = role.assignments.filter(\n a => a.memberId !== memberId\n );\n }\n }\n\n ctx.setState(\n patch({\n incident: patch>({\n data: patch({\n roles: roles,\n }),\n }),\n })\n );\n }),\n catchError(error => {\n this.toast.showError(error);\n\n return throwError(() => error);\n })\n );\n }\n\n @Action(DeleteIncidentEventAction)\n deleteIncidentEvent(\n ctx: StateContext,\n { eventId }: DeleteIncidentEventAction\n ) {\n const organizationID = this.store.selectSnapshot(\n UserState.getCurrentOrganizationID\n );\n\n if (!organizationID) throw new Error('No organization ID set');\n\n const state = ctx.getState();\n\n if (!state.incident.data) throw new Error('No incident selected');\n\n return removeListEntity(\n ctx,\n 'events',\n eventId,\n (event: IncidentEvent) => {\n return event.id !== eventId;\n },\n this.incidentsService.deleteIncidentEvent(\n organizationID,\n state.incident.data.id,\n eventId\n )\n ).pipe(\n tap(() => {\n this.toast.showInfo(\n this.translate.instant('incidentEvents.toasts.eventDeleted.header'),\n this.translate.instant('incidentEvents.toasts.eventDeleted.body')\n );\n })\n );\n }\n\n @Action(AddIncidentEventAction)\n addIncidentEvent(\n ctx: StateContext,\n { incidentId, event }: AddIncidentEventAction\n ) {\n const state = ctx.getState();\n if (state.incident.data?.id === incidentId) {\n const statePatch: any = {};\n\n if (event.type === 'FIELD_UPDATED') {\n const payload = event.payload as IncidentEventPayloadFieldUpdated;\n\n if (payload.newValue.intValue) {\n statePatch[payload.field] = payload.newValue.intValue;\n } else if (payload.newValue.stringValue) {\n statePatch[payload.field] = payload.newValue.stringValue;\n }\n\n ctx.setState(\n patch({\n incident: patch({\n data: patch(statePatch),\n }),\n })\n );\n } else if (\n event.type === 'TASK_CREATED' ||\n event.type === 'TASK_STATUS_UPDATED' ||\n event.type === 'TASK_ASSIGNED'\n ) {\n this.store.dispatch(new LoadTasksForIncidentAction(incidentId));\n } else {\n this.store.dispatch(new LoadIncidentDetailsAction(incidentId));\n }\n\n const translatedEventAction = this.translate.instant(\n EventTypeToHeader(event)\n );\n\n if (event.actor.type === IncidentEventActor.SYSTEM) {\n this.toast.showInfo(\n this.translate.instant('incidentEvents.toastHeader'),\n `System ${translatedEventAction}`\n );\n } else if (event.actor.type === IncidentEventActor.USER) {\n this.toast.showInfo(\n this.translate.instant('incidentEvents.toastHeader'),\n `${event.actor.user!.firstname} ${event.actor.user!.lastname} ${translatedEventAction}`\n );\n }\n\n return addListEntity(ctx, 'events', 'id', of(event));\n }\n\n return of();\n }\n\n // update incident helper\n // Generic function to call the incidents service\n private execute(\n ctx: StateContext,\n serviceMethod: (\n organizationId: string,\n incidentId: number,\n ...args: T\n ) => Observable>,\n ...args: T\n ) {\n const organizationID = this.store.selectSnapshot(\n UserState.getCurrentOrganizationID\n );\n\n if (!organizationID) throw new Error('No organization ID set');\n\n const state = ctx.getState();\n\n return saveEntity(\n ctx,\n 'incident',\n serviceMethod(organizationID, state.incident.data!.id!, ...args),\n true\n ).pipe(\n catchError(error => {\n this.toast.showError(error);\n throw error;\n })\n );\n }\n}\n"],"names":["IncidentEventActor","ImpactTimings","EVENT_FIELDS","EVENTS_FRAGMENT","gql","LIST_INCIDENTS_QUERY","GET_INCIDENT_QUERY","GET_INCIDENT_RELATED_ALERTS","UPDATE_INCIDENT_TITLE_MUTATION","CREATE_INCIDENT_MUTATION","UPDATE_INCIDENT_SUMMARY_MUTATION","UPDATE_INCIDENT_PRIORITY_MUTATION","UPDATE_INCIDENT_STATE_MUTATION","UPDATE_INCIDENT_SERVICE_IMPACT_MUTATION","LINK_SERVICE_MUTATION","UNLINK_SERVICE_MUTATION","LINK_STATUSPAGE_MUTATION","UNLINK_STATUSPAGE_MUTATION","UPDATE_STATUSPAGE_LINK_IMPACT_MUTATION","ADD_COMMENT_TO_INCIDENT_MUTATION","ASSIGN_RESPONDER_ROLE_MUTATION","UNASSIGN_RESPONDER_ROLE_MUTATION","DELETE_EVENT_MUTATION","DELETE_INCIDENT_MUTATION","GET_INCIDENT_TASKS_QUERY","IncidentsService","constructor","apollo","inject","Apollo","listIncidents","organizationId","pagination","query","variables","organizationUUID","listIncidentsRequest","page","pageSize","pipe","map","data","items","toIdentifiableEntities","incidents","incident","__spreadProps","__spreadValues","timings","mapIncidentTimings","createdAt","Date","parse","totalSize","loadIncident","publicIncidentId","eventPagination","id","listEventOptions","pageToken","res","mapGQLResponse","events","mapEventPayload","loadIncidentTasks","tasks","loadRelatedAlerts","relatedAlertPagination","listRelatedAlertsOptions","relatedAlerts","alerts","createIncident","spec","mutate","mutation","schemaVersionId","priorityId","title","summary","affectedServiceIds","statuspageIds","errors","Error","message","updateIncidentTitle","newTitle","incidentId","updateIncidentSummary","newSummary","updateIncidentPriority","newPriorityId","updateIncidentState","newStateId","updateIncidentServiceImpact","serviceId","newImpactLinkId","updateServiceImpact","updateIncidentImpactTiming","timing","datetime","setNull","updateIncidentTimings","linkService","unLinkService","linkStatuspage","publicStatuspageId","linkOptions","notifySubscribers","unlinkStatuspage","updateStatuspageLinkImpact","newSchemaImpactId","addCommentToIncident","comment","assignResponderRole","memberId","roleId","unassignResponderRole","assignmentId","unAssignResponderRole","deleteIncidentEvent","eventId","deleteIncident","gqlData","type","payload","actor","IncidentEventActor","SYSTEM","USER","scheduledAt","undefined","startedAt","acknowledgedAt","resolvedAt","closedAt","factory","ɵfac","LoadTasksForIncidentAction","type","constructor","incidentId","UpdateTaskStatusAction","taskId","status","AssignTaskAction","assigneeId","UPDATE_TASK_STATUS_MUTATION","gql","ASSIGN_TASK_MUTATION","TasksService","constructor","apollo","inject","Apollo","updateTaskStatus","organizationId","taskId","status","mutate","mutation","variables","pipe","map","data","errors","Error","message","assignTask","assigneeId","factory","ɵfac","TasksState","constructor","store","inject","Store","incidentService","IncidentsService","tasksService","TasksService","toast","ToastService","tasks","state","ListEntitiesToIterable","tasksInStatus","status","createSelector","TasksState_1","Object","values","entities","filter","task","includes","data","tasksByIds","ids","map","id","undefined","loadTasksForIncident","ctx","incidentId","organizationID","selectSnapshot","UserState","getCurrentOrganizationID","Error","loadEntities","loadIncidentTasks","pipe","toIdentifiableEntities","updateTaskStatus","taskId","updateListEntity","catchError","err","showError","assignTask","assigneeId","factory","ɵfac","__decorate","Action","LoadTasksForIncidentAction","UpdateTaskStatusAction","AssignTaskAction","Selector","State","name","defaults","NewListEntities","EventActionMappings","Map","EventFieldMappings","EventTypeToHeader","event","type","payload","get","field","IncidentDetailsState","constructor","store","inject","Store","incidentsService","IncidentsService","toast","ToastService","translate","TranslateService","eventPagination","PaginatedListEntities","CursorPagination","relatedAlertsPagination","OffsetPagination","incidentDetails","state","incident","schemaVersion","data","events","relatedAlerts","getOwnAssignedRoles","membership","roles","filter","role","assignments","find","assignment","memberId","id","undefined","availableServices","allServices","selectedServices","affectedServices","map","s","service","entities","Object","values","includes","entity","taskIds","tasks","task","taskId","createSelector","IncidentDetailsState_1","TasksState","taskState","tasksByIds","ownTasks","UserState","assigneeId","loadIncidentDetails","ctx","organizationID","selectSnapshot","getCurrentOrganizationID","Error","refresh","getState","pagination","GetDefaultState","observable","loadIncident","forkJoin","loadEntity","loadEntititesPaginated","pipe","toIdentifiableEntities","event","fromEntries","entries","key","val","payload","loadingError","message","items","totalSize","nextPageToken","loadRelatedAlerts","updateIncidentTitle","newTitle","execute","bind","updateIncidentSummary","newSummary","updateIncidentPriority","newPriorityId","updateIncidentState","newStateId","updateIncidentServiceImpact","newImpactLinkId","updateIncidentTiming","timing","datetime","setNull","updateIncidentImpactTiming","linkServiceToIncident","publicServiceId","linkService","unLinkServiceFromIncident","unLinkService","linkStatuspageToIncident","publicStatuspageId","linkOptions","linkStatuspage","unlinkStatuspageToIncident","unlinkStatuspage","updateStatuspageLinkImpact","newSchemaImpactId","addCommentToIncident","comment","assignIdentityToIncidentRole","roleId","assignResponderRole","tap","incidentRoleAssignment","assign","push","setState","patch","catchError","error","showError","throwError","unassignIdentityFromIncidentRole","assignmentId","unassignResponderRole","a","deleteIncidentEvent","eventId","removeListEntity","showInfo","instant","addIncidentEvent","incidentId","statePatch","type","newValue","intValue","field","stringValue","dispatch","LoadTasksForIncidentAction","LoadIncidentDetailsAction","translatedEventAction","EventTypeToHeader","actor","IncidentEventActor","SYSTEM","USER","user","firstname","lastname","addListEntity","of","serviceMethod","args","saveEntity","factory","ɵfac","__decorate","Action","LoadIncidentRelatedAlertsAction","UpdateSelectedIncidentTitle","UpdateSelectedIncidentSummary","UpdateSelectedIncidentPriority","UpdateSelectedIncidentState","UpdateSelectedIncidentServiceImpact","UpdateSelectedIncidentTiming","LinkServiceToIncident","UnLinkServiceFromIncident","LinkStatuspageToIncident","UnlinkStatuspageFromIncident","UpdateStatuspageLinkImpactAction","AddCommentToIncidentAction","AssignResponderRoleAction","UnassignResponderRoleAction","DeleteIncidentEventAction","AddIncidentEventAction","Selector","ServicesState","services","State","name","defaults","NewEntity"],"mappings":";;+kBA+FA,IAAYA,EAAZ,SAAYA,EAAkB,CAC5BA,OAAAA,EAAA,OAAA,SACAA,EAAA,KAAA,OAFUA,CAGZ,EAHYA,GAAkB,CAAA,CAAA,ECtE9B,IAAYC,GAAZ,SAAYA,EAAa,CACvBA,OAAAA,EAAA,UAAA,cACAA,EAAA,QAAA,YACAA,EAAA,aAAA,iBACAA,EAAA,SAAA,aACAA,EAAA,OAAA,WALUA,CAMZ,EANYA,IAAa,CAAA,CAAA,EAQZC,GAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4KfC,GAAkBC;;;QAGvBF,EAAY;;;E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