Merge pull request #9022 from mufaddal7/fix/newrelic-dashboard

Fix/newrelic dashboard
This commit is contained in:
Fredrik Adelöw
2022-01-19 12:12:49 +01:00
committed by GitHub
4 changed files with 17 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-newrelic-dashboard': patch
---
Newrelic Dashboards will render single page dashboards, meaning dashboards which do not have a parent GUID
@@ -73,9 +73,18 @@ export class NewRelicDashboardClient implements NewRelicDashboardApi {
const DashboardEntityList = await this.callApi<DashboardEntity>(
getDashboardParentGuidQuery,
{
query: `parentId ='${guid}'`,
query: `id ='${guid}' OR parentId ='${guid}'`,
},
);
if (
DashboardEntityList &&
DashboardEntityList?.data?.actor.entitySearch.results.entities?.length > 1
) {
DashboardEntityList.data.actor.entitySearch.results.entities =
DashboardEntityList?.data.actor.entitySearch.results.entities.filter(
entity => entity?.dashboardParentGuid !== null,
);
}
return {
getDashboardEntity: DashboardEntityList!,
};
@@ -14,4 +14,4 @@
* limitations under the License.
*/
export const getDashboardParentGuidQuery =
'query ($query: String) {\n actor {\n entitySearch(query: $query) {\n results {\n entities {\n name\n ... on DashboardEntityOutline {\n name\n guid\n }\n permalink\n }\n }\n }\n }\n}\n';
'query ($query: String) {\n actor {\n entitySearch(query: $query) {\n results {\n entities {\n name\n ... on DashboardEntityOutline {\n name\n dashboardParentGuid\n guid\n }\n permalink\n }\n }\n }\n }\n}\n';
@@ -27,6 +27,7 @@ export type DashboardEntity = {
};
export type ResultEntity = {
dashboardParentGuid: string;
guid: string;
permalink: string;
name: string;