merge and small fixes

This commit is contained in:
Med Mouine
2024-05-27 18:45:26 -04:00
parent 2335b85099
commit 7895114acd
7 changed files with 102 additions and 258 deletions

View File

@@ -1,40 +1,29 @@
import React from 'react';
import { useEntity } from '@backstage/plugin-catalog-react'
import { Typography, Box, Grid, Divider, Paper, Card, CardHeader, CardContent } from '@material-ui/core';
import {
InfoCard,
Header,
Page,
Content,
ContentHeader,
HeaderLabel,
Link,
SupportButton,
Table,
} from '@backstage/core-components';
import { ExampleFetchComponent } from '../ExampleFetchComponent';
import {useEntity} from '@backstage/plugin-catalog-react'
import {Box, Card, CardContent, CardHeader, Divider, Grid, Paper} from '@material-ui/core';
import {Link,} from '@backstage/core-components';
export const DevspacesComponent = () => {
const { entity } = useEntity();
const annotations = entity?.metadata?.annotations;
const clusterUrl = "oc-med.wk.nt.local"
const devspacesApp = "devspaces"
const devspacesLink = `https://${devspacesApp}.apps.${clusterUrl}/#https://github.com/${annotations?.['github.com/project-slug']}`;
const {entity} = useEntity();
const annotations = entity?.metadata?.annotations;
const clusterUrl = "oc-med.wk.nt.local"
const devspacesApp = "devspaces"
const devspacesLink = `https://${devspacesApp}.apps.${clusterUrl}/#https://github.com/${annotations?.['github.com/project-slug']}`;
return (
<Paper>
<Grid>
<Card>
{/*<CardHeader title="OpenShift DevSpaces">*/}
<CardHeader title={ <Box mb={2}> OpenShift DevSpaces </Box> }/>
<Divider />
<CardContent>
<Link to={devspacesLink}>
Open project in VSCode Web IDE
</Link>
</CardContent>
</Card>
</Grid>
</Paper>
);
return (
<Paper>
<Grid>
<Card>
{/*<CardHeader title="OpenShift DevSpaces">*/}
<CardHeader title={<Box mb={2}> OpenShift DevSpaces </Box>}/>
<Divider/>
<CardContent>
<Link to={devspacesLink}>
Open project in VSCode Web IDE
</Link>
</CardContent>
</Card>
</Grid>
</Paper>
);
};

View File

@@ -1,29 +0,0 @@
import React from 'react';
import { ExampleComponent } from './ExampleComponent';
import { rest } from 'msw';
import { setupServer } from 'msw/node';
import { screen } from '@testing-library/react';
import {
setupRequestMockHandlers,
renderInTestApp,
} from '@backstage/test-utils';
describe('ExampleComponent', () => {
const server = setupServer();
// Enable sane handlers for network requests
setupRequestMockHandlers(server);
// setup mock response
beforeEach(() => {
server.use(
rest.get('/*', (_, res, ctx) => res(ctx.status(200), ctx.json({}))),
);
});
it('should render', async () => {
await renderInTestApp(<ExampleComponent />);
expect(
screen.getByText('Welcome to devspaces-plugin!'),
).toBeInTheDocument();
});
});