From 69883ebcc01905286302378830aafacc9e58eacf Mon Sep 17 00:00:00 2001 From: mufaddal motiwala Date: Wed, 19 Jan 2022 12:50:30 +0530 Subject: [PATCH 1/3] render single page dashboards Signed-off-by: mufaddal motiwala --- .../src/api/NewRelicDashboardClient.ts | 11 ++++++++++- .../src/queries/getDashboardParentGuidQuery.ts | 2 +- .../newrelic-dashboard/src/types/DashboardEntity.ts | 1 + 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/plugins/newrelic-dashboard/src/api/NewRelicDashboardClient.ts b/plugins/newrelic-dashboard/src/api/NewRelicDashboardClient.ts index b79cceeeda..2411102712 100644 --- a/plugins/newrelic-dashboard/src/api/NewRelicDashboardClient.ts +++ b/plugins/newrelic-dashboard/src/api/NewRelicDashboardClient.ts @@ -73,9 +73,18 @@ export class NewRelicDashboardClient implements NewRelicDashboardApi { const DashboardEntityList = await this.callApi( 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!, }; diff --git a/plugins/newrelic-dashboard/src/queries/getDashboardParentGuidQuery.ts b/plugins/newrelic-dashboard/src/queries/getDashboardParentGuidQuery.ts index 3a06384539..bc7c0b072b 100644 --- a/plugins/newrelic-dashboard/src/queries/getDashboardParentGuidQuery.ts +++ b/plugins/newrelic-dashboard/src/queries/getDashboardParentGuidQuery.ts @@ -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'; diff --git a/plugins/newrelic-dashboard/src/types/DashboardEntity.ts b/plugins/newrelic-dashboard/src/types/DashboardEntity.ts index 78a1b7913d..0c4fbb7a90 100644 --- a/plugins/newrelic-dashboard/src/types/DashboardEntity.ts +++ b/plugins/newrelic-dashboard/src/types/DashboardEntity.ts @@ -27,6 +27,7 @@ export type DashboardEntity = { }; export type ResultEntity = { + dashboardParentGuid: string; guid: string; permalink: string; name: string; From afe1bd78d2a29421939e5a8698bba3619a6f8af5 Mon Sep 17 00:00:00 2001 From: mufaddal motiwala Date: Wed, 19 Jan 2022 12:53:02 +0530 Subject: [PATCH 2/3] add changeset Signed-off-by: mufaddal motiwala --- .changeset/shaggy-llamas-build.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/shaggy-llamas-build.md diff --git a/.changeset/shaggy-llamas-build.md b/.changeset/shaggy-llamas-build.md new file mode 100644 index 0000000000..b4a870b361 --- /dev/null +++ b/.changeset/shaggy-llamas-build.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-newrelic-dashboard': patch +--- + +Newrelic Dashboards will render single page dashboards, meaning dashboards which dont have a parentGUID From dfbd30a14cef244631696b7250362d3f0f3de4cd Mon Sep 17 00:00:00 2001 From: mufaddal motiwala Date: Wed, 19 Jan 2022 13:02:58 +0530 Subject: [PATCH 3/3] md quality workflow check Signed-off-by: mufaddal motiwala --- .changeset/shaggy-llamas-build.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.changeset/shaggy-llamas-build.md b/.changeset/shaggy-llamas-build.md index b4a870b361..5137bf93c5 100644 --- a/.changeset/shaggy-llamas-build.md +++ b/.changeset/shaggy-llamas-build.md @@ -2,4 +2,4 @@ '@backstage/plugin-newrelic-dashboard': patch --- -Newrelic Dashboards will render single page dashboards, meaning dashboards which dont have a parentGUID +Newrelic Dashboards will render single page dashboards, meaning dashboards which do not have a parent GUID