From ce0260753273ef24fd9d43659b635457d4a453ce Mon Sep 17 00:00:00 2001 From: Aurelio Saraiva Date: Wed, 18 Aug 2021 18:22:37 -0300 Subject: [PATCH 1/7] added title Signed-off-by: Aurelio Saraiva --- .../examples/documented-component/catalog-info.yaml | 1 + plugins/techdocs/src/home/components/columns.tsx | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/techdocs-backend/examples/documented-component/catalog-info.yaml b/plugins/techdocs-backend/examples/documented-component/catalog-info.yaml index 125c18200d..e6d14025e1 100644 --- a/plugins/techdocs-backend/examples/documented-component/catalog-info.yaml +++ b/plugins/techdocs-backend/examples/documented-component/catalog-info.yaml @@ -2,6 +2,7 @@ apiVersion: backstage.io/v1alpha1 kind: Component metadata: name: documented-component + title: Documented Component description: A Service with TechDocs documentation annotations: backstage.io/techdocs-ref: dir:. diff --git a/plugins/techdocs/src/home/components/columns.tsx b/plugins/techdocs/src/home/components/columns.tsx index 5cdcc66c37..80dfd80a35 100644 --- a/plugins/techdocs/src/home/components/columns.tsx +++ b/plugins/techdocs/src/home/components/columns.tsx @@ -19,6 +19,10 @@ import { Link, SubvalueCell, TableColumn } from '@backstage/core-components'; import { EntityRefLinks } from '@backstage/plugin-catalog-react'; import { DocsTableRow } from './types'; +function formatTitle(entity): String { + return entity.metadata.title || entity.metadata.name; +} + export function createNameColumn(): TableColumn { return { title: 'Document', @@ -26,9 +30,7 @@ export function createNameColumn(): TableColumn { highlight: true, render: (row: DocsTableRow) => ( {row.entity.metadata.name} - } + value={{formatTitle(row.entity)}} subvalue={row.entity.metadata.description} /> ), From 60169a761d5c98821e4f1bf6488a3c2e30188778 Mon Sep 17 00:00:00 2001 From: Aurelio Saraiva Date: Wed, 18 Aug 2021 19:34:16 -0300 Subject: [PATCH 2/7] renamed function to customTitle Signed-off-by: Aurelio Saraiva --- plugins/techdocs/src/home/components/columns.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plugins/techdocs/src/home/components/columns.tsx b/plugins/techdocs/src/home/components/columns.tsx index 80dfd80a35..b7ec8271a4 100644 --- a/plugins/techdocs/src/home/components/columns.tsx +++ b/plugins/techdocs/src/home/components/columns.tsx @@ -17,9 +17,10 @@ import React from 'react'; import { Link, SubvalueCell, TableColumn } from '@backstage/core-components'; import { EntityRefLinks } from '@backstage/plugin-catalog-react'; +import { Entity } from '@backstage/catalog-model'; import { DocsTableRow } from './types'; -function formatTitle(entity): String { +function customTitle(entity: Entity): String { return entity.metadata.title || entity.metadata.name; } @@ -30,7 +31,7 @@ export function createNameColumn(): TableColumn { highlight: true, render: (row: DocsTableRow) => ( {formatTitle(row.entity)}} + value={{customTitle(row.entity)}} subvalue={row.entity.metadata.description} /> ), From 4578d0708c528a22eed08d759113dcfb0bc6eb3e Mon Sep 17 00:00:00 2001 From: Aurelio Saraiva Date: Wed, 18 Aug 2021 19:49:37 -0300 Subject: [PATCH 3/7] updated docs with new property title Signed-off-by: Aurelio Saraiva --- docs/features/software-catalog/descriptor-format.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/features/software-catalog/descriptor-format.md b/docs/features/software-catalog/descriptor-format.md index fb17f4a434..f39454a797 100644 --- a/docs/features/software-catalog/descriptor-format.md +++ b/docs/features/software-catalog/descriptor-format.md @@ -231,6 +231,14 @@ follows. Example: `visits-tracking-service`, `CircleciBuildsDumpV2_avro_gcs` +### `title` [optional] + +The title of the entity. This is a friendly title to be used in the Backstage +interface. This is an optional property, if it doesn't exist the `name` property +will be used. + +Only available for Templates and Docs. + ### `namespace` [optional] The ID of a namespace that the entity belongs to. This is a string that follows From 3cb2124bcd99b10372a097d52fe792c5d765628b Mon Sep 17 00:00:00 2001 From: Aurelio Saraiva Date: Mon, 30 Aug 2021 18:19:49 -0300 Subject: [PATCH 4/7] removed doc in favor #6888 Signed-off-by: Aurelio Saraiva --- docs/features/software-catalog/descriptor-format.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/docs/features/software-catalog/descriptor-format.md b/docs/features/software-catalog/descriptor-format.md index c2141db0e5..8b07e1a51a 100644 --- a/docs/features/software-catalog/descriptor-format.md +++ b/docs/features/software-catalog/descriptor-format.md @@ -231,14 +231,6 @@ follows. Example: `visits-tracking-service`, `CircleciBuildsDumpV2_avro_gcs` -### `title` [optional] - -The title of the entity. This is a friendly title to be used in the Backstage -interface. This is an optional property, if it doesn't exist the `name` property -will be used. - -Only available for Templates and Docs. - ### `namespace` [optional] The ID of a namespace that the entity belongs to. This is a string that follows From 434dfc5d47ded59ca4625232e26fededc0d94146 Mon Sep 17 00:00:00 2001 From: Aurelio Saraiva Date: Mon, 30 Aug 2021 18:24:25 -0300 Subject: [PATCH 5/7] added changeset for techdocs title Signed-off-by: Aurelio Saraiva --- .changeset/two-hats-judge.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/two-hats-judge.md diff --git a/.changeset/two-hats-judge.md b/.changeset/two-hats-judge.md new file mode 100644 index 0000000000..11909c8926 --- /dev/null +++ b/.changeset/two-hats-judge.md @@ -0,0 +1,6 @@ +--- +'@backstage/plugin-techdocs': patch +'@backstage/plugin-techdocs-backend': patch +--- + +added support for title in Techdocs From 690550862a1a80ef766721608bba7d431f0fc905 Mon Sep 17 00:00:00 2001 From: Aurelio Saraiva Date: Tue, 31 Aug 2021 09:43:25 -0300 Subject: [PATCH 6/7] adjusted changeset description Signed-off-by: Aurelio Saraiva --- .changeset/two-hats-judge.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.changeset/two-hats-judge.md b/.changeset/two-hats-judge.md index 11909c8926..27768aba8b 100644 --- a/.changeset/two-hats-judge.md +++ b/.changeset/two-hats-judge.md @@ -1,6 +1,5 @@ --- '@backstage/plugin-techdocs': patch -'@backstage/plugin-techdocs-backend': patch --- -added support for title in Techdocs +Display [metadata.title](https://backstage.io/docs/features/software-catalog/descriptor-format#title-optional) for components on the TechDocs homepage, if defined; otherwise fall back to `metadata.name` as displayed before. From d288ffc77a8ed81cd706a38ba525e9b97fe3f4f5 Mon Sep 17 00:00:00 2001 From: Aurelio Saraiva Date: Tue, 31 Aug 2021 09:51:07 -0300 Subject: [PATCH 7/7] fixed typo camelcase Signed-off-by: Aurelio Saraiva --- plugins/techdocs/src/home/components/columns.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/techdocs/src/home/components/columns.tsx b/plugins/techdocs/src/home/components/columns.tsx index b7ec8271a4..d29f44da75 100644 --- a/plugins/techdocs/src/home/components/columns.tsx +++ b/plugins/techdocs/src/home/components/columns.tsx @@ -20,7 +20,7 @@ import { EntityRefLinks } from '@backstage/plugin-catalog-react'; import { Entity } from '@backstage/catalog-model'; import { DocsTableRow } from './types'; -function customTitle(entity: Entity): String { +function customTitle(entity: Entity): string { return entity.metadata.title || entity.metadata.name; }