Merged PR 2176: update formatting
update formatting Related work items: #22012
This commit is contained in:
@@ -5,7 +5,7 @@ import { PrismaClient } from "@prisma/client";
|
|||||||
import CryptoJS from "crypto-js";
|
import CryptoJS from "crypto-js";
|
||||||
import { getUpToLastSlash, streamToString } from "../utils/adminHelper";
|
import { getUpToLastSlash, streamToString } from "../utils/adminHelper";
|
||||||
import { listContainersForUser } from "../../../actions/azurestorage";
|
import { listContainersForUser } from "../../../actions/azurestorage";
|
||||||
|
import pLimit from "p-limit";
|
||||||
const prisma = global.prisma || new PrismaClient();
|
const prisma = global.prisma || new PrismaClient();
|
||||||
const WORDKEY = process.env.HASHKEY;
|
const WORDKEY = process.env.HASHKEY;
|
||||||
/**
|
/**
|
||||||
@@ -34,8 +34,10 @@ export async function fetchAdminStorageData() {
|
|||||||
|
|
||||||
const users = await prisma.user.findMany();
|
const users = await prisma.user.findMany();
|
||||||
|
|
||||||
|
const limit = pLimit(5);
|
||||||
let data = await Promise.all(
|
let data = await Promise.all(
|
||||||
users.map(async (user) => {
|
users.map(async (user) => {
|
||||||
|
limit(async () => {
|
||||||
const containers = await listContainersForUser(
|
const containers = await listContainersForUser(
|
||||||
blobServiceClient,
|
blobServiceClient,
|
||||||
`${user.id}`,
|
`${user.id}`,
|
||||||
@@ -54,7 +56,9 @@ export async function fetchAdminStorageData() {
|
|||||||
`/api/file/downloadblob?container=${
|
`/api/file/downloadblob?container=${
|
||||||
container.container
|
container.container
|
||||||
}&casefolderID=${folderPath}&blobname=${blob.name
|
}&casefolderID=${folderPath}&blobname=${blob.name
|
||||||
.substring(blob.name.lastIndexOf("/") + 1)
|
.substring(
|
||||||
|
blob.name.lastIndexOf("/") + 1
|
||||||
|
)
|
||||||
.trim()}`,
|
.trim()}`,
|
||||||
process.env.HASHKEY
|
process.env.HASHKEY
|
||||||
);
|
);
|
||||||
@@ -62,7 +66,8 @@ export async function fetchAdminStorageData() {
|
|||||||
const fileNameOnly = blob.name.substring(
|
const fileNameOnly = blob.name.substring(
|
||||||
blob.name.lastIndexOf("/") + 1
|
blob.name.lastIndexOf("/") + 1
|
||||||
);
|
);
|
||||||
const isTmpFile = fileNameOnly.startsWith("TMP-");
|
const isTmpFile =
|
||||||
|
fileNameOnly.startsWith("TMP-");
|
||||||
|
|
||||||
const blobWithHash = {
|
const blobWithHash = {
|
||||||
...blob,
|
...blob,
|
||||||
@@ -92,7 +97,9 @@ export async function fetchAdminStorageData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// rep.json handling
|
// rep.json handling
|
||||||
if (blob.name.toLowerCase().endsWith("rep.json")) {
|
if (
|
||||||
|
blob.name.toLowerCase().endsWith("rep.json")
|
||||||
|
) {
|
||||||
folderGroup.hasRepJson = true;
|
folderGroup.hasRepJson = true;
|
||||||
folderGroup.repJsonBlob = blobWithHash;
|
folderGroup.repJsonBlob = blobWithHash;
|
||||||
|
|
||||||
@@ -140,6 +147,7 @@ export async function fetchAdminStorageData() {
|
|||||||
containers: containersWithHashes
|
containers: containersWithHashes
|
||||||
}
|
}
|
||||||
: null;
|
: null;
|
||||||
|
});
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,8 @@ export const AppealRow_pdf = (props) => {
|
|||||||
color: "grey"
|
color: "grey"
|
||||||
},
|
},
|
||||||
documentList: {
|
documentList: {
|
||||||
fontSize: 10
|
fontSize: 10,
|
||||||
|
lineHeight: 1.4
|
||||||
},
|
},
|
||||||
richArea: {
|
richArea: {
|
||||||
fontSize: 12,
|
fontSize: 12,
|
||||||
@@ -432,10 +433,16 @@ export const AppealRow_pdf = (props) => {
|
|||||||
flexDirection: "column",
|
flexDirection: "column",
|
||||||
marginBottom: 10
|
marginBottom: 10
|
||||||
}}
|
}}
|
||||||
wrap={false}
|
|
||||||
>
|
>
|
||||||
<View
|
<View
|
||||||
wrap={false}
|
style={{
|
||||||
|
flexDirection: "column",
|
||||||
|
marginBottom: 10
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
{/* Removed wrap={false} here so the list can flow to page 2 */}
|
||||||
|
|
||||||
|
<View
|
||||||
style={{
|
style={{
|
||||||
flexDirection: "row",
|
flexDirection: "row",
|
||||||
marginBottom: 10
|
marginBottom: 10
|
||||||
@@ -449,18 +456,32 @@ export const AppealRow_pdf = (props) => {
|
|||||||
{rows[0].value}
|
{rows[0].value}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
style={
|
style={
|
||||||
styles.questionAnswerWide
|
styles.questionAnswerWide
|
||||||
}
|
}
|
||||||
>
|
>
|
||||||
{blobList.map((blob, i) => (
|
{blobList.map((blob, i) => {
|
||||||
<Text key={i}>
|
const isTargetType =
|
||||||
{getDocumentTypeFromFilename(
|
getDocumentTypeFromFilename(
|
||||||
blob.name
|
blob.name
|
||||||
) ===
|
) ===
|
||||||
documentTypeCode[0]
|
documentTypeCode[0]
|
||||||
.value && (
|
.value;
|
||||||
|
|
||||||
|
if (!isTargetType)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
/* wrap={false} here ensures a single filename stays together */
|
||||||
|
<View
|
||||||
|
key={i}
|
||||||
|
wrap={false}
|
||||||
|
style={{
|
||||||
|
marginBottom: 4
|
||||||
|
}}
|
||||||
|
>
|
||||||
<Text
|
<Text
|
||||||
style={
|
style={
|
||||||
styles.documentList
|
styles.documentList
|
||||||
@@ -468,15 +489,12 @@ export const AppealRow_pdf = (props) => {
|
|||||||
>
|
>
|
||||||
{blob.name}
|
{blob.name}
|
||||||
{blob?.size &&
|
{blob?.size &&
|
||||||
" - " +
|
` - ${bytesToSize(blob.size)}`}
|
||||||
bytesToSize(
|
|
||||||
blob?.size
|
|
||||||
)}{" "}
|
|
||||||
{"\n"}
|
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
</View>
|
||||||
</Text>
|
);
|
||||||
))}
|
})}
|
||||||
|
</View>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user