diff --git a/.changeset/fuzzy-socks-do.md b/.changeset/fuzzy-socks-do.md new file mode 100644 index 0000000000..aabc10f0cd --- /dev/null +++ b/.changeset/fuzzy-socks-do.md @@ -0,0 +1,5 @@ +--- +'@backstage/plugin-techdocs': patch +--- + +Allow for searching TechDocs by entity title diff --git a/plugins/techdocs-backend/examples/documented-component/catalog-info.yaml b/plugins/techdocs-backend/examples/documented-component/catalog-info.yaml index e6d14025e1..6b30213a60 100644 --- a/plugins/techdocs-backend/examples/documented-component/catalog-info.yaml +++ b/plugins/techdocs-backend/examples/documented-component/catalog-info.yaml @@ -2,7 +2,7 @@ apiVersion: backstage.io/v1alpha1 kind: Component metadata: name: documented-component - title: Documented Component + title: Example Docs description: A Service with TechDocs documentation annotations: backstage.io/techdocs-ref: dir:. diff --git a/plugins/techdocs/api-report.md b/plugins/techdocs/api-report.md index ebd6adcd3c..90834c6fcb 100644 --- a/plugins/techdocs/api-report.md +++ b/plugins/techdocs/api-report.md @@ -78,6 +78,13 @@ export type DocsGroupConfig = { export const DocsTable: { (props: DocsTableProps): React_2.JSX.Element | null; columns: { + createTitleColumn( + options?: + | { + hidden?: boolean | undefined; + } + | undefined, + ): TableColumn; createNameColumn(): TableColumn; createOwnerColumn(): TableColumn; createKindColumn(): TableColumn; @@ -142,6 +149,13 @@ export type EntityListDocsGridPageProps = { export const EntityListDocsTable: { (props: EntityListDocsTableProps): React_2.JSX.Element; columns: { + createTitleColumn( + options?: + | { + hidden?: boolean | undefined; + } + | undefined, + ): TableColumn; createNameColumn(): TableColumn; createOwnerColumn(): TableColumn; createKindColumn(): TableColumn; diff --git a/plugins/techdocs/src/home/components/Tables/DocsTable.tsx b/plugins/techdocs/src/home/components/Tables/DocsTable.tsx index de57c70e6a..b1537affdb 100644 --- a/plugins/techdocs/src/home/components/Tables/DocsTable.tsx +++ b/plugins/techdocs/src/home/components/Tables/DocsTable.tsx @@ -52,6 +52,7 @@ export type DocsTableProps = { }; const defaultColumns: TableColumn[] = [ + columnFactories.createTitleColumn({ hidden: true }), columnFactories.createNameColumn(), columnFactories.createOwnerColumn(), columnFactories.createKindColumn(), diff --git a/plugins/techdocs/src/home/components/Tables/columns.tsx b/plugins/techdocs/src/home/components/Tables/columns.tsx index 8c8346b406..ef22f6d288 100644 --- a/plugins/techdocs/src/home/components/Tables/columns.tsx +++ b/plugins/techdocs/src/home/components/Tables/columns.tsx @@ -30,11 +30,20 @@ function customTitle(entity: Entity): string { * @public */ export const columnFactories = { + createTitleColumn(options?: { hidden?: boolean }): TableColumn { + const nameCol = columnFactories.createNameColumn(); + return { + ...nameCol, + field: 'entity.metadata.title', + hidden: options?.hidden, + }; + }, createNameColumn(): TableColumn { return { title: 'Document', field: 'entity.metadata.name', highlight: true, + searchable: true, defaultSort: 'asc', customSort: (row1, row2) => { const title1 = customTitle(row1.entity).toLocaleLowerCase();