diff --git a/src/api/api.ts b/src/api/api.ts index 33732766120f4f30b564d8ebe0fdac44c5a6c4f8..aa2cef112eef959ead9bee018f5bf33090806cb4 100644 --- a/src/api/api.ts +++ b/src/api/api.ts @@ -386,6 +386,18 @@ export interface Repository { * @memberof Repository */ 'id'?: string; + /** + * + * @type {string} + * @memberof Repository + */ + 'type'?: RepositoryTypeEnum; + /** + * + * @type {RepositoryAttributes} + * @memberof Repository + */ + 'attributes'?: RepositoryAttributes; /** * * @type {Links} @@ -393,6 +405,38 @@ export interface Repository { */ 'links'?: Links; } + +export const RepositoryTypeEnum = { + Repository: 'Repository' +} as const; + +export type RepositoryTypeEnum = typeof RepositoryTypeEnum[keyof typeof RepositoryTypeEnum]; + +/** + * + * @export + * @interface RepositoryAttributes + */ +export interface RepositoryAttributes { + /** + * + * @type {string} + * @memberof RepositoryAttributes + */ + 'description'?: string; + /** + * + * @type {string} + * @memberof RepositoryAttributes + */ + 'maintainer'?: string; + /** + * + * @type {{ [key: string]: any; }} + * @memberof RepositoryAttributes + */ + 'attributes'?: { [key: string]: any; }; +} /** * * @export diff --git a/src/components/repositories/list.tsx b/src/components/repositories/list.tsx index a9809c0b08bf469166b968950137c66feaa589ee..a9320319860d3ac6383cec7f08ea9826395f69ab 100644 --- a/src/components/repositories/list.tsx +++ b/src/components/repositories/list.tsx @@ -20,11 +20,30 @@ const columns: Array<GridColDef<IRepository>> = [ renderCell: (params) => { return <Link href={'./repositories/' + params.value}>{params.value}</Link> } + }, { + field: 'description', + headerName: 'Description', + type: 'string', + minWidth: 250, + flex: 1, + valueGetter: (params): string => { + return params?.row?.attributes?.description + } + }, { + field: 'maintainer', + headerName: 'Maintainer', + type: 'string', + minWidth: 200, + flex: 1, + valueGetter: (params): string => { + return params?.row?.attributes?.maintainer + } } ] export const RepositoriesList: React.FC<IResourceComponentsProps> = () => { const { dataGridProps } = useDataGrid<IRepository>() + console.log('repositoriesList', dataGridProps) return ( <List> diff --git a/src/interfaces/IRepository.tsx b/src/interfaces/IRepository.tsx index dde8ae79a562c91e503be3a84958fd5966f8cf8b..590a788f0bed5d2be2199d4ab4f41534b62e9a06 100644 --- a/src/interfaces/IRepository.tsx +++ b/src/interfaces/IRepository.tsx @@ -1,5 +1,12 @@ +export interface IRepositoryAttributes { + description: string + maintainer: string + attributes: any +} + export interface IRepository { id: string + attributes: IRepositoryAttributes } export default IRepository