From e5af62f2cbbc5488546903fd93a48e5e3fca82ea Mon Sep 17 00:00:00 2001 From: tahaKhanAbdalli Date: Thu, 21 Dec 2023 18:45:13 +0500 Subject: [PATCH 01/26] clarify special character issue resolved --- src/utils/password-validation.schema.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/password-validation.schema.ts b/src/utils/password-validation.schema.ts index 6484895a..19468de8 100644 --- a/src/utils/password-validation.schema.ts +++ b/src/utils/password-validation.schema.ts @@ -94,7 +94,7 @@ const common = yup .matches(/[0-9]/, 'Password must contain at least one numeric digit') .matches( /[!@#$%^&*(),.?":{}|<>]/, - 'Password must contain at least one special character' + 'Special character required - !@#$%^&*(),.?":{}|<>' ) .test( 'no-common-patterns', From 1aa8c4680de72a43614983a0c902fc73424aa485 Mon Sep 17 00:00:00 2001 From: tahaKhanAbdalli Date: Fri, 22 Dec 2023 11:14:57 +0500 Subject: [PATCH 02/26] item remove from filter in audit log --- src/resources/audit/AuditList.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/resources/audit/AuditList.tsx b/src/resources/audit/AuditList.tsx index da9e77ad..3a6c030b 100644 --- a/src/resources/audit/AuditList.tsx +++ b/src/resources/audit/AuditList.tsx @@ -65,7 +65,6 @@ const filters = [ label='User' />, , - , Date: Fri, 22 Dec 2023 16:45:24 +0500 Subject: [PATCH 03/26] handling subject field in auditlist resolved --- src/resources/audit/AuditList.tsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/resources/audit/AuditList.tsx b/src/resources/audit/AuditList.tsx index 3a6c030b..0c51246d 100644 --- a/src/resources/audit/AuditList.tsx +++ b/src/resources/audit/AuditList.tsx @@ -15,7 +15,8 @@ import { ExportButton, useGetList, Link, - BooleanField + BooleanField, + NumberInput } from 'react-admin' import * as constants from '../../constants' import ActivityTypes from '../../utils/activity-types' @@ -65,13 +66,18 @@ const filters = [ label='User' />, , + , , , - + ] const resourcesRefKey: Record = { @@ -244,7 +250,7 @@ export default function AuditList({ source='resource' label='Resource' /> {!omit.includes('dataId') && ( - label='Name' + label='Name ' render={(record) => { return ( record.dataId && From fb4af6d02c3fe07bd9c06d2650302c15a5f0a100 Mon Sep 17 00:00:00 2001 From: tahaKhanAbdalli Date: Fri, 22 Dec 2023 18:29:27 +0500 Subject: [PATCH 04/26] remarks were not showing into the address list issue resolved --- src/resources/addresses/AddressList.tsx | 2 +- src/types.d.ts | 2 +- src/utils/init-data.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/resources/addresses/AddressList.tsx b/src/resources/addresses/AddressList.tsx index 4f88d0a6..99e144ad 100644 --- a/src/resources/addresses/AddressList.tsx +++ b/src/resources/addresses/AddressList.tsx @@ -17,7 +17,7 @@ export default function AddressList(): React.ReactElement { source='fullAddress' /> source='active' looseValue /> source='createdAt' /> - source='Remarks' /> + source='remarks' /> ) diff --git a/src/types.d.ts b/src/types.d.ts index 014d2926..99b8e222 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -261,7 +261,7 @@ interface Address { createdAt: string fullAddress: string active: boolean - Remarks: string + remarks: string } interface Dispatch { diff --git a/src/utils/init-data.ts b/src/utils/init-data.ts index 985d06e1..71ce63d6 100644 --- a/src/utils/init-data.ts +++ b/src/utils/init-data.ts @@ -96,7 +96,7 @@ export const getAddresses = ( id: index + 1, fullAddress: `${ctr} Some St, Some Town, Some County, DD${ctr} ${ctr}EF`, createdAt: DateTime.now().toISO() ?? '', - Remarks: '', + remarks: '', active } }) From 8abd7383c4a5973af0d7cddbf9fdcff460a7d649 Mon Sep 17 00:00:00 2001 From: tahaKhanAbdalli Date: Tue, 26 Dec 2023 11:06:58 +0500 Subject: [PATCH 05/26] change the name of subject to object and data to subject --- src/resources/audit/AuditList.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/resources/audit/AuditList.tsx b/src/resources/audit/AuditList.tsx index 0c51246d..8d0ac29c 100644 --- a/src/resources/audit/AuditList.tsx +++ b/src/resources/audit/AuditList.tsx @@ -66,17 +66,21 @@ const filters = [ label='User' />, , - , , , + , ] From d414ef3ad0d2d4ff26cd45e73d2291b4ce32f419 Mon Sep 17 00:00:00 2001 From: tahaKhanAbdalli Date: Tue, 26 Dec 2023 12:08:35 +0500 Subject: [PATCH 06/26] added build date into the footer --- src/components/Layout/Footer.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/Layout/Footer.tsx b/src/components/Layout/Footer.tsx index 2a399106..6dee69a0 100644 --- a/src/components/Layout/Footer.tsx +++ b/src/components/Layout/Footer.tsx @@ -3,7 +3,10 @@ import preval from 'preval.macro' const Footer = (): React.ReactElement => { const buildDate = preval`module.exports = new Date().toISOString().slice(0, 19).replace('T', ' ')` - const trimmedAppBuildDate = buildDate.substring(0, buildDate.length - 3) + const trimmedAppBuildDate = `Build Date: ${buildDate.substring( + 0, + buildDate.length - 3 + )}` return (
Date: Tue, 26 Dec 2023 14:04:13 +0500 Subject: [PATCH 07/26] media type need edit issue resolved --- src/resources/reference-data/ReferenceDataForm.tsx | 2 +- src/resources/reference-data/ReferenceDataShow.tsx | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/resources/reference-data/ReferenceDataForm.tsx b/src/resources/reference-data/ReferenceDataForm.tsx index beab9297..b4835821 100644 --- a/src/resources/reference-data/ReferenceDataForm.tsx +++ b/src/resources/reference-data/ReferenceDataForm.tsx @@ -79,7 +79,7 @@ const FormContent = ({ {name === constants.R_MEDIA_TYPE ? ( ) : null} diff --git a/src/resources/reference-data/ReferenceDataShow.tsx b/src/resources/reference-data/ReferenceDataShow.tsx index a7fbcf48..6a7b2ef9 100644 --- a/src/resources/reference-data/ReferenceDataShow.tsx +++ b/src/resources/reference-data/ReferenceDataShow.tsx @@ -23,6 +23,7 @@ const Actions = ({ resource }: ShowActionProps): React.ReactElement => { const redirect = useRedirect() return ( + { redirect( @@ -58,8 +59,12 @@ export default function ReferenceDataShow({ variant='h6' source='name' /> {name === R_MEDIA_TYPE ? ( - + + + Note: Item-size is + stored to facilitate future shelf loading calculations. + ) : null} From 87da05d14ee4dd2927c27307e57a0756153261ec Mon Sep 17 00:00:00 2001 From: tahaKhanAbdalli Date: Tue, 26 Dec 2023 16:32:49 +0500 Subject: [PATCH 08/26] Departure date edit able issue resolved --- src/resources/users/UserForm.tsx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/resources/users/UserForm.tsx b/src/resources/users/UserForm.tsx index c7f97032..dd8400fc 100644 --- a/src/resources/users/UserForm.tsx +++ b/src/resources/users/UserForm.tsx @@ -1,5 +1,11 @@ import React from 'react' -import { SimpleForm, TextInput, useEditContext, SelectInput } from 'react-admin' +import { + SimpleForm, + TextInput, + useEditContext, + SelectInput, + DateTimeInput +} from 'react-admin' import { yupResolver } from '@hookform/resolvers/yup' import * as yup from 'yup' import EditToolBar from '../../components/EditToolBar' @@ -59,6 +65,11 @@ export default function UserForm({ isEdit }: FormProps): React.ReactElement { /> + ) } From e258eb255054e4f2791f83e2f0e634685d6c2c84 Mon Sep 17 00:00:00 2001 From: Ian Mayo Date: Tue, 2 Jan 2024 12:31:23 +0000 Subject: [PATCH 09/26] Minor tidying to label --- .../reference-data/ReferenceDataShow.tsx | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/resources/reference-data/ReferenceDataShow.tsx b/src/resources/reference-data/ReferenceDataShow.tsx index 6a7b2ef9..3e159497 100644 --- a/src/resources/reference-data/ReferenceDataShow.tsx +++ b/src/resources/reference-data/ReferenceDataShow.tsx @@ -59,13 +59,14 @@ export default function ReferenceDataShow({ variant='h6' source='name' /> {name === R_MEDIA_TYPE ? ( - - - - Note: Item-size is - stored to facilitate future shelf loading calculations. - - + + + +   + (Note: Item-size is + stored to facilitate future shelf loading calculations) + + ) : null} source='active' looseValue /> From 01d4ac2f681b8a97c1f825447550038025bb928f Mon Sep 17 00:00:00 2001 From: Ian Mayo Date: Tue, 2 Jan 2024 13:19:13 +0000 Subject: [PATCH 10/26] Correct field titles --- src/resources/audit/AuditList.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/resources/audit/AuditList.tsx b/src/resources/audit/AuditList.tsx index 8d0ac29c..80fdf2d9 100644 --- a/src/resources/audit/AuditList.tsx +++ b/src/resources/audit/AuditList.tsx @@ -254,7 +254,7 @@ export default function AuditList({ source='resource' label='Resource' /> {!omit.includes('dataId') && ( - label='Name ' + label='Subject ' render={(record) => { return ( record.dataId && @@ -267,7 +267,7 @@ export default function AuditList({ source value for different kinds of resource */} {!omit.includes('subjectId') && ( - label='Subject Item' + label='Object' render={(record) => { return ( record.subjectId && From 2d0c6055af165c66a46fb0cdf386b75d23f64bfd Mon Sep 17 00:00:00 2001 From: Ian Mayo Date: Tue, 2 Jan 2024 15:50:00 +0000 Subject: [PATCH 11/26] use maximum value of id, rather than current number of rows --- src/hooks/useCustomId.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/hooks/useCustomId.ts b/src/hooks/useCustomId.ts index a6117777..51a2e598 100644 --- a/src/hooks/useCustomId.ts +++ b/src/hooks/useCustomId.ts @@ -14,7 +14,7 @@ export default function useCustomid(): UseCustomId { const { getValues } = useFormContext() const [create] = useCreate() as any const resource = useResourceContext() - const { total = 0 } = useGetList(resource, { + const results = useGetList(resource, { sort: { field: 'id', order: 'DESC' }, pagination: { page: 1, perPage: 1 } }) @@ -26,8 +26,8 @@ export default function useCustomid(): UseCustomId { const values = getValues() const preFix = ID_FIX?.[resource] - const totalItems: number = total - const recordNumber = totalItems + 1 + const maxId: number = results.data?.length ? results.data[0].id : 0 + const recordNumber = maxId + 1 const id = typeof preFix !== 'undefined' ? `${preFix}-${recordNumber}` : recordNumber From 94ae39f4887ed5deb288e8adc47ae9b9f5c147be Mon Sep 17 00:00:00 2001 From: tahaKhanAbdalli Date: Wed, 3 Jan 2024 14:26:56 +0500 Subject: [PATCH 12/26] resource filter in audit list issue resolved --- src/resources/audit/AuditList.tsx | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/src/resources/audit/AuditList.tsx b/src/resources/audit/AuditList.tsx index 80fdf2d9..4e367be5 100644 --- a/src/resources/audit/AuditList.tsx +++ b/src/resources/audit/AuditList.tsx @@ -7,7 +7,6 @@ import { DateTimeInput, useListContext, AutocompleteArrayInput, - TextInput, FunctionField, DatagridConfigurable, type DatagridConfigurableProps, @@ -16,7 +15,8 @@ import { useGetList, Link, BooleanField, - NumberInput + NumberInput, + SelectInput } from 'react-admin' import * as constants from '../../constants' import ActivityTypes from '../../utils/activity-types' @@ -43,6 +43,21 @@ const SecurityRelatedFilter = ({ return } +const availableResources = [ + 'user', + 'item', + 'batch', + 'destruction', + 'vaultLocation', + 'dispatch', + 'project', + 'platform', + 'mediaType' +] +const yourListOfResources = availableResources.map((resource) => ({ + id: resource, + name: resource +})) const choices = ActivityTypes.map((v) => ({ name: v.label, id: v.label })) const filters = [ @@ -65,7 +80,13 @@ const filters = [ key='user' label='User' />, - , + , + Date: Wed, 3 Jan 2024 16:15:01 +0500 Subject: [PATCH 13/26] unique value of new media type id issues resolved --- src/hooks/useCustomId.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/hooks/useCustomId.ts b/src/hooks/useCustomId.ts index 51a2e598..9bea9a3a 100644 --- a/src/hooks/useCustomId.ts +++ b/src/hooks/useCustomId.ts @@ -14,9 +14,9 @@ export default function useCustomid(): UseCustomId { const { getValues } = useFormContext() const [create] = useCreate() as any const resource = useResourceContext() - const results = useGetList(resource, { - sort: { field: 'id', order: 'DESC' }, - pagination: { page: 1, perPage: 1 } + const {data : existingRcordes} = useGetList(resource, { + sort: {field: 'id', order: "DESC"}, + pagination: {page: 1, perPage: 1} }) const createPath = useCreatePath() const redirect = useRedirect() @@ -26,10 +26,9 @@ export default function useCustomid(): UseCustomId { const values = getValues() const preFix = ID_FIX?.[resource] - const maxId: number = results.data?.length ? results.data[0].id : 0 - const recordNumber = maxId + 1 + const highestId = existingRcordes?.[0]?.id || 0; const id = - typeof preFix !== 'undefined' ? `${preFix}-${recordNumber}` : recordNumber + typeof preFix !== 'undefined' ? `${preFix}-${highestId + 1}` : highestId + 1 const data = { id, ...values } From ca85cbe6dfa1cc9184d7c9cff4e2a9eb10458817 Mon Sep 17 00:00:00 2001 From: tahaKhanAbdalli Date: Wed, 3 Jan 2024 19:06:17 +0500 Subject: [PATCH 14/26] cosmatic displayed values in resource columns. --- src/resources/audit/AuditList.tsx | 27 +++++++++++++-------------- src/resources/audit/config.tsx | 24 ++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 14 deletions(-) create mode 100644 src/resources/audit/config.tsx diff --git a/src/resources/audit/AuditList.tsx b/src/resources/audit/AuditList.tsx index 4e367be5..7dad5ad6 100644 --- a/src/resources/audit/AuditList.tsx +++ b/src/resources/audit/AuditList.tsx @@ -25,7 +25,7 @@ import SourceField from '../../components/SourceField' import SourceInput from '../../components/SourceInput' import StyledTopToolbar from '../../components/StyledTopToolbar' import { useLocation } from 'react-router-dom' - +import { availableResources, cosmeticLabels } from './config' interface Props { label: string source: string @@ -43,20 +43,10 @@ const SecurityRelatedFilter = ({ return } -const availableResources = [ - 'user', - 'item', - 'batch', - 'destruction', - 'vaultLocation', - 'dispatch', - 'project', - 'platform', - 'mediaType' -] + const yourListOfResources = availableResources.map((resource) => ({ id: resource, - name: resource + name: cosmeticLabels[resource as keyof typeof cosmeticLabels] })) const choices = ActivityTypes.map((v) => ({ name: v.label, id: v.label })) @@ -272,7 +262,16 @@ export default function AuditList({ label='Security Related' looseValue /> - source='resource' label='Resource' /> + + source='resource' + label='Resource' + render={(record) => ( + + {cosmeticLabels[record.resource as keyof typeof cosmeticLabels] || + record.resource} + + )} + /> {!omit.includes('dataId') && ( label='Subject ' diff --git a/src/resources/audit/config.tsx b/src/resources/audit/config.tsx new file mode 100644 index 00000000..8542847e --- /dev/null +++ b/src/resources/audit/config.tsx @@ -0,0 +1,24 @@ +import * as constants from '../../constants' + +export const availableResources = [ + constants.R_USERS, + constants.R_ITEMS, + constants.R_BATCHES, + constants.R_DESTRUCTION, + constants.R_VAULT_LOCATION, + constants.R_DISPATCH, + constants.R_PROJECTS, + constants.R_MEDIA_TYPE, + constants.R_PLATFORMS +] +export const cosmeticLabels = { + [constants.R_USERS]: 'User', + [constants.R_ITEMS]: 'Item', + [constants.R_BATCHES]: 'Batch', + [constants.R_DESTRUCTION]: 'Destruction', + [constants.R_VAULT_LOCATION]: 'Vault Location', + [constants.R_DISPATCH]: 'Dispatch', + [constants.R_PROJECTS]: 'Project', + [constants.R_MEDIA_TYPE]: 'Media Type', + [constants.R_PLATFORMS]: 'Platform' +} From 614ca3e415ad0d292240e6e582d281b0c95ec047 Mon Sep 17 00:00:00 2001 From: tahaKhanAbdalli Date: Wed, 3 Jan 2024 20:50:52 +0500 Subject: [PATCH 15/26] project values come from the config-file --- src/constants.ts | 24 ++++++++++++++++++++++++ src/resources/audit/AuditList.tsx | 13 ++++++++----- src/resources/audit/config.tsx | 24 ------------------------ 3 files changed, 32 insertions(+), 29 deletions(-) delete mode 100644 src/resources/audit/config.tsx diff --git a/src/constants.ts b/src/constants.ts index 9495a0b2..fd4b82ba 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -107,3 +107,27 @@ export const ITEM_CLONE = 'item_clone' export const ITEM_SAVE = 'item_save' export const CHANGE_PASSWORD_EVENT = 'change_password' + + +export const availableResources = [ + R_USERS, + R_ITEMS, + R_BATCHES, + R_DESTRUCTION, + R_VAULT_LOCATION, + R_DISPATCH, + R_PROJECTS, + R_MEDIA_TYPE, + R_PLATFORMS +] +export const cosmeticLabels = { + [R_USERS]: 'User', + [R_ITEMS]: 'Item', + [R_BATCHES]: 'Batch', + [R_DESTRUCTION]: 'Destruction', + [R_VAULT_LOCATION]: 'Vault Location', + [R_DISPATCH]: 'Dispatch', + [R_PROJECTS]: 'Project', + [R_MEDIA_TYPE]: 'Media Type', + [R_PLATFORMS]: 'Platform' +} \ No newline at end of file diff --git a/src/resources/audit/AuditList.tsx b/src/resources/audit/AuditList.tsx index 7dad5ad6..f05a40fc 100644 --- a/src/resources/audit/AuditList.tsx +++ b/src/resources/audit/AuditList.tsx @@ -25,7 +25,7 @@ import SourceField from '../../components/SourceField' import SourceInput from '../../components/SourceInput' import StyledTopToolbar from '../../components/StyledTopToolbar' import { useLocation } from 'react-router-dom' -import { availableResources, cosmeticLabels } from './config' + interface Props { label: string source: string @@ -44,9 +44,11 @@ const SecurityRelatedFilter = ({ return } -const yourListOfResources = availableResources.map((resource) => ({ +const yourListOfResources = constants.availableResources.map((resource) => ({ id: resource, - name: cosmeticLabels[resource as keyof typeof cosmeticLabels] + name: constants.cosmeticLabels[ + resource as keyof typeof constants.cosmeticLabels + ] })) const choices = ActivityTypes.map((v) => ({ name: v.label, id: v.label })) @@ -267,8 +269,9 @@ export default function AuditList({ label='Resource' render={(record) => ( - {cosmeticLabels[record.resource as keyof typeof cosmeticLabels] || - record.resource} + {constants.cosmeticLabels[ + record.resource as keyof typeof constants.cosmeticLabels + ] || record.resource} )} /> diff --git a/src/resources/audit/config.tsx b/src/resources/audit/config.tsx deleted file mode 100644 index 8542847e..00000000 --- a/src/resources/audit/config.tsx +++ /dev/null @@ -1,24 +0,0 @@ -import * as constants from '../../constants' - -export const availableResources = [ - constants.R_USERS, - constants.R_ITEMS, - constants.R_BATCHES, - constants.R_DESTRUCTION, - constants.R_VAULT_LOCATION, - constants.R_DISPATCH, - constants.R_PROJECTS, - constants.R_MEDIA_TYPE, - constants.R_PLATFORMS -] -export const cosmeticLabels = { - [constants.R_USERS]: 'User', - [constants.R_ITEMS]: 'Item', - [constants.R_BATCHES]: 'Batch', - [constants.R_DESTRUCTION]: 'Destruction', - [constants.R_VAULT_LOCATION]: 'Vault Location', - [constants.R_DISPATCH]: 'Dispatch', - [constants.R_PROJECTS]: 'Project', - [constants.R_MEDIA_TYPE]: 'Media Type', - [constants.R_PLATFORMS]: 'Platform' -} From 2903bf376d515da7d6513e247cc42a5d15b4665d Mon Sep 17 00:00:00 2001 From: tahaKhanAbdalli Date: Thu, 4 Jan 2024 14:59:19 +0500 Subject: [PATCH 16/26] project values come from configData --- src/constants.ts | 21 ++--- src/resources/audit/AuditList.tsx | 133 +++++++++++++++++------------- 2 files changed, 86 insertions(+), 68 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index fd4b82ba..6fcf9103 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -109,17 +109,7 @@ export const ITEM_SAVE = 'item_save' export const CHANGE_PASSWORD_EVENT = 'change_password' -export const availableResources = [ - R_USERS, - R_ITEMS, - R_BATCHES, - R_DESTRUCTION, - R_VAULT_LOCATION, - R_DISPATCH, - R_PROJECTS, - R_MEDIA_TYPE, - R_PLATFORMS -] + export const cosmeticLabels = { [R_USERS]: 'User', [R_ITEMS]: 'Item', @@ -129,5 +119,12 @@ export const cosmeticLabels = { [R_DISPATCH]: 'Dispatch', [R_PROJECTS]: 'Project', [R_MEDIA_TYPE]: 'Media Type', - [R_PLATFORMS]: 'Platform' + [R_PLATFORMS]: 'Platform', + [R_ORGANISATION]: 'Organization', + [R_CAT_CAVE]: 'Cat Cave', + [R_CAT_CODE]: 'Cat Code', + [R_CAT_HANDLE]: 'Cat Handle', + [R_DEPARTMENT]: 'Department', + [R_PROTECTIVE_MARKING]: 'Protective Marking', + } \ No newline at end of file diff --git a/src/resources/audit/AuditList.tsx b/src/resources/audit/AuditList.tsx index f05a40fc..548dcfa3 100644 --- a/src/resources/audit/AuditList.tsx +++ b/src/resources/audit/AuditList.tsx @@ -25,11 +25,29 @@ import SourceField from '../../components/SourceField' import SourceInput from '../../components/SourceInput' import StyledTopToolbar from '../../components/StyledTopToolbar' import { useLocation } from 'react-router-dom' +import { useConfigData } from '../../utils/useConfigData' interface Props { label: string source: string } +export const availableResources = [ + constants.R_USERS, + constants.R_ITEMS, + constants.R_BATCHES, + constants.R_DESTRUCTION, + constants.R_VAULT_LOCATION, + constants.R_DISPATCH, + constants.R_PROJECTS, + constants.R_MEDIA_TYPE, + constants.R_PLATFORMS, + constants.R_ORGANISATION, + constants.R_CAT_CAVE, + constants.R_CAT_CODE, + constants.R_CAT_HANDLE, + constants.R_DEPARTMENT, + constants.R_PROTECTIVE_MARKING +] const SecurityRelatedFilter = ({ label, @@ -43,60 +61,7 @@ const SecurityRelatedFilter = ({ return } - -const yourListOfResources = constants.availableResources.map((resource) => ({ - id: resource, - name: constants.cosmeticLabels[ - resource as keyof typeof constants.cosmeticLabels - ] -})) - const choices = ActivityTypes.map((v) => ({ name: v.label, id: v.label })) -const filters = [ - , - , - , - , - , - - , - , - , - -] - const resourcesRefKey: Record = { [constants.R_BATCHES]: 'batchNumber', [constants.R_ITEMS]: 'itemNumber', @@ -221,6 +186,61 @@ export default function AuditList({ : 'simple-audit-list' const filteredData = location.state?.filter + const ConfigData = useConfigData() + const yourListOfResources = availableResources.map((resource) => ({ + id: resource, + name: + resource === constants.R_PROJECTS + ? ConfigData?.projectName + : constants.cosmeticLabels[ + resource as keyof typeof constants.cosmeticLabels + ] + })) + + const filters = [ + , + , + , + , + , + + , + , + , + + ] return ( ( - {constants.cosmeticLabels[ - record.resource as keyof typeof constants.cosmeticLabels - ] || record.resource} + {String( + yourListOfResources.find((r) => r.id === record.resource) + ?.name || record.resource + )} )} /> From 01996dea1a519bf79389b68f5c1f04b600a788b7 Mon Sep 17 00:00:00 2001 From: tahaKhanAbdalli Date: Thu, 4 Jan 2024 15:45:08 +0500 Subject: [PATCH 17/26] lint issue resolve and code refactored --- src/resources/audit/AuditList.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/resources/audit/AuditList.tsx b/src/resources/audit/AuditList.tsx index 548dcfa3..7cfbd93d 100644 --- a/src/resources/audit/AuditList.tsx +++ b/src/resources/audit/AuditList.tsx @@ -241,6 +241,12 @@ export default function AuditList({ label='Object (expert users only)' /> ] + const renderResource = (record: Audit): string => { + const resourceName = yourListOfResources.find( + (r) => r.id === record.resource + )?.name + return String(resourceName ?? record.resource) + } return ( + source='resource' label='Resource' - render={(record) => ( - - {String( - yourListOfResources.find((r) => r.id === record.resource) - ?.name || record.resource - )} - - )} + render={renderResource} /> {!omit.includes('dataId') && ( From b118cee5045977d5bb647b7b2233b2be932a679e Mon Sep 17 00:00:00 2001 From: Ian Mayo Date: Thu, 4 Jan 2024 11:24:55 +0000 Subject: [PATCH 18/26] Minor tidying --- src/resources/audit/AuditList.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/resources/audit/AuditList.tsx b/src/resources/audit/AuditList.tsx index 7cfbd93d..78c82ef6 100644 --- a/src/resources/audit/AuditList.tsx +++ b/src/resources/audit/AuditList.tsx @@ -187,7 +187,7 @@ export default function AuditList({ const filteredData = location.state?.filter const ConfigData = useConfigData() - const yourListOfResources = availableResources.map((resource) => ({ + const labelledResources = availableResources.map((resource) => ({ id: resource, name: resource === constants.R_PROJECTS @@ -218,7 +218,7 @@ export default function AuditList({ label='User' />, ] const renderResource = (record: Audit): string => { - const resourceName = yourListOfResources.find( + const resourceName = labelledResources.find( (r) => r.id === record.resource )?.name return String(resourceName ?? record.resource) From 5cb2ee98b2b28c72af2625aa42cf745fefd7a529 Mon Sep 17 00:00:00 2001 From: tahaKhanAbdalli Date: Fri, 5 Jan 2024 17:50:41 +0500 Subject: [PATCH 19/26] edit form go to show page after editing issue resolved --- src/hooks/useCustomId.ts | 2 +- src/resources/addresses/index.tsx | 11 +++++++++-- src/resources/batches/index.tsx | 10 +++++++++- src/resources/destruction/index.tsx | 11 +++++++++-- src/resources/dispatch/index.tsx | 9 ++++++++- .../items/ItemForm/ItemFormToolbar.tsx | 8 +++++--- src/resources/items/ItemForm/index.tsx | 1 + src/resources/platforms/index.tsx | 19 +++++++++++++++++-- src/resources/projects/index.tsx | 11 +++++++++-- src/resources/reference-data/index.tsx | 9 +++++++-- src/resources/users/index.tsx | 9 ++++----- src/resources/vault-locations/index.tsx | 11 +++++++++-- 12 files changed, 88 insertions(+), 23 deletions(-) diff --git a/src/hooks/useCustomId.ts b/src/hooks/useCustomId.ts index 9bea9a3a..c6b1e68f 100644 --- a/src/hooks/useCustomId.ts +++ b/src/hooks/useCustomId.ts @@ -28,7 +28,7 @@ export default function useCustomid(): UseCustomId { const preFix = ID_FIX?.[resource] const highestId = existingRcordes?.[0]?.id || 0; const id = - typeof preFix !== 'undefined' ? `${preFix}-${highestId + 1}` : highestId + 1 + typeof preFix !== 'undefined' ? `${preFix}-${(highestId as number) + 1}` : (highestId as number) + 1 const data = { id, ...values } diff --git a/src/resources/addresses/index.tsx b/src/resources/addresses/index.tsx index 8ae0f30f..b7acdcbf 100644 --- a/src/resources/addresses/index.tsx +++ b/src/resources/addresses/index.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { Create, Edit, Show } from 'react-admin' +import { Create, Edit, Show, useRedirect } from 'react-admin' import * as constants from '../../constants' const AddressList = React.lazy(async () => await import('./AddressList')) const AddressForm = React.lazy(async () => await import('./AddressForm')) @@ -13,8 +13,15 @@ const AddressCreate = (): React.ReactElement => { } export const AddressEdit = (): React.ReactElement => { + const redirect = useRedirect() return ( - + { + redirect(`/${constants.R_ADDRESSES}/${data?.id}/show`) + } + }}> ) diff --git a/src/resources/batches/index.tsx b/src/resources/batches/index.tsx index 59719b40..c9a6de7c 100644 --- a/src/resources/batches/index.tsx +++ b/src/resources/batches/index.tsx @@ -55,8 +55,16 @@ const Actions = (): React.ReactElement => { } const BatchEdit = (): React.ReactElement => { + const redirect = useRedirect() return ( - }> + } + mutationOptions={{ + onSuccess: (data: { batchNumber: string; id: number }): void => { + redirect(`/${constants.R_BATCHES}/${data?.id}/show`) + } + }}> ) diff --git a/src/resources/destruction/index.tsx b/src/resources/destruction/index.tsx index c52505c7..b79e1140 100644 --- a/src/resources/destruction/index.tsx +++ b/src/resources/destruction/index.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { Create, Edit } from 'react-admin' +import { Create, Edit, useRedirect } from 'react-admin' import DestructionForm from './DestructionForm' import * as constants from '../../constants' @@ -19,8 +19,15 @@ const DestructionCreate = (): React.ReactElement => { } const DestructionEdit = (): React.ReactElement => { + const redirect = useRedirect() return ( - + { + redirect(`/${constants.R_DESTRUCTION}/${data?.id}/show`) + } + }}> ) diff --git a/src/resources/dispatch/index.tsx b/src/resources/dispatch/index.tsx index 9146cb61..038c12b4 100644 --- a/src/resources/dispatch/index.tsx +++ b/src/resources/dispatch/index.tsx @@ -24,8 +24,15 @@ const DispatchCreate = (): React.ReactElement => { } export const DispatchEdit = (): React.ReactElement => { + const redirect = useRedirect() return ( - + { + redirect(`/${constants.R_DISPATCH}/${data.id}/show`) + } + }}> ) diff --git a/src/resources/items/ItemForm/ItemFormToolbar.tsx b/src/resources/items/ItemForm/ItemFormToolbar.tsx index 6d0b9e8c..ebb0aed0 100644 --- a/src/resources/items/ItemForm/ItemFormToolbar.tsx +++ b/src/resources/items/ItemForm/ItemFormToolbar.tsx @@ -37,10 +37,11 @@ interface ActionsProps { const Actions = (props: ActionsProps): React.ReactElement => { const { onSuccess, setOpenRemarks, vLocationAudits } = props - + const redirect = useRedirect() const onSuccessWithRemarksClose = (data: any): void => { onSuccess(data) setOpenRemarks(false) + redirect(`/${constants.R_RICH_ITEMS}/${data?.id}/show`) } return ( @@ -71,10 +72,11 @@ interface Props { onSave: (event: React.SyntheticEvent) => void setOpenRemarks: React.Dispatch openRemarks: boolean + isEdit: boolean } const ItemFormToolbar = (props: Props): React.ReactElement => { - const { onSuccess, onSave, openRemarks, setOpenRemarks } = props + const { onSuccess, onSave, openRemarks, setOpenRemarks, isEdit } = props const { notify } = useContext(NotificationContext) const { reset, getValues, setValue } = useFormContext() const [alwaysEnable, setAlwaysEnable] = useState(false) @@ -141,7 +143,7 @@ const ItemFormToolbar = (props: Props): React.ReactElement => { itemId ) setTimeout(() => { - if (!clone) { + if (!clone && !isEdit) { redirect(path) } }, 0) diff --git a/src/resources/items/ItemForm/index.tsx b/src/resources/items/ItemForm/index.tsx index 0f2193e2..9ebf7ff7 100644 --- a/src/resources/items/ItemForm/index.tsx +++ b/src/resources/items/ItemForm/index.tsx @@ -156,6 +156,7 @@ export default function ItemForm({ isEdit }: FormProps): React.ReactElement { openRemarks={openRemarks} setOpenRemarks={setOpenRemarks} onSave={onSave} + isEdit /> }> { const PlatformEdit = ({ name }: PropType): React.ReactElement => { const cName: string = name + const redirect = useRedirect() + return ( - + { + redirect(`/${cName}/${data?.id}/show`) + } + }}> ) diff --git a/src/resources/projects/index.tsx b/src/resources/projects/index.tsx index ddd4f499..4db180fd 100644 --- a/src/resources/projects/index.tsx +++ b/src/resources/projects/index.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { Create, Edit } from 'react-admin' +import { Create, Edit, useRedirect } from 'react-admin' import ProjectForm from './ProjectForm' import * as constants from '../../constants' @@ -15,8 +15,15 @@ const ProjectCreate = (): React.ReactElement => { } const ProjectEdit = (): React.ReactElement => { + const redirect = useRedirect() return ( - + { + redirect(`/${constants.R_PROJECTS}/${data?.id}/show`) + } + }}> ) diff --git a/src/resources/reference-data/index.tsx b/src/resources/reference-data/index.tsx index 0ed1252b..2f11f985 100644 --- a/src/resources/reference-data/index.tsx +++ b/src/resources/reference-data/index.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { Create, Edit } from 'react-admin' +import { Create, Edit, useRedirect } from 'react-admin' import ReferenceDataForm from './ReferenceDataForm' import * as constants from '../../constants' interface PropType { @@ -17,11 +17,16 @@ const RerferenceDataCreate = ({ name }: PropType): React.ReactElement => { export const ReferenceDataEdit = ({ name }: PropType): React.ReactElement => { const cName: string = name + const redirect = useRedirect() return ( { + redirect(`/${cName}/${data?.id}/show`) + } + }} resource={cName}> diff --git a/src/resources/users/index.tsx b/src/resources/users/index.tsx index 1c942da6..a25d266f 100644 --- a/src/resources/users/index.tsx +++ b/src/resources/users/index.tsx @@ -1,5 +1,5 @@ import React, { useState } from 'react' -import { Create, Edit, useEditContext } from 'react-admin' +import { Create, Edit, useEditContext, useRedirect } from 'react-admin' import UserForm from './UserForm' import * as constants from '../../constants' import useAudit from '../../hooks/useAudit' @@ -20,10 +20,9 @@ const UserCreate = (): React.ReactElement => { } const UserEdit = (): React.ReactElement => { - const path: string = `/${constants.R_USERS}` const audit = useAudit() const [prev, setPrev] = useState() - + const redirect = useRedirect() return ( { subjectResource: null, subjectId: null }) + redirect(`/${constants.R_USERS}/${data?.id}/show`) } }} mutationMode={constants.MUTATION_MODE} - resource={constants.R_USERS} - redirect={path}> + resource={constants.R_USERS}> ) diff --git a/src/resources/vault-locations/index.tsx b/src/resources/vault-locations/index.tsx index 029a4fd3..29c55ec9 100644 --- a/src/resources/vault-locations/index.tsx +++ b/src/resources/vault-locations/index.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { Create, Edit } from 'react-admin' +import { Create, Edit, useRedirect } from 'react-admin' import VaultLocationForm from './VaultLocationForm' import VaultLocationList from './VaultLocationList' import ReferenceDataShow from '../reference-data/ReferenceDataShow' @@ -14,8 +14,15 @@ const VaultLocationCreate = (): React.ReactElement => { } export const VaultLocationEdit = (): React.ReactElement => { + const redirect = useRedirect() return ( - + { + redirect(`/${constants.R_VAULT_LOCATION}/${data?.id}/show`) + } + }}> ) From c4ec889301d253dcd8820a17da2fb2c8a4354ed0 Mon Sep 17 00:00:00 2001 From: tahaKhanAbdalli Date: Fri, 5 Jan 2024 19:10:36 +0500 Subject: [PATCH 20/26] save not working for destuction edit issue resolved --- src/hooks/useCustomId.ts | 2 +- src/resources/destruction/DestructionForm.tsx | 13 +------------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/src/hooks/useCustomId.ts b/src/hooks/useCustomId.ts index 9bea9a3a..c6b1e68f 100644 --- a/src/hooks/useCustomId.ts +++ b/src/hooks/useCustomId.ts @@ -28,7 +28,7 @@ export default function useCustomid(): UseCustomId { const preFix = ID_FIX?.[resource] const highestId = existingRcordes?.[0]?.id || 0; const id = - typeof preFix !== 'undefined' ? `${preFix}-${highestId + 1}` : highestId + 1 + typeof preFix !== 'undefined' ? `${preFix}-${(highestId as number) + 1}` : (highestId as number) + 1 const data = { id, ...values } diff --git a/src/resources/destruction/DestructionForm.tsx b/src/resources/destruction/DestructionForm.tsx index b072f37f..91ba7a19 100644 --- a/src/resources/destruction/DestructionForm.tsx +++ b/src/resources/destruction/DestructionForm.tsx @@ -12,7 +12,6 @@ import { useUpdate } from 'react-admin' import * as constants from '../../constants' -import DatePicker from '../../components/DatePicker' import { yupResolver } from '@hookform/resolvers/yup' import * as yup from 'yup' import { ConditionalReferenceInput } from '../batches/BatchForm' @@ -38,7 +37,7 @@ const DestructionFormToolbar = ( return ( - + ) } @@ -155,16 +154,6 @@ export default function DestructionForm(props: Props): React.ReactElement { toolbar={} resolver={yupResolver(schema)} onSubmit={handleSubmit as any}> - {isEdit && ( Date: Tue, 9 Jan 2024 17:59:02 +0500 Subject: [PATCH 21/26] user show history doesn't filter results issue resolved --- src/resources/users/UserShow.tsx | 25 +++++++++---------------- src/resources/users/index.tsx | 9 ++++++--- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/src/resources/users/UserShow.tsx b/src/resources/users/UserShow.tsx index c4ab9eb9..65195ee7 100644 --- a/src/resources/users/UserShow.tsx +++ b/src/resources/users/UserShow.tsx @@ -364,25 +364,11 @@ const UserShowComp = ({ export default function UserShow(): React.ReactElement { const [record, setRecord] = useState() const { hasAccess } = useCanAccess() - const [filteredData, setFilteredData] = useState([]) const hasWriteAccess = hasAccess(R_USERS, { write: true }) - const { isLoading, data } = useGetList(R_AUDIT, {}) + const { isLoading } = useGetList(R_AUDIT, {}) const audit = useAudit() const navigate = useNavigate() - useEffect(() => { - if (data != null) - setFilteredData( - data.filter((audit) => { - return ( - audit.user === record?.id || - audit.subjectId === record?.id || - (audit.dataId === record?.id && audit.resource === R_USERS) - ) - }) - ) - }, [data, record, isLoading]) - if (isLoading) return return ( @@ -394,7 +380,14 @@ export default function UserShow(): React.ReactElement { { - navigate('/audit', { state: { data: filteredData } }) + if (record) { + navigate( + `/audit?filter=${JSON.stringify({ + resource: constants.R_USERS, + dataId: record.id ?? '' + })}` + ) + } }} /> diff --git a/src/resources/users/index.tsx b/src/resources/users/index.tsx index a25d266f..5311b7bc 100644 --- a/src/resources/users/index.tsx +++ b/src/resources/users/index.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react' +import React, { useEffect, useState } from 'react' import { Create, Edit, useEditContext, useRedirect } from 'react-admin' import UserForm from './UserForm' import * as constants from '../../constants' @@ -54,8 +54,11 @@ interface EditValType { const EditVal = ({ setPrev }: EditValType): React.ReactElement => { const { record } = useEditContext() - console.log(record) - setPrev(record) + + useEffect(() => { + setPrev(record) + }, [record, setPrev]) + return } From 7c72bff8808ec6c687403cc6b3450d1d9a43436d Mon Sep 17 00:00:00 2001 From: tahaKhanAbdalli Date: Tue, 9 Jan 2024 18:14:01 +0500 Subject: [PATCH 22/26] lint issue resolved --- src/resources/users/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/resources/users/index.tsx b/src/resources/users/index.tsx index 5311b7bc..c37f2b03 100644 --- a/src/resources/users/index.tsx +++ b/src/resources/users/index.tsx @@ -56,7 +56,7 @@ const EditVal = ({ setPrev }: EditValType): React.ReactElement => { const { record } = useEditContext() useEffect(() => { - setPrev(record) + setPrev(record as User) }, [record, setPrev]) return From 5c3c8eb92cdde6514124fb399f5ab20a0cec7461 Mon Sep 17 00:00:00 2001 From: tahaKhanAbdalli Date: Tue, 9 Jan 2024 18:39:17 +0500 Subject: [PATCH 23/26] live items asset report fails with project filter issue resolved --- src/resources/items/ItemsReport.tsx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/resources/items/ItemsReport.tsx b/src/resources/items/ItemsReport.tsx index 36f4c468..3b4f3655 100644 --- a/src/resources/items/ItemsReport.tsx +++ b/src/resources/items/ItemsReport.tsx @@ -99,7 +99,7 @@ export default function ItemsReport( const { footer, children, headStyle = {}, sx = {}, ...rest } = props return ( Date: Tue, 9 Jan 2024 19:40:43 +0500 Subject: [PATCH 24/26] auditlist filter for date misses for today issue resolved --- src/components/DateFilter.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/components/DateFilter.tsx b/src/components/DateFilter.tsx index d66d5f19..e9f4e08b 100644 --- a/src/components/DateFilter.tsx +++ b/src/components/DateFilter.tsx @@ -63,7 +63,6 @@ const getFilter = (value: Values, source: string, format: string): Filter[] => { case 'past_week': return [ resetTodayFilter, - todayFilter, { key: gteKeyName, value: minusFromNow('week') From 961a7583f97f278887bc5178a12a1f62e9a4c110 Mon Sep 17 00:00:00 2001 From: Ian Mayo Date: Tue, 9 Jan 2024 16:12:25 +0000 Subject: [PATCH 25/26] Fixes for date searches --- src/components/DateFilter.tsx | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/components/DateFilter.tsx b/src/components/DateFilter.tsx index e9f4e08b..dc2abcc3 100644 --- a/src/components/DateFilter.tsx +++ b/src/components/DateFilter.tsx @@ -37,12 +37,9 @@ const getFilter = (value: Values, source: string, format: string): Filter[] => { return formattedDate } - const now = formatter(DateTime.now()) const gteKeyName: string = `${source}_gte` const lteKeyName: string = `${source}_lte` - const todayFilter: Filter = { key: lteKeyName, value: now } - const resetTodayFilter: Filter = { key: source, value: undefined } const resetGTFilter: Filter = { key: gteKeyName, value: undefined } const resetLTFilter: Filter = { key: lteKeyName, value: undefined } @@ -63,6 +60,10 @@ const getFilter = (value: Values, source: string, format: string): Filter[] => { case 'past_week': return [ resetTodayFilter, + { + key: lteKeyName, + value: DateTime.now().endOf('day').toISO() ?? '' + }, { key: gteKeyName, value: minusFromNow('week') @@ -71,7 +72,10 @@ const getFilter = (value: Values, source: string, format: string): Filter[] => { case 'past_month': return [ resetTodayFilter, - todayFilter, + { + key: lteKeyName, + value: DateTime.now().endOf('day').toISO() ?? '' + }, { key: gteKeyName, value: minusFromNow('month') @@ -80,7 +84,10 @@ const getFilter = (value: Values, source: string, format: string): Filter[] => { case 'past_year': return [ resetTodayFilter, - todayFilter, + { + key: lteKeyName, + value: DateTime.now().endOf('day').toISO() ?? '' + }, { key: gteKeyName, value: minusFromNow('year') From 4af859ea0e88818f99a151a32d0f61ea0f3d5e6c Mon Sep 17 00:00:00 2001 From: tahaKhanAbdalli Date: Wed, 10 Jan 2024 11:51:45 +0500 Subject: [PATCH 26/26] projekt label coming from configData. --- src/resources/items/ItemsReport.tsx | 94 ++++++++++++++--------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/src/resources/items/ItemsReport.tsx b/src/resources/items/ItemsReport.tsx index 3b4f3655..c2c70b84 100644 --- a/src/resources/items/ItemsReport.tsx +++ b/src/resources/items/ItemsReport.tsx @@ -22,7 +22,7 @@ import { DateTime } from 'luxon' import { Download } from '@mui/icons-material' import Printable from '../../components/Printable' import FlexBox from '../../components/FlexBox' - +import { useConfigData } from '../../utils/useConfigData' type Props = PartialBy & { footer?: React.FunctionComponent headStyle?: Record @@ -134,52 +134,6 @@ export default function ItemsReport( ) } - -const referenceFields: RefFieldType[] = [ - { - name: 'vaultLocation', - resource: constants.R_VAULT_LOCATION, - source: 'name', - label: 'Vault Location' - }, - { - name: 'createdBy_eq', - resource: constants.R_USERS, - source: 'name', - label: 'Created By' - }, - { - name: 'createdBy', - resource: constants.R_USERS, - source: 'name', - label: 'Created By' - }, - { - name: 'protectiveMarking', - resource: constants.R_PROTECTIVE_MARKING, - source: 'name', - label: 'Protective Marking' - }, - { - name: 'batch', - resource: constants.R_BATCHES, - source: 'batchNumber', - label: 'Batch' - }, - { - name: 'project', - resource: constants.R_PROJECTS, - source: 'name', - label: 'Project' - }, - { - name: 'platform', - resource: constants.R_PLATFORMS, - source: 'name', - label: 'Platform' - } -] - const fields: FieldType[] = [ { name: 'mediaType', @@ -218,6 +172,52 @@ export function ItemAssetReport(props: Props): React.ReactElement { } const { data } = useGetIdentity() + const configDate = useConfigData() + + const referenceFields: RefFieldType[] = [ + { + name: 'vaultLocation', + resource: constants.R_VAULT_LOCATION, + source: 'name', + label: 'Vault Location' + }, + { + name: 'createdBy_eq', + resource: constants.R_USERS, + source: 'name', + label: 'Created By' + }, + { + name: 'createdBy', + resource: constants.R_USERS, + source: 'name', + label: 'Created By' + }, + { + name: 'protectiveMarking', + resource: constants.R_PROTECTIVE_MARKING, + source: 'name', + label: 'Protective Marking' + }, + { + name: 'batch', + resource: constants.R_BATCHES, + source: 'batchNumber', + label: 'Batch' + }, + { + name: 'project', + resource: constants.R_PROJECTS, + source: 'name', + label: configDate?.projectName ?? 'Default Label' + }, + { + name: 'platform', + resource: constants.R_PLATFORMS, + source: 'name', + label: 'Platform' + } + ] const handleOpen = (open: boolean) => () => { setOpen(open)