-
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
feat(#1): catalogue and recommender integration #37
base: main
Are you sure you want to change the base?
Conversation
…, featuring keywords list
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.
@AlvaroFernandezBejarano This PR is now ready for review! Sorry for the time it took, I got dragged away by other tasks. It implements all of what is mentioned in the original posts, yet to keep the development of catalogue browsing features manageable, I created a few issues for follow up work:
- Implement streaming to load catalogue queries #39 to implement progressive loading of the catalogue upon querying it. It is not a priority, won't be addressed now.
- Implement catalogue query filtering by providers and keywords #40 to implement the filtering by providers and keywords. This is the next step in the catalogue work.
- Rework catalogue query pagination #41 to implement pagination. Only after Implement catalogue query filtering by providers and keywords #40
- Make recommender optional #42 to make the use of the recommender optional: this is ultra low priority.
When you'll have time, please have a look and let me know!
echo "CATALOGUE_URL=${{ secrets.CATALOGUE_URL }}" > .env.production | ||
echo "RECOMMENDER_URL=${{ secrets.RECOMMENDER_URL }}" >> .env.production |
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.
Having these two env variables set is required for the production build to work, otherwise the prefetching of nextjs fails.
@@ -10,7 +12,7 @@ FROM node:20-alpine as builder | |||
WORKDIR /app | |||
COPY --from=deps /app/node_modules ./node_modules | |||
COPY . . | |||
RUN npm run build | |||
RUN npm run ${BUILD_CMD} |
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.
Remark: this is really an optional addition, to enable us to build locally or to do a development build with prefetching disabled. I am happy to remove it if you find that irrelevant.
hostname: 'picsum.photos', | ||
port: '', | ||
pathname: '/200' | ||
hostname: '**' |
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.
Not ideal in terms of security, but we have no choice if we want to be able to render any images stored in the offerings and participants.. if you have any ideas to make this more secure, let me know!
"compile": "next build --experimental-build-mode compile", | ||
"generate": "next build --experimental-build-mode generate", |
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.
This two commands are here to enable us to build the app without prefetching, therefore not requiring valid URLs for the catalogue or recommender. I am happy to remove that if you find this irrelevant.
const goBack = () => { | ||
if (document.referrer.includes('/catalogue?')) { | ||
window.history.back() | ||
} else { | ||
window.location.href = '/catalogue' | ||
} | ||
} |
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.
It may sound unusual to use window.history
directly, but I found that more elegant than creating a hook to modify Nextjs' router
, which doesn't store the navigation history.
</div> | ||
<div className='pt-2'> | ||
<PriceCard price={asset.price} /> | ||
<PriceCard price={offering?.price ?? 0} /> |
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.
NB: price
is not part of the Sedimark ontology for the time being.
@@ -8,11 +8,11 @@ function Recommender ({ recommendations }) { | |||
<div className='flex gap-4 overflow-x-auto p-4 w-full'> | |||
{recommendations.map((recommendation, index) => { | |||
return ( | |||
<Link key={`${recommendation.title}-${recommendation.created_at}-${index + 1}`} href='#'> | |||
<Link key={`${recommendation.title.value}-${recommendation.created.value}-${index + 1}`} href={`/catalogue/${btoa(recommendation.offering.value)}`}> |
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.
NB: offering IDs are URLs... so to put them in the URL path, they are encoded in base64. I am open to other approaches!
const query = searchParams?.query || '' | ||
const currentPage = Number(searchParams?.page) || 1 | ||
|
||
return ( | ||
<div className='bg-sedimark-dark-deep-blue'> | ||
<SearchBar /> | ||
<Suspense | ||
key={type + query + currentPage} // Ensures the Catalogue component is re-rendered when the search parameters change | ||
key={query + currentPage} // Ensures the Catalogue component is re-rendered when the search parameters change |
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.
The type
has been removed because we won't distinguish two types of offerings anymore in the project (just datasets, no services).
<div> | ||
<Image src='/img/ukri-icon.png' height={48} width={149} alt='UKRI' /> | ||
</div> |
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.
Sorry this addition is not relevant in the PR, but that's something we need to do.
Description
Hi there! This PR integrates a catalogue instance, as well as a recommender instance, to the marketplace. More precisely, it implements:
How to test
You will need to port-forward to the Sedimark cluster to access the catalogue and recommender:
Be sure to add the necessary variables to your env. You can check that in the updated example env, but for convenience:
Then as usual:
To-do
Closes #1