diff --git a/plugins/report-portal-backend/OWNERS b/plugins/report-portal-backend/OWNERS deleted file mode 100644 index ac83ec42036..00000000000 --- a/plugins/report-portal-backend/OWNERS +++ /dev/null @@ -1,8 +0,0 @@ -approvers: - - yashoswalyo - - riginoommen - - deshmukhmayur -reviewers: - - yashoswalyo - - riginoommen - - deshmukhmayur diff --git a/plugins/report-portal-backend/config.d.ts b/plugins/report-portal-backend/config.d.ts index 40a05a48547..e7b2e32ff58 100644 --- a/plugins/report-portal-backend/config.d.ts +++ b/plugins/report-portal-backend/config.d.ts @@ -1,8 +1,17 @@ export interface Config { /** * Configuration values for Report Portal plugin + * @visibility frontend */ reportPortal: { + /** + * Email to connect for adding more instances + * @visibility frontend + */ + supportEmail: string; + /** + * @visibility frontend + */ integrations: Array<{ /** * Host of report portal url diff --git a/plugins/report-portal-backend/package.json b/plugins/report-portal-backend/package.json index 487efdf527e..b18ab2b3073 100644 --- a/plugins/report-portal-backend/package.json +++ b/plugins/report-portal-backend/package.json @@ -1,6 +1,6 @@ { "name": "@appdev-platform/backstage-plugin-report-portal-backend", - "version": "0.1.1", + "version": "0.2.0", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", diff --git a/plugins/report-portal-backend/src/index.ts b/plugins/report-portal-backend/src/index.ts index 8e2a7199c33..b427ec7ef8c 100644 --- a/plugins/report-portal-backend/src/index.ts +++ b/plugins/report-portal-backend/src/index.ts @@ -5,4 +5,5 @@ */ export * from './dynamic/index'; -export * from './service/router'; +export { createRouter } from './service/router'; +export { reportPortalPlugin as default } from './plugin'; diff --git a/plugins/report-portal-backend/src/plugin.ts b/plugins/report-portal-backend/src/plugin.ts index 14e28240a4d..0da90b24022 100644 --- a/plugins/report-portal-backend/src/plugin.ts +++ b/plugins/report-portal-backend/src/plugin.ts @@ -1,4 +1,3 @@ -import { loggerToWinstonLogger } from '@backstage/backend-common'; import { coreServices, createBackendPlugin, @@ -21,10 +20,10 @@ export const reportPortalPlugin = createBackendPlugin({ http: coreServices.httpRouter, }, async init({ config, logger, http }) { - http.use(() => - createRouter({ + http.use( + await createRouter({ config: config, - logger: loggerToWinstonLogger(logger), + logger: logger, }), ); }, diff --git a/plugins/report-portal-backend/src/service/router.ts b/plugins/report-portal-backend/src/service/router.ts index cf7c4f9750a..38224fa1967 100644 --- a/plugins/report-portal-backend/src/service/router.ts +++ b/plugins/report-portal-backend/src/service/router.ts @@ -1,20 +1,22 @@ import { errorHandler } from '@backstage/backend-common'; +import { LoggerService } from '@backstage/backend-plugin-api'; import { Config } from '@backstage/config'; import express from 'express'; import Router from 'express-promise-router'; import { createProxyMiddleware } from 'http-proxy-middleware'; -import { Logger } from 'winston'; export interface RouterOptions { - logger: Logger; + logger: LoggerService; config: Config; } export async function createRouter( options: RouterOptions, ): Promise { - const { config } = options; + const { config, logger } = options; + + logger.info('Report portal backend plugin initialized'); const hostsConfig = config.getConfigArray('reportPortal.integrations'); const router = Router(); diff --git a/plugins/report-portal/OWNERS b/plugins/report-portal/OWNERS deleted file mode 100644 index ac83ec42036..00000000000 --- a/plugins/report-portal/OWNERS +++ /dev/null @@ -1,8 +0,0 @@ -approvers: - - yashoswalyo - - riginoommen - - deshmukhmayur -reviewers: - - yashoswalyo - - riginoommen - - deshmukhmayur diff --git a/plugins/report-portal/config.d.ts b/plugins/report-portal/config.d.ts index 731ba78f0da..e7b2e32ff58 100644 --- a/plugins/report-portal/config.d.ts +++ b/plugins/report-portal/config.d.ts @@ -1,6 +1,7 @@ export interface Config { /** * Configuration values for Report Portal plugin + * @visibility frontend */ reportPortal: { /** @@ -8,6 +9,9 @@ export interface Config { * @visibility frontend */ supportEmail: string; + /** + * @visibility frontend + */ integrations: Array<{ /** * Host of report portal url @@ -15,7 +19,16 @@ export interface Config { */ host: string; /** - * Type of projects to list + * Base api url for report portal instance + */ + baseUrl: string; + /** + * The Api token that will be used to + * @visibility secret + */ + token: string; + /** + * Filter type to apply for current host * @visibility frontend */ filterType: string; diff --git a/plugins/report-portal/dev/index.tsx b/plugins/report-portal/dev/index.tsx index 6f050f14c1e..ffb87ad5954 100644 --- a/plugins/report-portal/dev/index.tsx +++ b/plugins/report-portal/dev/index.tsx @@ -8,7 +8,7 @@ import { } from '@backstage/plugin-catalog'; import { EntityProvider } from '@backstage/plugin-catalog-react'; -import { Grid } from '@material-ui/core'; +import Grid from '@mui/material/Grid'; import { mockEntity } from '../src/mocks'; import { ReportPortalOverviewCard, reportPortalPlugin } from '../src/plugin'; diff --git a/plugins/report-portal/package.json b/plugins/report-portal/package.json index 21e06a546d9..fe5944db238 100644 --- a/plugins/report-portal/package.json +++ b/plugins/report-portal/package.json @@ -1,6 +1,6 @@ { "name": "@appdev-platform/backstage-plugin-report-portal", - "version": "0.1.2", + "version": "0.2.0", "main": "src/index.ts", "types": "src/index.ts", "license": "Apache-2.0", @@ -32,9 +32,9 @@ "@backstage/core-plugin-api": "^1.9.0", "@backstage/plugin-catalog-react": "^1.10.0", "@backstage/theme": "^0.5.1", - "@material-ui/core": "^4.12.2", - "@material-ui/icons": "^4.11.3", - "@material-ui/lab": "^4.0.0-alpha.61", + "@mui/icons-material": "^5.15.17", + "@mui/material": "^5.15.17", + "@mui/styles": "^5.15.17", "luxon": "^3.4.4", "react-multi-progress": "^1.3.0", "react-use": "^17.2.4" diff --git a/plugins/report-portal/src/api/ReportPortalClient.ts b/plugins/report-portal/src/api/ReportPortalClient.ts index 416ac07adfa..b1a72f62b50 100644 --- a/plugins/report-portal/src/api/ReportPortalClient.ts +++ b/plugins/report-portal/src/api/ReportPortalClient.ts @@ -1,4 +1,4 @@ -import { DiscoveryApi } from '@backstage/core-plugin-api'; +import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api'; import { ReportPortalApi } from './ReportPortalApi'; import { @@ -8,7 +8,10 @@ import { } from './types'; export class ReportPortalClient implements ReportPortalApi { - constructor(private readonly discoveryApi: DiscoveryApi) {} + constructor( + private readonly discoveryApi: DiscoveryApi, + private readonly fetchApi: FetchApi, + ) {} private async getBaseApiUrl() { return `${await this.discoveryApi.getBaseUrl('report-portal')}/v1/`; @@ -33,7 +36,7 @@ export class ReportPortalClient implements ReportPortalApi { ); } baseUrl.searchParams.append('host', host); - const response = await fetch(baseUrl); + const response = await this.fetchApi.fetch(baseUrl); if (response.status !== 200) { throw new Error('Failed to fetch launch details'); } @@ -43,7 +46,7 @@ export class ReportPortalClient implements ReportPortalApi { async getProjectDetails(projectId: string, host: string) { const baseUrl = new URL(`project/${projectId}`, await this.getBaseApiUrl()); baseUrl.searchParams.append('host', host); - const response = await fetch(baseUrl); + const response = await this.fetchApi.fetch(baseUrl); if (response.status !== 200) { throw new Error('Failed to fetch project details'); } @@ -61,7 +64,7 @@ export class ReportPortalClient implements ReportPortalApi { ); } baseUrl.searchParams.append('host', host); - const response = await fetch(baseUrl); + const response = await this.fetchApi.fetch(baseUrl); if (response.status !== 200) { throw new Error('Failed to get instance details'); } diff --git a/plugins/report-portal/src/components/LaunchesPage/LaunchesPage.tsx b/plugins/report-portal/src/components/LaunchesPage/LaunchesPage.tsx index 78bf9d3cbe8..3deb99be94f 100644 --- a/plugins/report-portal/src/components/LaunchesPage/LaunchesPage.tsx +++ b/plugins/report-portal/src/components/LaunchesPage/LaunchesPage.tsx @@ -10,8 +10,9 @@ import { } from '@backstage/core-components'; import { useRouteRef } from '@backstage/core-plugin-api'; -import { Button, makeStyles } from '@material-ui/core'; -import Launch from '@material-ui/icons/Launch'; +import Launch from '@mui/icons-material/Launch'; +import Button from '@mui/material/Button'; +import makeStyles from '@mui/styles/makeStyles'; import { projectsRouteRef, rootRouteRef } from '../../routes'; import { LaunchesPageContent } from './LaunchesPageContent/LaunchesPageContent'; diff --git a/plugins/report-portal/src/components/LaunchesPage/LaunchesPageContent/LaunchesPageContent.tsx b/plugins/report-portal/src/components/LaunchesPage/LaunchesPageContent/LaunchesPageContent.tsx index 0fad73114d2..9a903624d2d 100644 --- a/plugins/report-portal/src/components/LaunchesPage/LaunchesPageContent/LaunchesPageContent.tsx +++ b/plugins/report-portal/src/components/LaunchesPage/LaunchesPageContent/LaunchesPageContent.tsx @@ -3,8 +3,9 @@ import React, { useEffect, useState } from 'react'; import { ErrorPanel, Table, TableColumn } from '@backstage/core-components'; import { useApi } from '@backstage/core-plugin-api'; -import { IconButton, Link } from '@material-ui/core'; -import Launch from '@material-ui/icons/Launch'; +import Launch from '@mui/icons-material/Launch'; +import IconButton from '@mui/material/IconButton'; +import Link from '@mui/material/Link'; import { DateTime } from 'luxon'; import { @@ -160,6 +161,7 @@ export const LaunchesPageContent = (props: { target="_blank" rel="noopener noreferrer" href={`https://${host}/ui/#${project}/launches/latest/${row.id}`} + size="large" > diff --git a/plugins/report-portal/src/components/ProjectsPage/ProjectsPage.tsx b/plugins/report-portal/src/components/ProjectsPage/ProjectsPage.tsx index 9f0f5dadac2..e0c2b199ebf 100644 --- a/plugins/report-portal/src/components/ProjectsPage/ProjectsPage.tsx +++ b/plugins/report-portal/src/components/ProjectsPage/ProjectsPage.tsx @@ -10,8 +10,9 @@ import { } from '@backstage/core-components'; import { useRouteRef } from '@backstage/core-plugin-api'; -import { Button, makeStyles } from '@material-ui/core'; -import Launch from '@material-ui/icons/Launch'; +import Launch from '@mui/icons-material/Launch'; +import Button from '@mui/material/Button'; +import makeStyles from '@mui/styles/makeStyles'; import { rootRouteRef } from '../../routes'; import { ProjectsPageContent } from './ProjectsPageContent/ProjectsPageContent'; diff --git a/plugins/report-portal/src/components/ProjectsPage/ProjectsPageContent/ProjectsPageContent.tsx b/plugins/report-portal/src/components/ProjectsPage/ProjectsPageContent/ProjectsPageContent.tsx index 71e62bfc8ca..3f7086bbbec 100644 --- a/plugins/report-portal/src/components/ProjectsPage/ProjectsPageContent/ProjectsPageContent.tsx +++ b/plugins/report-portal/src/components/ProjectsPage/ProjectsPageContent/ProjectsPageContent.tsx @@ -8,9 +8,9 @@ import { } from '@backstage/core-components'; import { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api'; -import { IconButton } from '@material-ui/core'; -import Launch from '@material-ui/icons/Launch'; -import { Skeleton } from '@material-ui/lab'; +import Launch from '@mui/icons-material/Launch'; +import IconButton from '@mui/material/IconButton'; +import Skeleton from '@mui/material/Skeleton'; import { ProjectDetails, @@ -114,6 +114,7 @@ export const ProjectsPageContent = (props: { host: string }) => { target="_blank" rel="noopener noreferrer" href={`https://${host}/ui/#${row.projectName}/`} + size="large" > diff --git a/plugins/report-portal/src/components/ReportPortalGlobalPage/GlobalPageContent/GlobalPageContent.tsx b/plugins/report-portal/src/components/ReportPortalGlobalPage/GlobalPageContent/GlobalPageContent.tsx index 676f495a308..9268d2221ef 100644 --- a/plugins/report-portal/src/components/ReportPortalGlobalPage/GlobalPageContent/GlobalPageContent.tsx +++ b/plugins/report-portal/src/components/ReportPortalGlobalPage/GlobalPageContent/GlobalPageContent.tsx @@ -3,9 +3,9 @@ import React, { useEffect, useState } from 'react'; import { Link, Table, TableColumn } from '@backstage/core-components'; import { configApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api'; -import { IconButton } from '@material-ui/core'; -import LaunchIcon from '@material-ui/icons/Launch'; -import { Skeleton } from '@material-ui/lab'; +import LaunchIcon from '@mui/icons-material/Launch'; +import IconButton from '@mui/material/IconButton'; +import Skeleton from '@mui/material/Skeleton'; import { reportPortalApiRef } from '../../../api'; import { useInstanceDetails } from '../../../hooks'; @@ -75,6 +75,7 @@ export const GlobalPageContent = () => { href={reportPortalApi.getReportPortalBaseUrl(rowData.instance)} rel="noreferrer noopener" target="_blank" + size="large" > diff --git a/plugins/report-portal/src/components/ReportPortalGlobalPage/ReportPortalGlobalPage.tsx b/plugins/report-portal/src/components/ReportPortalGlobalPage/ReportPortalGlobalPage.tsx index e2a3d1f135d..a8716a95591 100644 --- a/plugins/report-portal/src/components/ReportPortalGlobalPage/ReportPortalGlobalPage.tsx +++ b/plugins/report-portal/src/components/ReportPortalGlobalPage/ReportPortalGlobalPage.tsx @@ -3,7 +3,8 @@ import React from 'react'; import { Content, PageWithHeader } from '@backstage/core-components'; import { configApiRef, useApi } from '@backstage/core-plugin-api'; -import { Button, Grid } from '@material-ui/core'; +import Button from '@mui/material/Button'; +import Grid from '@mui/material/Grid'; import { GlobalPageContent } from './GlobalPageContent'; diff --git a/plugins/report-portal/src/components/ReportPortalIcon/ReportPortalIcon.tsx b/plugins/report-portal/src/components/ReportPortalIcon/ReportPortalIcon.tsx index 2ea2c04ddef..bfd79dee1a6 100644 --- a/plugins/report-portal/src/components/ReportPortalIcon/ReportPortalIcon.tsx +++ b/plugins/report-portal/src/components/ReportPortalIcon/ReportPortalIcon.tsx @@ -1,6 +1,6 @@ import React from 'react'; -import { SvgIcon, SvgIconProps } from '@material-ui/core'; +import SvgIcon, { SvgIconProps } from '@mui/material/SvgIcon'; export const ReportPortalIcon = (props: SvgIconProps) => { return ( diff --git a/plugins/report-portal/src/components/ReportPortalOverviewCard/ReportPortalOverviewCard.tsx b/plugins/report-portal/src/components/ReportPortalOverviewCard/ReportPortalOverviewCard.tsx index 8ecd1ad87f3..542d655cd95 100644 --- a/plugins/report-portal/src/components/ReportPortalOverviewCard/ReportPortalOverviewCard.tsx +++ b/plugins/report-portal/src/components/ReportPortalOverviewCard/ReportPortalOverviewCard.tsx @@ -5,18 +5,26 @@ import { InfoCard, InfoCardVariants } from '@backstage/core-components'; import { configApiRef, useApi } from '@backstage/core-plugin-api'; import { useEntity } from '@backstage/plugin-catalog-react'; -import { - Divider, - Grid, - List, - ListItem, - ListItemSecondaryAction, - ListItemText, - makeStyles, - Theme, - Typography, -} from '@material-ui/core'; -import { Skeleton } from '@material-ui/lab'; +// import { +// Divider, +// Grid, +// List, +// ListItem, +// ListItemSecondaryAction, +// ListItemText, +// Theme, +// Typography, +// } from '@mui/material'; +import Divider from '@mui/material/Divider'; +import Grid from '@mui/material/Grid'; +import List from '@mui/material/List'; +import ListItem from '@mui/material/ListItem'; +import ListItemSecondaryAction from '@mui/material/ListItemSecondaryAction'; +import ListItemText from '@mui/material/ListItemText'; +import Skeleton from '@mui/material/Skeleton'; +import { Theme } from '@mui/material/styles'; +import Typography from '@mui/material/Typography'; +import makeStyles from '@mui/styles/makeStyles'; import { useLaunchDetails, useProjectDetails } from '../../hooks'; import { isReportPortalAvailable } from '../../utils/isReportPortalAvailable'; @@ -53,7 +61,7 @@ const useStylesForDefect = makeStyles((theme: Theme) => ({ }, })); -const DefectStatus = (props: { color: string; children: string }) => { +const DefectStatus = (props: { color: string; children: any }) => { const classes = useStylesForDefect({ backgroundColor: props.color }); return ( - Passed: {launchDetails!.statistics.executions.passed ?? 0} + + Passed: {launchDetails!.statistics.executions.passed ?? 0} + - Failed: {launchDetails!.statistics.executions.failed ?? 0} + + Failed: {launchDetails!.statistics.executions.failed ?? 0} + - Skipped: {launchDetails!.statistics.executions.skipped ?? 0} + + Skipped: {launchDetails!.statistics.executions.skipped ?? 0} + diff --git a/plugins/report-portal/src/plugin.ts b/plugins/report-portal/src/plugin.ts index d894c478cd1..ae42aa929f5 100644 --- a/plugins/report-portal/src/plugin.ts +++ b/plugins/report-portal/src/plugin.ts @@ -4,6 +4,7 @@ import { createPlugin, createRoutableExtension, discoveryApiRef, + fetchApiRef, } from '@backstage/core-plugin-api'; import { reportPortalApiRef, ReportPortalClient } from './api'; @@ -20,8 +21,10 @@ export const reportPortalPlugin = createPlugin({ api: reportPortalApiRef, deps: { discovery: discoveryApiRef, + fetch: fetchApiRef, }, - factory: ({ discovery }) => new ReportPortalClient(discovery), + factory: ({ discovery, fetch }) => + new ReportPortalClient(discovery, fetch), }), ], });