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

Dpo3 dpkrt 754 #548

Closed
wants to merge 17 commits into from
Closed
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
dcfadf0
fix: numerical identifiers converted to strings
EMaslowskiQ Apr 11, 2023
fd30a5f
Merge pull request #538 from Smithsonian/DPO3DPKRT-731/fix-numerical-…
EMaslowskiQ Apr 11, 2023
47789b1
(wip) Validation check for identifiers
natashaJ-NZP Apr 28, 2023
f1eafc0
Resolving pull request 'flags' from Eric M.'s code review
natashaJ-NZP May 2, 2023
2c4f6b5
[DPO3DPKRT-739] Validation check for identifiers (#540)
natashaJ-NZP May 2, 2023
3255372
Changed the background color of the ingest/discard buttons to blue an…
natashaJ-NZP May 3, 2023
34612eb
test commit - to see if the changes applied update in real time.
natashaJ-NZP May 4, 2023
34905a8
Added file format text to the bottom of the upload section on the upl…
natashaJ-NZP May 4, 2023
a3f0d34
[DPO3DPKRT-744] Improvements to UI styles & Validation Checks
natashaJ-NZP May 5, 2023
79a72a5
Changes to add tooltips to all the Field boxes in Ingestion
natashaJ-NZP May 19, 2023
e064d26
Merge branch 'DPO3DPKRT-747' of https://github.com/Smithsonian/dpo-pa…
natashaJ-NZP May 19, 2023
b53da73
Created a LabelTooltipText component. Added the component to Subject…
natashaJ-NZP Jun 9, 2023
8b82f94
Adding the rest of the tooltips to the details page
natashaJ-NZP Jun 9, 2023
ba82303
Added a warning message for process upload
natashaJ-NZP Jun 28, 2023
02a01d2
Finished adding the Idenitifier Collection ID to the Subject List
natashaJ-NZP Jul 3, 2023
b6f7152
Resolved ES Lint errors
natashaJ-NZP Jul 6, 2023
4e2a1ff
Resolved two more trailing space errors from ES Lint
natashaJ-NZP Jul 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
147,529 changes: 147,529 additions & 0 deletions .yarn/releases/yarn-1.22.19.cjs

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions .yarnrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


yarn-path ".yarn/releases/yarn-1.22.19.cjs"
1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"@material-ui/icons": "4.9.1",
"@material-ui/lab": "4.0.0-alpha.56",
"@material-ui/pickers": "3.3.10",
"@material/tooltip": "14.0.0",
"@testing-library/jest-dom": "5.16.5",
"@testing-library/react": "13.4.0",
"@testing-library/user-event": "14.4.3",
Expand Down
71 changes: 71 additions & 0 deletions client/src/components/controls/LabelTooltipText.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import React from 'react';

Check failure on line 1 in client/src/components/controls/LabelTooltipText.tsx

View workflow job for this annotation

GitHub Actions / lint

Trailing spaces not allowed
import { makeStyles } from '@material-ui/core/styles';
import { Typography, TypographyProps, Tooltip, PropTypes } from "@material-ui/core";

Check failure on line 3 in client/src/components/controls/LabelTooltipText.tsx

View workflow job for this annotation

GitHub Actions / lint

Strings must use singlequote
import { HelpOutline } from "@material-ui/icons";

Check failure on line 4 in client/src/components/controls/LabelTooltipText.tsx

View workflow job for this annotation

GitHub Actions / lint

Strings must use singlequote

const useStyles = makeStyles(({ spacing }) => ({
container: {
display: 'flex',
padding: ({ padding }: LabelTooltipTextProps ) => padding ? padding : '0px 10px',
//borderRadius: 5,
//border: `1px dashed #0086ff`,
width: ({ width }: LabelTooltipTextProps ) => width || '100%',
marginTop: ({ marginTop }: LabelTooltipTextProps ) => spacing(marginTop || 0),
//backgroundColor: ({ required, error }: LabelTooltipTextProps ) => (error ? fade(palette.error.light, 0.3) : required ? palette.primary.light : palette.secondary.light)
},
label: {
color: 'auto'
},
loading: {
position: 'absolute',
top: 16,
right: 10
}
}));

interface LabelTooltipTextProps {
error?: boolean;
label?: string;
labelProps?: TypographyProps;
labelTooltipTxt: string;
marginTop?: number;
padding?: string;
renderLabel?: boolean;
width?: string;
align?: PropTypes.Alignment;
}

function LabelTooltipText(props: LabelTooltipTextProps): React.ReactElement {

Check failure on line 38 in client/src/components/controls/LabelTooltipText.tsx

View workflow job for this annotation

GitHub Actions / lint

Trailing spaces not allowed
const { label, labelTooltipTxt, labelProps, renderLabel, align = 'left', } = props

Check failure on line 39 in client/src/components/controls/LabelTooltipText.tsx

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon
const classes = useStyles(props);

let content: React.ReactNode = (
<>
<Typography align={align} className={classes.label} variant='caption'>
{label}
</Typography>
</>
);

if (labelTooltipTxt) {
const tooltipContent = (
<>
<Typography align={align} className={classes.label} variant='caption' {...labelProps}>
{label}
<Tooltip title={labelTooltipTxt}>
<HelpOutline fontSize='small' style={{ alignSelf: 'center', cursor: 'pointer', verticalAlign:'middle', padding:'20px 5px' }} />

Check failure on line 56 in client/src/components/controls/LabelTooltipText.tsx

View workflow job for this annotation

GitHub Actions / lint

Missing space before value for key 'verticalAlign'

Check failure on line 56 in client/src/components/controls/LabelTooltipText.tsx

View workflow job for this annotation

GitHub Actions / lint

Missing space before value for key 'padding'
</Tooltip>
</Typography>
</>
);
content = tooltipContent;
}

if (renderLabel === false) {
content = null;
}

return <div> {content} </div>

Check failure on line 68 in client/src/components/controls/LabelTooltipText.tsx

View workflow job for this annotation

GitHub Actions / lint

Missing semicolon
}

export default LabelTooltipText;
17 changes: 16 additions & 1 deletion client/src/components/shared/AssetIdentifiers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { eVocabularySetID } from '@dpo-packrat/common';
import FieldType from './FieldType';
import IdentifierList from './IdentifierList';

//Styles
const useStyles = makeStyles(({ palette, spacing }) => ({
assetIdentifier: {
display: 'flex',
Expand All @@ -31,6 +32,7 @@ const useStyles = makeStyles(({ palette, spacing }) => ({
}
}));

//Defines the prop type
interface AssetIdentifiersProps {
systemCreated: boolean;
identifiers: StateIdentifier[];
Expand All @@ -44,11 +46,18 @@ interface AssetIdentifiersProps {
}

function AssetIdentifiers(props: AssetIdentifiersProps): React.ReactElement {

//Props - types defined in interface
const { systemCreated, identifiers, onSystemCreatedChange, onAddIdentifer, onUpdateIdentifer, onRemoveIdentifer,
subjectView, onUpdateIdIdentifierPreferred, identifierName } = props;

//Component styling
const classes = useStyles();

//Handles state change for the Identifier entries
const [getEntries, getInitialEntry] = useVocabularyStore(state => [state.getEntries, state.getInitialEntry]);

//Function creates object to define new identifier
const addIdentifer = (initialEntry: number | null) => {
const newIdentifier: StateIdentifier = {
id: identifiers.length + 1,
Expand All @@ -62,11 +71,13 @@ function AssetIdentifiers(props: AssetIdentifiersProps): React.ReactElement {
onAddIdentifer(updatedIdentifiers);
};

//Function removes Identifier
const removeIdentifier = (_idIdentifier: number, id: number) => {
const updatedIdentifiers = lodash.filter(identifiers, identifier => identifier.id !== id);
onRemoveIdentifer(updatedIdentifiers);
};

//Function updates any changes to the Identifier
const updateIdentifierFields = (id: number, name: string, value: string | number | boolean) => {
const updatedIdentifiers = identifiers.map(identifier => {
if (identifier.id === id) {
Expand All @@ -80,10 +91,12 @@ function AssetIdentifiers(props: AssetIdentifiersProps): React.ReactElement {
onUpdateIdentifer(updatedIdentifiers);
};

//The label of the Asset Identifier UI (currently says 'Model Identifier(s))
const label: string = (identifierName ? identifierName : 'Asset') + ' Identifier(s)';
return (
//The Identifier Component
<Box marginBottom='10px'>
<FieldType required label={label} padding='10px'>
<FieldType required label={label} padding='10px' labelTooltip='Assign an identifier to your digital asset here. The identifier will make it easier to search for the digital asset later.'>
<Box display='flex' justifyContent='space-between'>
<Box className={classes.assetIdentifier}>
<label htmlFor='systemCreated' style={{ display: 'none' }}>System Created Identifier</label>
Expand All @@ -98,6 +111,8 @@ function AssetIdentifiers(props: AssetIdentifiersProps): React.ReactElement {
System will create an identifier
</Typography>
</Box>

{/*May need to write the logic here to check if there are no identifiers in existence.*/}
{!identifiers.length && (
<Button
className={classes.addIdentifierButton}
Expand Down
27 changes: 18 additions & 9 deletions client/src/components/shared/FieldType.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@
import { fade, makeStyles } from '@material-ui/core/styles';
import React from 'react';
import Progress from './Progress';
import { HelpOutline } from '@material-ui/icons';
// import { HelpOutline } from '@material-ui/icons';

const useStyles = makeStyles(({ palette, spacing }) => ({
container: {
display: 'flex',
padding: ({ padding }: FieldTypeProps) => padding ? padding : '0px 10px',
borderRadius: 5,
//borderRadius: 5,
//border: `1px dashed #0086ff`,
width: ({ width }: FieldTypeProps) => width || '100%',
marginTop: ({ marginTop }: FieldTypeProps) => spacing(marginTop || 0),
backgroundColor: ({ required, error }: FieldTypeProps) => (error ? fade(palette.error.light, 0.3) : required ? palette.primary.light : palette.secondary.light)
Expand Down Expand Up @@ -53,18 +56,24 @@
const classes = useStyles(props);

let content: React.ReactNode = (
<Typography align={align} className={classes.label} variant='caption' {...labelProps}>
{label}
</Typography>
<>
<Typography align={align} className={classes.label} variant='caption' {...labelProps}>
{label}
</Typography>
</>
);

if (labelTooltip) {
const tooltipContent = (
<Tooltip title={labelTooltip}>
<Typography align={align} className={classes.label} variant='caption' {...labelProps}>
{label}
</Typography>
</Tooltip>
<>

Check failure on line 68 in client/src/components/shared/FieldType.tsx

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 12 spaces but found 8

Check failure on line 68 in client/src/components/shared/FieldType.tsx

View workflow job for this annotation

GitHub Actions / lint

Expected indentation of 12 space characters but found 8
<Typography align={align} className={classes.label} variant='caption' {...labelProps}>
{label}
<Tooltip title={labelTooltip}>
<HelpOutline fontSize='small' style={{ alignSelf: 'center', cursor: 'pointer', verticalAlign:'middle', padding:'20px 5px' }} />
</Tooltip>
</Typography>
</>

);
content = tooltipContent;
}
Expand Down
27 changes: 15 additions & 12 deletions client/src/components/shared/SidebarBottomNavigator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,33 @@
* This component renders bottom navigation view, used in data upload
* and ingestion flow
*/
import { Box } from '@material-ui/core';
import { Box, TypographyProps } from '@material-ui/core';
import { makeStyles } from '@material-ui/core/styles';
import React from 'react';
import { Link } from 'react-router-dom';
import { Colors } from '../../theme';
import LoadingButton from '../controls/LoadingButton';

const useStyles = makeStyles(({ palette, breakpoints }) => ({
const useStyles = makeStyles(({breakpoints }) => ({
uploadContainer: {
display: 'flex',
//display: 'flex',
bottom: 0,
alignItems: 'center',
justifyContent: 'space-between',
padding: '10px 0px',
background: palette.background.paper
padding: '10px',
//background: palette.background.paper
background: 'rgb(236, 245, 253)'
},
container: {
display: 'flex',
//display: 'flex',
bottom: 0,
alignItems: 'center',
justifyContent: 'space-between',
width: '53vw',
padding: '20px 0px',
marginLeft: 20,
background: palette.background.paper
width: '100%',
padding: '20px',
//marginLeft: 20,
//background: palette.background.paper
//background: 'rgb(236, 245, 253)'
},
navButton: {
minHeight: 35,
Expand All @@ -45,10 +47,11 @@ const useStyles = makeStyles(({ palette, breakpoints }) => ({
},
link: {
textDecoration: 'none'
}
},
}));

interface SidebarBottomNavigatorProps {
btnProps?: TypographyProps;
leftLabel: string;
leftLoading?: boolean;
leftRoute?: string;
Expand All @@ -68,7 +71,7 @@ function SidebarBottomNavigator(props: SidebarBottomNavigatorProps): React.React
// console.log(`SidebarBottomNavigator ${JSON.stringify(props)}, onClickRight ${onClickRight ? 'defined' : 'NOT defined'}`);

let leftButton = (
<LoadingButton className={classes.navButton} disableElevation loaderSize={15} loading={leftLoading || false} disabled={disableNavigation} onClick={onClickLeft}>
<LoadingButton className={classes.navButton} style={{marginRight: '30px'}} disableElevation loaderSize={15} loading={leftLoading || false} disabled={disableNavigation} onClick={onClickLeft}>
{leftLabel}
</LoadingButton>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ function ObjectSelectModal(props: ObjectSelectModalProps): React.ReactElement {
setIsSaving(false);
};

// This opens up the dialog box when you click the 'Add' button on the Parents or Children block.
return (
<Dialog
open={open}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@ function Model(props: ModelProps): React.ReactElement {
)}

<Box mb={2} width='52vw'>
{/*ASSET IDENTIFIERS FORM STARTS HERE*/}
<AssetIdentifiers
systemCreated={model.systemCreated}
identifiers={model.identifiers}
Expand Down Expand Up @@ -383,6 +384,8 @@ function Model(props: ModelProps): React.ReactElement {
</Box>
</>
)}

{/* METADATA FORMS AREA*/}
<Box className={classes.modelDetailsContainer}>
<Box display='flex' flexDirection='column' className={classes.dataEntry}>
<TableContainer component={Paper} elevation={0} className={tableClasses.captureMethodTableContainer} style={{ backgroundColor: 'rgb(255, 252, 209', paddingTop: '10px' }}>
Expand All @@ -405,6 +408,8 @@ function Model(props: ModelProps): React.ReactElement {
className={clsx(tableClasses.select, tableClasses.datasetFieldSelect)}
SelectDisplayProps={{ style: { paddingLeft: '10px', borderRadius: '5px' } }}
>

{/* Grabs the dropdown options for SELECT */}
{getEntries(eVocabularySetID.eModelCreationMethod).map(({ idVocabulary, Term }, index) => <MenuItem key={index} value={idVocabulary}>{Term}</MenuItem>)}
</Select>
</TableCell>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function Description(props: DescriptionProps): React.ReactElement {
<FieldType
required
label='Description'
labelTooltip='Add your uploaded file(s) description here.'
direction='row'
containerProps={{ ...rowFieldProps, ...containerProps }}
width={viewMode ? 'auto' : undefined}
Expand Down
5 changes: 3 additions & 2 deletions client/src/pages/Ingestion/components/Metadata/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ function Metadata(): React.ReactElement {
}
}
});
// detects the asset type for breadcrumb
if (metadata.idSOAttachment && metadata.idAsset) {
switch (objectType) {
case eSystemObjectType.eCaptureData: {
Expand Down Expand Up @@ -164,7 +165,7 @@ function Metadata(): React.ReactElement {
const onNext = async (): Promise<void> => {
const updateMode: boolean = !!(metadata.file.idAsset);
setFieldErrors(getFieldErrors(metadata));

// Add the validation to check if the value in fields exist and is a string
if (assetType.photogrammetry) {
const hasError: boolean = updateMode
? validateFields(metadata.photogrammetry, photogrammetryFieldsSchemaUpdate)
Expand Down Expand Up @@ -192,7 +193,7 @@ function Metadata(): React.ReactElement {
: validateFields(metadata.other, otherFieldsSchema);
if (hasError) return;
}

// This may be the code that initiates the completion of the Ingestion process.
if (isLast) {
setDisableNavigation(true);
setIngestionLoading(true);
Expand Down
11 changes: 8 additions & 3 deletions client/src/pages/Ingestion/components/SubjectItem/SearchList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import { SubjectUnitIdentifier } from '../../../../types/graphql';
import SubjectList from './SubjectList';
import { toast } from 'react-toastify';
import { actionOnKeyPress } from '../../../../utils/shared';
// import { HelpOutline } from '@material-ui/icons';
// import Tooltip from "@material-ui/core/Tooltip";

const useStyles = makeStyles(({ palette, breakpoints }) => ({
container: {
Expand All @@ -38,11 +40,11 @@ const useStyles = makeStyles(({ palette, breakpoints }) => ({
}));

type SearchListProps = {
EdanOnly?: boolean
EdanOnly?: boolean;
};

function SearchList(props: SearchListProps): React.ReactElement {
const { EdanOnly } = props;
const { EdanOnly} = props;
const classes = useStyles();
const [query, setQuery] = useState('');
const [searchSubject, { data, called, loading, error }] = useLazyQuery(SearchIngestionSubjectsDocument, { fetchPolicy: 'no-cache' });
Expand Down Expand Up @@ -80,7 +82,10 @@ function SearchList(props: SearchListProps): React.ReactElement {
content = <SubjectList subjects={subjects} selected={false} emptyLabel='No subjects found' />;

return (
<FieldType required={false} label='Search for Subject' marginTop={2} padding='10px'>
<FieldType required={false} label='Search for Subject' marginTop={2} padding='10px' labelTooltip='This is the entity that the digital asset(s) is based on and where it will be saved to.'>
{/* <Tooltip title="Lorem ipsum dolor sit amet" placement="bottom">
<HelpOutline fontSize='small' style={{ alignSelf: 'center', cursor: 'pointer' }} />
</Tooltip> */}
<Box className={classes.container}>
<label htmlFor='searchSubjectFilter' style={{ display: 'none' }}>Search Subject</label>
<TextField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function SubjectList(props: SubjectListProps): React.ReactElement {
const [addSubject, removeSubject] = useSubjectStore(state => [state.addSubject, state.removeSubject]);
const classes = useStyles();

const header: string[] = ['ARK / ID', 'UNIT', 'NAME'];
const header: string[] = ['ARK / ID', 'UNIT', 'NAME', 'COLLECTION'];

const getSubjectList = ({ id, arkId, unit, name, collectionId }: StateSubject, index: number) => (
<SubjectListItem
Expand Down