@pagerduty/backstage-plugin 0.15.5 → 0.15.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config.d.ts +1 -1
- package/dist/api/client.esm.js.map +1 -1
- package/dist/components/ChangeEvents/ChangeEventEmptyState.esm.js +12 -9
- package/dist/components/ChangeEvents/ChangeEventEmptyState.esm.js.map +1 -1
- package/dist/components/ChangeEvents/ChangeEventForbiddenState.esm.js +12 -9
- package/dist/components/ChangeEvents/ChangeEventForbiddenState.esm.js.map +1 -1
- package/dist/components/ChangeEvents/ChangeEventListItem.esm.js +37 -25
- package/dist/components/ChangeEvents/ChangeEventListItem.esm.js.map +1 -1
- package/dist/components/ChangeEvents/ChangeEvents.esm.js +13 -9
- package/dist/components/ChangeEvents/ChangeEvents.esm.js.map +1 -1
- package/dist/components/EntityPagerDutyCard/index.esm.js +2 -2
- package/dist/components/EntityPagerDutyCard/index.esm.js.map +1 -1
- package/dist/components/EntityPagerDutySmallCard/index.esm.js +2 -2
- package/dist/components/EntityPagerDutySmallCard/index.esm.js.map +1 -1
- package/dist/components/Errors/ForbiddenError.esm.js +6 -6
- package/dist/components/Errors/ForbiddenError.esm.js.map +1 -1
- package/dist/components/Errors/MissingTokenError.esm.js +6 -6
- package/dist/components/Errors/MissingTokenError.esm.js.map +1 -1
- package/dist/components/Errors/ServiceNotFoundError.esm.js +6 -6
- package/dist/components/Errors/ServiceNotFoundError.esm.js.map +1 -1
- package/dist/components/Escalation/EscalationPolicy.esm.js +21 -18
- package/dist/components/Escalation/EscalationPolicy.esm.js.map +1 -1
- package/dist/components/Escalation/EscalationUser.esm.js +48 -39
- package/dist/components/Escalation/EscalationUser.esm.js.map +1 -1
- package/dist/components/Escalation/EscalationUsersEmptyState.esm.js +5 -2
- package/dist/components/Escalation/EscalationUsersEmptyState.esm.js.map +1 -1
- package/dist/components/Escalation/EscalationUsersForbiddenState.esm.js +5 -2
- package/dist/components/Escalation/EscalationUsersForbiddenState.esm.js.map +1 -1
- package/dist/components/HomePagePagerDutyCard/Content.esm.js +2 -2
- package/dist/components/HomePagePagerDutyCard/Content.esm.js.map +1 -1
- package/dist/components/Icons/index.esm.js +2 -2
- package/dist/components/Icons/index.esm.js.map +1 -1
- package/dist/components/Incident/IncidentEmptyState.esm.js +15 -13
- package/dist/components/Incident/IncidentEmptyState.esm.js.map +1 -1
- package/dist/components/Incident/IncidentForbiddenState.esm.js +12 -9
- package/dist/components/Incident/IncidentForbiddenState.esm.js.map +1 -1
- package/dist/components/Incident/IncidentListItem.esm.js +53 -40
- package/dist/components/Incident/IncidentListItem.esm.js.map +1 -1
- package/dist/components/Incident/Incidents.esm.js +10 -6
- package/dist/components/Incident/Incidents.esm.js.map +1 -1
- package/dist/components/PagerDutyCard/index.esm.js +115 -81
- package/dist/components/PagerDutyCard/index.esm.js.map +1 -1
- package/dist/components/PagerDutyCardCommon/InsightsCard.esm.js +8 -2
- package/dist/components/PagerDutyCardCommon/InsightsCard.esm.js.map +1 -1
- package/dist/components/PagerDutyCardCommon/OpenServiceButton.esm.js +9 -6
- package/dist/components/PagerDutyCardCommon/OpenServiceButton.esm.js.map +1 -1
- package/dist/components/PagerDutyCardCommon/ServiceStandardsCard.esm.js +34 -16
- package/dist/components/PagerDutyCardCommon/ServiceStandardsCard.esm.js.map +1 -1
- package/dist/components/PagerDutyCardCommon/StatusCard.esm.js +10 -6
- package/dist/components/PagerDutyCardCommon/StatusCard.esm.js.map +1 -1
- package/dist/components/PagerDutyCardCommon/TriggerIncidentButton.esm.js +27 -20
- package/dist/components/PagerDutyCardCommon/TriggerIncidentButton.esm.js.map +1 -1
- package/dist/components/PagerDutyPage/MappingTable.esm.js +39 -31
- package/dist/components/PagerDutyPage/MappingTable.esm.js.map +1 -1
- package/dist/components/PagerDutyPage/ServiceMappingComponent.esm.js +3 -2
- package/dist/components/PagerDutyPage/ServiceMappingComponent.esm.js.map +1 -1
- package/dist/components/PagerDutyPage/index.esm.js +85 -50
- package/dist/components/PagerDutyPage/index.esm.js.map +1 -1
- package/dist/components/PagerDutySmallCard/index.esm.js +116 -89
- package/dist/components/PagerDutySmallCard/index.esm.js.map +1 -1
- package/dist/components/TriggerButton/index.esm.js +23 -19
- package/dist/components/TriggerButton/index.esm.js.map +1 -1
- package/dist/components/TriggerDialog/TriggerDialog.esm.js +56 -36
- package/dist/components/TriggerDialog/TriggerDialog.esm.js.map +1 -1
- package/dist/components/constants.esm.js.map +1 -1
- package/dist/components/pagerDutyEntity.esm.js +1 -1
- package/dist/components/pagerDutyEntity.esm.js.map +1 -1
- package/dist/deprecated.esm.js +1 -2
- package/dist/deprecated.esm.js.map +1 -1
- package/dist/hooks/index.esm.js.map +1 -1
- package/dist/index.d.ts +12 -12
- package/dist/plugin.esm.js +2 -2
- package/dist/plugin.esm.js.map +1 -1
- package/package.json +19 -28
- package/CHANGELOG.md +0 -1390
- package/LICENSE +0 -201
- package/README.md +0 -51
package/config.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.esm.js","sources":["../../src/api/client.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n PagerDutyApi,\n PagerDutyTriggerAlarmRequest,\n PagerDutyClientApiDependencies,\n PagerDutyClientApiConfig,\n RequestOptions,\n} from './types';\nimport { PagerDutyChangeEventsResponse, \n PagerDutyOnCallUsersResponse, \n PagerDutyUser, \n PagerDutyServiceResponse,\n PagerDutyIncidentsResponse,\n PagerDutyServiceStandardsResponse,\n PagerDutyServiceMetricsResponse,\n PagerDutyEntityMappingsResponse,\n PagerDutySetting\n} from '@pagerduty/backstage-plugin-common';\nimport { createApiRef, ConfigApi } from '@backstage/core-plugin-api';\nimport { NotFoundError } from '@backstage/errors';\nimport { Entity } from '@backstage/catalog-model';\nimport { getPagerDutyEntity } from '../components/pagerDutyEntity';\nimport { PagerDutyEntity } from '../types';\n\n/** @public */\nexport class UnauthorizedError extends Error {}\n\n/** @public */\nexport class ForbiddenError extends Error { }\n\n/** @public */\nexport const pagerDutyApiRef = createApiRef<PagerDutyApi>({\n id: 'plugin.pagerduty.api',\n});\n\n/** @public */\nexport class PagerDutyClient implements PagerDutyApi {\n static fromConfig(\n configApi: ConfigApi,\n dependencies: PagerDutyClientApiDependencies,\n ) {\n const { discoveryApi, fetchApi } = dependencies;\n\n const eventsBaseUrl: string =\n configApi.getOptionalString('pagerDuty.eventsBaseUrl') ??\n 'https://events.pagerduty.com/v2';\n\n return new PagerDutyClient({\n eventsBaseUrl,\n discoveryApi,\n fetchApi,\n });\n }\n\n constructor(private readonly config: PagerDutyClientApiConfig) {}\n\n async getServiceByPagerDutyEntity(\n pagerDutyEntity: PagerDutyEntity,\n ): Promise<PagerDutyServiceResponse> {\n const { integrationKey, serviceId, account } = pagerDutyEntity;\n\n let response: PagerDutyServiceResponse;\n let url: string;\n\n if (integrationKey) {\n url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services?integration_key=${integrationKey}`;\n\n if(account) {\n url = `${url}&account=${account}`;\n }\n const serviceResponse = await this.findByUrl<PagerDutyServiceResponse>(url);\n\n if (serviceResponse.service === undefined) throw new NotFoundError();\n\n response = serviceResponse;\n } else if (serviceId) {\n url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services/${serviceId}`;\n\n if (account) {\n url = `${url}?account=${account}`;\n }\n\n response = await this.findByUrl<PagerDutyServiceResponse>(url);\n } else {\n throw new NotFoundError();\n }\n\n return response;\n }\n\n async getSetting(id: string): Promise<PagerDutySetting> {\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/settings/${id}`;\n\n return await this.findByUrl<PagerDutySetting>(url);\n }\n\n async storeSettings(settings: PagerDutySetting[]): Promise<Response> {\n const body = JSON.stringify(settings);\n\n const options = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8',\n Accept: 'application/json, text/plain, */*',\n },\n body,\n };\n\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/settings`;\n\n return this.request(url, options);\n }\n\n async getEntityMappings(): Promise<PagerDutyEntityMappingsResponse> {\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/mapping/entity`;\n\n return await this.findByUrl<PagerDutyEntityMappingsResponse>(url);\n }\n\n async storeServiceMapping(serviceId: string, integrationKey: string, backstageEntityRef: string, account: string): Promise<Response> {\n\n const body = JSON.stringify({\n entityRef: backstageEntityRef,\n serviceId: serviceId,\n integrationKey: integrationKey,\n account: account,\n });\n\n const options = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8',\n Accept: 'application/json, text/plain, */*',\n },\n body,\n };\n\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/mapping/entity`;\n\n return this.request(url, options);\n }\n\n async getServiceByEntity(entity: Entity): Promise<PagerDutyServiceResponse> {\n return await this.getServiceByPagerDutyEntity(getPagerDutyEntity(entity));\n }\n\n async getServiceById(serviceId: string, account?: string): Promise<PagerDutyServiceResponse> {\n let url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services/${serviceId}`;\n\n if(account) {\n url = url.concat(`?account=${account}`);\n }\n\n return await this.findByUrl<PagerDutyServiceResponse>(url);\n }\n\n async getIncidentsByServiceId(\n serviceId: string,\n account?: string,\n ): Promise<PagerDutyIncidentsResponse> {\n let url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services/${serviceId}/incidents`;\n\n if(account) {\n url = url.concat(`?account=${account}`);\n }\n\n return await this.findByUrl<PagerDutyIncidentsResponse>(url);\n }\n\n async getChangeEventsByServiceId(\n serviceId: string,\n account?: string,\n ): Promise<PagerDutyChangeEventsResponse> {\n let url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services/${serviceId}/change-events`;\n\n if(account) {\n url = url.concat(`?account=${account}`);\n }\n\n return await this.findByUrl<PagerDutyChangeEventsResponse>(url);\n }\n\n async getServiceStandardsByServiceId(\n serviceId: string,\n account?: string\n ): Promise<PagerDutyServiceStandardsResponse> {\n let url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services/${serviceId}/standards`;\n\n if(account) {\n url = url.concat(`?account=${account}`);\n }\n\n return await this.findByUrl<PagerDutyServiceStandardsResponse>(url);\n }\n\n async getServiceMetricsByServiceId(\n serviceId: string,\n account?: string\n ): Promise<PagerDutyServiceMetricsResponse> {\n let url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services/${serviceId}/metrics`;\n\n if (account){\n url = url.concat(`?account=${account}`);\n }\n\n return await this.findByUrl<PagerDutyServiceMetricsResponse>(url);\n }\n\n async getOnCallByPolicyId(\n policyId: string,\n account?: string,\n ): Promise<PagerDutyUser[]> {\n const params = `escalation_policy_ids[]=${policyId}`;\n let url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/oncall-users?${params}`;\n\n if (account) {\n url = url.concat(`&account=${account}`);\n }\n\n const response: PagerDutyOnCallUsersResponse = await this.findByUrl<PagerDutyOnCallUsersResponse>(url);\n return response.users;\n }\n\n triggerAlarm(request: PagerDutyTriggerAlarmRequest): Promise<Response> {\n const { integrationKey, source, description, userName } = request;\n\n const body = JSON.stringify({\n event_action: 'trigger',\n routing_key: integrationKey,\n client: 'Backstage',\n client_url: source,\n payload: {\n summary: description,\n source: source,\n severity: 'error',\n class: 'manual trigger',\n custom_details: {\n user: userName,\n },\n },\n });\n\n const options = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8',\n Accept: 'application/json, text/plain, */*',\n },\n body,\n };\n\n const url = this.config.eventsBaseUrl ?? 'https://events.pagerduty.com/v2';\n\n return this.request(`${url}/enqueue`, options);\n }\n\n private async findByUrl<T>(url: string): Promise<T> {\n const options = {\n method: 'GET',\n headers: {\n Accept: 'application/vnd.pagerduty+json;version=2',\n 'Content-Type': 'application/json',\n },\n };\n const response = await this.request(url, options);\n return response.json();\n }\n\n private async request(\n url: string,\n options: RequestOptions,\n ): Promise<Response> {\n const response = await this.config.fetchApi.fetch(url, options);\n if (response.status === 401) {\n throw new UnauthorizedError(\"Unauthorized: You don't have access to this resource\");\n }\n\n if (response.status === 403) {\n throw new ForbiddenError(\"Forbidden: You are not allowed to perform this action\");\n }\n\n if (response.status === 404) {\n throw new NotFoundError(\"Not Found: Resource not found\");\n }\n\n if (!response.ok) {\n const payload = await response.json();\n const errors = payload.errors.map((error: string) => error).join(' ');\n const message = `Request failed with ${response.status}, ${errors}`;\n throw new Error(message);\n }\n return response;\n }\n}\n"],"names":[],"mappings":";;;;AAwCO,MAAM,0BAA0B,KAAM,CAAA;AAAC,CAAA;AAGvC,MAAM,uBAAuB,KAAM,CAAA;AAAE,CAAA;AAGrC,MAAM,kBAAkB,YAA2B,CAAA;AAAA,EACxD,EAAI,EAAA,sBAAA;AACN,CAAC,EAAA;AAGM,MAAM,eAAwC,CAAA;AAAA,EAkBnD,YAA6B,MAAkC,EAAA;AAAlC,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA,CAAA;AAAA,GAAmC;AAAA,EAjBhE,OAAO,UACL,CAAA,SAAA,EACA,YACA,EAAA;AACA,IAAM,MAAA,EAAE,YAAc,EAAA,QAAA,EAAa,GAAA,YAAA,CAAA;AAEnC,IAAA,MAAM,aACJ,GAAA,SAAA,CAAU,iBAAkB,CAAA,yBAAyB,CACrD,IAAA,iCAAA,CAAA;AAEF,IAAA,OAAO,IAAI,eAAgB,CAAA;AAAA,MACzB,aAAA;AAAA,MACA,YAAA;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Ac,+BAA+B,CAAA,CAAA;AAAA,KACzD;AAEA,IAAI,IAAA,CAAC,SAAS,EAAI,EAAA;AAChB,MAAM,MAAA,OAAA,GAAU,MAAM,QAAA,CAAS,IAAK,EAAA,CAAA;AACpC,MAAM,MAAA,MAAA,GAAS,QAAQ,MAAO,CAAA,GAAA,CAAI,CAAC,KAAkB,KAAA,KAAK,CAAE,CAAA,IAAA,CAAK,GAAG,CAAA,CAAA;AACpE,MAAA,MAAM,OAAU,GAAA,CAAA,oBAAA,EAAuB,QAAS,CAAA,MAAM,KAAK,MAAM,CAAA,CAAA,CAAA;AACjE,MAAM,MAAA,IAAI,MAAM,OAAO,CAAA,CAAA;AAAA,KACzB;AACA,IAAO,OAAA,QAAA,CAAA;AAAA,GACT;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"client.esm.js","sources":["../../src/api/client.ts"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n PagerDutyApi,\n PagerDutyTriggerAlarmRequest,\n PagerDutyClientApiDependencies,\n PagerDutyClientApiConfig,\n RequestOptions,\n} from './types';\nimport { PagerDutyChangeEventsResponse, \n PagerDutyOnCallUsersResponse, \n PagerDutyUser, \n PagerDutyServiceResponse,\n PagerDutyIncidentsResponse,\n PagerDutyServiceStandardsResponse,\n PagerDutyServiceMetricsResponse,\n PagerDutyEntityMappingsResponse,\n PagerDutySetting\n} from 'common';\nimport { createApiRef, ConfigApi } from '@backstage/core-plugin-api';\nimport { NotFoundError } from '@backstage/errors';\nimport { Entity } from '@backstage/catalog-model';\nimport { getPagerDutyEntity } from '../components/pagerDutyEntity';\nimport { PagerDutyEntity } from '../types';\n\n/** @public */\nexport class UnauthorizedError extends Error {}\n\n/** @public */\nexport class ForbiddenError extends Error { }\n\n/** @public */\nexport const pagerDutyApiRef = createApiRef<PagerDutyApi>({\n id: 'plugin.pagerduty.api',\n});\n\n/** @public */\nexport class PagerDutyClient implements PagerDutyApi {\n static fromConfig(\n configApi: ConfigApi,\n dependencies: PagerDutyClientApiDependencies,\n ) {\n const { discoveryApi, fetchApi } = dependencies;\n\n const eventsBaseUrl: string =\n configApi.getOptionalString('pagerDuty.eventsBaseUrl') ??\n 'https://events.pagerduty.com/v2';\n\n return new PagerDutyClient({\n eventsBaseUrl,\n discoveryApi,\n fetchApi,\n });\n }\n\n constructor(private readonly config: PagerDutyClientApiConfig) {}\n\n async getServiceByPagerDutyEntity(\n pagerDutyEntity: PagerDutyEntity,\n ): Promise<PagerDutyServiceResponse> {\n const { integrationKey, serviceId, account } = pagerDutyEntity;\n\n let response: PagerDutyServiceResponse;\n let url: string;\n\n if (integrationKey) {\n url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services?integration_key=${integrationKey}`;\n\n if(account) {\n url = `${url}&account=${account}`;\n }\n const serviceResponse = await this.findByUrl<PagerDutyServiceResponse>(url);\n\n if (serviceResponse.service === undefined) throw new NotFoundError();\n\n response = serviceResponse;\n } else if (serviceId) {\n url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services/${serviceId}`;\n\n if (account) {\n url = `${url}?account=${account}`;\n }\n\n response = await this.findByUrl<PagerDutyServiceResponse>(url);\n } else {\n throw new NotFoundError();\n }\n\n return response;\n }\n\n async getSetting(id: string): Promise<PagerDutySetting> {\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/settings/${id}`;\n\n return await this.findByUrl<PagerDutySetting>(url);\n }\n\n async storeSettings(settings: PagerDutySetting[]): Promise<Response> {\n const body = JSON.stringify(settings);\n\n const options = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8',\n Accept: 'application/json, text/plain, */*',\n },\n body,\n };\n\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/settings`;\n\n return this.request(url, options);\n }\n\n async getEntityMappings(): Promise<PagerDutyEntityMappingsResponse> {\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/mapping/entity`;\n\n return await this.findByUrl<PagerDutyEntityMappingsResponse>(url);\n }\n\n async storeServiceMapping(serviceId: string, integrationKey: string, backstageEntityRef: string, account: string): Promise<Response> {\n\n const body = JSON.stringify({\n entityRef: backstageEntityRef,\n serviceId: serviceId,\n integrationKey: integrationKey,\n account: account,\n });\n\n const options = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8',\n Accept: 'application/json, text/plain, */*',\n },\n body,\n };\n\n const url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/mapping/entity`;\n\n return this.request(url, options);\n }\n\n async getServiceByEntity(entity: Entity): Promise<PagerDutyServiceResponse> {\n return await this.getServiceByPagerDutyEntity(getPagerDutyEntity(entity));\n }\n\n async getServiceById(serviceId: string, account?: string): Promise<PagerDutyServiceResponse> {\n let url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services/${serviceId}`;\n\n if(account) {\n url = url.concat(`?account=${account}`);\n }\n\n return await this.findByUrl<PagerDutyServiceResponse>(url);\n }\n\n async getIncidentsByServiceId(\n serviceId: string,\n account?: string,\n ): Promise<PagerDutyIncidentsResponse> {\n let url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services/${serviceId}/incidents`;\n\n if(account) {\n url = url.concat(`?account=${account}`);\n }\n\n return await this.findByUrl<PagerDutyIncidentsResponse>(url);\n }\n\n async getChangeEventsByServiceId(\n serviceId: string,\n account?: string,\n ): Promise<PagerDutyChangeEventsResponse> {\n let url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services/${serviceId}/change-events`;\n\n if(account) {\n url = url.concat(`?account=${account}`);\n }\n\n return await this.findByUrl<PagerDutyChangeEventsResponse>(url);\n }\n\n async getServiceStandardsByServiceId(\n serviceId: string,\n account?: string\n ): Promise<PagerDutyServiceStandardsResponse> {\n let url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services/${serviceId}/standards`;\n\n if(account) {\n url = url.concat(`?account=${account}`);\n }\n\n return await this.findByUrl<PagerDutyServiceStandardsResponse>(url);\n }\n\n async getServiceMetricsByServiceId(\n serviceId: string,\n account?: string\n ): Promise<PagerDutyServiceMetricsResponse> {\n let url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/services/${serviceId}/metrics`;\n\n if (account){\n url = url.concat(`?account=${account}`);\n }\n\n return await this.findByUrl<PagerDutyServiceMetricsResponse>(url);\n }\n\n async getOnCallByPolicyId(\n policyId: string,\n account?: string,\n ): Promise<PagerDutyUser[]> {\n const params = `escalation_policy_ids[]=${policyId}`;\n let url = `${await this.config.discoveryApi.getBaseUrl(\n 'pagerduty',\n )}/oncall-users?${params}`;\n\n if (account) {\n url = url.concat(`&account=${account}`);\n }\n\n const response: PagerDutyOnCallUsersResponse = await this.findByUrl<PagerDutyOnCallUsersResponse>(url);\n return response.users;\n }\n\n triggerAlarm(request: PagerDutyTriggerAlarmRequest): Promise<Response> {\n const { integrationKey, source, description, userName } = request;\n\n const body = JSON.stringify({\n event_action: 'trigger',\n routing_key: integrationKey,\n client: 'Backstage',\n client_url: source,\n payload: {\n summary: description,\n source: source,\n severity: 'error',\n class: 'manual trigger',\n custom_details: {\n user: userName,\n },\n },\n });\n\n const options = {\n method: 'POST',\n headers: {\n 'Content-Type': 'application/json; charset=UTF-8',\n Accept: 'application/json, text/plain, */*',\n },\n body,\n };\n\n const url = this.config.eventsBaseUrl ?? 'https://events.pagerduty.com/v2';\n\n return this.request(`${url}/enqueue`, options);\n }\n\n private async findByUrl<T>(url: string): Promise<T> {\n const options = {\n method: 'GET',\n headers: {\n Accept: 'application/vnd.pagerduty+json;version=2',\n 'Content-Type': 'application/json',\n },\n };\n const response = await this.request(url, options);\n return response.json();\n }\n\n private async request(\n url: string,\n options: RequestOptions,\n ): Promise<Response> {\n const response = await this.config.fetchApi.fetch(url, options);\n if (response.status === 401) {\n throw new UnauthorizedError(\"Unauthorized: You don't have access to this resource\");\n }\n\n if (response.status === 403) {\n throw new ForbiddenError(\"Forbidden: You are not allowed to perform this action\");\n }\n\n if (response.status === 404) {\n throw new NotFoundError(\"Not Found: Resource not found\");\n }\n\n if (!response.ok) {\n const payload = await response.json();\n const errors = payload.errors.map((error: string) => error).join(' ');\n const message = `Request failed with ${response.status}, ${errors}`;\n throw new Error(message);\n }\n return response;\n }\n}\n"],"names":[],"mappings":";;;;AAwCO,MAAM,0BAA0B,KAAA,CAAM;AAAC;AAGvC,MAAM,uBAAuB,KAAA,CAAM;AAAE;AAGrC,MAAM,kBAAkB,YAAA,CAA2B;AAAA,EACxD,EAAA,EAAI;AACN,CAAC;AAGM,MAAM,eAAA,CAAwC;AAAA,EAkBnD,YAA6B,MAAA,EAAkC;AAAlC,IAAA,IAAA,CAAA,MAAA,GAAA,MAAA;AAAA,EAAmC;AAAA,EAjBhE,OAAO,UAAA,CACL,SAAA,EACA,YAAA,EACA;AACA,IAAA,MAAM,EAAE,YAAA,EAAc,QAAA,EAAS,GAAI,YAAA;AAEnC,IAAA,MAAM,aAAA,GACJ,SAAA,CAAU,iBAAA,CAAkB,yBAAyB,CAAA,IACrD,iCAAA;AAEF,IAAA,OAAO,IAAI,eAAA,CAAgB;AAAA,MACzB,aAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,EACH;AAAA,EAIA,MAAM,4BACJ,eAAA,EACmC;AACnC,IAAA,MAAM,EAAE,cAAA,EAAgB,SAAA,EAAW,OAAA,EAAQ,GAAI,eAAA;AAE/C,IAAA,IAAI,QAAA;AACJ,IAAA,IAAI,GAAA;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AAW,MAAM,IAAA,CAAK,OAAA,CAAQ,KAAK,OAAO,CAAA;AAChD,IAAA,OAAO,SAAS,IAAA,EAAK;AAAA,EACvB;AAAA,EAEA,MAAc,OAAA,CACZ,GAAA,EACA,OAAA,EACmB;AACnB,IAAA,MAAM,WAAW,MAAM,IAAA,CAAK,OAAO,QAAA,CAAS,KAAA,CAAM,KAAK,OAAO,CAAA;AAC9D,IAAA,IAAI,QAAA,CAAS,WAAW,GAAA,EAAK;AAC3B,MAAA,MAAM,IAAI,kBAAkB,sDAAsD,CAAA;AAAA,IACpF;AAEA,IAAA,IAAI,QAAA,CAAS,WAAW,GAAA,EAAK;AAC3B,MAAA,MAAM,IAAI,eAAe,uDAAuD,CAAA;AAAA,IAClF;AAEA,IAAA,IAAI,QAAA,CAAS,WAAW,GAAA,EAAK;AAC3B,MAAA,MAAM,IAAI,cAAc,+BAA+B,CAAA;AAAA,IACzD;AAEA,IAAA,IAAI,CAAC,SAAS,EAAA,EAAI;AAChB,MAAA,MAAM,OAAA,GAAU,MAAM,QAAA,CAAS,IAAA,EAAK;AACpC,MAAA,MAAM,MAAA,GAAS,QAAQ,MAAA,CAAO,GAAA,CAAI,CAAC,KAAA,KAAkB,KAAK,CAAA,CAAE,IAAA,CAAK,GAAG,CAAA;AACpE,MAAA,MAAM,OAAA,GAAU,CAAA,oBAAA,EAAuB,QAAA,CAAS,MAAM,KAAK,MAAM,CAAA,CAAA;AACjE,MAAA,MAAM,IAAI,MAAM,OAAO,CAAA;AAAA,IACzB;AACA,IAAA,OAAO,QAAA;AAAA,EACT;AACF;;;;"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Grid, Typography } from '@material-ui/core';
|
|
3
3
|
import EmptyStateImage from '../../assets/emptystate.svg';
|
|
4
4
|
|
|
5
5
|
const ChangeEventEmptyState = () => {
|
|
6
|
-
return /* @__PURE__ */
|
|
7
|
-
"
|
|
8
|
-
{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, justifyContent: "center", direction: "column", alignItems: "center", children: [
|
|
7
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Typography, { variant: "h5", children: "No change events to display yet." }) }),
|
|
8
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
|
|
9
|
+
"img",
|
|
10
|
+
{
|
|
11
|
+
src: EmptyStateImage,
|
|
12
|
+
alt: "EmptyState",
|
|
13
|
+
"data-testid": "emptyStateImg"
|
|
14
|
+
}
|
|
15
|
+
) })
|
|
16
|
+
] });
|
|
14
17
|
};
|
|
15
18
|
|
|
16
19
|
export { ChangeEventEmptyState };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangeEventEmptyState.esm.js","sources":["../../../src/components/ChangeEvents/ChangeEventEmptyState.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport
|
|
1
|
+
{"version":3,"file":"ChangeEventEmptyState.esm.js","sources":["../../../src/components/ChangeEvents/ChangeEventEmptyState.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport { Grid, Typography } from '@material-ui/core';\nimport EmptyStateImage from '../../assets/emptystate.svg';\n\nexport const ChangeEventEmptyState = () => {\n return (\n <Grid container justifyContent=\"center\" direction=\"column\" alignItems=\"center\">\n <Grid item xs={12}>\n <Typography variant=\"h5\">No change events to display yet.</Typography>\n </Grid>\n <Grid item xs={12}>\n <img\n src={EmptyStateImage}\n alt=\"EmptyState\"\n data-testid=\"emptyStateImg\"\n />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;AAoBO,MAAM,wBAAwB,MAAM;AACzC,EAAA,uBACE,IAAA,CAAC,QAAK,SAAA,EAAS,IAAA,EAAC,gBAAe,QAAA,EAAS,SAAA,EAAU,QAAA,EAAS,UAAA,EAAW,QAAA,EACpE,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,EAAA,EAAI,EAAA,EACb,8BAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,IAAA,EAAK,QAAA,EAAA,kCAAA,EAAgC,CAAA,EAC3D,CAAA;AAAA,oBACA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,IAAI,EAAA,EACb,QAAA,kBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAA,EAAK,eAAA;AAAA,QACL,GAAA,EAAI,YAAA;AAAA,QACJ,aAAA,EAAY;AAAA;AAAA,KACd,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Grid, Typography } from '@material-ui/core';
|
|
3
3
|
import ForbiddenStateImage from '../../assets/forbiddenstate.svg';
|
|
4
4
|
|
|
5
5
|
const ChangeEventForbiddenState = () => {
|
|
6
|
-
return /* @__PURE__ */
|
|
7
|
-
"
|
|
8
|
-
{
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
return /* @__PURE__ */ jsxs(Grid, { container: true, justifyContent: "center", direction: "column", alignItems: "center", children: [
|
|
7
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(Typography, { variant: "h5", children: "Feature not available with your account or token." }) }),
|
|
8
|
+
/* @__PURE__ */ jsx(Grid, { item: true, xs: 12, children: /* @__PURE__ */ jsx(
|
|
9
|
+
"img",
|
|
10
|
+
{
|
|
11
|
+
src: ForbiddenStateImage,
|
|
12
|
+
alt: "ForbiddenState",
|
|
13
|
+
"data-testid": "forbiddenStateImg"
|
|
14
|
+
}
|
|
15
|
+
) })
|
|
16
|
+
] });
|
|
14
17
|
};
|
|
15
18
|
|
|
16
19
|
export { ChangeEventForbiddenState };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangeEventForbiddenState.esm.js","sources":["../../../src/components/ChangeEvents/ChangeEventForbiddenState.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport
|
|
1
|
+
{"version":3,"file":"ChangeEventForbiddenState.esm.js","sources":["../../../src/components/ChangeEvents/ChangeEventForbiddenState.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport { Grid, Typography } from '@material-ui/core';\nimport ForbiddenStateImage from '../../assets/forbiddenstate.svg';\n\nexport const ChangeEventForbiddenState = () => {\n return (\n <Grid container justifyContent=\"center\" direction=\"column\" alignItems=\"center\">\n <Grid item xs={12}>\n <Typography variant=\"h5\">Feature not available with your account or token.</Typography>\n </Grid>\n <Grid item xs={12}>\n <img\n src={ForbiddenStateImage}\n alt=\"ForbiddenState\"\n data-testid=\"forbiddenStateImg\"\n />\n </Grid>\n </Grid>\n );\n};\n"],"names":[],"mappings":";;;;AAoBO,MAAM,4BAA4B,MAAM;AAC7C,EAAA,uBACE,IAAA,CAAC,QAAK,SAAA,EAAS,IAAA,EAAC,gBAAe,QAAA,EAAS,SAAA,EAAU,QAAA,EAAS,UAAA,EAAW,QAAA,EACpE,QAAA,EAAA;AAAA,oBAAA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,EAAA,EAAI,EAAA,EACb,8BAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,IAAA,EAAK,QAAA,EAAA,mDAAA,EAAiD,CAAA,EAC5E,CAAA;AAAA,oBACA,GAAA,CAAC,IAAA,EAAA,EAAK,IAAA,EAAI,IAAA,EAAC,IAAI,EAAA,EACb,QAAA,kBAAA,GAAA;AAAA,MAAC,KAAA;AAAA,MAAA;AAAA,QACC,GAAA,EAAK,mBAAA;AAAA,QACL,GAAA,EAAI,gBAAA;AAAA,QACJ,aAAA,EAAY;AAAA;AAAA,KACd,EACF;AAAA,GAAA,EACF,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
2
|
import { Link } from '@backstage/core-components';
|
|
3
3
|
import { makeStyles, Tooltip, IconButton, ListItem, ListItemText, Typography, ListItemSecondaryAction } from '@material-ui/core';
|
|
4
4
|
import { DateTime, Duration } from 'luxon';
|
|
@@ -35,35 +35,47 @@ const ChangeEventListItem = ({ changeEvent }) => {
|
|
|
35
35
|
let externalLinkElem;
|
|
36
36
|
if (changeEvent.links.length > 0) {
|
|
37
37
|
const text = changeEvent.links[0].text;
|
|
38
|
-
externalLinkElem = /* @__PURE__ */
|
|
38
|
+
externalLinkElem = /* @__PURE__ */ jsx(Tooltip, { title: text, placement: "top", children: /* @__PURE__ */ jsx(
|
|
39
39
|
IconButton,
|
|
40
40
|
{
|
|
41
41
|
component: Link,
|
|
42
42
|
to: changeEvent.links[0].href,
|
|
43
|
-
className: changeEvent.html_url === void 0 ? classes.smallExternalLinkWithoutMarginIconStyle : classes.smallExternalLinkIconStyle
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
));
|
|
43
|
+
className: changeEvent.html_url === void 0 ? classes.smallExternalLinkWithoutMarginIconStyle : classes.smallExternalLinkIconStyle,
|
|
44
|
+
children: /* @__PURE__ */ jsx(LinkIcon, {})
|
|
45
|
+
}
|
|
46
|
+
) });
|
|
47
47
|
}
|
|
48
|
-
return /* @__PURE__ */
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
48
|
+
return /* @__PURE__ */ jsxs(ListItem, { dense: true, children: [
|
|
49
|
+
/* @__PURE__ */ jsx(
|
|
50
|
+
ListItemText,
|
|
51
|
+
{
|
|
52
|
+
primary: /* @__PURE__ */ jsx(Fragment, { children: changeEvent.summary }),
|
|
53
|
+
primaryTypographyProps: {
|
|
54
|
+
variant: "body1",
|
|
55
|
+
className: classes.listItemPrimary
|
|
56
|
+
},
|
|
57
|
+
secondary: /* @__PURE__ */ jsxs(Typography, { variant: "body2", color: "textSecondary", children: [
|
|
58
|
+
"Triggered from ",
|
|
59
|
+
changeEvent.source,
|
|
60
|
+
" ",
|
|
61
|
+
changedAt,
|
|
62
|
+
"."
|
|
63
|
+
] })
|
|
64
|
+
}
|
|
65
|
+
),
|
|
66
|
+
/* @__PURE__ */ jsxs(ListItemSecondaryAction, { children: [
|
|
67
|
+
externalLinkElem,
|
|
68
|
+
changeEvent.html_url === void 0 ? null : /* @__PURE__ */ jsx(Tooltip, { title: "View in PagerDuty", placement: "top", children: /* @__PURE__ */ jsx(
|
|
69
|
+
IconButton,
|
|
70
|
+
{
|
|
71
|
+
component: Link,
|
|
72
|
+
to: changeEvent.html_url,
|
|
73
|
+
className: classes.smallIconStyle,
|
|
74
|
+
children: /* @__PURE__ */ jsx(OpenInBrowserIcon, {})
|
|
75
|
+
}
|
|
76
|
+
) })
|
|
77
|
+
] })
|
|
78
|
+
] }, changeEvent.id);
|
|
67
79
|
};
|
|
68
80
|
|
|
69
81
|
export { ChangeEventListItem };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangeEventListItem.esm.js","sources":["../../../src/components/ChangeEvents/ChangeEventListItem.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport
|
|
1
|
+
{"version":3,"file":"ChangeEventListItem.esm.js","sources":["../../../src/components/ChangeEvents/ChangeEventListItem.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport { Link } from '@backstage/core-components';\nimport {\n ListItem,\n ListItemSecondaryAction,\n Tooltip,\n ListItemText,\n makeStyles,\n IconButton,\n Typography,\n} from '@material-ui/core';\nimport { DateTime, Duration } from 'luxon';\nimport { PagerDutyChangeEvent } from 'common';\nimport OpenInBrowserIcon from '@material-ui/icons/OpenInBrowser';\nimport LinkIcon from '@material-ui/icons/Link';\nimport { BackstageTheme } from '@backstage/theme';\n\nconst useStyles = makeStyles<BackstageTheme>((theme) => ({\n denseListIcon: {\n marginRight: 0,\n display: \"flex\",\n flexDirection: \"column\",\n alignItems: \"center\",\n justifyContent: \"center\",\n },\n listItemPrimary: {\n fontWeight: \"bold\",\n },\n smallExternalLinkIconStyle: {\n color: theme.palette.text.primary,\n },\n smallExternalLinkWithoutMarginIconStyle: {\n color: theme.palette.text.primary,\n marginRight: \"-20px\",\n },\n smallIconStyle: {\n color: theme.palette.text.primary,\n marginRight: \"-20px\",\n },\n}));\n\ntype Props = {\n changeEvent: PagerDutyChangeEvent;\n};\n\nexport const ChangeEventListItem = ({ changeEvent }: Props) => {\n const classes = useStyles();\n const duration =\n new Date().getTime() - new Date(changeEvent.timestamp).getTime();\n const changedAt = DateTime.local()\n .minus(Duration.fromMillis(duration))\n .toRelative({ locale: 'en' });\n \n let externalLinkElem: JSX.Element | undefined;\n if (changeEvent.links.length > 0) {\n const text: string = changeEvent.links[0].text;\n externalLinkElem = (\n <Tooltip title={text} placement=\"top\">\n <IconButton\n component={Link}\n to={changeEvent.links[0].href}\n className={\n changeEvent.html_url === undefined\n ? classes.smallExternalLinkWithoutMarginIconStyle\n : classes.smallExternalLinkIconStyle\n }\n >\n <LinkIcon />\n </IconButton>\n </Tooltip>\n );\n }\n\n return (\n <ListItem dense key={changeEvent.id}>\n <ListItemText\n primary={<>{changeEvent.summary}</>}\n primaryTypographyProps={{\n variant: 'body1',\n className: classes.listItemPrimary,\n }}\n secondary={\n <Typography variant=\"body2\" color=\"textSecondary\">\n Triggered from {changeEvent.source} {changedAt}.\n </Typography>\n }\n />\n <ListItemSecondaryAction>\n {externalLinkElem}\n {changeEvent.html_url === undefined ? null : (\n <Tooltip title=\"View in PagerDuty\" placement=\"top\">\n <IconButton\n component={Link}\n to={changeEvent.html_url}\n className={classes.smallIconStyle}\n >\n <OpenInBrowserIcon />\n </IconButton>\n </Tooltip>\n )}\n </ListItemSecondaryAction>\n </ListItem>\n );\n};\n"],"names":[],"mappings":";;;;;;;AAiCA,MAAM,SAAA,GAAY,UAAA,CAA2B,CAAC,KAAA,MAAW;AAAA,EACvD,aAAA,EAAe;AAAA,IACb,WAAA,EAAa,CAAA;AAAA,IACb,OAAA,EAAS,MAAA;AAAA,IACT,aAAA,EAAe,QAAA;AAAA,IACf,UAAA,EAAY,QAAA;AAAA,IACZ,cAAA,EAAgB;AAAA,GAClB;AAAA,EACA,eAAA,EAAiB;AAAA,IACf,UAAA,EAAY;AAAA,GACd;AAAA,EACA,0BAAA,EAA4B;AAAA,IAC1B,KAAA,EAAO,KAAA,CAAM,OAAA,CAAQ,IAAA,CAAK;AAAA,GAC5B;AAAA,EACA,uCAAA,EAAyC;AAAA,IACvC,KAAA,EAAO,KAAA,CAAM,OAAA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AA,EAAA,EAAS,KAAA,EAAK,IAAA,EACb,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,YAAA;AAAA,MAAA;AAAA,QACC,OAAA,kBAAS,GAAA,CAAA,QAAA,EAAA,EAAG,QAAA,EAAA,WAAA,CAAY,OAAA,EAAQ,CAAA;AAAA,QAChC,sBAAA,EAAwB;AAAA,UACtB,OAAA,EAAS,OAAA;AAAA,UACT,WAAW,OAAA,CAAQ;AAAA,SACrB;AAAA,QACA,2BACE,IAAA,CAAC,UAAA,EAAA,EAAW,OAAA,EAAQ,OAAA,EAAQ,OAAM,eAAA,EAAgB,QAAA,EAAA;AAAA,UAAA,iBAAA;AAAA,UAChC,WAAA,CAAY,MAAA;AAAA,UAAO,GAAA;AAAA,UAAE,SAAA;AAAA,UAAU;AAAA,SAAA,EACjD;AAAA;AAAA,KAEJ;AAAA,yBACC,uBAAA,EAAA,EACE,QAAA,EAAA;AAAA,MAAA,gBAAA;AAAA,MACA,WAAA,CAAY,aAAa,MAAA,GAAY,IAAA,uBACnC,OAAA,EAAA,EAAQ,KAAA,EAAM,mBAAA,EAAoB,SAAA,EAAU,KAAA,EAC3C,QAAA,kBAAA,GAAA;AAAA,QAAC,UAAA;AAAA,QAAA;AAAA,UACC,SAAA,EAAW,IAAA;AAAA,UACX,IAAI,WAAA,CAAY,QAAA;AAAA,UAChB,WAAW,OAAA,CAAQ,cAAA;AAAA,UAEnB,8BAAC,iBAAA,EAAA,EAAkB;AAAA;AAAA,OACrB,EACF;AAAA,KAAA,EAEJ;AAAA,GAAA,EAAA,EA1BmB,YAAY,EA2BjC,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
+
import { useEffect } from 'react';
|
|
2
3
|
import { List } from '@material-ui/core';
|
|
3
4
|
import { ChangeEventListItem } from './ChangeEventListItem.esm.js';
|
|
4
5
|
import { ChangeEventEmptyState } from './ChangeEventEmptyState.esm.js';
|
|
@@ -22,23 +23,26 @@ const ChangeEvents = ({ serviceId, account, refreshEvents }) => {
|
|
|
22
23
|
}, [refreshEvents, getChangeEvents]);
|
|
23
24
|
if (error) {
|
|
24
25
|
if (error.message.includes("Forbidden")) {
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ jsx(ChangeEventForbiddenState, {});
|
|
26
27
|
}
|
|
27
|
-
return /* @__PURE__ */
|
|
28
|
+
return /* @__PURE__ */ jsxs(Alert, { severity: "error", children: [
|
|
29
|
+
"Error encountered while fetching information. ",
|
|
30
|
+
error.message
|
|
31
|
+
] });
|
|
28
32
|
}
|
|
29
33
|
if (loading) {
|
|
30
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ jsx(Progress, {});
|
|
31
35
|
}
|
|
32
36
|
if (!changeEvents?.length) {
|
|
33
|
-
return /* @__PURE__ */
|
|
37
|
+
return /* @__PURE__ */ jsx(ChangeEventEmptyState, {});
|
|
34
38
|
}
|
|
35
|
-
return /* @__PURE__ */
|
|
39
|
+
return /* @__PURE__ */ jsx(List, { dense: true, children: changeEvents.map((changeEvent, index) => /* @__PURE__ */ jsx(
|
|
36
40
|
ChangeEventListItem,
|
|
37
41
|
{
|
|
38
|
-
key: changeEvent.id + index,
|
|
39
42
|
changeEvent
|
|
40
|
-
}
|
|
41
|
-
|
|
43
|
+
},
|
|
44
|
+
changeEvent.id + index
|
|
45
|
+
)) });
|
|
42
46
|
};
|
|
43
47
|
|
|
44
48
|
export { ChangeEvents };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChangeEvents.esm.js","sources":["../../../src/components/ChangeEvents/ChangeEvents.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport
|
|
1
|
+
{"version":3,"file":"ChangeEvents.esm.js","sources":["../../../src/components/ChangeEvents/ChangeEvents.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport { useEffect } from 'react';\nimport { List } from '@material-ui/core';\nimport { ChangeEventListItem } from './ChangeEventListItem';\nimport { ChangeEventEmptyState } from './ChangeEventEmptyState';\nimport { ChangeEventForbiddenState } from './ChangeEventForbiddenState';\nimport useAsyncFn from 'react-use/lib/useAsyncFn';\nimport { pagerDutyApiRef } from '../../api';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { Progress } from '@backstage/core-components';\nimport { Alert } from '@material-ui/lab';\n\ntype Props = {\n serviceId: string;\n account?: string;\n refreshEvents: boolean;\n};\n\nexport const ChangeEvents = ({ serviceId, account, refreshEvents }: Props) => {\n const api = useApi(pagerDutyApiRef);\n\n const [{ value: changeEvents, loading, error }, getChangeEvents] = useAsyncFn(\n async () => {\n const { change_events } = await api.getChangeEventsByServiceId(serviceId, account);\n return change_events;\n },\n );\n\n useEffect(() => {\n getChangeEvents();\n }, [refreshEvents, getChangeEvents]);\n\n if (error) {\n if (error.message.includes('Forbidden')) {\n return <ChangeEventForbiddenState />;\n }\n\n return (\n <Alert severity=\"error\">\n Error encountered while fetching information. {error.message}\n </Alert>\n );\n }\n\n if (loading) {\n return <Progress />;\n }\n\n if (!changeEvents?.length) {\n return <ChangeEventEmptyState />;\n }\n\n return (\n <List dense>\n {changeEvents!.map((changeEvent, index) => (\n <ChangeEventListItem\n key={changeEvent.id + index}\n changeEvent={changeEvent}\n />\n ))}\n </List>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;AAkCO,MAAM,eAAe,CAAC,EAAE,SAAA,EAAW,OAAA,EAAS,eAAc,KAAa;AAC5E,EAAA,MAAM,GAAA,GAAM,OAAO,eAAe,CAAA;AAElC,EAAA,MAAM,CAAC,EAAE,KAAA,EAAO,YAAA,EAAc,SAAS,KAAA,EAAM,EAAG,eAAe,CAAA,GAAI,UAAA;AAAA,IACjE,YAAY;AACV,MAAA,MAAM,EAAE,aAAA,EAAc,GAAI,MAAM,GAAA,CAAI,0BAAA,CAA2B,WAAW,OAAO,CAAA;AACjF,MAAA,OAAO,aAAA;AAAA,IACT;AAAA,GACF;AAEA,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,eAAA,EAAgB;AAAA,EAClB,CAAA,EAAG,CAAC,aAAA,EAAe,eAAe,CAAC,CAAA;AAEnC,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,IAAI,KAAA,CAAM,OAAA,CAAQ,QAAA,CAAS,WAAW,CAAA,EAAG;AACvC,MAAA,2BAAQ,yBAAA,EAAA,EAA0B,CAAA;AAAA,IACpC;AAEA,IAAA,uBACE,IAAA,CAAC,KAAA,EAAA,EAAM,QAAA,EAAS,OAAA,EAAQ,QAAA,EAAA;AAAA,MAAA,gDAAA;AAAA,MACyB,KAAA,CAAM;AAAA,KAAA,EACvD,CAAA;AAAA,EAEJ;AAEA,EAAA,IAAI,OAAA,EAAS;AACX,IAAA,2BAAQ,QAAA,EAAA,EAAS,CAAA;AAAA,EACnB;AAEA,EAAA,IAAI,CAAC,cAAc,MAAA,EAAQ;AACzB,IAAA,2BAAQ,qBAAA,EAAA,EAAsB,CAAA;AAAA,EAChC;AAEA,EAAA,uBACE,GAAA,CAAC,QAAK,KAAA,EAAK,IAAA,EACR,uBAAc,GAAA,CAAI,CAAC,aAAa,KAAA,qBAC/B,GAAA;AAAA,IAAC,mBAAA;AAAA,IAAA;AAAA,MAEC;AAAA,KAAA;AAAA,IADK,YAAY,EAAA,GAAK;AAAA,GAGzB,CAAA,EACH,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { PAGERDUTY_INTEGRATION_KEY, PAGERDUTY_SERVICE_ID } from '../constants.esm.js';
|
|
3
3
|
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
4
4
|
import { getPagerDutyEntity } from '../pagerDutyEntity.esm.js';
|
|
@@ -11,7 +11,7 @@ const EntityPagerDutyCard = (props) => {
|
|
|
11
11
|
const { readOnly, disableChangeEvents, disableOnCall } = props;
|
|
12
12
|
const { entity } = useEntity();
|
|
13
13
|
const pagerDutyEntity = getPagerDutyEntity(entity);
|
|
14
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
15
|
PagerDutyCard,
|
|
16
16
|
{
|
|
17
17
|
...pagerDutyEntity,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../../src/components/EntityPagerDutyCard/index.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../src/components/EntityPagerDutyCard/index.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport { Entity } from '@backstage/catalog-model';\nimport { PAGERDUTY_INTEGRATION_KEY, PAGERDUTY_SERVICE_ID } from '../constants';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getPagerDutyEntity } from '../pagerDutyEntity';\nimport { PagerDutyCard } from '../PagerDutyCard';\n\n/** @public */\nexport const isPluginApplicableToEntity = (entity: Entity) =>\n Boolean(\n entity.metadata.annotations?.[PAGERDUTY_INTEGRATION_KEY] ||\n entity.metadata.annotations?.[PAGERDUTY_SERVICE_ID],\n );\n\n/** @public */\nexport type EntityPagerDutyCardProps = {\n readOnly?: boolean;\n disableChangeEvents?: boolean;\n disableOnCall?: boolean;\n};\n\n/** @public */\nexport const EntityPagerDutyCard = (props: EntityPagerDutyCardProps) => {\n const { readOnly, disableChangeEvents, disableOnCall } = props;\n const { entity } = useEntity();\n const pagerDutyEntity = getPagerDutyEntity(entity);\n return (\n <PagerDutyCard\n {...pagerDutyEntity}\n readOnly={readOnly}\n disableChangeEvents={disableChangeEvents}\n disableOnCall={disableOnCall}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAuBO,MAAM,0BAAA,GAA6B,CAAC,MAAA,KACzC,OAAA;AAAA,EACE,MAAA,CAAO,SAAS,WAAA,GAAc,yBAAyB,KACrD,MAAA,CAAO,QAAA,CAAS,cAAc,oBAAoB;AACtD;AAUK,MAAM,mBAAA,GAAsB,CAAC,KAAA,KAAoC;AACtE,EAAA,MAAM,EAAE,QAAA,EAAU,mBAAA,EAAqB,aAAA,EAAc,GAAI,KAAA;AACzD,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,SAAA,EAAU;AAC7B,EAAA,MAAM,eAAA,GAAkB,mBAAmB,MAAM,CAAA;AACjD,EAAA,uBACE,GAAA;AAAA,IAAC,aAAA;AAAA,IAAA;AAAA,MACE,GAAG,eAAA;AAAA,MACJ,QAAA;AAAA,MACA,mBAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { PAGERDUTY_INTEGRATION_KEY, PAGERDUTY_SERVICE_ID } from '../constants.esm.js';
|
|
3
3
|
import { useEntity } from '@backstage/plugin-catalog-react';
|
|
4
4
|
import { getPagerDutyEntity } from '../pagerDutyEntity.esm.js';
|
|
@@ -11,7 +11,7 @@ const EntityPagerDutySmallCard = (props) => {
|
|
|
11
11
|
const { readOnly, disableInsights, disableOnCall } = props;
|
|
12
12
|
const { entity } = useEntity();
|
|
13
13
|
const pagerDutyEntity = getPagerDutyEntity(entity);
|
|
14
|
-
return /* @__PURE__ */
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
15
|
PagerDutySmallCard,
|
|
16
16
|
{
|
|
17
17
|
...pagerDutyEntity,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../../src/components/EntityPagerDutySmallCard/index.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../src/components/EntityPagerDutySmallCard/index.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport { Entity } from '@backstage/catalog-model';\nimport { PAGERDUTY_INTEGRATION_KEY, PAGERDUTY_SERVICE_ID } from '../constants';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { getPagerDutyEntity } from '../pagerDutyEntity';\nimport { PagerDutySmallCard } from '../PagerDutySmallCard';\n\n/** @public */\nexport const isPluginApplicableToEntity = (entity: Entity) =>\n Boolean(\n entity.metadata.annotations?.[PAGERDUTY_INTEGRATION_KEY] ||\n entity.metadata.annotations?.[PAGERDUTY_SERVICE_ID],\n );\n\n/** @public */\nexport type EntityPagerDutySmallCardProps = {\n readOnly?: boolean;\n disableInsights?: boolean;\n disableOnCall?: boolean;\n};\n\n/** @public */\nexport const EntityPagerDutySmallCard = (props: EntityPagerDutySmallCardProps) => {\n const { readOnly, disableInsights, disableOnCall } = props;\n const { entity } = useEntity();\n const pagerDutyEntity = getPagerDutyEntity(entity);\n return (\n <PagerDutySmallCard\n {...pagerDutyEntity}\n readOnly={readOnly}\n disableInsights={disableInsights}\n disableOnCall={disableOnCall}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;AAuBO,MAAM,0BAAA,GAA6B,CAAC,MAAA,KACzC,OAAA;AAAA,EACE,MAAA,CAAO,SAAS,WAAA,GAAc,yBAAyB,KACrD,MAAA,CAAO,QAAA,CAAS,cAAc,oBAAoB;AACtD;AAUK,MAAM,wBAAA,GAA2B,CAAC,KAAA,KAAyC;AAChF,EAAA,MAAM,EAAE,QAAA,EAAU,eAAA,EAAiB,aAAA,EAAc,GAAI,KAAA;AACrD,EAAA,MAAM,EAAE,MAAA,EAAO,GAAI,SAAA,EAAU;AAC7B,EAAA,MAAM,eAAA,GAAkB,mBAAmB,MAAM,CAAA;AACjD,EAAA,uBACE,GAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACE,GAAG,eAAA;AAAA,MACJ,QAAA;AAAA,MACA,eAAA;AAAA,MACA;AAAA;AAAA,GACF;AAEJ;;;;"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Button } from '@material-ui/core';
|
|
3
3
|
import { EmptyState } from '@backstage/core-components';
|
|
4
4
|
|
|
5
|
-
const ForbiddenError = () => /* @__PURE__ */
|
|
5
|
+
const ForbiddenError = () => /* @__PURE__ */ jsx(
|
|
6
6
|
EmptyState,
|
|
7
7
|
{
|
|
8
8
|
missing: "info",
|
|
9
9
|
title: "Unauthorized",
|
|
10
10
|
description: "You don't have the required permissions to perform this action. See README for more details.",
|
|
11
|
-
action: /* @__PURE__ */
|
|
11
|
+
action: /* @__PURE__ */ jsx(
|
|
12
12
|
Button,
|
|
13
13
|
{
|
|
14
14
|
color: "primary",
|
|
15
15
|
variant: "contained",
|
|
16
|
-
href: "https://pagerduty.github.io/backstage-plugin-docs/getting-started/pagerduty/"
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
href: "https://pagerduty.github.io/backstage-plugin-docs/getting-started/pagerduty/",
|
|
17
|
+
children: "Read More"
|
|
18
|
+
}
|
|
19
19
|
)
|
|
20
20
|
}
|
|
21
21
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ForbiddenError.esm.js","sources":["../../../src/components/Errors/ForbiddenError.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport
|
|
1
|
+
{"version":3,"file":"ForbiddenError.esm.js","sources":["../../../src/components/Errors/ForbiddenError.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport { Button } from '@material-ui/core';\nimport { EmptyState } from '@backstage/core-components';\n\nexport const ForbiddenError = () => (\n <EmptyState\n missing=\"info\"\n title=\"Unauthorized\"\n description=\"You don't have the required permissions to perform this action. See README for more details.\"\n action={\n <Button\n color=\"primary\"\n variant=\"contained\"\n href=\"https://pagerduty.github.io/backstage-plugin-docs/getting-started/pagerduty/\"\n >\n Read More\n </Button>\n }\n />\n);\n"],"names":[],"mappings":";;;;AAmBO,MAAM,iBAAiB,sBAC5B,GAAA;AAAA,EAAC,UAAA;AAAA,EAAA;AAAA,IACC,OAAA,EAAQ,MAAA;AAAA,IACR,KAAA,EAAM,cAAA;AAAA,IACN,WAAA,EAAY,8FAAA;AAAA,IACZ,MAAA,kBACE,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAM,SAAA;AAAA,QACN,OAAA,EAAQ,WAAA;AAAA,QACR,IAAA,EAAK,8EAAA;AAAA,QACN,QAAA,EAAA;AAAA;AAAA;AAED;AAEJ;;;;"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Button } from '@material-ui/core';
|
|
3
3
|
import { EmptyState } from '@backstage/core-components';
|
|
4
4
|
|
|
5
|
-
const MissingTokenError = () => /* @__PURE__ */
|
|
5
|
+
const MissingTokenError = () => /* @__PURE__ */ jsx(
|
|
6
6
|
EmptyState,
|
|
7
7
|
{
|
|
8
8
|
missing: "info",
|
|
9
9
|
title: "Missing or invalid PagerDuty Token",
|
|
10
10
|
description: "The request to fetch data needs a valid token. See README for more details.",
|
|
11
|
-
action: /* @__PURE__ */
|
|
11
|
+
action: /* @__PURE__ */ jsx(
|
|
12
12
|
Button,
|
|
13
13
|
{
|
|
14
14
|
color: "primary",
|
|
15
15
|
variant: "contained",
|
|
16
|
-
href: "https://pagerduty.github.io/backstage-plugin-docs/getting-started/pagerduty/"
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
href: "https://pagerduty.github.io/backstage-plugin-docs/getting-started/pagerduty/",
|
|
17
|
+
children: "Read More"
|
|
18
|
+
}
|
|
19
19
|
)
|
|
20
20
|
}
|
|
21
21
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MissingTokenError.esm.js","sources":["../../../src/components/Errors/MissingTokenError.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport
|
|
1
|
+
{"version":3,"file":"MissingTokenError.esm.js","sources":["../../../src/components/Errors/MissingTokenError.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport { Button } from '@material-ui/core';\nimport { EmptyState } from '@backstage/core-components';\n\nexport const MissingTokenError = () => (\n <EmptyState\n missing=\"info\"\n title=\"Missing or invalid PagerDuty Token\"\n description=\"The request to fetch data needs a valid token. See README for more details.\"\n action={\n <Button\n color=\"primary\"\n variant=\"contained\"\n href=\"https://pagerduty.github.io/backstage-plugin-docs/getting-started/pagerduty/\"\n >\n Read More\n </Button>\n }\n />\n);\n"],"names":[],"mappings":";;;;AAmBO,MAAM,oBAAoB,sBAC/B,GAAA;AAAA,EAAC,UAAA;AAAA,EAAA;AAAA,IACC,OAAA,EAAQ,MAAA;AAAA,IACR,KAAA,EAAM,oCAAA;AAAA,IACN,WAAA,EAAY,6EAAA;AAAA,IACZ,MAAA,kBACE,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAM,SAAA;AAAA,QACN,OAAA,EAAQ,WAAA;AAAA,QACR,IAAA,EAAK,8EAAA;AAAA,QACN,QAAA,EAAA;AAAA;AAAA;AAED;AAEJ;;;;"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { Button } from '@material-ui/core';
|
|
3
3
|
import { EmptyState } from '@backstage/core-components';
|
|
4
4
|
|
|
5
|
-
const ServiceNotFoundError = () => /* @__PURE__ */
|
|
5
|
+
const ServiceNotFoundError = () => /* @__PURE__ */ jsx(
|
|
6
6
|
EmptyState,
|
|
7
7
|
{
|
|
8
8
|
missing: "data",
|
|
9
9
|
title: "PagerDuty Service Not Found",
|
|
10
10
|
description: "A service could not be found within PagerDuty based on the provided service id. Please verify your configuration.",
|
|
11
|
-
action: /* @__PURE__ */
|
|
11
|
+
action: /* @__PURE__ */ jsx(
|
|
12
12
|
Button,
|
|
13
13
|
{
|
|
14
14
|
color: "primary",
|
|
15
15
|
variant: "contained",
|
|
16
|
-
href: "https://pagerduty.github.io/backstage-plugin-docs/getting-started/pagerduty/"
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
href: "https://pagerduty.github.io/backstage-plugin-docs/getting-started/pagerduty/",
|
|
17
|
+
children: "Read More"
|
|
18
|
+
}
|
|
19
19
|
)
|
|
20
20
|
}
|
|
21
21
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServiceNotFoundError.esm.js","sources":["../../../src/components/Errors/ServiceNotFoundError.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport
|
|
1
|
+
{"version":3,"file":"ServiceNotFoundError.esm.js","sources":["../../../src/components/Errors/ServiceNotFoundError.tsx"],"sourcesContent":["/*\n * Copyright 2020 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n// eslint-disable-next-line @backstage/no-undeclared-imports\nimport { Button } from '@material-ui/core';\nimport { EmptyState } from '@backstage/core-components';\n\nexport const ServiceNotFoundError = () => (\n <EmptyState\n missing=\"data\"\n title=\"PagerDuty Service Not Found\"\n description=\"A service could not be found within PagerDuty based on the provided service id. Please verify your configuration.\"\n action={\n <Button\n color=\"primary\"\n variant=\"contained\"\n href=\"https://pagerduty.github.io/backstage-plugin-docs/getting-started/pagerduty/\"\n >\n Read More\n </Button>\n }\n />\n);\n"],"names":[],"mappings":";;;;AAmBO,MAAM,uBAAuB,sBAClC,GAAA;AAAA,EAAC,UAAA;AAAA,EAAA;AAAA,IACC,OAAA,EAAQ,MAAA;AAAA,IACR,KAAA,EAAM,6BAAA;AAAA,IACN,WAAA,EAAY,mHAAA;AAAA,IACZ,MAAA,kBACE,GAAA;AAAA,MAAC,MAAA;AAAA,MAAA;AAAA,QACC,KAAA,EAAM,SAAA;AAAA,QACN,OAAA,EAAQ,WAAA;AAAA,QACR,IAAA,EAAK,8EAAA;AAAA,QACN,QAAA,EAAA;AAAA;AAAA;AAED;AAEJ;;;;"}
|