@backstage-community/plugin-puppetdb 0.1.21 → 0.2.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @backstage-community/plugin-puppetdb
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 01a1e61: Backstage version bump to v1.34.1
8
+
9
+ ## 0.1.22
10
+
11
+ ### Patch Changes
12
+
13
+ - 61e6448: Backstage version bump to v1.32.2
14
+
3
15
  ## 0.1.21
4
16
 
5
17
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"PuppetDbClient.esm.js","sources":["../../src/api/PuppetDbClient.ts"],"sourcesContent":["/*\n * Copyright 2022 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 */\nimport {\n PuppetDbApi,\n PuppetDbReport,\n PuppetDbReportEvent,\n PuppetDbReportLog,\n} from './types';\nimport { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\n\nexport class PuppetDbClient implements PuppetDbApi {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n\n constructor({\n discoveryApi,\n fetchApi,\n }: {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n }) {\n this.discoveryApi = discoveryApi;\n this.fetchApi = fetchApi;\n }\n\n private async callApi<T>(\n path: string,\n query: { [key in string]: any },\n ): Promise<T | undefined> {\n const apiUrl = `${await this.discoveryApi.getBaseUrl('proxy')}/puppetdb`;\n const response = await this.fetchApi.fetch(\n `${apiUrl}${path}?${new URLSearchParams(query).toString()}`,\n {\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n );\n if (response.ok) {\n return (await response.json()) as T;\n }\n throw await ResponseError.fromResponse(response);\n }\n\n async getPuppetDbReportEvents(\n puppetDbReportHash: string,\n ): Promise<PuppetDbReportEvent[] | undefined> {\n if (!puppetDbReportHash) {\n throw new Error('PuppetDB report hash is required');\n }\n\n const events = (await this.callApi(\n `/pdb/query/v4/reports/${puppetDbReportHash}/events`,\n {},\n )) as PuppetDbReportEvent[];\n\n if (!events || events.length === 0) {\n return undefined;\n }\n\n return events;\n }\n\n async getPuppetDbReportLogs(\n puppetDbReportHash: string,\n ): Promise<PuppetDbReportLog[] | undefined> {\n if (!puppetDbReportHash) {\n throw new Error('PuppetDB report hash is required');\n }\n\n const events = (await this.callApi(\n `/pdb/query/v4/reports/${puppetDbReportHash}/logs`,\n {},\n )) as PuppetDbReportLog[];\n\n if (!events || events.length === 0) {\n return undefined;\n }\n\n return events;\n }\n\n async getPuppetDbNodeReports(\n puppetDbCertName: string,\n ): Promise<PuppetDbReport[] | undefined> {\n if (!puppetDbCertName) {\n throw new Error('PuppetDB certname is required');\n }\n\n return this.callApi(`/pdb/query/v4/reports`, {\n query: `[\"=\",\"certname\",\"${puppetDbCertName}\"]`,\n order_by: `[{\"field\": \"start_time\", \"order\": \"desc\"},{\"field\": \"end_time\", \"order\": \"desc\"}]`,\n limit: 100,\n });\n }\n}\n"],"names":[],"mappings":";;AAwBO,MAAM,cAAsC,CAAA;AAAA,EACjD,YAAA,CAAA;AAAA,EACA,QAAA,CAAA;AAAA,EAEA,WAAY,CAAA;AAAA,IACV,YAAA;AAAA,IACA,QAAA;AAAA,GAIC,EAAA;AACD,IAAA,IAAA,CAAK,YAAe,GAAA,YAAA,CAAA;AACpB,IAAA,IAAA,CAAK,QAAW,GAAA,QAAA,CAAA;AAAA,GAClB;AAAA,EAEA,MAAc,OACZ,CAAA,IAAA,EACA,KACwB,EAAA;AACxB,IA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BAAkB,CAAA,KAAA,CAAA;AAAA,MAC3C,EAAC;AAAA,KACH,CAAA;AAEA,IAAA,IAAI,CAAC,MAAA,IAAU,MAAO,CAAA,MAAA,KAAW,CAAG,EAAA;AAClC,MAAO,OAAA,KAAA,CAAA,CAAA;AAAA,KACT;AAEA,IAAO,OAAA,MAAA,CAAA;AAAA,GACT;AAAA,EAEA,MAAM,uBACJ,gBACuC,EAAA;AACvC,IAAA,IAAI,CAAC,gBAAkB,EAAA;AACrB,MAAM,MAAA,IAAI,MAAM,+BAA+B,CAAA,CAAA;AAAA,KACjD;AAEA,IAAO,OAAA,IAAA,CAAK,QAAQ,CAAyB,qBAAA,CAAA,EAAA;AAAA,MAC3C,KAAA,EAAO,oBAAoB,gBAAgB,CAAA,EAAA,CAAA;AAAA,MAC3C,QAAU,EAAA,CAAA,iFAAA,CAAA;AAAA,MACV,KAAO,EAAA,GAAA;AAAA,KACR,CAAA,CAAA;AAAA,GACH;AACF;;;;"}
1
+ {"version":3,"file":"PuppetDbClient.esm.js","sources":["../../src/api/PuppetDbClient.ts"],"sourcesContent":["/*\n * Copyright 2022 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 */\nimport {\n PuppetDbApi,\n PuppetDbReport,\n PuppetDbReportEvent,\n PuppetDbReportLog,\n} from './types';\nimport { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';\nimport { ResponseError } from '@backstage/errors';\n\nexport class PuppetDbClient implements PuppetDbApi {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n\n constructor({\n discoveryApi,\n fetchApi,\n }: {\n discoveryApi: DiscoveryApi;\n fetchApi: FetchApi;\n }) {\n this.discoveryApi = discoveryApi;\n this.fetchApi = fetchApi;\n }\n\n private async callApi<T>(\n path: string,\n query: { [key in string]: any },\n ): Promise<T | undefined> {\n const apiUrl = `${await this.discoveryApi.getBaseUrl('proxy')}/puppetdb`;\n const response = await this.fetchApi.fetch(\n `${apiUrl}${path}?${new URLSearchParams(query).toString()}`,\n {\n headers: {\n 'Content-Type': 'application/json',\n },\n },\n );\n if (response.ok) {\n return (await response.json()) as T;\n }\n throw await ResponseError.fromResponse(response);\n }\n\n async getPuppetDbReportEvents(\n puppetDbReportHash: string,\n ): Promise<PuppetDbReportEvent[] | undefined> {\n if (!puppetDbReportHash) {\n throw new Error('PuppetDB report hash is required');\n }\n\n const events = (await this.callApi(\n `/pdb/query/v4/reports/${puppetDbReportHash}/events`,\n {},\n )) as PuppetDbReportEvent[];\n\n if (!events || events.length === 0) {\n return undefined;\n }\n\n return events;\n }\n\n async getPuppetDbReportLogs(\n puppetDbReportHash: string,\n ): Promise<PuppetDbReportLog[] | undefined> {\n if (!puppetDbReportHash) {\n throw new Error('PuppetDB report hash is required');\n }\n\n const events = (await this.callApi(\n `/pdb/query/v4/reports/${puppetDbReportHash}/logs`,\n {},\n )) as PuppetDbReportLog[];\n\n if (!events || events.length === 0) {\n return undefined;\n }\n\n return events;\n }\n\n async getPuppetDbNodeReports(\n puppetDbCertName: string,\n ): Promise<PuppetDbReport[] | undefined> {\n if (!puppetDbCertName) {\n throw new Error('PuppetDB certname is required');\n }\n\n return this.callApi(`/pdb/query/v4/reports`, {\n query: `[\"=\",\"certname\",\"${puppetDbCertName}\"]`,\n order_by: `[{\"field\": \"start_time\", \"order\": \"desc\"},{\"field\": \"end_time\", \"order\": \"desc\"}]`,\n limit: 100,\n });\n }\n}\n"],"names":[],"mappings":";;AAwBO,MAAM,cAAsC,CAAA;AAAA,EACjD,YAAA;AAAA,EACA,QAAA;AAAA,EAEA,WAAY,CAAA;AAAA,IACV,YAAA;AAAA,IACA;AAAA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,GAAU,MAAM,IAAK,CAAA,OAAA;AAAA,MACzB,yBAAyB,kBAAkB,CAAA,KAAA,CAAA;AAAA,MAC3C;AAAC,KACH;AAEA,IAAA,IAAI,CAAC,MAAA,IAAU,MAAO,CAAA,MAAA,KAAW,CAAG,EAAA;AAClC,MAAO,OAAA,KAAA,CAAA;AAAA;AAGT,IAAO,OAAA,MAAA;AAAA;AACT,EAEA,MAAM,uBACJ,gBACuC,EAAA;AACvC,IAAA,IAAI,CAAC,gBAAkB,EAAA;AACrB,MAAM,MAAA,IAAI,MAAM,+BAA+B,CAAA;AAAA;AAGjD,IAAO,OAAA,IAAA,CAAK,QAAQ,CAAyB,qBAAA,CAAA,EAAA;AAAA,MAC3C,KAAA,EAAO,oBAAoB,gBAAgB,CAAA,EAAA,CAAA;AAAA,MAC3C,QAAU,EAAA,CAAA,iFAAA,CAAA;AAAA,MACV,KAAO,EAAA;AAAA,KACR,CAAA;AAAA;AAEL;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.esm.js","sources":["../../src/api/types.ts"],"sourcesContent":["/*\n * Copyright 2022 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 */\nimport { createApiRef } from '@backstage/core-plugin-api';\n\n/**\n * Report from a PuppetDB.\n */\nexport type PuppetDbReport = {\n /** The name of the node that the report was received from. */\n certname: string;\n /** The ID of the report. */\n hash: string;\n /** The environment assigned to the node that submitted the report. */\n environment: string;\n /** The status associated to report's node. */\n status: string;\n /** The job id associated with the report. */\n job_id?: string;\n /** A flag indicating whether the report was produced by a noop run. */\n noop: boolean;\n /** A flag indicating whether the report contains noop events. */\n noop_pending?: boolean;\n /** The version of Puppet that generated the report. */\n puppet_version: string;\n /** The version number of the report format that Puppet used to generate the original report data. */\n report_format: number;\n /** An identifier string that Puppet uses to match a specific catalog for a node to a specific Puppet run. */\n configuration_version: string;\n /** The time on the agent at which the Puppet run began. */\n start_time: string;\n /** The time on the agent at which the Puppet run ended. */\n end_time: string;\n /** The time of catalog submission from the Puppet Server to PuppetDB. */\n producer_timestamp: string;\n /** The time at which PuppetDB received the report. */\n receive_time: string;\n /** The certname of the Puppet Server that sent the report to PuppetDB. */\n producer: string;\n /** A string used to identify a Puppet run. */\n transaction_uuid: string;\n /** A string used to tie a catalog to a report to the catalog used from that Puppet run. */\n catalog_uuid: string;\n /** A string used to tie a catalog to the Puppet code which generated the catalog. */\n code_id: string;\n /** A string used to identify whether the Puppet run used a cached catalogs. */\n cached_catalog_status: string;\n /** Either \"agent\", \"plan\", or \"any\" to restrict the results to reports submitted from that source. */\n type: string;\n /** A flag indicating whether any of the report's events remediated configuration drift. */\n corrective_change: boolean;\n /** Report metrics. */\n metrics?: {\n /** Metrics data. */\n data: PuppetDbReportMetric[];\n /** Link to the metrics endpoint. */\n href: string;\n };\n};\n\n/**\n * Resource event generated from Puppet report.\n */\nexport type PuppetDbReportEvent = {\n /** The name of the node on which the event occurred. */\n certname: string;\n /** The ID of the report that the event occurred in. */\n report: string;\n /** The status of the event. Legal values are success, failure, noop, and skipped. */\n status: string;\n /** The timestamp (from the Puppet agent) at which the event occurred. Timestamps are always ISO-8601 compatible date/time strings. */\n timestamp: string;\n /** The timestamp (from the Puppet agent) at which the Puppet run began. Timestamps are always ISO-8601 compatible date/time strings. */\n run_start_time: string;\n /** The timestamp (from the Puppet agent) at which the Puppet run finished. Timestamps are always ISO-8601 compatible date/time strings. */\n run_end_time: string;\n /** The timestamp (from the PuppetDB server) at which the Puppet report was received. Timestamps are always ISO-8601 compatible date/time strings. */\n report_receive_time: string;\n /** The type of resource that the event occurred on, such as File, Package, etc. */\n resource_type: string;\n /** The title of the resource on which the event occurred. */\n resource_title: string;\n /** The property/parameter of the resource on which the event occurred. For example, on a Package resource, this field might have a value of ensure. */\n property?: string;\n /** The name of the resource on which the event occurred. */\n name?: string;\n /** The new value that Puppet was attempting to set for the specified resource property. Any rich data values will appear as readable strings. */\n new_value?: string;\n /** The previous value of the resource property, which Puppet was attempting to change. Any rich data values will appear as readable strings. */\n old_value?: string;\n /** A description (supplied by the resource provider) of what happened during the event. */\n message?: string;\n /** The manifest file in which the resource definition is located. */\n file?: string;\n /** The line (of the containing manifest file) at which the resource definition can be found. */\n line?: number;\n /** The Puppet class where this resource is declared. */\n containing_class?: string;\n /** Whether the event occurred in the most recent Puppet run (per-node). */\n latest_report?: boolean;\n /** The environment associated with the reporting node. */\n environment: string;\n /** An identifier string that Puppet uses to match a specific catalog for a node to a specific Puppet run. */\n configuration_version: string;\n /** The containment path associated with the event, as an ordered array that ends with the most specific containing element. */\n containment_path: string[];\n /** Whether the event represents a \"corrective change\", meaning the event rectified configuration drift. */\n corrective_change: boolean;\n};\n\n/**\n * Resource log generated from Puppet report.\n */\nexport type PuppetDbReportLog = {\n /** The manifest file in which the resource definition is located. */\n file?: string;\n /** The line (of the containing manifest file) at which the resource definition can be found. */\n line?: number;\n /** The timestamp (from the Puppet agent) at which the event occurred. Timestamps are always ISO-8601 compatible date/time strings. */\n time: string;\n /** A description (supplied by the resource provider) of what happened during the event. */\n message?: string;\n /** The log level. */\n level: string;\n /** Log source */\n source: string;\n /** Resource tags */\n tags: string[];\n};\n\n/**\n * A metric from a PuppetDB report.\n */\nexport type PuppetDbReportMetric = {\n /**\n * The name of the metric.\n */\n name: string;\n /**\n * The value of the metric.\n */\n value: string;\n /**\n * The category of the metric.\n */\n category: string;\n};\n\nexport const puppetDbApiRef = createApiRef<PuppetDbApi>({\n id: 'plugin.puppetdb.service',\n});\n\n/**\n * The API provided by the PuppetDB plugin.\n */\nexport type PuppetDbApi = {\n /**\n * Get a list of PuppetDB reports for the specified node.\n *\n * @param puppetDbCertName - The name of the node that the report was received from.\n * @returns A list of PuppetDB reports for the specified node.\n */\n getPuppetDbNodeReports(\n puppetDbCertName: string,\n ): Promise<PuppetDbReport[] | undefined>;\n\n /**\n * Get a specific PuppetDB report events.\n *\n * @param puppetDbReportHash - The ID of the report.\n * @returns Events from a specific PuppetDB report.\n */\n getPuppetDbReportEvents(\n puppetDbReportHash: string,\n ): Promise<PuppetDbReportEvent[] | undefined>;\n\n /**\n * Get a specific PuppetDB report logs.\n *\n * @param puppetDbReportHash - The ID of the report.\n * @returns Logs from a specific PuppetDB report.\n */\n getPuppetDbReportLogs(\n puppetDbReportHash: string,\n ): Promise<PuppetDbReportLog[] | undefined>;\n};\n"],"names":[],"mappings":";;AAgKO,MAAM,iBAAiB,YAA0B,CAAA;AAAA,EACtD,EAAI,EAAA,yBAAA;AACN,CAAC;;;;"}
1
+ {"version":3,"file":"types.esm.js","sources":["../../src/api/types.ts"],"sourcesContent":["/*\n * Copyright 2022 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 */\nimport { createApiRef } from '@backstage/core-plugin-api';\n\n/**\n * Report from a PuppetDB.\n */\nexport type PuppetDbReport = {\n /** The name of the node that the report was received from. */\n certname: string;\n /** The ID of the report. */\n hash: string;\n /** The environment assigned to the node that submitted the report. */\n environment: string;\n /** The status associated to report's node. */\n status: string;\n /** The job id associated with the report. */\n job_id?: string;\n /** A flag indicating whether the report was produced by a noop run. */\n noop: boolean;\n /** A flag indicating whether the report contains noop events. */\n noop_pending?: boolean;\n /** The version of Puppet that generated the report. */\n puppet_version: string;\n /** The version number of the report format that Puppet used to generate the original report data. */\n report_format: number;\n /** An identifier string that Puppet uses to match a specific catalog for a node to a specific Puppet run. */\n configuration_version: string;\n /** The time on the agent at which the Puppet run began. */\n start_time: string;\n /** The time on the agent at which the Puppet run ended. */\n end_time: string;\n /** The time of catalog submission from the Puppet Server to PuppetDB. */\n producer_timestamp: string;\n /** The time at which PuppetDB received the report. */\n receive_time: string;\n /** The certname of the Puppet Server that sent the report to PuppetDB. */\n producer: string;\n /** A string used to identify a Puppet run. */\n transaction_uuid: string;\n /** A string used to tie a catalog to a report to the catalog used from that Puppet run. */\n catalog_uuid: string;\n /** A string used to tie a catalog to the Puppet code which generated the catalog. */\n code_id: string;\n /** A string used to identify whether the Puppet run used a cached catalogs. */\n cached_catalog_status: string;\n /** Either \"agent\", \"plan\", or \"any\" to restrict the results to reports submitted from that source. */\n type: string;\n /** A flag indicating whether any of the report's events remediated configuration drift. */\n corrective_change: boolean;\n /** Report metrics. */\n metrics?: {\n /** Metrics data. */\n data: PuppetDbReportMetric[];\n /** Link to the metrics endpoint. */\n href: string;\n };\n};\n\n/**\n * Resource event generated from Puppet report.\n */\nexport type PuppetDbReportEvent = {\n /** The name of the node on which the event occurred. */\n certname: string;\n /** The ID of the report that the event occurred in. */\n report: string;\n /** The status of the event. Legal values are success, failure, noop, and skipped. */\n status: string;\n /** The timestamp (from the Puppet agent) at which the event occurred. Timestamps are always ISO-8601 compatible date/time strings. */\n timestamp: string;\n /** The timestamp (from the Puppet agent) at which the Puppet run began. Timestamps are always ISO-8601 compatible date/time strings. */\n run_start_time: string;\n /** The timestamp (from the Puppet agent) at which the Puppet run finished. Timestamps are always ISO-8601 compatible date/time strings. */\n run_end_time: string;\n /** The timestamp (from the PuppetDB server) at which the Puppet report was received. Timestamps are always ISO-8601 compatible date/time strings. */\n report_receive_time: string;\n /** The type of resource that the event occurred on, such as File, Package, etc. */\n resource_type: string;\n /** The title of the resource on which the event occurred. */\n resource_title: string;\n /** The property/parameter of the resource on which the event occurred. For example, on a Package resource, this field might have a value of ensure. */\n property?: string;\n /** The name of the resource on which the event occurred. */\n name?: string;\n /** The new value that Puppet was attempting to set for the specified resource property. Any rich data values will appear as readable strings. */\n new_value?: string;\n /** The previous value of the resource property, which Puppet was attempting to change. Any rich data values will appear as readable strings. */\n old_value?: string;\n /** A description (supplied by the resource provider) of what happened during the event. */\n message?: string;\n /** The manifest file in which the resource definition is located. */\n file?: string;\n /** The line (of the containing manifest file) at which the resource definition can be found. */\n line?: number;\n /** The Puppet class where this resource is declared. */\n containing_class?: string;\n /** Whether the event occurred in the most recent Puppet run (per-node). */\n latest_report?: boolean;\n /** The environment associated with the reporting node. */\n environment: string;\n /** An identifier string that Puppet uses to match a specific catalog for a node to a specific Puppet run. */\n configuration_version: string;\n /** The containment path associated with the event, as an ordered array that ends with the most specific containing element. */\n containment_path: string[];\n /** Whether the event represents a \"corrective change\", meaning the event rectified configuration drift. */\n corrective_change: boolean;\n};\n\n/**\n * Resource log generated from Puppet report.\n */\nexport type PuppetDbReportLog = {\n /** The manifest file in which the resource definition is located. */\n file?: string;\n /** The line (of the containing manifest file) at which the resource definition can be found. */\n line?: number;\n /** The timestamp (from the Puppet agent) at which the event occurred. Timestamps are always ISO-8601 compatible date/time strings. */\n time: string;\n /** A description (supplied by the resource provider) of what happened during the event. */\n message?: string;\n /** The log level. */\n level: string;\n /** Log source */\n source: string;\n /** Resource tags */\n tags: string[];\n};\n\n/**\n * A metric from a PuppetDB report.\n */\nexport type PuppetDbReportMetric = {\n /**\n * The name of the metric.\n */\n name: string;\n /**\n * The value of the metric.\n */\n value: string;\n /**\n * The category of the metric.\n */\n category: string;\n};\n\nexport const puppetDbApiRef = createApiRef<PuppetDbApi>({\n id: 'plugin.puppetdb.service',\n});\n\n/**\n * The API provided by the PuppetDB plugin.\n */\nexport type PuppetDbApi = {\n /**\n * Get a list of PuppetDB reports for the specified node.\n *\n * @param puppetDbCertName - The name of the node that the report was received from.\n * @returns A list of PuppetDB reports for the specified node.\n */\n getPuppetDbNodeReports(\n puppetDbCertName: string,\n ): Promise<PuppetDbReport[] | undefined>;\n\n /**\n * Get a specific PuppetDB report events.\n *\n * @param puppetDbReportHash - The ID of the report.\n * @returns Events from a specific PuppetDB report.\n */\n getPuppetDbReportEvents(\n puppetDbReportHash: string,\n ): Promise<PuppetDbReportEvent[] | undefined>;\n\n /**\n * Get a specific PuppetDB report logs.\n *\n * @param puppetDbReportHash - The ID of the report.\n * @returns Logs from a specific PuppetDB report.\n */\n getPuppetDbReportLogs(\n puppetDbReportHash: string,\n ): Promise<PuppetDbReportLog[] | undefined>;\n};\n"],"names":[],"mappings":";;AAgKO,MAAM,iBAAiB,YAA0B,CAAA;AAAA,EACtD,EAAI,EAAA;AACN,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReportDetailsEventsTable.esm.js","sources":["../../../src/components/ReportDetailsPage/ReportDetailsEventsTable.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 */\nimport Typography from '@material-ui/core/Typography';\nimport React from 'react';\nimport { puppetDbApiRef, PuppetDbReportEvent } from '../../api';\nimport {\n ResponseErrorPanel,\n Table,\n TableColumn,\n} from '@backstage/core-components';\nimport useAsync from 'react-use/esm/useAsync';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { StatusField } from '../StatusField';\n\ntype ReportEventsTableProps = {\n hash: string;\n};\n\nconst useStyles = makeStyles(theme => ({\n empty: {\n padding: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n },\n}));\n\n/**\n * Component for displaying PuppetDB report events.\n *\n * @public\n */\nexport const ReportDetailsEventsTable = (props: ReportEventsTableProps) => {\n const { hash } = props;\n const puppetDbApi = useApi(puppetDbApiRef);\n const classes = useStyles();\n const { value, loading, error } = useAsync(async () => {\n return puppetDbApi.getPuppetDbReportEvents(hash);\n }, [puppetDbApi, hash]);\n\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const columns: TableColumn<PuppetDbReportEvent>[] = [\n {\n title: 'Run Start Time',\n field: 'run_start_time',\n align: 'center',\n width: '300px',\n render: rowData => (\n <Typography noWrap>\n {new Date(Date.parse(rowData.run_start_time)).toLocaleString()}\n </Typography>\n ),\n },\n {\n title: 'Run End Time',\n field: 'run_end_time',\n align: 'center',\n width: '300px',\n render: rowData => (\n <Typography noWrap>\n {new Date(Date.parse(rowData.run_end_time)).toLocaleString()}\n </Typography>\n ),\n },\n {\n title: 'Containing Class',\n field: 'containing_class',\n render: rowData => (\n <Typography noWrap title={rowData.file || ''}>\n {rowData.containing_class}\n </Typography>\n ),\n },\n {\n title: 'Resource',\n field: 'resource_title',\n render: rowData => (\n <Typography noWrap>\n {rowData.resource_type}[{rowData.resource_title}]\n </Typography>\n ),\n },\n {\n title: 'Property',\n field: 'property',\n render: rowData => <Typography noWrap>{rowData.property}</Typography>,\n },\n {\n title: 'Old Value',\n field: 'old_value',\n render: rowData => <Typography noWrap>{rowData.old_value}</Typography>,\n },\n {\n title: 'New Value',\n field: 'new_value',\n render: rowData => <Typography noWrap>{rowData.new_value}</Typography>,\n },\n {\n title: 'Status',\n field: 'status',\n render: rowData => <StatusField status={rowData.status} />,\n },\n ];\n\n return (\n <Table\n options={{\n sorting: true,\n actionsColumnIndex: -1,\n loadingType: 'linear',\n padding: 'dense',\n showEmptyDataSourceMessage: !loading,\n showTitle: true,\n toolbar: true,\n pageSize: 10,\n pageSizeOptions: [10],\n }}\n emptyContent={\n <Typography color=\"textSecondary\" className={classes.empty}>\n No events\n </Typography>\n }\n title=\"Latest events\"\n columns={columns}\n data={value || []}\n isLoading={loading}\n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AAA,MACP,KAAO,EAAA,WAAA;AAAA,MACP,QAAQ,CAAW,OAAA,qBAAA,KAAA,CAAA,aAAA,CAAC,cAAW,MAAM,EAAA,IAAA,EAAA,EAAE,QAAQ,SAAU,CAAA;AAAA,KAC3D;AAAA,IACA;AAAA,MACE,KAAO,EAAA,QAAA;AAAA,MACP,KAAO,EAAA,QAAA;AAAA,MACP,QAAQ,CAAW,OAAA,qBAAA,KAAA,CAAA,aAAA,CAAC,WAAY,EAAA,EAAA,MAAA,EAAQ,QAAQ,MAAQ,EAAA,CAAA;AAAA,KAC1D;AAAA,GACF,CAAA;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,OAAS,EAAA;AAAA,QACP,OAAS,EAAA,IAAA;AAAA,QACT,kBAAoB,EAAA,CAAA,CAAA;AAAA,QACpB,WAAa,EAAA,QAAA;AAAA,QACb,OAAS,EAAA,OAAA;AAAA,QACT,4BAA4B,CAAC,OAAA;AAAA,QAC7B,SAAW,EAAA,IAAA;AAAA,QACX,OAAS,EAAA,IAAA;AAAA,QACT,QAAU,EAAA,EAAA;AAAA,QACV,eAAA,EAAiB,CAAC,EAAE,CAAA;AAAA,OACtB;AAAA,MACA,YAAA,sCACG,UAAW,EAAA,EAAA,KAAA,EAAM,iBAAgB,SAAW,EAAA,OAAA,CAAQ,SAAO,WAE5D,CAAA;AAAA,MAEF,KAAM,EAAA,eAAA;AAAA,MACN,OAAA;AAAA,MACA,IAAA,EAAM,SAAS,EAAC;AAAA,MAChB,SAAW,EAAA,OAAA;AAAA,KAAA;AAAA,GACb,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ReportDetailsEventsTable.esm.js","sources":["../../../src/components/ReportDetailsPage/ReportDetailsEventsTable.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 */\nimport Typography from '@material-ui/core/Typography';\nimport React from 'react';\nimport { puppetDbApiRef, PuppetDbReportEvent } from '../../api';\nimport {\n ResponseErrorPanel,\n Table,\n TableColumn,\n} from '@backstage/core-components';\nimport useAsync from 'react-use/esm/useAsync';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { StatusField } from '../StatusField';\n\ntype ReportEventsTableProps = {\n hash: string;\n};\n\nconst useStyles = makeStyles(theme => ({\n empty: {\n padding: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n },\n}));\n\n/**\n * Component for displaying PuppetDB report events.\n *\n * @public\n */\nexport const ReportDetailsEventsTable = (props: ReportEventsTableProps) => {\n const { hash } = props;\n const puppetDbApi = useApi(puppetDbApiRef);\n const classes = useStyles();\n const { value, loading, error } = useAsync(async () => {\n return puppetDbApi.getPuppetDbReportEvents(hash);\n }, [puppetDbApi, hash]);\n\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const columns: TableColumn<PuppetDbReportEvent>[] = [\n {\n title: 'Run Start Time',\n field: 'run_start_time',\n align: 'center',\n width: '300px',\n render: rowData => (\n <Typography noWrap>\n {new Date(Date.parse(rowData.run_start_time)).toLocaleString()}\n </Typography>\n ),\n },\n {\n title: 'Run End Time',\n field: 'run_end_time',\n align: 'center',\n width: '300px',\n render: rowData => (\n <Typography noWrap>\n {new Date(Date.parse(rowData.run_end_time)).toLocaleString()}\n </Typography>\n ),\n },\n {\n title: 'Containing Class',\n field: 'containing_class',\n render: rowData => (\n <Typography noWrap title={rowData.file || ''}>\n {rowData.containing_class}\n </Typography>\n ),\n },\n {\n title: 'Resource',\n field: 'resource_title',\n render: rowData => (\n <Typography noWrap>\n {rowData.resource_type}[{rowData.resource_title}]\n </Typography>\n ),\n },\n {\n title: 'Property',\n field: 'property',\n render: rowData => <Typography noWrap>{rowData.property}</Typography>,\n },\n {\n title: 'Old Value',\n field: 'old_value',\n render: rowData => <Typography noWrap>{rowData.old_value}</Typography>,\n },\n {\n title: 'New Value',\n field: 'new_value',\n render: rowData => <Typography noWrap>{rowData.new_value}</Typography>,\n },\n {\n title: 'Status',\n field: 'status',\n render: rowData => <StatusField status={rowData.status} />,\n },\n ];\n\n return (\n <Table\n options={{\n sorting: true,\n actionsColumnIndex: -1,\n loadingType: 'linear',\n padding: 'dense',\n showEmptyDataSourceMessage: !loading,\n showTitle: true,\n toolbar: true,\n pageSize: 10,\n pageSizeOptions: [10],\n }}\n emptyContent={\n <Typography color=\"textSecondary\" className={classes.empty}>\n No events\n </Typography>\n }\n title=\"Latest events\"\n columns={columns}\n data={value || []}\n isLoading={loading}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAgCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,KAAO,EAAA;AAAA,IACL,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACxB,OAAS,EAAA,MAAA;AAAA,IACT,cAAgB,EAAA;AAAA;AAEpB,CAAE,CAAA,CAAA;AAOW,MAAA,wBAAA,GAA2B,CAAC,KAAkC,KAAA;AACzE,EAAM,MAAA,EAAE,MAAS,GAAA,KAAA;AACjB,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAA,MAAM,UAAU,SAAU,EAAA;AAC1B,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,SAAS,YAAY;AACrD,IAAO,OAAA,WAAA,CAAY,wBAAwB,IAAI,CAAA;AAAA,GAC9C,EAAA,CAAC,WAAa,EAAA,IAAI,CAAC,CAAA;AAEtB,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,uB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CACG,UAAW,EAAA,EAAA,KAAA,EAAM,iBAAgB,SAAW,EAAA,OAAA,CAAQ,SAAO,WAE5D,CAAA;AAAA,MAEF,KAAM,EAAA,eAAA;AAAA,MACN,OAAA;AAAA,MACA,IAAA,EAAM,SAAS,EAAC;AAAA,MAChB,SAAW,EAAA;AAAA;AAAA,GACb;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReportDetailsLogsTable.esm.js","sources":["../../../src/components/ReportDetailsPage/ReportDetailsLogsTable.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 Typography from '@material-ui/core/Typography';\nimport React from 'react';\nimport { puppetDbApiRef, PuppetDbReportLog } from '../../api';\nimport {\n ResponseErrorPanel,\n Table,\n TableColumn,\n} from '@backstage/core-components';\nimport useAsync from 'react-use/esm/useAsync';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { makeStyles } from '@material-ui/core/styles';\n\ntype ReportLogsTableProps = {\n hash: string;\n};\n\nconst useStyles = makeStyles(theme => ({\n empty: {\n padding: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n },\n level_error: {\n color: theme.palette.error.light,\n },\n level_warning: {\n color: theme.palette.warning.light,\n },\n level_notice: {\n color: theme.palette.info.light,\n },\n}));\n\n/**\n * Component for displaying PuppetDB report logs.\n *\n * @public\n */\nexport const ReportDetailsLogsTable = (props: ReportLogsTableProps) => {\n const { hash } = props;\n const puppetDbApi = useApi(puppetDbApiRef);\n const classes = useStyles();\n const { value, loading, error } = useAsync(async () => {\n return puppetDbApi.getPuppetDbReportLogs(hash);\n }, [puppetDbApi, hash]);\n\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const columns: TableColumn<PuppetDbReportLog>[] = [\n {\n title: 'Level',\n field: 'level',\n align: 'center',\n width: '100px',\n render: rowData => (\n <Typography\n noWrap\n className={\n (rowData.level === 'warning' && classes.level_warning) ||\n (rowData.level === 'error' && classes.level_error) ||\n classes.level_notice\n }\n >\n {rowData.level.toLocaleUpperCase('en-US')}\n </Typography>\n ),\n },\n {\n title: 'Timestamp',\n field: 'time',\n align: 'center',\n width: '300px',\n render: rowData => (\n <Typography noWrap>\n {new Date(Date.parse(rowData.time)).toLocaleString()}\n </Typography>\n ),\n },\n {\n title: 'Source',\n field: 'source',\n render: rowData => <Typography noWrap>{rowData.source}</Typography>,\n },\n {\n title: 'Message',\n field: 'message',\n render: rowData => <Typography noWrap>{rowData.message}</Typography>,\n },\n ];\n\n return (\n <Table\n options={{\n sorting: true,\n actionsColumnIndex: -1,\n loadingType: 'linear',\n padding: 'dense',\n showEmptyDataSourceMessage: !loading,\n showTitle: true,\n toolbar: true,\n pageSize: 10,\n pageSizeOptions: [10],\n }}\n emptyContent={\n <Typography color=\"textSecondary\" className={classes.empty}>\n No logs\n </Typography>\n }\n title=\"Latest logs\"\n columns={columns}\n data={value || []}\n isLoading={loading}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAgCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,KAAO,EAAA;AAAA,IACL,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACxB,OAAS,EAAA,MAAA;AAAA,IACT,cAAgB,EAAA,QAAA;AAAA,GAClB;AAAA,EACA,WAAa,EAAA;AAAA,IACX,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,KAAM,CAAA,KAAA;AAAA,GAC7B;AAAA,EACA,aAAe,EAAA;AAAA,IACb,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,OA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AM,EAAA,aAAA;AAAA,MACN,OAAA;AAAA,MACA,IAAA,EAAM,SAAS,EAAC;AAAA,MAChB,SAAW,EAAA,OAAA;AAAA,KAAA;AAAA,GACb,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ReportDetailsLogsTable.esm.js","sources":["../../../src/components/ReportDetailsPage/ReportDetailsLogsTable.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 Typography from '@material-ui/core/Typography';\nimport React from 'react';\nimport { puppetDbApiRef, PuppetDbReportLog } from '../../api';\nimport {\n ResponseErrorPanel,\n Table,\n TableColumn,\n} from '@backstage/core-components';\nimport useAsync from 'react-use/esm/useAsync';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { makeStyles } from '@material-ui/core/styles';\n\ntype ReportLogsTableProps = {\n hash: string;\n};\n\nconst useStyles = makeStyles(theme => ({\n empty: {\n padding: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n },\n level_error: {\n color: theme.palette.error.light,\n },\n level_warning: {\n color: theme.palette.warning.light,\n },\n level_notice: {\n color: theme.palette.info.light,\n },\n}));\n\n/**\n * Component for displaying PuppetDB report logs.\n *\n * @public\n */\nexport const ReportDetailsLogsTable = (props: ReportLogsTableProps) => {\n const { hash } = props;\n const puppetDbApi = useApi(puppetDbApiRef);\n const classes = useStyles();\n const { value, loading, error } = useAsync(async () => {\n return puppetDbApi.getPuppetDbReportLogs(hash);\n }, [puppetDbApi, hash]);\n\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const columns: TableColumn<PuppetDbReportLog>[] = [\n {\n title: 'Level',\n field: 'level',\n align: 'center',\n width: '100px',\n render: rowData => (\n <Typography\n noWrap\n className={\n (rowData.level === 'warning' && classes.level_warning) ||\n (rowData.level === 'error' && classes.level_error) ||\n classes.level_notice\n }\n >\n {rowData.level.toLocaleUpperCase('en-US')}\n </Typography>\n ),\n },\n {\n title: 'Timestamp',\n field: 'time',\n align: 'center',\n width: '300px',\n render: rowData => (\n <Typography noWrap>\n {new Date(Date.parse(rowData.time)).toLocaleString()}\n </Typography>\n ),\n },\n {\n title: 'Source',\n field: 'source',\n render: rowData => <Typography noWrap>{rowData.source}</Typography>,\n },\n {\n title: 'Message',\n field: 'message',\n render: rowData => <Typography noWrap>{rowData.message}</Typography>,\n },\n ];\n\n return (\n <Table\n options={{\n sorting: true,\n actionsColumnIndex: -1,\n loadingType: 'linear',\n padding: 'dense',\n showEmptyDataSourceMessage: !loading,\n showTitle: true,\n toolbar: true,\n pageSize: 10,\n pageSizeOptions: [10],\n }}\n emptyContent={\n <Typography color=\"textSecondary\" className={classes.empty}>\n No logs\n </Typography>\n }\n title=\"Latest logs\"\n columns={columns}\n data={value || []}\n isLoading={loading}\n />\n );\n};\n"],"names":[],"mappings":";;;;;;;;;AAgCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,KAAO,EAAA;AAAA,IACL,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACxB,OAAS,EAAA,MAAA;AAAA,IACT,cAAgB,EAAA;AAAA,GAClB;AAAA,EACA,WAAa,EAAA;AAAA,IACX,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,KAAM,CAAA;AAAA,GAC7B;AAAA,EACA,aAAe,EAAA;AAAA,IACb,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,OAAQ,CAAA;AAAA,GAC/B;AAAA,EACA,YAAc,EAAA;AAAA,IACZ,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA;A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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 { Link as RouterLink, useParams } from 'react-router-dom';\nimport { Breadcrumbs, Link } from '@backstage/core-components';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { puppetDbRouteRef } from '../../routes';\nimport React, { useState } from 'react';\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport Tab from '@material-ui/core/Tab';\nimport Box from '@material-ui/core/Box';\nimport Typography from '@material-ui/core/Typography';\nimport Tabs from '@material-ui/core/Tabs';\nimport { ReportDetailsEventsTable } from './ReportDetailsEventsTable';\nimport { ReportDetailsLogsTable } from './ReportDetailsLogsTable';\n\nconst useStyles = makeStyles(theme => ({\n cards: {\n marginTop: theme.spacing(2),\n },\n tabs: {\n borderBottom: `1px solid ${theme.palette.textVerySubtle}`,\n backgroundColor: theme.palette.background.default,\n padding: theme.spacing(0, 4),\n },\n default: {\n padding: theme.spacing(2),\n fontWeight: theme.typography.fontWeightBold,\n color: theme.palette.text.secondary,\n textTransform: 'uppercase',\n },\n selected: {\n color: theme.palette.text.primary,\n },\n}));\n\n/**\n * Component for displaying the details of a PuppetDB report.\n *\n * @public\n */\nexport const ReportDetailsPage = () => {\n const { hash = '' } = useParams();\n const classes = useStyles();\n const [tabIndex, setTabIndex] = useState(0);\n const reportsRouteLink = useRouteRef(puppetDbRouteRef);\n const tabs = [\n { id: 'events', label: 'Events' },\n { id: 'logs', label: 'Logs' },\n ];\n const safeTabIndex = tabIndex > tabs.length - 1 ? 0 : tabIndex;\n\n return (\n <div>\n <Breadcrumbs aria-label=\"breadcrumb\">\n <Link component={RouterLink} to={reportsRouteLink()}>\n PuppetDB Reports\n </Link>\n <Typography noWrap>{hash}</Typography>\n </Breadcrumbs>\n <Card\n style={{ position: 'relative', overflow: 'visible' }}\n className={classes.cards}\n >\n <CardContent>\n <Tabs\n indicatorColor=\"primary\"\n onChange={(_, index) => setTabIndex(index)}\n value={safeTabIndex}\n >\n {tabs.map((tab, index) => (\n <Tab\n className={classes.default}\n label={tab.label}\n key={tab.id}\n value={index}\n classes={{ selected: classes.selected }}\n />\n ))}\n </Tabs>\n <Box ml={2} pt={2} my={1} display=\"flex\" flexDirection=\"column\">\n {safeTabIndex === 0 && <ReportDetailsEventsTable hash={hash} />}\n {safeTabIndex === 1 && <ReportDetailsLogsTable hash={hash} />}\n </Box>\n </CardContent>\n </Card>\n </div>\n );\n};\n"],"names":["RouterLink"],"mappings":";;;;;;;;;;;;;;;AA+BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,KAAO,EAAA;AAAA,IACL,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,GAC5B;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,YAAc,EAAA,CAAA,UAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,cAAc,CAAA,CAAA;AAAA,IACvD,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,UAAW,CAAA,OAAA;AAAA,IAC1C,OAAS,EAAA,KAAA,CAAM,OAAQ,CAAA,CAAA,EAAG,CAAC,CAAA;AAAA,GAC7B;AAAA,EACA,OAAS,EAAA;AAAA,IACP,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACxB,UAAA,EAAY,MAAM,UAAW,CAAA,cAAA;AAAA,IAC7B,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,SAAA;AAAA,IAC1B,aAAe,EAAA,WAAA;AAAA,GACjB;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,IAAA;AAAA,MAAA;AAAA,QACC,cAAe,EAAA,SAAA;AAAA,QACf,QAAU,EAAA,CAAC,CAAG,EAAA,KAAA,KAAU,YAAY,KAAK,CAAA;AAAA,QACzC,KAAO,EAAA,YAAA;AAAA,OAAA;AAAA,MAEN,IAAK,CAAA,GAAA,CAAI,CAAC,GAAA,EAAK,KACd,qBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,GAAA;AAAA,QAAA;AAAA,UACC,WAAW,OAAQ,CAAA,OAAA;AAAA,UACnB,OAAO,GAAI,CAAA,KAAA;AAAA,UACX,KAAK,GAAI,CAAA,EAAA;AAAA,UACT,KAAO,EAAA,KAAA;AAAA,UACP,OAAS,EAAA,EAAE,QAAU,EAAA,OAAA,CAAQ,QAAS,EAAA;AAAA,SAAA;AAAA,OAEzC,CAAA;AAAA,KACH,kBACC,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,EAAI,EAAA,CAAA,EAAG,IAAI,CAAG,EAAA,EAAA,EAAI,CAAG,EAAA,OAAA,EAAQ,MAAO,EAAA,aAAA,EAAc,YACpD,YAAiB,KAAA,CAAA,oBAAM,KAAA,CAAA,aAAA,CAAA,wBAAA,EAAA,EAAyB,IAAY,EAAA,CAAA,EAC5D,YAAiB,KAAA,CAAA,oBAAM,KAAA,CAAA,aAAA,CAAA,sBAAA,EAAA,EAAuB,IAAY,EAAA,CAC7D,CACF,CAAA;AAAA,GAEJ,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ReportDetailsPage.esm.js","sources":["../../../src/components/ReportDetailsPage/ReportDetailsPage.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\nimport { Link as RouterLink, useParams } from 'react-router-dom';\nimport { Breadcrumbs, Link } from '@backstage/core-components';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { puppetDbRouteRef } from '../../routes';\nimport React, { useState } from 'react';\nimport Card from '@material-ui/core/Card';\nimport CardContent from '@material-ui/core/CardContent';\nimport Tab from '@material-ui/core/Tab';\nimport Box from '@material-ui/core/Box';\nimport Typography from '@material-ui/core/Typography';\nimport Tabs from '@material-ui/core/Tabs';\nimport { ReportDetailsEventsTable } from './ReportDetailsEventsTable';\nimport { ReportDetailsLogsTable } from './ReportDetailsLogsTable';\n\nconst useStyles = makeStyles(theme => ({\n cards: {\n marginTop: theme.spacing(2),\n },\n tabs: {\n borderBottom: `1px solid ${theme.palette.textVerySubtle}`,\n backgroundColor: theme.palette.background.default,\n padding: theme.spacing(0, 4),\n },\n default: {\n padding: theme.spacing(2),\n fontWeight: theme.typography.fontWeightBold,\n color: theme.palette.text.secondary,\n textTransform: 'uppercase',\n },\n selected: {\n color: theme.palette.text.primary,\n },\n}));\n\n/**\n * Component for displaying the details of a PuppetDB report.\n *\n * @public\n */\nexport const ReportDetailsPage = () => {\n const { hash = '' } = useParams();\n const classes = useStyles();\n const [tabIndex, setTabIndex] = useState(0);\n const reportsRouteLink = useRouteRef(puppetDbRouteRef);\n const tabs = [\n { id: 'events', label: 'Events' },\n { id: 'logs', label: 'Logs' },\n ];\n const safeTabIndex = tabIndex > tabs.length - 1 ? 0 : tabIndex;\n\n return (\n <div>\n <Breadcrumbs aria-label=\"breadcrumb\">\n <Link component={RouterLink} to={reportsRouteLink()}>\n PuppetDB Reports\n </Link>\n <Typography noWrap>{hash}</Typography>\n </Breadcrumbs>\n <Card\n style={{ position: 'relative', overflow: 'visible' }}\n className={classes.cards}\n >\n <CardContent>\n <Tabs\n indicatorColor=\"primary\"\n onChange={(_, index) => setTabIndex(index)}\n value={safeTabIndex}\n >\n {tabs.map((tab, index) => (\n <Tab\n className={classes.default}\n label={tab.label}\n key={tab.id}\n value={index}\n classes={{ selected: classes.selected }}\n />\n ))}\n </Tabs>\n <Box ml={2} pt={2} my={1} display=\"flex\" flexDirection=\"column\">\n {safeTabIndex === 0 && <ReportDetailsEventsTable hash={hash} />}\n {safeTabIndex === 1 && <ReportDetailsLogsTable hash={hash} />}\n </Box>\n </CardContent>\n </Card>\n </div>\n );\n};\n"],"names":["RouterLink"],"mappings":";;;;;;;;;;;;;;;AA+BA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,KAAO,EAAA;AAAA,IACL,SAAA,EAAW,KAAM,CAAA,OAAA,CAAQ,CAAC;AAAA,GAC5B;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,YAAc,EAAA,CAAA,UAAA,EAAa,KAAM,CAAA,OAAA,CAAQ,cAAc,CAAA,CAAA;AAAA,IACvD,eAAA,EAAiB,KAAM,CAAA,OAAA,CAAQ,UAAW,CAAA,OAAA;AAAA,IAC1C,OAAS,EAAA,KAAA,CAAM,OAAQ,CAAA,CAAA,EAAG,CAAC;AAAA,GAC7B;AAAA,EACA,OAAS,EAAA;AAAA,IACP,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACxB,UAAA,EAAY,MAAM,UAAW,CAAA,cAAA;AAAA,IAC7B,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA,SAAA;AAAA,IAC1B,aAAe,EAAA;AAAA,GACjB;AAAA,EACA,QAAU,EAAA;AAAA,IACR,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,IAAK,CAAA;AAAA;AAE9B,CAAE,CAAA,CAAA;AAOK,MAAM,oBAAoB,MAAM;AACrC,EAAA,MAAM,EAAE,IAAA,GAAO,EAAG,EAAA,GAAI,SAAU,EAAA;AAChC,EAAA,MAAM,UAAU,SAAU,EAAA;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AA,UACnB,OAAO,GAAI,CAAA,KAAA;AAAA,UACX,KAAK,GAAI,CAAA,EAAA;AAAA,UACT,KAAO,EAAA,KAAA;AAAA,UACP,OAAS,EAAA,EAAE,QAAU,EAAA,OAAA,CAAQ,QAAS;AAAA;AAAA,OAEzC;AAAA,KACH,kBACC,KAAA,CAAA,aAAA,CAAA,GAAA,EAAA,EAAI,EAAI,EAAA,CAAA,EAAG,IAAI,CAAG,EAAA,EAAA,EAAI,CAAG,EAAA,OAAA,EAAQ,MAAO,EAAA,aAAA,EAAc,YACpD,YAAiB,KAAA,CAAA,oBAAM,KAAA,CAAA,aAAA,CAAA,wBAAA,EAAA,EAAyB,IAAY,EAAA,CAAA,EAC5D,YAAiB,KAAA,CAAA,oBAAM,KAAA,CAAA,aAAA,CAAA,sBAAA,EAAA,EAAuB,IAAY,EAAA,CAC7D,CACF;AAAA,GAEJ,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReportsPage.esm.js","sources":["../../../src/components/ReportsPage/ReportsPage.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 */\nimport React from 'react';\nimport { ReportsTable } from './ReportsTable';\nimport { Page, Content } from '@backstage/core-components';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { ANNOTATION_PUPPET_CERTNAME } from '../../constants';\n\n/**\n * Component to display PuppetDB reports page.\n *\n * @public\n */\nexport const ReportsPage = () => {\n const { entity } = useEntity();\n const certName =\n entity?.metadata?.annotations?.[ANNOTATION_PUPPET_CERTNAME] ?? '';\n\n return (\n <Page themeId=\"tool\">\n <Content>\n <ReportsTable certName={certName} />\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;AA0BO,MAAM,cAAc,MAAM;AAC/B,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAC7B,EAAA,MAAM,QACJ,GAAA,MAAA,EAAQ,QAAU,EAAA,WAAA,GAAc,0BAA0B,CAAK,IAAA,EAAA,CAAA;AAEjE,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,+BACE,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,QAAoB,EAAA,CACpC,CACF,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ReportsPage.esm.js","sources":["../../../src/components/ReportsPage/ReportsPage.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 */\nimport React from 'react';\nimport { ReportsTable } from './ReportsTable';\nimport { Page, Content } from '@backstage/core-components';\nimport { useEntity } from '@backstage/plugin-catalog-react';\nimport { ANNOTATION_PUPPET_CERTNAME } from '../../constants';\n\n/**\n * Component to display PuppetDB reports page.\n *\n * @public\n */\nexport const ReportsPage = () => {\n const { entity } = useEntity();\n const certName =\n entity?.metadata?.annotations?.[ANNOTATION_PUPPET_CERTNAME] ?? '';\n\n return (\n <Page themeId=\"tool\">\n <Content>\n <ReportsTable certName={certName} />\n </Content>\n </Page>\n );\n};\n"],"names":[],"mappings":";;;;;;AA0BO,MAAM,cAAc,MAAM;AAC/B,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAC7B,EAAA,MAAM,QACJ,GAAA,MAAA,EAAQ,QAAU,EAAA,WAAA,GAAc,0BAA0B,CAAK,IAAA,EAAA;AAEjE,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,IAAK,EAAA,EAAA,OAAA,EAAQ,MACZ,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,+BACE,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,QAAoB,EAAA,CACpC,CACF,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"ReportsTable.esm.js","sources":["../../../src/components/ReportsPage/ReportsTable.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 */\nimport { puppetDbApiRef, PuppetDbReport } from '../../api';\nimport useAsync from 'react-use/esm/useAsync';\nimport React from 'react';\nimport {\n Link,\n ResponseErrorPanel,\n Table,\n TableColumn,\n} from '@backstage/core-components';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport { Link as RouterLink } from 'react-router-dom';\nimport { puppetDbReportRouteRef } from '../../routes';\nimport { StatusField } from '../StatusField';\n\ntype ReportsTableProps = {\n certName: string;\n};\n\nconst useStyles = makeStyles(theme => ({\n empty: {\n padding: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n },\n}));\n\n/**\n * Component for displaying a table of PuppetDB reports for a given node.\n *\n * @public\n */\nexport const ReportsTable = (props: ReportsTableProps) => {\n const { certName } = props;\n const puppetDbApi = useApi(puppetDbApiRef);\n const reportsRouteLink = useRouteRef(puppetDbReportRouteRef);\n const classes = useStyles();\n\n const { value, loading, error } = useAsync(async () => {\n return puppetDbApi.getPuppetDbNodeReports(certName);\n }, [puppetDbApi, certName]);\n\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const columns: TableColumn<PuppetDbReport>[] = [\n {\n title: 'Configuration Version',\n field: 'configuration_version',\n render: rowData => (\n <Link\n component={RouterLink}\n to={reportsRouteLink({ hash: rowData.hash! })}\n >\n {rowData.configuration_version !== '' ? (\n <Typography noWrap>{rowData.configuration_version}</Typography>\n ) : (\n <Typography noWrap>\n <em>(N/A)</em>\n </Typography>\n )}\n </Link>\n ),\n },\n {\n title: 'Start Time',\n field: 'start_time',\n align: 'center',\n width: '300px',\n render: rowData => (\n <Typography noWrap>\n {new Date(Date.parse(rowData.start_time)).toLocaleString()}\n </Typography>\n ),\n },\n {\n title: 'End Time',\n field: 'end_time',\n align: 'center',\n width: '300px',\n render: rowData => (\n <Typography noWrap>\n {new Date(Date.parse(rowData.end_time)).toLocaleString()}\n </Typography>\n ),\n },\n {\n title: 'Run Duration',\n align: 'center',\n width: '400px',\n render: rowData => {\n const start_date = new Date(Date.parse(rowData.start_time));\n const end_date = new Date(Date.parse(rowData.end_time));\n const duration = new Date(end_date.getTime() - start_date.getTime());\n return (\n <Typography noWrap>\n {duration.getUTCHours().toString().padStart(2, '0')}:\n {duration.getUTCMinutes().toString().padStart(2, '0')}:\n {duration.getUTCSeconds().toString().padStart(2, '0')}.\n {duration.getUTCMilliseconds().toString().padStart(4, '0')}\n </Typography>\n );\n },\n },\n {\n title: 'Environment',\n field: 'environment',\n },\n {\n title: 'Mode',\n field: 'noop',\n align: 'center',\n render: rowData =>\n rowData.noop ? (\n <Typography>NOOP</Typography>\n ) : (\n <Typography>NO-NOOP</Typography>\n ),\n },\n {\n title: 'Status',\n field: 'status',\n align: 'center',\n render: rowData => <StatusField status={rowData.status} />,\n },\n ];\n\n return (\n <Table\n options={{\n sorting: true,\n actionsColumnIndex: -1,\n loadingType: 'linear',\n padding: 'dense',\n showEmptyDataSourceMessage: !loading,\n showTitle: true,\n toolbar: true,\n pageSize: 10,\n pageSizeOptions: [10],\n }}\n emptyContent={\n <Typography color=\"textSecondary\" className={classes.empty}>\n No reports\n </Typography>\n }\n title={`Latest PuppetDB reports from node ${certName}`}\n columns={columns}\n data={value || []}\n isLoading={loading}\n />\n );\n};\n"],"names":["RouterLink"],"mappings":";;;;;;;;;;;;AAmCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,KAAO,EAAA;AAAA,IACL,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACxB,OAAS,EAAA,MAAA;AAAA,IACT,cAAgB,EAAA,QAAA;AAAA,GAClB;AACF,CAAE,CAAA,CAAA,CAAA;AAOW,MAAA,YAAA,GAAe,CAAC,KAA6B,KAAA;AACxD,EAAM,MAAA,EAAE,UAAa,GAAA,KAAA,CAAA;AACrB,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA,CAAA;AACzC,EAAM,MAAA,gBAAA,GAAmB,YAAY,sBAAsB,CAAA,CAAA;AAC3D,EAAA,MAAM,UAAU,SAAU,EAAA,CAAA;AAE1B,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,KAAM,EAAA,GAAI,SAAS,YAAY;AACrD,IAAO,OAAA,WAAA,CAAY,uBAAuB,QAAQ,CAAA,CAAA;AAAA,GACjD,EAAA,CAAC,WAAa,EAAA,QAAQ,CAAC,CAAA,CAAA;AAE1B,EAAA,IAAI,KAAO,EAAA;AACT,IAAO,uBAAA,KAAA,CAAA,aAAA,CAAC,sBAAmB,KAAc,EAAA,CAAA,CAAA;AAAA,GAC3C;AAEA,EAAA,MAAM,OAAyC,GAAA;AAAA,IAC7C;AAAA,MACE,KAAO,EAAA,uBAAA;AAA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AAAA,MACP,KAAO,EAAA,QAAA;AAAA,MACP,QAAQ,CAAW,OAAA,qBAAA,KAAA,CAAA,aAAA,CAAC,WAAY,EAAA,EAAA,MAAA,EAAQ,QAAQ,MAAQ,EAAA,CAAA;AAAA,KAC1D;AAAA,GACF,CAAA;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,OAAS,EAAA;AAAA,QACP,OAAS,EAAA,IAAA;AAAA,QACT,kBAAoB,EAAA,CAAA,CAAA;AAAA,QACpB,WAAa,EAAA,QAAA;AAAA,QACb,OAAS,EAAA,OAAA;AAAA,QACT,4BAA4B,CAAC,OAAA;AAAA,QAC7B,SAAW,EAAA,IAAA;AAAA,QACX,OAAS,EAAA,IAAA;AAAA,QACT,QAAU,EAAA,EAAA;AAAA,QACV,eAAA,EAAiB,CAAC,EAAE,CAAA;AAAA,OACtB;AAAA,MACA,YAAA,sCACG,UAAW,EAAA,EAAA,KAAA,EAAM,iBAAgB,SAAW,EAAA,OAAA,CAAQ,SAAO,YAE5D,CAAA;AAAA,MAEF,KAAA,EAAO,qCAAqC,QAAQ,CAAA,CAAA;AAAA,MACpD,OAAA;AAAA,MACA,IAAA,EAAM,SAAS,EAAC;AAAA,MAChB,SAAW,EAAA,OAAA;AAAA,KAAA;AAAA,GACb,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"ReportsTable.esm.js","sources":["../../../src/components/ReportsPage/ReportsTable.tsx"],"sourcesContent":["/*\n * Copyright 2022 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 */\nimport { puppetDbApiRef, PuppetDbReport } from '../../api';\nimport useAsync from 'react-use/esm/useAsync';\nimport React from 'react';\nimport {\n Link,\n ResponseErrorPanel,\n Table,\n TableColumn,\n} from '@backstage/core-components';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { makeStyles } from '@material-ui/core/styles';\nimport Typography from '@material-ui/core/Typography';\nimport { Link as RouterLink } from 'react-router-dom';\nimport { puppetDbReportRouteRef } from '../../routes';\nimport { StatusField } from '../StatusField';\n\ntype ReportsTableProps = {\n certName: string;\n};\n\nconst useStyles = makeStyles(theme => ({\n empty: {\n padding: theme.spacing(2),\n display: 'flex',\n justifyContent: 'center',\n },\n}));\n\n/**\n * Component for displaying a table of PuppetDB reports for a given node.\n *\n * @public\n */\nexport const ReportsTable = (props: ReportsTableProps) => {\n const { certName } = props;\n const puppetDbApi = useApi(puppetDbApiRef);\n const reportsRouteLink = useRouteRef(puppetDbReportRouteRef);\n const classes = useStyles();\n\n const { value, loading, error } = useAsync(async () => {\n return puppetDbApi.getPuppetDbNodeReports(certName);\n }, [puppetDbApi, certName]);\n\n if (error) {\n return <ResponseErrorPanel error={error} />;\n }\n\n const columns: TableColumn<PuppetDbReport>[] = [\n {\n title: 'Configuration Version',\n field: 'configuration_version',\n render: rowData => (\n <Link\n component={RouterLink}\n to={reportsRouteLink({ hash: rowData.hash! })}\n >\n {rowData.configuration_version !== '' ? (\n <Typography noWrap>{rowData.configuration_version}</Typography>\n ) : (\n <Typography noWrap>\n <em>(N/A)</em>\n </Typography>\n )}\n </Link>\n ),\n },\n {\n title: 'Start Time',\n field: 'start_time',\n align: 'center',\n width: '300px',\n render: rowData => (\n <Typography noWrap>\n {new Date(Date.parse(rowData.start_time)).toLocaleString()}\n </Typography>\n ),\n },\n {\n title: 'End Time',\n field: 'end_time',\n align: 'center',\n width: '300px',\n render: rowData => (\n <Typography noWrap>\n {new Date(Date.parse(rowData.end_time)).toLocaleString()}\n </Typography>\n ),\n },\n {\n title: 'Run Duration',\n align: 'center',\n width: '400px',\n render: rowData => {\n const start_date = new Date(Date.parse(rowData.start_time));\n const end_date = new Date(Date.parse(rowData.end_time));\n const duration = new Date(end_date.getTime() - start_date.getTime());\n return (\n <Typography noWrap>\n {duration.getUTCHours().toString().padStart(2, '0')}:\n {duration.getUTCMinutes().toString().padStart(2, '0')}:\n {duration.getUTCSeconds().toString().padStart(2, '0')}.\n {duration.getUTCMilliseconds().toString().padStart(4, '0')}\n </Typography>\n );\n },\n },\n {\n title: 'Environment',\n field: 'environment',\n },\n {\n title: 'Mode',\n field: 'noop',\n align: 'center',\n render: rowData =>\n rowData.noop ? (\n <Typography>NOOP</Typography>\n ) : (\n <Typography>NO-NOOP</Typography>\n ),\n },\n {\n title: 'Status',\n field: 'status',\n align: 'center',\n render: rowData => <StatusField status={rowData.status} />,\n },\n ];\n\n return (\n <Table\n options={{\n sorting: true,\n actionsColumnIndex: -1,\n loadingType: 'linear',\n padding: 'dense',\n showEmptyDataSourceMessage: !loading,\n showTitle: true,\n toolbar: true,\n pageSize: 10,\n pageSizeOptions: [10],\n }}\n emptyContent={\n <Typography color=\"textSecondary\" className={classes.empty}>\n No reports\n </Typography>\n }\n title={`Latest PuppetDB reports from node ${certName}`}\n columns={columns}\n data={value || []}\n isLoading={loading}\n />\n );\n};\n"],"names":["RouterLink"],"mappings":";;;;;;;;;;;;AAmCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,KAAO,EAAA;AAAA,IACL,OAAA,EAAS,KAAM,CAAA,OAAA,CAAQ,CAAC,CAAA;AAAA,IACxB,OAAS,EAAA,MAAA;AAAA,IACT,cAAgB,EAAA;AAAA;AAEpB,CAAE,CAAA,CAAA;AAOW,MAAA,YAAA,GAAe,CAAC,KAA6B,KAAA;AACxD,EAAM,MAAA,EAAE,UAAa,GAAA,KAAA;AACrB,EAAM,MAAA,WAAA,GAAc,OAAO,cAAc,CAAA;AACzC,EAAM,MAAA,gBAAA,GAAmB,YAAY,sBAAsB,CAAA;AAC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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 React from 'react';\nimport { Routes, Route } from 'react-router-dom';\nimport { puppetDbReportRouteRef } from '../routes';\nimport { ANNOTATION_PUPPET_CERTNAME } from '../constants';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport { ReportsPage } from './ReportsPage';\nimport { ReportDetailsPage } from './ReportDetailsPage';\n\n/**\n * Checks if the entity has a puppet certname annotation.\n * @param entity - The entity to check for the puppet certname annotation.\n *\n * @public\n */\nexport const isPuppetDbAvailable = (entity: Entity) =>\n Boolean(entity.metadata.annotations?.[ANNOTATION_PUPPET_CERTNAME]);\n\n/** @public */\nexport const Router = () => {\n const { entity } = useEntity();\n\n if (!isPuppetDbAvailable(entity)) {\n return (\n <MissingAnnotationEmptyState annotation={ANNOTATION_PUPPET_CERTNAME} />\n );\n }\n\n return (\n <Routes>\n <Route path=\"/\" element={<ReportsPage />} />\n <Route\n path={`${puppetDbReportRouteRef.path}`}\n element={<ReportDetailsPage />}\n />\n </Routes>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAkCa,MAAA,mBAAA,GAAsB,CAAC,MAClC,KAAA,OAAA,CAAQ,OAAO,QAAS,CAAA,WAAA,GAAc,0BAA0B,CAAC,EAAA;AAG5D,MAAM,SAAS,MAAM;AAC1B,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA,CAAA;AAE7B,EAAI,IAAA,CAAC,mBAAoB,CAAA,MAAM,CAAG,EAAA;AAChC,IACE,uBAAA,KAAA,CAAA,aAAA,CAAC,2BAA4B,EAAA,EAAA,UAAA,EAAY,0BAA4B,EAAA,CAAA,CAAA;AAAA,GAEzE;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,MACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,IAAA,EAAK,KAAI,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAY,EAAA,IAAA,CAAA,EAAI,CAC1C,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAM,CAAG,EAAA,sBAAA,CAAuB,IAAI,CAAA,CAAA;AAAA,MACpC,OAAA,sCAAU,iBAAkB,EAAA,IAAA,CAAA;AAAA,KAAA;AAAA,GAEhC,CAAA,CAAA;AAEJ;;;;"}
1
+ {"version":3,"file":"Router.esm.js","sources":["../../src/components/Router.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\nimport React from 'react';\nimport { Routes, Route } from 'react-router-dom';\nimport { puppetDbReportRouteRef } from '../routes';\nimport { ANNOTATION_PUPPET_CERTNAME } from '../constants';\nimport { Entity } from '@backstage/catalog-model';\nimport {\n useEntity,\n MissingAnnotationEmptyState,\n} from '@backstage/plugin-catalog-react';\nimport { ReportsPage } from './ReportsPage';\nimport { ReportDetailsPage } from './ReportDetailsPage';\n\n/**\n * Checks if the entity has a puppet certname annotation.\n * @param entity - The entity to check for the puppet certname annotation.\n *\n * @public\n */\nexport const isPuppetDbAvailable = (entity: Entity) =>\n Boolean(entity.metadata.annotations?.[ANNOTATION_PUPPET_CERTNAME]);\n\n/** @public */\nexport const Router = () => {\n const { entity } = useEntity();\n\n if (!isPuppetDbAvailable(entity)) {\n return (\n <MissingAnnotationEmptyState annotation={ANNOTATION_PUPPET_CERTNAME} />\n );\n }\n\n return (\n <Routes>\n <Route path=\"/\" element={<ReportsPage />} />\n <Route\n path={`${puppetDbReportRouteRef.path}`}\n element={<ReportDetailsPage />}\n />\n </Routes>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAkCa,MAAA,mBAAA,GAAsB,CAAC,MAClC,KAAA,OAAA,CAAQ,OAAO,QAAS,CAAA,WAAA,GAAc,0BAA0B,CAAC;AAG5D,MAAM,SAAS,MAAM;AAC1B,EAAM,MAAA,EAAE,MAAO,EAAA,GAAI,SAAU,EAAA;AAE7B,EAAI,IAAA,CAAC,mBAAoB,CAAA,MAAM,CAAG,EAAA;AAChC,IACE,uBAAA,KAAA,CAAA,aAAA,CAAC,2BAA4B,EAAA,EAAA,UAAA,EAAY,0BAA4B,EAAA,CAAA;AAAA;AAIzE,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,MACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAM,EAAA,EAAA,IAAA,EAAK,KAAI,OAAS,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAY,EAAA,IAAA,CAAA,EAAI,CAC1C,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,KAAA;AAAA,IAAA;AAAA,MACC,IAAA,EAAM,CAAG,EAAA,sBAAA,CAAuB,IAAI,CAAA,CAAA;AAAA,MACpC,OAAA,sCAAU,iBAAkB,EAAA,IAAA;AAAA;AAAA,GAEhC,CAAA;AAEJ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"StatusField.esm.js","sources":["../../../src/components/StatusField/StatusField.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\nimport React from 'react';\nimport {\n StatusPending,\n StatusRunning,\n StatusOK,\n StatusError,\n} from '@backstage/core-components';\n\ntype StatusCellProps = {\n status: string;\n};\n\n/**\n * Component to display status field for Puppet reports and events.\n *\n * @public\n */\nexport const StatusField = (props: StatusCellProps) => {\n const { status } = props;\n\n const statusUC = status.toLocaleUpperCase('en-US');\n switch (status) {\n case 'failed':\n return (\n <>\n <StatusError />\n {statusUC}\n </>\n );\n case 'changed':\n return (\n <>\n <StatusRunning />\n {statusUC}\n </>\n );\n case 'unchanged':\n return (\n <>\n <StatusPending />\n {statusUC}\n </>\n );\n default:\n return (\n <>\n <StatusOK />\n {statusUC}\n </>\n );\n }\n};\n"],"names":[],"mappings":";;;AAiCa,MAAA,WAAA,GAAc,CAAC,KAA2B,KAAA;AACrD,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA,CAAA;AAEnB,EAAM,MAAA,QAAA,GAAW,MAAO,CAAA,iBAAA,CAAkB,OAAO,CAAA,CAAA;AACjD,EAAA,QAAQ,MAAQ;AAAA,IACd,KAAK,QAAA;AACH,MAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAY,EAAA,IAAA,CAAA,EACZ,QACH,CAAA,CAAA;AAAA,IAEJ,KAAK,SAAA;AACH,MAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,IAAA,CAAA,EACd,QACH,CAAA,CAAA;AAAA,IAEJ,KAAK,WAAA;AACH,MAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,IAAA,CAAA,EACd,QACH,CAAA,CAAA;AAAA,IAEJ;AACE,MAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,IAAA,CAAA,EACT,QACH,CAAA,CAAA;AAAA,GAEN;AACF;;;;"}
1
+ {"version":3,"file":"StatusField.esm.js","sources":["../../../src/components/StatusField/StatusField.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\nimport React from 'react';\nimport {\n StatusPending,\n StatusRunning,\n StatusOK,\n StatusError,\n} from '@backstage/core-components';\n\ntype StatusCellProps = {\n status: string;\n};\n\n/**\n * Component to display status field for Puppet reports and events.\n *\n * @public\n */\nexport const StatusField = (props: StatusCellProps) => {\n const { status } = props;\n\n const statusUC = status.toLocaleUpperCase('en-US');\n switch (status) {\n case 'failed':\n return (\n <>\n <StatusError />\n {statusUC}\n </>\n );\n case 'changed':\n return (\n <>\n <StatusRunning />\n {statusUC}\n </>\n );\n case 'unchanged':\n return (\n <>\n <StatusPending />\n {statusUC}\n </>\n );\n default:\n return (\n <>\n <StatusOK />\n {statusUC}\n </>\n );\n }\n};\n"],"names":[],"mappings":";;;AAiCa,MAAA,WAAA,GAAc,CAAC,KAA2B,KAAA;AACrD,EAAM,MAAA,EAAE,QAAW,GAAA,KAAA;AAEnB,EAAM,MAAA,QAAA,GAAW,MAAO,CAAA,iBAAA,CAAkB,OAAO,CAAA;AACjD,EAAA,QAAQ,MAAQ;AAAA,IACd,KAAK,QAAA;AACH,MAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,WAAY,EAAA,IAAA,CAAA,EACZ,QACH,CAAA;AAAA,IAEJ,KAAK,SAAA;AACH,MAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,IAAA,CAAA,EACd,QACH,CAAA;AAAA,IAEJ,KAAK,WAAA;AACH,MAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,aAAc,EAAA,IAAA,CAAA,EACd,QACH,CAAA;AAAA,IAEJ;AACE,MAAA,uBAEI,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,QAAS,EAAA,IAAA,CAAA,EACT,QACH,CAAA;AAAA;AAGR;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport {\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { puppetDbApiRef, PuppetDbClient } from './api';\nimport { puppetDbRouteRef } from './routes';\n\n/**\n * Create the PuppetDB frontend plugin.\n *\n * @public\n * */\nexport const puppetdbPlugin = createPlugin({\n id: 'puppetDb',\n apis: [\n createApiFactory({\n api: puppetDbApiRef,\n deps: { discoveryApi: discoveryApiRef, fetchApi: fetchApiRef },\n factory: ({ discoveryApi, fetchApi }) =>\n new PuppetDbClient({ discoveryApi, fetchApi }),\n }),\n ],\n});\n\n/**\n * Creates a routable extension for the PuppetDB plugin content.\n *\n * @public\n */\nexport const PuppetDbPage = puppetdbPlugin.provide(\n createRoutableExtension({\n name: 'PuppetDbPage',\n component: () => import('./components/Router').then(m => m.Router),\n mountPoint: puppetDbRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;;;AA+BO,MAAM,iBAAiB,YAAa,CAAA;AAAA,EACzC,EAAI,EAAA,UAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,cAAA;AAAA,MACL,IAAM,EAAA,EAAE,YAAc,EAAA,eAAA,EAAiB,UAAU,WAAY,EAAA;AAAA,MAC7D,OAAA,EAAS,CAAC,EAAE,YAAc,EAAA,QAAA,EACxB,KAAA,IAAI,cAAe,CAAA,EAAE,YAAc,EAAA,QAAA,EAAU,CAAA;AAAA,KAChD,CAAA;AAAA,GACH;AACF,CAAC,EAAA;AAOM,MAAM,eAAe,cAAe,CAAA,OAAA;AAAA,EACzC,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,cAAA;AAAA,IACN,SAAA,EAAW,MAAM,OAAO,4BAAqB,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,MAAM,CAAA;AAAA,IACjE,UAAY,EAAA,gBAAA;AAAA,GACb,CAAA;AACH;;;;"}
1
+ {"version":3,"file":"plugin.esm.js","sources":["../src/plugin.ts"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport {\n createApiFactory,\n createPlugin,\n createRoutableExtension,\n discoveryApiRef,\n fetchApiRef,\n} from '@backstage/core-plugin-api';\n\nimport { puppetDbApiRef, PuppetDbClient } from './api';\nimport { puppetDbRouteRef } from './routes';\n\n/**\n * Create the PuppetDB frontend plugin.\n *\n * @public\n * */\nexport const puppetdbPlugin = createPlugin({\n id: 'puppetDb',\n apis: [\n createApiFactory({\n api: puppetDbApiRef,\n deps: { discoveryApi: discoveryApiRef, fetchApi: fetchApiRef },\n factory: ({ discoveryApi, fetchApi }) =>\n new PuppetDbClient({ discoveryApi, fetchApi }),\n }),\n ],\n});\n\n/**\n * Creates a routable extension for the PuppetDB plugin content.\n *\n * @public\n */\nexport const PuppetDbPage = puppetdbPlugin.provide(\n createRoutableExtension({\n name: 'PuppetDbPage',\n component: () => import('./components/Router').then(m => m.Router),\n mountPoint: puppetDbRouteRef,\n }),\n);\n"],"names":[],"mappings":";;;;;AA+BO,MAAM,iBAAiB,YAAa,CAAA;AAAA,EACzC,EAAI,EAAA,UAAA;AAAA,EACJ,IAAM,EAAA;AAAA,IACJ,gBAAiB,CAAA;AAAA,MACf,GAAK,EAAA,cAAA;AAAA,MACL,IAAM,EAAA,EAAE,YAAc,EAAA,eAAA,EAAiB,UAAU,WAAY,EAAA;AAAA,MAC7D,OAAA,EAAS,CAAC,EAAE,YAAc,EAAA,QAAA,EACxB,KAAA,IAAI,cAAe,CAAA,EAAE,YAAc,EAAA,QAAA,EAAU;AAAA,KAChD;AAAA;AAEL,CAAC;AAOM,MAAM,eAAe,cAAe,CAAA,OAAA;AAAA,EACzC,uBAAwB,CAAA;AAAA,IACtB,IAAM,EAAA,cAAA;AAAA,IACN,SAAA,EAAW,MAAM,OAAO,4BAAqB,EAAE,IAAK,CAAA,CAAA,CAAA,KAAK,EAAE,MAAM,CAAA;AAAA,IACjE,UAAY,EAAA;AAAA,GACb;AACH;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport { createRouteRef, createSubRouteRef } from '@backstage/core-plugin-api';\n\n/** @public */\nexport const puppetDbRouteRef = createRouteRef({\n id: 'puppetdb',\n});\n\n/** @public */\nexport const puppetDbReportRouteRef = createSubRouteRef({\n id: 'puppetdb/report',\n path: '/:hash',\n parent: puppetDbRouteRef,\n});\n"],"names":[],"mappings":";;AAkBO,MAAM,mBAAmB,cAAe,CAAA;AAAA,EAC7C,EAAI,EAAA,UAAA;AACN,CAAC,EAAA;AAGM,MAAM,yBAAyB,iBAAkB,CAAA;AAAA,EACtD,EAAI,EAAA,iBAAA;AAAA,EACJ,IAAM,EAAA,QAAA;AAAA,EACN,MAAQ,EAAA,gBAAA;AACV,CAAC;;;;"}
1
+ {"version":3,"file":"routes.esm.js","sources":["../src/routes.ts"],"sourcesContent":["/*\n * Copyright 2023 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 */\nimport { createRouteRef, createSubRouteRef } from '@backstage/core-plugin-api';\n\n/** @public */\nexport const puppetDbRouteRef = createRouteRef({\n id: 'puppetdb',\n});\n\n/** @public */\nexport const puppetDbReportRouteRef = createSubRouteRef({\n id: 'puppetdb/report',\n path: '/:hash',\n parent: puppetDbRouteRef,\n});\n"],"names":[],"mappings":";;AAkBO,MAAM,mBAAmB,cAAe,CAAA;AAAA,EAC7C,EAAI,EAAA;AACN,CAAC;AAGM,MAAM,yBAAyB,iBAAkB,CAAA;AAAA,EACtD,EAAI,EAAA,iBAAA;AAAA,EACJ,IAAM,EAAA,QAAA;AAAA,EACN,MAAQ,EAAA;AACV,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@backstage-community/plugin-puppetdb",
3
- "version": "0.1.21",
3
+ "version": "0.2.0",
4
4
  "description": "Backstage plugin to visualize resource information and Puppet facts from PuppetDB.",
5
5
  "backstage": {
6
6
  "role": "frontend-plugin",
@@ -42,20 +42,20 @@
42
42
  "test": "backstage-cli package test"
43
43
  },
44
44
  "dependencies": {
45
- "@backstage/catalog-model": "^1.7.0",
46
- "@backstage/core-components": "^0.15.0",
47
- "@backstage/core-plugin-api": "^1.9.4",
48
- "@backstage/errors": "^1.2.4",
49
- "@backstage/plugin-catalog-react": "^1.13.1",
45
+ "@backstage/catalog-model": "^1.7.2",
46
+ "@backstage/core-components": "^0.16.2",
47
+ "@backstage/core-plugin-api": "^1.10.2",
48
+ "@backstage/errors": "^1.2.6",
49
+ "@backstage/plugin-catalog-react": "^1.15.0",
50
50
  "@material-ui/core": "^4.12.2",
51
51
  "@types/react": "^16.13.1 || ^17.0.0 || ^18.0.0",
52
52
  "react-use": "^17.2.4"
53
53
  },
54
54
  "devDependencies": {
55
- "@backstage/cli": "^0.27.1",
56
- "@backstage/core-app-api": "^1.15.0",
57
- "@backstage/dev-utils": "^1.1.1",
58
- "@backstage/test-utils": "^1.6.0",
55
+ "@backstage/cli": "^0.29.4",
56
+ "@backstage/core-app-api": "^1.15.3",
57
+ "@backstage/dev-utils": "^1.1.5",
58
+ "@backstage/test-utils": "^1.7.3",
59
59
  "@testing-library/dom": "^10.0.0",
60
60
  "@testing-library/jest-dom": "^6.0.0",
61
61
  "@testing-library/react": "^15.0.0",
@@ -71,5 +71,12 @@
71
71
  "react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0",
72
72
  "react-router-dom": "6.0.0-beta.0 || ^6.3.0"
73
73
  },
74
+ "typesVersions": {
75
+ "*": {
76
+ "index": [
77
+ "dist/index.d.ts"
78
+ ]
79
+ }
80
+ },
74
81
  "module": "./dist/index.esm.js"
75
82
  }