improve default docs sorting
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-techdocs': patch
|
||||
---
|
||||
|
||||
Improve default sorting of docs table
|
||||
@@ -51,6 +51,13 @@ export type DocsTableProps = {
|
||||
options?: TableOptions<DocsTableRow>;
|
||||
};
|
||||
|
||||
const defaultColumns: TableColumn<DocsTableRow>[] = [
|
||||
columnFactories.createNameColumn(),
|
||||
columnFactories.createOwnerColumn(),
|
||||
columnFactories.createKindColumn(),
|
||||
columnFactories.createTypeColumn(),
|
||||
];
|
||||
|
||||
/**
|
||||
* Component which renders a table documents
|
||||
*
|
||||
@@ -84,13 +91,6 @@ export const DocsTable = (props: DocsTableProps) => {
|
||||
};
|
||||
});
|
||||
|
||||
const defaultColumns: TableColumn<DocsTableRow>[] = [
|
||||
columnFactories.createNameColumn(),
|
||||
columnFactories.createOwnerColumn(),
|
||||
columnFactories.createKindColumn(),
|
||||
columnFactories.createTypeColumn(),
|
||||
];
|
||||
|
||||
const defaultActions: TableProps<DocsTableRow>['actions'] = [
|
||||
actionFactories.createCopyDocsUrlAction(copyToClipboard),
|
||||
];
|
||||
|
||||
@@ -35,6 +35,12 @@ export const columnFactories = {
|
||||
title: 'Document',
|
||||
field: 'entity.metadata.name',
|
||||
highlight: true,
|
||||
defaultSort: 'asc',
|
||||
customSort: (row1, row2) => {
|
||||
const title1 = customTitle(row1.entity).toLocaleLowerCase();
|
||||
const title2 = customTitle(row2.entity).toLocaleLowerCase();
|
||||
return title1.localeCompare(title2);
|
||||
},
|
||||
render: (row: DocsTableRow) => (
|
||||
<SubvalueCell
|
||||
value={
|
||||
|
||||
Reference in New Issue
Block a user