some final cleanup

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2021-12-17 10:13:02 +01:00
parent 7a4bd2ceac
commit 2847cd8234
11 changed files with 18 additions and 25 deletions
+1 -1
View File
@@ -14,4 +14,4 @@
'@backstage/plugin-sonarqube': patch
---
Fixed Link component import and usage. Now using backstage verion of Link
Prefer using `Link` from `@backstage/core-components` rather than material-UI.
@@ -94,6 +94,7 @@ export const WithLink = () => (
</TestApiProvider>
</div>
);
export const Fixed = () => (
<div style={containerStyle}>
<TestApiProvider apis={apis}>
@@ -106,6 +107,7 @@ export const Fixed = () => (
</TestApiProvider>
</div>
);
export const Warning = () => (
<div style={containerStyle}>
<TestApiProvider apis={apis}>
@@ -80,14 +80,11 @@ export function ErrorPage(props: IErrorPageProps) {
Looks like someone dropped the mic!
</Typography>
<Typography variant="h6">
<Link to=".." data-testid="go-back-link">
<Link to="#" data-testid="go-back-link" onClick={() => navigate(-1)}>
Go back
</Link>
... or please{' '}
<Link to={support.url} rel="noopener noreferrer">
contact support
</Link>{' '}
if you think this is a bug.
... or please <Link to={support.url}>contact support</Link> if you
think this is a bug.
</Typography>
</Grid>
</Grid>
+1 -3
View File
@@ -38,9 +38,7 @@ const DefaultEntityPage = () => (
<Typography variant="body1">
To override this component with your custom implementation, read
docs on{' '}
<Link target="_blank" to="https://backstage.io/docs">
backstage.io/docs
</Link>
<Link to="https://backstage.io/docs">backstage.io/docs</Link>
</Typography>
</Content>
}
@@ -121,9 +121,7 @@ const SourceInfo = ({ build }: { build: CITableBuildInfo }) => {
<Typography variant="button">{source?.branchName}</Typography>
<Typography variant="body1">
{source?.commit?.url !== undefined ? (
<Link to={source?.commit?.url} target="_blank">
{source?.commit.shortHash}
</Link>
<Link to={source?.commit?.url}>{source?.commit.shortHash}</Link>
) : (
source?.commit.shortHash
)}
@@ -169,7 +167,7 @@ const generatedColumns: TableColumn[] = [
field: 'buildName',
highlight: true,
render: (row: Partial<CITableBuildInfo>) => (
<Link to={row?.buildUrl!} target="_blank">
<Link to={row?.buildUrl ?? ''}>
<Box display="flex" alignItems="center">
<LaunchIcon fontSize="small" color="disabled" />
<Box mr={1} />
@@ -63,7 +63,7 @@ const WidgetContent = ({
),
message: lastRun.message,
url: (
<Link to={lastRun.googleUrl ?? ''} target="_blank">
<Link to={lastRun.googleUrl ?? ''}>
See more on Google{' '}
<ExternalLinkIcon className={classes.externalLinkIcon} />
</Link>
@@ -71,7 +71,7 @@ const WidgetContent = ({
),
message: lastRun.message,
url: (
<Link to={lastRun.githubUrl ?? ''} target="_blank">
<Link to={lastRun.githubUrl ?? ''}>
See more on GitHub{' '}
<ExternalLinkIcon className={classes.externalLinkIcon} />
</Link>
@@ -24,7 +24,7 @@ const columns: TableColumn[] = [
field: 'name',
highlight: true,
render: (componentData: any) => (
<Link to={`/gitops-cluster/${componentData.name}`}>
<Link to={`/gitops-cluster/${encodeURIComponent(componentData.name)}`}>
{componentData.name}
</Link>
),
@@ -13,12 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Progress, Table, TableColumn } from '@backstage/core-components';
import { Link, Progress, Table, TableColumn } from '@backstage/core-components';
import { alertApiRef, useApi, useRouteRef } from '@backstage/core-plugin-api';
import { Box, IconButton, Link, Tooltip, Typography } from '@material-ui/core';
import { Box, IconButton, Tooltip, Typography } from '@material-ui/core';
import RetryIcon from '@material-ui/icons/Replay';
import { default as React, useState } from 'react';
import { Link as RouterLink } from 'react-router-dom';
import { Project } from '../../../../api/JenkinsApi';
import JenkinsLogo from '../../../../assets/JenkinsLogo.svg';
import { buildRouteRef } from '../../../../plugin';
@@ -107,7 +106,6 @@ const generatedColumns: TableColumn[] = [
return (
<Link
component={RouterLink}
to={routeLink({
jobFullName: encodeURIComponent(row.fullName),
buildNumber: String(row.lastBuild?.number),
@@ -127,7 +125,7 @@ const generatedColumns: TableColumn[] = [
render: (row: Partial<Project>) => (
<>
<p>
<Link to={row.lastBuild?.source?.url || ''} target="_blank">
<Link to={row.lastBuild?.source?.url ?? ''}>
{row.lastBuild?.source?.branchName}
</Link>
</p>
@@ -154,7 +152,7 @@ const generatedColumns: TableColumn[] = [
<>
<p>
{row.lastBuild?.tests && (
<Link to={row.lastBuild?.tests.testUrl || ''} target="_blank">
<Link to={row.lastBuild?.tests.testUrl ?? ''}>
{row.lastBuild?.tests.passed} / {row.lastBuild?.tests.total}{' '}
passed
<FailSkippedWidget
@@ -35,7 +35,7 @@ describe('<LatestRunCard />', () => {
const jenkinsApi: Partial<JenkinsApi> = {
getProjects: () =>
Promise.resolve([
{ lastBuild: { timestamp: 0, status: 'success' } },
{ lastBuild: { timestamp: 0, status: 'success', url: 'foo' } },
] as Project[]),
};
@@ -67,7 +67,7 @@ const WidgetContent = ({
'latest run': displayDate,
duration: displayDuration,
link: (
<Link to={latestRun.lastBuild.url} target="_blank">
<Link to={latestRun.lastBuild.url}>
See more on Jenkins{' '}
<ExternalLinkIcon className={classes.externalLinkIcon} />
</Link>