Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CRDCDH-1739 Data Activity show who uploaded #500

Draft
wants to merge 3 commits into
base: 3.1.0
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/content/dataSubmissions/DataActivity.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ import {
import { FormatDate } from "../../utils";
import FileListDialog from "../../components/FileListDialog";
import ErrorDetailsDialog from "../../components/ErrorDetailsDialog";
import StyledTooltip from "../../components/StyledFormComponents/StyledTooltip";

const StyledDateTooltip = styled(StyledTooltip)({
cursor: "pointer",
});

const StyledRejectedStatus = styled("div")({
color: "#B54717",
Expand Down Expand Up @@ -107,14 +112,24 @@ const columns: Column<Batch>[] = [
},
{
label: "Uploaded Date",
renderValue: (data) =>
data?.createdAt ? `${FormatDate(data.createdAt, "MM-DD-YYYY [at] hh:mm A")}` : "",
renderValue: (data) => (
<StyledDateTooltip title={FormatDate(data.createdAt, "M/D/YYYY h:mm A")} placement="top">
<span data-testid={`activity-uploaded-date-${data?._id}`}>
{FormatDate(data.createdAt, "M/D/YYYY")}
</span>
</StyledDateTooltip>
),
field: "createdAt",
default: true,
sx: {
minWidth: "240px",
minWidth: "92px",
},
},
{
label: "Uploaded By",
renderValue: (data) => data?.submitterName || "",
field: "submitterName",
},
{
label: "Upload Errors",
renderValue: (data) => (
Expand Down
3 changes: 2 additions & 1 deletion src/graphql/listBatches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const FullBatchFragment = gql`
createdAt
updatedAt
}
submitterName
status
errors
}
Expand Down Expand Up @@ -78,7 +79,7 @@ export type Response<IsPartial = false> = {
total: number;
batches: (IsPartial extends true
? Pick<Batch, "_id" | "displayID" | "createdAt" | "updatedAt">
: Batch)[];
: Omit<Batch, "submitterID">)[];
};
batchStatusList: {
batches: Pick<Batch, "_id" | "status">[];
Expand Down
29 changes: 16 additions & 13 deletions src/types/Submissions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,28 +161,31 @@ type UploadType = "metadata" | "data file";
type Batch = {
_id: string;
displayID: number;
submissionID: string; // parent
submissionID: string;
type: UploadType;
fileCount: number; // calculated by BE
fileCount: number;
files: BatchFileInfo[];
status: BatchStatus;
errors: string[];
/**
* The ID of the user who created the batch
*/
submitterID?: string;
/**
* The name of the user who created the batch
*/
submitterName?: string;
createdAt: string; // ISO 8601 date time format with UTC or offset e.g., 2023-05-01T09:23:30Z
updatedAt: string; // ISO 8601 date time format with UTC or offset e.g., 2023-05-01T09:23:30Z
};

type NewBatch = {
_id: string;
submissionID: string; // parent
bucketName?: string; // S3 bucket of the submission, for file batch / CLI use
filePrefix?: string; // prefix/path within S3 bucket, for file batch / CLI use
type: UploadType;
fileCount: number; // calculated by BE
type NewBatch = Pick<
Batch,
"_id" | "submissionID" | "type" | "fileCount" | "status" | "errors" | "createdAt" | "updatedAt"
> & {
bucketName?: string;
filePrefix?: string;
files: FileURL[];
status: BatchStatus; // [New, Uploaded, Upload Failed, Loaded, Rejected] Loaded and Rejected are for metadata batch only
errors: string[];
createdAt: string; // ISO 8601 date time format with UTC or offset e.g., 2023-05-01T09:23:30Z
updatedAt: string; // ISO 8601 date time format with UTC or offset e.g., 2023-05-01T09:23:30Z
};

type ListBatches = {
Expand Down