Rename view/edit annotations

This commit is contained in:
James Turley
2021-02-20 11:07:08 +00:00
parent e337085d38
commit 9c521c53a7
4 changed files with 8 additions and 8 deletions
@@ -70,14 +70,14 @@ The value of this annotation is a location reference string (see above). If this
annotation is specified, it is expected to point to a repository that the
TechDocs system can read and generate docs from.
### backstage.io/browser-view-url, backstage.io/browser-edit-url
### backstage.io/view-url, backstage.io/edit-url
```yaml
# Example:
metadata:
annotations:
backstage.io/browser-view-url: https://some.website/catalog-info.yaml
backstage.io/browser-edit-url: https://github.com/my-org/catalog/edit/master/my-service.jsonnet
backstage.io/view-url: https://some.website/catalog-info.yaml
backstage.io/edit-url: https://github.com/my-org/catalog/edit/master/my-service.jsonnet
```
These annotations allow customising links from the catalog pages. The view URL
@@ -135,7 +135,7 @@ describe('<AboutCard /> custom links', () => {
annotations: {
'backstage.io/managed-by-location':
'bitbucket:https://bitbucket.org/backstage/backstage/src/master/software.yaml',
'backstage.io/browser-edit-url': 'https://another.place',
'backstage.io/edit-url': 'https://another.place',
[SOURCE_LOCATION_ANNOTATION]:
'url:https://another.place/backstage.git',
},
@@ -86,7 +86,7 @@ describe('CatalogTable component', () => {
kind: 'Component',
metadata: {
name: 'component1',
annotations: { 'backstage.io/browser-edit-url': 'https://other.place' },
annotations: { 'backstage.io/edit-url': 'https://other.place' },
},
};
@@ -115,7 +115,7 @@ describe('CatalogTable component', () => {
kind: 'Component',
metadata: {
name: 'component1',
annotations: { 'backstage.io/browser-view-url': 'https://other.place' },
annotations: { 'backstage.io/view-url': 'https://other.place' },
},
};
+2 -2
View File
@@ -82,7 +82,7 @@ export const findEditUrl = (
): string | undefined => {
const annotations = metadata.annotations || {};
const editUrl = annotations['backstage.io/browser-edit-url'];
const editUrl = annotations['backstage.io/edit-url'];
if (editUrl) return editUrl;
@@ -95,5 +95,5 @@ export const findViewUrl = (
): string | undefined => {
const annotations = metadata.annotations || {};
return annotations['backstage.io/browser-view-url'] || location?.target;
return annotations['backstage.io/view-url'] || location?.target;
};