Skip to content

Commit

Permalink
CRDCDH-1739 Data Activity show who uploaded
Browse files Browse the repository at this point in the history
  • Loading branch information
amattu2 committed Oct 18, 2024
1 parent 8b1df14 commit 7c0bd21
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 14 deletions.
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
2 changes: 2 additions & 0 deletions src/graphql/listBatches.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const FullBatchFragment = gql`
createdAt
updatedAt
}
submitterID
submitterName
status
errors
}
Expand Down
29 changes: 18 additions & 11 deletions src/types/Submissions.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,22 +167,29 @@ type Batch = {
files: BatchFileInfo[];
status: BatchStatus;
errors: string[];
/**
* The ID of the user who created the batch
*
* @since 3.1.0
*/
submitterID?: string;
/**
* The name of the user who created the batch
*
* @since 3.1.0
*/
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

0 comments on commit 7c0bd21

Please sign in to comment.