-
Notifications
You must be signed in to change notification settings - Fork 0
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
Wire up details panel to collection item nodes #18
base: main
Are you sure you want to change the base?
Conversation
@@ -22,16 +25,27 @@ watch(resultSelected, () => { | |||
|
|||
async function getData() { | |||
const resp = await fetchResourceData(resultSelected.value); | |||
const imageResourceids = resp.resource["Digital Reference"]?.map((tile: { [key: string]: any; }) => // eslint-disable-line @typescript-eslint/no-explicit-any | |||
tile["Digital Source"]["resourceId"]); | |||
const accessionNumber = resp.resource['Identifier']?.find((identifier: {[key: string]: any;}) => // eslint-disable-line @typescript-eslint/no-explicit-any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what else to do about the key value type. I think it has to be 'any' because I really don't know what it might be, so I used this // eslint-disable-line @typescript-eslint/no-explicit-any
to appease the linter.
const imageResourceids = resp.resource["Digital Reference"]?.map((tile: { [key: string]: any; }) => // eslint-disable-line @typescript-eslint/no-explicit-any | ||
tile["Digital Source"]["resourceId"]); | ||
const accessionNumber = resp.resource['Identifier']?.find((identifier: {[key: string]: any;}) => // eslint-disable-line @typescript-eslint/no-explicit-any | ||
identifier["Identifier_type"]["@display_value"]==="Accession Number"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm using 'Accession' number here as a placeholder. I'm really not sure what will go here because there is nothing in the graph that corresponds to the mock-up.
({ | ||
"person": tile["Addition to Collection_carried out by"]["@display_value"], | ||
"date": tile["Addition to Collection_time"]["Addition to Collection_time_begin of the begin"]["@display_value"], | ||
"details": tile["Addition to Collection_Statement"]?.map((statement: {[key: string]: any;}) => // eslint-disable-line @typescript-eslint/no-explicit-any | ||
(statement["Addition to Collection_Statement_content"]["@display_value"])).join(" ") | ||
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
add optional chaining to allow forother parts of display to render properly
({ | |
"person": tile["Addition to Collection_carried out by"]["@display_value"], | |
"date": tile["Addition to Collection_time"]["Addition to Collection_time_begin of the begin"]["@display_value"], | |
"details": tile["Addition to Collection_Statement"]?.map((statement: {[key: string]: any;}) => // eslint-disable-line @typescript-eslint/no-explicit-any | |
(statement["Addition to Collection_Statement_content"]["@display_value"])).join(" ") | |
})); | |
({ | |
"person": tile?.["Addition to Collection_carried out by"]?.["@display_value"], | |
"date": tile?.["Addition to Collection_time"]?.["Addition to Collection_time_begin of the begin"]["@display_value"], | |
"details": tile?.["Addition to Collection_Statement"]?.map((statement: {[key: string]: any;}) => // eslint-disable-line @typescript-eslint/no-explicit-any | |
(statement?.["Addition to Collection_Statement_content"]?.["@display_value"])).join(" ") | |
})); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah - I thought the optional chaining in the ?.map
above that which passes 'tile' in would ensure there was a tile, but I guess not if you had a parent with no children.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok - that should be fixed now.
/> | ||
</div> | ||
<div v-if="images.length" class="images"> | ||
<Carousel :value="images" :numVisible="2" :numScroll="1" containerClass="flex items-center"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these properties should use hyphens instead of camelCase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, I can't change those. They are passed into Carousel. I checked to see if Carousel would take hyphenated args, but no luck.
const imageResourceids = resp.resource["Digital Reference"]?.map((tile: { [key: string]: any; }) => // eslint-disable-line @typescript-eslint/no-explicit-any | ||
tile["Digital Source"]["resourceId"]); | ||
const accessionNumber = resp.resource['Identifier']?.find((identifier: {[key: string]: any;}) => // eslint-disable-line @typescript-eslint/no-explicit-any | ||
identifier["Identifier_type"]["@display_value"]==="Accession Number"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
identifier["Identifier_type"]["@display_value"]==="Accession Number"); | |
type UnspecifiedObject = { [key: string]: UnspecifiedObject | unknown }; | |
..... | |
..... | |
const imageResourceids = resp.resource["Digital Reference"]?.map((tile: UnspecifiedObject) => | |
(tile["Digital Source"] as UnspecifiedObject)?.["resourceId"]); |
Removes (most) mock data from the collection item details panel. Loads identifier, images, and acquisition information from tile data.