Merge pull request #4018 from andrewthauer/update-catalog-table-actions

feat: enable catalog table actions for all location types
This commit is contained in:
Andrew Thauer
2021-01-12 12:15:00 -05:00
committed by GitHub
2 changed files with 12 additions and 5 deletions
+9
View File
@@ -0,0 +1,9 @@
---
'@backstage/plugin-catalog': patch
---
Enable catalog table actions for all location types.
The edit button has had support for other providers for a while and there is
no specific reason the View in GitHub cannot work for all locations. This
change also replaces the GitHub icon with the OpenInNew icon.
@@ -17,7 +17,7 @@ import { Entity } from '@backstage/catalog-model';
import { Table, TableColumn, TableProps } from '@backstage/core';
import { Chip, Link } from '@material-ui/core';
import Edit from '@material-ui/icons/Edit';
import GitHub from '@material-ui/icons/GitHub';
import OpenInNew from '@material-ui/icons/OpenInNew';
import { Alert } from '@material-ui/lab';
import React from 'react';
import { generatePath, Link as RouterLink } from 'react-router-dom';
@@ -111,13 +111,12 @@ export const CatalogTable = ({
(rowData: Entity) => {
const location = findLocationForEntityMeta(rowData.metadata);
return {
icon: () => <GitHub fontSize="small" />,
tooltip: 'View on GitHub',
icon: () => <OpenInNew fontSize="small" />,
tooltip: 'View',
onClick: () => {
if (!location) return;
window.open(location.target, '_blank');
},
hidden: location?.type !== 'github',
};
},
(rowData: Entity) => {
@@ -129,7 +128,6 @@ export const CatalogTable = ({
if (!location) return;
window.open(createEditLink(location), '_blank');
},
hidden: location?.type !== 'github',
};
},
(rowData: Entity) => {