Skip to content

Commit

Permalink
Update submission table to add name/description.
Browse files Browse the repository at this point in the history
Update dashboard page to load submission data.
  • Loading branch information
NickPhura committed Dec 8, 2023
1 parent b8152cc commit e827ac2
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 60 deletions.
14 changes: 7 additions & 7 deletions api/src/paths/administrative/submission/unreviewed/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,16 +49,16 @@ GET.apiDoc = {
type: 'string',
format: 'uuid'
},
submission_feature_id: {
type: 'integer',
minimum: 1
name: {
type: 'string',
maxLength: 200
},
description: {
type: 'string',
maxLength: 3000
},
create_date: {
type: 'string'
},
data: {
type: 'object',
properties: {}
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions api/src/repositories/submission-repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1109,9 +1109,9 @@ export class SubmissionRepository extends BaseRepository {
* {
* submission_id: number;
* uuid: string;
* name: string;
* description: string;
* create_date: string;
* submission_feature_id: number;
* data: Record<string, unknown>;
* }[]
* >}
* @memberof SubmissionRepository
Expand All @@ -1120,18 +1120,18 @@ export class SubmissionRepository extends BaseRepository {
{
submission_id: number;
uuid: string;
name: string;
description: string;
create_date: string;
submission_feature_id: number;
data: Record<string, unknown>;
}[]
> {
const sqlStatement = SQL`
SELECT
submission.submission_id,
submission.uuid,
submission.create_date,
submission_feature.submission_feature_id,
submission_feature.data
submission.name,
submission.description,
submission.create_date
FROM
submission
LEFT JOIN
Expand Down
8 changes: 4 additions & 4 deletions api/src/services/submission-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -541,9 +541,9 @@ export class SubmissionService extends DBService {
* {
* submission_id: number;
* uuid: string;
* name: string;
* description: string;
* create_date: string;
* submission_feature_id: number;
* data: Record<string, unknown>;
* }[]
* >}
* @memberof SubmissionService
Expand All @@ -552,9 +552,9 @@ export class SubmissionService extends DBService {
{
submission_id: number;
uuid: string;
name: string;
description: string;
create_date: string;
submission_feature_id: number;
data: Record<string, unknown>;
}[]
> {
return this.submissionRepository.getUnreviewedSubmissions();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,72 +1,51 @@
import { CircularProgress, Link, Typography } from '@mui/material';
import { CircularProgress, Typography } from '@mui/material';
import Box from '@mui/material/Box';
import Chip from '@mui/material/Chip';
import { DataGrid, GridColDef, GridRenderCellParams, GridTreeNodeWithRender } from '@mui/x-data-grid';
import { DataGrid, GridColDef } from '@mui/x-data-grid';
import { useApi } from 'hooks/useApi';
import useDataLoader from 'hooks/useDataLoader';
import { IUnreviewedSubmission } from 'interfaces/useDatasetApi.interface';
import React from 'react';
import { ensureProtocol } from 'utils/Utils';

const DatasetsForReviewTable: React.FC<React.PropsWithChildren> = () => {
const biohubApi = useApi();

const unsecuredDatasetDataLoader = useDataLoader(() => biohubApi.dataset.getUnreviewedSubmissions());
unsecuredDatasetDataLoader.load();

const datasetList: IUnreviewedSubmission[] = unsecuredDatasetDataLoader.data ?? [];
const columns: GridColDef<IUnreviewedSubmission>[] = [
{
field: 'artifacts_to_review',
headerName: 'FILES TO REVIEW',
field: 'submission_id',
headerName: 'ID',
flex: 1,
disableColumnMenu: true
},
{
field: 'uuid',
headerName: 'UUID',
flex: 1,
disableColumnMenu: true
},
{
field: 'dataset_name',
headerName: 'TITLE',
field: 'name',
headerName: 'Name',
flex: 2,
disableColumnMenu: true,
renderCell: (params: GridRenderCellParams<IUnreviewedSubmission, any, any, GridTreeNodeWithRender>) => {
return (
<Link href={`${ensureProtocol(window.location.host)}/datasets/${params.row.dataset_id}/details`}>
{params.row.dataset_name}
</Link>
);
}
disableColumnMenu: true
},
{
field: 'dataset_type',
headerName: 'TYPE',
flex: 1,
disableColumnMenu: true,
renderCell: (params: GridRenderCellParams<IUnreviewedSubmission, any, any, GridTreeNodeWithRender>) => {
return params.row.keywords.map((item) => (
<Chip
key={params.row.dataset_id}
color="primary"
style={{ backgroundColor: '#d9eaf7', color: 'black', fontSize: '10px' }}
sx={{ textTransform: 'uppercase' }}
label={prepKeyword(item)}
/>
));
}
field: 'description',
headerName: 'Description',
flex: 2,
disableColumnMenu: true
},
{
field: 'last_updated',
headerName: 'LAST UPDATED',
field: 'create_date',
headerName: 'Date Created',
flex: 1,
disableColumnMenu: true
}
];

const prepKeyword = (keyword: string): string => {
let prep = keyword.toUpperCase();
if (prep === 'PROJECT') {
prep = 'INVENTORY PROJECT';
}
return prep;
};

return (
<>
{unsecuredDatasetDataLoader.isLoading && <CircularProgress className="pageProgress" size={40} />}
Expand Down Expand Up @@ -96,7 +75,7 @@ const DatasetsForReviewTable: React.FC<React.PropsWithChildren> = () => {
<DataGrid
sx={{ borderTop: '1pt solid #dadada', borderBottom: '1pt solid #dadada' }}
data-testid="security-reviews-data-grid"
getRowId={(row) => row.dataset_id}
getRowId={(row) => row.submission_id}
autoHeight
rows={datasetList}
columns={columns}
Expand Down
8 changes: 8 additions & 0 deletions app/src/interfaces/useDatasetApi.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,11 @@ export interface IDatasetForReview {
last_updated: string;
keywords: string[];
}

export interface IUnreviewedSubmission {
submission_id: number;
uuid: string;
name: string;
description: string;
create_date: string;
}
4 changes: 4 additions & 0 deletions database/src/migrations/release.0.8.0/biohub.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ CREATE TABLE submission(
uuid uuid DEFAULT public.gen_random_uuid() NOT NULL,
security_review_timestamp timestamptz(6),
source_system varchar(200) NOT NULL,
name varchar(200) NOT NULL,
description varchar(3000),
create_date timestamptz(6) DEFAULT now() NOT NULL,
create_user integer NOT NULL,
update_date timestamptz(6),
Expand All @@ -43,6 +45,8 @@ COMMENT ON COLUMN submission.submission_id IS 'System generated surrogate primar
COMMENT ON COLUMN submission.uuid IS 'The universally unique identifier for the submission as supplied by the source system.';
COMMENT ON COLUMN submission.security_review_timestamp IS 'The timestamp of when the security review of the submission was completed. Null indicates the security review has not been completed.';
COMMENT ON COLUMN submission.source_system IS 'The name of the source system from which the submission originated.';
COMMENT ON COLUMN submission.name IS 'The name of the submission.';
COMMENT ON COLUMN submission.description IS 'The description of the submission.';
COMMENT ON COLUMN submission.create_date IS 'The datetime the record was created.';
COMMENT ON COLUMN submission.create_user IS 'The id of the user who created the record as identified in the system user table.';
COMMENT ON COLUMN submission.update_date IS 'The datetime the record was updated.';
Expand Down
4 changes: 4 additions & 0 deletions database/src/seeds/04_mock_test_data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -218,11 +218,15 @@ const insertSubmission = () => `
INSERT INTO submission
(
uuid,
name,
description,
source_system
)
values
(
public.gen_random_uuid(),
$$${faker.company.name()}$$,
$$${faker.lorem.words({ min: 5, max: 100 })}$$,
'SIMS'
)
RETURNING submission_id;
Expand Down

0 comments on commit e827ac2

Please sign in to comment.