todo,todo-backend: add tag field to TodoItems

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2021-03-11 22:10:47 +01:00
parent 378f77b4f6
commit c07728eec8
10 changed files with 21 additions and 6 deletions
+1
View File
@@ -50,6 +50,7 @@ const mockedApi = {
items: [
{
text: 'Make sure this works',
tag: 'TODO',
author: 'Rugvip',
viewUrl: 'https://github.com/backstage/backstage',
},
+4 -1
View File
@@ -21,6 +21,9 @@ export type TodoItem = {
/** The contents of the TODO comment */
text: string;
/** The tag used, e.g. TODO, FIXME */
tag: string;
/** References author, if any */
author?: string;
@@ -39,7 +42,7 @@ export type TodoListOptions = {
offset?: number;
limit?: number;
orderBy?: {
field: 'text' | 'author' | 'viewUrl' | 'repoFilePath';
field: 'text' | 'tag' | 'author' | 'viewUrl' | 'repoFilePath';
direction: 'asc' | 'desc';
};
};
@@ -29,6 +29,7 @@ describe('TodoList', () => {
items: [
{
text: 'My TODO',
tag: 'FIXME',
viewUrl: 'https://example.com',
repoFilePath: '/my-file.js',
},
@@ -48,6 +49,6 @@ describe('TodoList', () => {
</ApiProvider>,
);
await expect(rendered.findByText('1-1 of 1')).resolves.toBeInTheDocument();
await expect(rendered.findByText('FIXME')).resolves.toBeInTheDocument();
});
});
@@ -30,6 +30,10 @@ import { TodoItem, TodoListOptions } from '../../api/types';
const PAGE_SIZE = 10;
const columns: TableColumn<TodoItem>[] = [
{
title: 'Tag',
field: 'tag',
},
{
title: 'Text',
field: 'text',
@@ -53,7 +57,6 @@ const columns: TableColumn<TodoItem>[] = [
{
title: 'Author',
field: 'author',
width: '20%',
render: ({ author }) => <OverflowTooltip text={author} />,
},
];