render single page dashboards

Signed-off-by: mufaddal motiwala <mufaddalmm.52@gmail.com>
This commit is contained in:
mufaddal motiwala
2022-01-19 12:50:30 +05:30
parent ec60bc64a9
commit 69883ebcc0
3 changed files with 12 additions and 2 deletions
@@ -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;