Skip to content

Commit

Permalink
Merge pull request #216 from Smithsonian/feature/edan-subject-creation
Browse files Browse the repository at this point in the history
Edan Integration:  edanmdm creation, scene publishing, scene download publishing
  • Loading branch information
jahjedtieson authored Aug 20, 2021
2 parents 85211f3 + 24eac1d commit ce280cf
Show file tree
Hide file tree
Showing 64 changed files with 1,351 additions and 230 deletions.
4 changes: 4 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ PACKRAT_DATABASE_URL=
PACKRAT_SESSION_SECRET=
PACKRAT_EDAN_AUTH_KEY=
PACKRAT_EDAN_SERVER=
PACKRAT_EDAN_3D_API=
PACKRAT_EDAN_APPID=
PACKRAT_EDAN_UPSERT_RESOURCE_ROOT=
PACKRAT_EDAN_STAGING_ROOT=
PACKRAT_EDAN_RESOURCES_HOTFOLDER=
PACKRAT_OCFL_STORAGE_ROOT=
PACKRAT_OCFL_STAGING_ROOT=
PACKRAT_COOK_SERVER_URL=
Expand Down
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dpo-packrat/client",
"version": "0.7.0",
"version": "0.8.0",
"private": true,
"license": "Apache-2.0",
"description": "Client for Packrat",
Expand Down
9 changes: 7 additions & 2 deletions client/src/components/controls/ReadOnlyRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,20 @@ interface ReadOnlyRowProps extends ViewableProps {
label: string;
value?: number | string | null;
padding?: number;
gridTemplate?: string;
}

function ReadOnlyRow(props: ReadOnlyRowProps): React.ReactElement {
const { label, value, padding } = props;
const { label, value, padding, gridTemplate } = props;

const rowFieldProps = { alignItems: 'center', justifyContent: 'space-between', style: { borderRadius: 0 } };
if (gridTemplate) {
rowFieldProps['style']['display'] = 'grid';
rowFieldProps['style']['gridTemplateColumns'] = gridTemplate;
}

return (
<FieldType required={false} label={label} direction='row' containerProps={rowFieldProps} width='auto'>
<FieldType required={false} label={label} direction='row' containerProps={rowFieldProps} width='100%'>
<Box width='fit-content' textAlign='right'>
<Typography variant='caption' style={{ fontFamily: 'Roboto, Helvetical, Arial, sans-serif', color: '#2C405A', overflowWrap: 'break-word', padding }}>
{value}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,21 @@ interface SceneData {
CountMeta: number;
CountSetup: number;
CountTour: number;
EdanUUID: string | null;
}

interface SceneDataProps {
sceneData: SceneData;
name: string;
hasBeenQCd: boolean;
isOriented: boolean;
EdanUUID: string;
setNameField: ({ target }: { target: EventTarget }) => void;
setCheckboxField: ({ target }: { target: EventTarget }) => void;
}

function SceneDataGrid(props: SceneDataProps): React.ReactElement {
const { sceneData, setCheckboxField, setNameField, name, hasBeenQCd, isOriented } = props;
const { sceneData, setCheckboxField, setNameField, name, hasBeenQCd, isOriented, EdanUUID } = props;
const classes = useStyles();
if (!sceneData)
return <Box></Box>;
Expand All @@ -61,6 +63,8 @@ function SceneDataGrid(props: SceneDataProps): React.ReactElement {
<FieldType required label='Is Oriented' direction='row' containerProps={rowFieldProps}>
<Checkbox name='isOriented' checked={isOriented} color='primary' onChange={setCheckboxField} />
</FieldType>

<ReadOnlyRow label='EDAN UUID' value={EdanUUID} />
<ReadOnlyRow label='Scene Count' value={CountScene} padding={15} />
<ReadOnlyRow label='Node Count' value={CountNode} padding={15} />
<ReadOnlyRow label='Camera Count' value={CountCamera} padding={15} />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ function Scene(props: SceneProps): React.ReactElement {
CountModel: 0,
CountMeta: 0,
CountSetup: 0,
CountTour: 0
CountTour: 0,
EdanUUID: ''
});
const [modalOpen, setModalOpen] = useState(false);
const [objectRelationship, setObjectRelationship] = useState('');
Expand Down Expand Up @@ -122,9 +123,7 @@ function Scene(props: SceneProps): React.ReactElement {
const { name, value } = target;
updateMetadataField(metadataIndex, name, value, MetadataType.scene);
};
console.log('idAssetVersion from Scene', idAssetVersion);

//
const openSourceObjectModal = async () => {
setDefaultIngestionFilters(eSystemObjectType.eModel, idSystemObject);
await setObjectRelationship('Source');
Expand Down Expand Up @@ -159,7 +158,6 @@ function Scene(props: SceneProps): React.ReactElement {
updateMetadataField(metadataIndex, objectRelationship === 'Source' ? 'sourceObjects' : 'derivedObjects', newSourceObjects, MetadataType.scene);
onModalClose();
};
//

return (
<Box className={classes.container}>
Expand Down Expand Up @@ -197,6 +195,7 @@ function Scene(props: SceneProps): React.ReactElement {
name={scene.name}
hasBeenQCd={scene.hasBeenQCd}
isOriented={scene.isOriented}
EdanUUID={scene.EdanUUID}
/>
<ObjectSelectModal
open={modalOpen}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function ModelDetails(props: DetailComponentProps): React.ReactElement {
const setDateField = (date: Date | string | null): void => {
if (date) {
const newDate = new Date(date);
updateDetailField(eSystemObjectType.eModel, 'DateCaptured', newDate);
updateDetailField(eSystemObjectType.eModel, 'DateCreated', newDate);
}
};

Expand All @@ -133,7 +133,7 @@ function ModelDetails(props: DetailComponentProps): React.ReactElement {
<Box className={classes.modelMetricsAndForm}>
<Box display='flex' flexDirection='column' className={classes.dataEntry}>
<FieldType required label='Date Created' direction='row' containerProps={rowFieldProps}>
<DateInputField value={ModelDetails.DateCaptured} onChange={date => setDateField(date)} />
<DateInputField value={ModelDetails.DateCreated} onChange={date => setDateField(date)} />
</FieldType>

<SelectField
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* This component renders details tab for Scene specific details used in DetailsTab component.
*/
import { Box, makeStyles, Checkbox /*, Typography */ } from '@material-ui/core';
import React, { useEffect } from 'react';
import React, { useEffect, useRef } from 'react';
import { Loader } from '../../../../../components';
import { GetSceneDocument } from '../../../../../types/graphql';
import { DetailComponentProps } from './index';
Expand All @@ -21,10 +21,11 @@ export const useStyles = makeStyles(({ palette }) => ({
color: palette.primary.dark
},
container: {
display: 'flex',
flexDirection: 'column',
marginBottom: 10,
width: 'fit-content',
'& > *': {
width: '20%',
maxWidth: '300px',
minWidth: '200px',
height: '20px',
'&:not(:last-child)': {
Expand All @@ -36,6 +37,7 @@ export const useStyles = makeStyles(({ palette }) => ({

function SceneDetails(props: DetailComponentProps): React.ReactElement {
const classes = useStyles();
const isMounted = useRef(false);
const { data, loading, onUpdateDetail, objectType } = props;
const [SceneDetails, updateDetailField] = useDetailTabStore(state => [state.SceneDetails, state.updateDetailField]);

Expand All @@ -54,7 +56,6 @@ function SceneDetails(props: DetailComponentProps): React.ReactElement {
},
fetchPolicy: 'no-cache'
});

updateDetailField(eSystemObjectType.eScene, 'ModelSceneXref', getScene?.Scene?.ModelSceneXref);
updateDetailField(eSystemObjectType.eScene, 'CountScene', getScene?.Scene?.CountScene);
updateDetailField(eSystemObjectType.eScene, 'CountNode', getScene?.Scene?.CountNode);
Expand All @@ -64,14 +65,16 @@ function SceneDetails(props: DetailComponentProps): React.ReactElement {
updateDetailField(eSystemObjectType.eScene, 'CountMeta', getScene?.Scene?.CountMeta);
updateDetailField(eSystemObjectType.eScene, 'CountSetup', getScene?.Scene?.CountSetup);
updateDetailField(eSystemObjectType.eScene, 'CountTour', getScene?.Scene?.CountTour);
updateDetailField(eSystemObjectType.eScene, 'EdanUUID', getScene?.Scene?.EdanUUID);
isMounted.current = true;
}
};

retrieveSceneData();
}, []);

useEffect(() => {
onUpdateDetail(objectType, SceneDetails);
if (isMounted.current) onUpdateDetail(objectType, SceneDetails);
}, [SceneDetails]);

if (!data || loading) {
Expand All @@ -83,28 +86,46 @@ function SceneDetails(props: DetailComponentProps): React.ReactElement {
updateDetailField(eSystemObjectType.eScene, name, checked);
};

const rowFieldProps = { alignItems: 'center', justifyContent: 'space-between', style: { borderRadius: 0 } };
const gridTemplateColumns = '100px 1fr';
const rowFieldProps = { alignItems: 'center', alignContent: 'center', style: { borderRadius: 0, display: 'grid', gridTemplateColumns } };

return (
<Box>
<ReferenceModels referenceModels={SceneDetails.ModelSceneXref} />

<Box display='flex' flexDirection='column' className={classes.container}>
<FieldType required label="Has been QC'd" direction='row' containerProps={rowFieldProps}>
<Checkbox name='HasBeenQCd' checked={SceneDetails.HasBeenQCd} color='primary' onChange={setCheckboxField} />
<Box className={classes.container}>
<FieldType
required
label="Has been QC'd"
direction='row'
width='100%'
containerProps={rowFieldProps}
>
<Box width='fit-content' textAlign='right'>
<Checkbox name='HasBeenQCd' checked={SceneDetails.HasBeenQCd} color='primary' onChange={setCheckboxField} />
</Box>
</FieldType>

<FieldType required label='Is Oriented' direction='row' containerProps={rowFieldProps}>
<Checkbox name='IsOriented' checked={SceneDetails.IsOriented} color='primary' onChange={setCheckboxField} />
<FieldType
required
label='Is Oriented'
direction='row'
width='100%'
containerProps={rowFieldProps}
>
<Box width='fit-content' textAlign='right'>
<Checkbox name='IsOriented' checked={SceneDetails.IsOriented} color='primary' onChange={setCheckboxField} />
</Box>
</FieldType>
<ReadOnlyRow label='Scene Count' value={SceneDetails.CountScene} padding={15} />
<ReadOnlyRow label='Node Count' value={SceneDetails.CountNode} padding={15} />
<ReadOnlyRow label='Camera Count' value={SceneDetails.CountCamera} padding={15} />
<ReadOnlyRow label='Light Count' value={SceneDetails.CountLight} padding={15} />
<ReadOnlyRow label='Model Count' value={SceneDetails.CountModel} padding={15} />
<ReadOnlyRow label='Meta Count' value={SceneDetails.CountMeta} padding={15} />
<ReadOnlyRow label='Setup Count' value={SceneDetails.CountSetup} padding={15} />
<ReadOnlyRow label='Tour Count' value={SceneDetails.CountTour} padding={15} />
<ReadOnlyRow label='EDAN UUID' value={SceneDetails.EdanUUID} padding={15} gridTemplate={gridTemplateColumns} />
<ReadOnlyRow label='Scene Count' value={SceneDetails.CountScene} padding={15} gridTemplate={gridTemplateColumns} />
<ReadOnlyRow label='Node Count' value={SceneDetails.CountNode} padding={15} gridTemplate={gridTemplateColumns} />
<ReadOnlyRow label='Camera Count' value={SceneDetails.CountCamera} padding={15} gridTemplate={gridTemplateColumns} />
<ReadOnlyRow label='Light Count' value={SceneDetails.CountLight} padding={15} gridTemplate={gridTemplateColumns} />
<ReadOnlyRow label='Model Count' value={SceneDetails.CountModel} padding={15} gridTemplate={gridTemplateColumns} />
<ReadOnlyRow label='Meta Count' value={SceneDetails.CountMeta} padding={15} gridTemplate={gridTemplateColumns} />
<ReadOnlyRow label='Setup Count' value={SceneDetails.CountSetup} padding={15} gridTemplate={gridTemplateColumns} />
<ReadOnlyRow label='Tour Count' value={SceneDetails.CountTour} padding={15} gridTemplate={gridTemplateColumns} />
</Box>
</Box>
);
Expand Down
4 changes: 2 additions & 2 deletions client/src/pages/Repository/components/DetailsView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ function DetailsView(): React.ReactElement {
// requires the fields to be populated.
if (objectType === eSystemObjectType.eModel) {
const ModelDetails = getDetail(objectType) as ModelDetailsType;
const { DateCaptured, idVCreationMethod, idVModality, idVPurpose, idVUnits, idVFileType } = ModelDetails;
const { DateCreated, idVCreationMethod, idVModality, idVPurpose, idVUnits, idVFileType } = ModelDetails;

updatedData.Model = {
Name: updatedData?.Name,
Expand All @@ -307,7 +307,7 @@ function DetailsView(): React.ReactElement {
Purpose: idVPurpose,
Units: idVUnits,
ModelFileType: idVFileType,
DateCaptured
DateCaptured: DateCreated
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ function WorkflowList(): React.ReactElement {
if (!value) return '';
return (
<Tooltip placement='left' title={value} arrow>
<p>{truncateWithEllipses(value, 40)}</p>
<div>{truncateWithEllipses(value, 40)}</div>
</Tooltip>
);
},
Expand Down
10 changes: 9 additions & 1 deletion client/src/pages/Workflow/components/WorkflowView/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
import React from 'react';
/* eslint-disable react-hooks/exhaustive-deps */
import React, { useEffect } from 'react';
import WorkflowFilter from './WorkflowFilter';
import WorkflowList from './WorkflowList';
import { useWorkflowStore } from '../../../../store/index';

function WorkflowView(): React.ReactElement {
const fetchWorkflowList = useWorkflowStore(state => state.fetchWorkflowList);

useEffect(() => {
fetchWorkflowList();
}, []);

return (
<React.Fragment>
<WorkflowFilter />
Expand Down
9 changes: 6 additions & 3 deletions client/src/store/detailTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
import lodash from 'lodash';

export interface ModelDetailsType {
DateCaptured: string | null;
DateCreated: string | null;
idVCreationMethod: number | null;
idVModality: number | null;
idVPurpose: number | null;
Expand Down Expand Up @@ -46,6 +46,7 @@ interface SceneDetailsType {
CountMeta: number;
CountSetup: number;
CountTour: number;
EdanUUID: string | null;
ModelSceneXref: any[];
}

Expand Down Expand Up @@ -116,7 +117,7 @@ export const useDetailTabStore = create<DetailTabStore>((set: SetState<DetailTab
EntireSubject: null
},
ModelDetails: {
DateCaptured: null,
DateCreated: null,
idVCreationMethod: null,
idVModality: null,
idVPurpose: null,
Expand Down Expand Up @@ -153,6 +154,7 @@ export const useDetailTabStore = create<DetailTabStore>((set: SetState<DetailTab
CountMeta: 0,
CountSetup: 0,
CountTour: 0,
EdanUUID: null,
ModelSceneXref: [
{
BoundingBoxP1X: 0,
Expand Down Expand Up @@ -459,10 +461,11 @@ export const useDetailTabStore = create<DetailTabStore>((set: SetState<DetailTab

if (objectType === eSystemObjectType.eScene) {
const {
Scene: { HasBeenQCd, IsOriented }
Scene: { HasBeenQCd, IsOriented, EdanUUID }
} = getDetailsTabDataForObject;
updateDetailField(eSystemObjectType.eScene, 'HasBeenQCd', HasBeenQCd);
updateDetailField(eSystemObjectType.eScene, 'IsOriented', IsOriented);
updateDetailField(eSystemObjectType.eScene, 'EdanUUID', EdanUUID);
}

if (objectType === eSystemObjectType.eProjectDocumentation) {
Expand Down
3 changes: 2 additions & 1 deletion client/src/store/metadata/metadata.defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,8 @@ export const defaultSceneFields: SceneFields = {
hasBeenQCd: false,
isOriented: false,
name: '',
directory: ''
directory: '',
EdanUUID: '',
};

export type SceneSchemaType = typeof sceneFieldsSchema;
Expand Down
1 change: 1 addition & 0 deletions client/src/store/metadata/metadata.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export type SceneFields = {
isOriented: boolean;
name: string;
directory: string;
EdanUUID: string;
idAsset?: number;
};

Expand Down
Loading

0 comments on commit ce280cf

Please sign in to comment.