Skip to content

Commit

Permalink
feat: enable catalog table actions for all location types
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
andrewthauer committed Jan 11, 2021
1 parent 15cc6ff commit c004889
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 9 additions & 0 deletions .changeset/red-baboons-rhyme.md
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 3 additions & 5 deletions plugins/catalog/src/components/CatalogTable/CatalogTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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) => {
Expand All @@ -129,7 +128,6 @@ export const CatalogTable = ({
if (!location) return;
window.open(createEditLink(location), '_blank');
},
hidden: location?.type !== 'github',
};
},
(rowData: Entity) => {
Expand Down

0 comments on commit c004889

Please sign in to comment.