diff --git a/plugins/new-relic-dashboard/src/components/ExampleComponents/ExampleComponent.tsx b/plugins/new-relic-dashboard/src/components/ExampleComponents/ExampleComponent.tsx deleted file mode 100644 index 5d7d84845d..0000000000 --- a/plugins/new-relic-dashboard/src/components/ExampleComponents/ExampleComponent.tsx +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2021 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import React from 'react'; -import { Typography, Grid } from '@material-ui/core'; -import { - InfoCard, - Header, - Page, - Content, - ContentHeader, - HeaderLabel, - SupportButton, -} from '@backstage/core-components'; -import { NewRelicExample } from './NewRelicExample'; - -export const ExampleComponent = () => ( - -
- - -
- - - This page will load a list of dashboards - - - - - - All content should be wrapped in a card like this. - - - - - - - - -
-); diff --git a/plugins/new-relic-dashboard/src/components/ExampleComponents/NewRelicExample.tsx b/plugins/new-relic-dashboard/src/components/ExampleComponents/NewRelicExample.tsx deleted file mode 100644 index 162dc3e42e..0000000000 --- a/plugins/new-relic-dashboard/src/components/ExampleComponents/NewRelicExample.tsx +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2021 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -import React from 'react'; -import { Typography, Grid } from '@material-ui/core'; - -export const NewRelicExample = () => { - // const [dashboardUrl, setDashboardUrl] = React.useState< - // DashboardSnapshotSummary | undefined - // >(); - - // const NewRelicDashboardAPI = useApi(NewRelicDashboardApiRef); - // const { value } = useAsync(async (): Promise => { - // let dashboardObject: any = NewRelicDashboardAPI.getDashboardEntity( - // 'MjY2NjU3MnxWSVp8REFTSEJPQVJEfGRhOjQ0OTc1MA', - // ); - - // return dashboardObject; - // }, []); - // useEffect(() => { - // if (value) { - // NewRelicDashboardAPI.getDashboardSnapshot( - // value?.getDashboardEntity?.data?.actor.entitySearch.results.entities[0] - // .guid, - // '2000000000', - // ); - // } - // }, [value]); - - // console.log( - // value?.getDashboardEntity.data.actor.entitySearch.results.entities[0].guid, - // ); - - return ( - - - New Relic Dashboards loaded via custom APIs - - - {/* {data.getTodos.map((todo: ITodo) => ( */} - {/* <>{JSON.stringify(value)} - <>{JSON.stringify(dashboardUrl?.getDashboardSnapshot.data.dashboardCreateSnapshotUrl)} */} - {/* {value?.getDashboardSnapshot?.map(contributor => ( - - <>{contributor} - - ))} */} - {/* */} - {/* ))} */} - - - ); -}; diff --git a/plugins/new-relic-dashboard/src/components/ExampleComponents/index.ts b/plugins/new-relic-dashboard/src/components/ExampleComponents/index.ts deleted file mode 100644 index 212740dcdb..0000000000 --- a/plugins/new-relic-dashboard/src/components/ExampleComponents/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2021 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -export { ExampleComponent } from './ExampleComponent'; diff --git a/plugins/new-relic-dashboard/src/components/NewRelicDashboard/DashboardSnapshot/DashboardSnapshot.tsx b/plugins/new-relic-dashboard/src/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshot.tsx similarity index 58% rename from plugins/new-relic-dashboard/src/components/NewRelicDashboard/DashboardSnapshot/DashboardSnapshot.tsx rename to plugins/new-relic-dashboard/src/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshot.tsx index 306789a6f8..c27ca1b183 100644 --- a/plugins/new-relic-dashboard/src/components/NewRelicDashboard/DashboardSnapshot/DashboardSnapshot.tsx +++ b/plugins/new-relic-dashboard/src/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshot.tsx @@ -14,13 +14,12 @@ * limitations under the License. */ import React from 'react'; -import { Grid, Paper, Typography } from '@material-ui/core'; +import { Box, Grid } from '@material-ui/core'; import { useApi } from '@backstage/core-plugin-api'; import { useAsync } from 'react-use'; -import { Progress } from '@backstage/core-components'; +import { InfoCard, Progress } from '@backstage/core-components'; import { NewRelicDashboardApiRef } from '../../../api'; import Alert from '@material-ui/lab/Alert'; -import Link from '@material-ui/core/Link'; type Props = { guid: String; @@ -50,33 +49,23 @@ export const DashboardSnapshot = ({ return {error.message}; } return ( - - - - - {name} - - - - - - {`${name} - - {/* {JSON.stringify( - value.getDashboardSnapshot.data.dashboardCreateSnapshotUrl.replace( - /...$/, - 'png', - ), - )} */} - - - + + + + + + {`${name} + + + + + ); }; diff --git a/plugins/new-relic-dashboard/src/components/NewRelicDashboard/DashboardSnapshot/DashboardSnapshotList.tsx b/plugins/new-relic-dashboard/src/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshotList.tsx similarity index 65% rename from plugins/new-relic-dashboard/src/components/NewRelicDashboard/DashboardSnapshot/DashboardSnapshotList.tsx rename to plugins/new-relic-dashboard/src/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshotList.tsx index 1946d4016b..f0d9b58599 100644 --- a/plugins/new-relic-dashboard/src/components/NewRelicDashboard/DashboardSnapshot/DashboardSnapshotList.tsx +++ b/plugins/new-relic-dashboard/src/components/NewRelicDashboard/DashboardSnapshotList/DashboardSnapshotList.tsx @@ -97,62 +97,48 @@ export const DashboardSnapshotList = ({ guid }: Props) => { return {error.message}; } return ( - <> - - {/* - {value.getDashboardEntity.data.actor.entitySearch.results.entities?.map( - (Entity: any) => { - return ( - - ); - }, - )} - */} - - {value.getDashboardEntity.data.actor.entitySearch.results.entities?.map( - (Entity: any, index: any) => { - return ( - - ); - }, - )} - + + {value.getDashboardEntity.data.actor.entitySearch.results.entities?.map( (Entity: any, index: any) => { return ( - - - + ); }, )} - - + + {value.getDashboardEntity.data.actor.entitySearch.results.entities?.map( + (Entity: any, index: any) => { + return ( + + + + ); + }, + )} + ); }; diff --git a/plugins/new-relic-dashboard/src/components/NewRelicDashboard/DashboardSnapshot/index.ts b/plugins/new-relic-dashboard/src/components/NewRelicDashboard/DashboardSnapshotList/index.ts similarity index 100% rename from plugins/new-relic-dashboard/src/components/NewRelicDashboard/DashboardSnapshot/index.ts rename to plugins/new-relic-dashboard/src/components/NewRelicDashboard/DashboardSnapshotList/index.ts diff --git a/plugins/new-relic-dashboard/src/components/ExampleComponents/ExampleComponent.test.tsx b/plugins/new-relic-dashboard/src/components/NewRelicDashboard/NewRelicComponent.test.tsx similarity index 94% rename from plugins/new-relic-dashboard/src/components/ExampleComponents/ExampleComponent.test.tsx rename to plugins/new-relic-dashboard/src/components/NewRelicDashboard/NewRelicComponent.test.tsx index 22cb0c9fca..4e9b47d0ab 100644 --- a/plugins/new-relic-dashboard/src/components/ExampleComponents/ExampleComponent.test.tsx +++ b/plugins/new-relic-dashboard/src/components/NewRelicDashboard/NewRelicComponent.test.tsx @@ -14,7 +14,7 @@ * limitations under the License. */ import React from 'react'; -import { ExampleComponent } from './ExampleComponent'; +import { NewRelicDashboard } from './NewRelicDashboard'; import { ThemeProvider } from '@material-ui/core'; import { lightTheme } from '@backstage/theme'; import { rest } from 'msw'; @@ -39,7 +39,7 @@ describe('ExampleComponent', () => { it('should render', async () => { const rendered = await renderInTestApp( - + , ); expect( diff --git a/plugins/new-relic-dashboard/src/components/NewRelicDashboard/NewRelicDashboard.tsx b/plugins/new-relic-dashboard/src/components/NewRelicDashboard/NewRelicDashboard.tsx index 9cc1764b99..11feff1cab 100644 --- a/plugins/new-relic-dashboard/src/components/NewRelicDashboard/NewRelicDashboard.tsx +++ b/plugins/new-relic-dashboard/src/components/NewRelicDashboard/NewRelicDashboard.tsx @@ -18,7 +18,7 @@ import { Grid } from '@material-ui/core'; import { Page, Content } from '@backstage/core-components'; import { useNewRelicDashboardEntity } from '../../hooks'; import { DashboardEntityList } from './DashboardEntityList'; -import { DashboardSnapshotList } from './DashboardSnapshot'; +import { DashboardSnapshotList } from './DashboardSnapshotList'; export const NewRelicDashboard = () => { const entity = useNewRelicDashboardEntity(); @@ -26,8 +26,12 @@ export const NewRelicDashboard = () => { - - + + + + + + diff --git a/plugins/new-relic-dashboard/src/index.ts b/plugins/new-relic-dashboard/src/index.ts index 0c02a223d1..119b01631b 100644 --- a/plugins/new-relic-dashboard/src/index.ts +++ b/plugins/new-relic-dashboard/src/index.ts @@ -15,7 +15,6 @@ */ export { newRelicDashboardPlugin, - NewRelicDashboardPage, EntityNewRelicDashboard, EntityPageNewRelicDashboard, } from './plugin'; diff --git a/plugins/new-relic-dashboard/src/plugin.ts b/plugins/new-relic-dashboard/src/plugin.ts index cca9cbd7e1..1af533332b 100644 --- a/plugins/new-relic-dashboard/src/plugin.ts +++ b/plugins/new-relic-dashboard/src/plugin.ts @@ -41,15 +41,6 @@ export const newRelicDashboardPlugin = createPlugin({ ], }); -export const NewRelicDashboardPage = newRelicDashboardPlugin.provide( - createRoutableExtension({ - name: 'NewRelicDashboardPage', - component: () => - import('./components/ExampleComponents').then(m => m.ExampleComponent), - mountPoint: rootRouteRef, - }), -); - export const EntityNewRelicDashboard = newRelicDashboardPlugin.provide( createRoutableExtension({ component: () => import('./Router').then(m => m.Router),