Skip to content

Commit

Permalink
Merge pull request #11 from DiSSCo/WorkshopPreparatoryDetails
Browse files Browse the repository at this point in the history
Update deployment files and minor fixes to error handling on Search page
  • Loading branch information
TomDijkema authored Jun 24, 2024
2 parents 7af1e3a + a37c008 commit affacca
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 61 deletions.
8 changes: 4 additions & 4 deletions deployment/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ services:
- "443:443"
volumes:
- ./nginx/conf:/etc/nginx:ro
- ./certbot/www:/var/www/certbot
- ./certbot/conf:/etc/letsencrypt
- ./certbot/www/:/var/www/certbot/:ro
- ./certbot/conf/:/etc/letsencrypt/:rw
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
certbot:
image: certbot/certbot
container_name: certbot
restart: unless-stopped
volumes:
- ./certbot/conf:/etc/letsencrypt
- ./certbot/www:/var/www/certbot
- ./certbot/conf/:/etc/letsencrypt/:rw
- ./certbot/www/:/var/www/certbot/:rw
entrypoint: "/bin/sh -c 'trap exit TERM; while :; do certbot renew; sleep 12h & wait $${!}; done;'"
8 changes: 4 additions & 4 deletions deployment/nginx/conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ http {
listen [::]:443 ssl;
http2 on;

ssl_certificate /etc/letsencrypt/live/marketplace.cetaf.org-0001/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/marketplace.cetaf.org-0001/privkey.pem;
ssl_certificate /etc/letsencrypt/live/marketplace.cetaf.org/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/marketplace.cetaf.org/privkey.pem;
ssl_session_timeout 1d;
ssl_session_cache shared:MozSSL:10m;
ssl_session_tickets off;
Expand All @@ -23,7 +23,7 @@ http {

# intermediate configuration
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA>
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA>;
ssl_prefer_server_ciphers off;

# HSTS (ngx_http_headers_module is required) (63072000 seconds)
Expand All @@ -34,7 +34,7 @@ http {
ssl_stapling_verify on;

# verify chain of trust of OCSP response using Root CA and Intermediate certs
ssl_trusted_certificate /etc/letsencrypt/live/marketplace.cetaf.org-0001/fullchain.pem;
ssl_trusted_certificate /etc/letsencrypt/live/marketplace.cetaf.org/fullchain.pem;

location / {
proxy_pass http://tettris_marketplace:3000;
Expand Down
23 changes: 12 additions & 11 deletions nginx/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
server {
include mime.types;
include mime.types;

listen 3000;
listen 3000;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}
location / {
root /usr/share/nginx/html;
index index.html index.htm;
try_files $uri $uri/ /index.html;
}

error_page 500 502 503 504 /50x.html;
error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /usr/share/nginx/html;
}

location = /50x.html {
root /usr/share/nginx/html;
}
}
5 changes: 0 additions & 5 deletions src/api/taxonomicService/GetTaxonomicServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,11 +62,6 @@ const GetTaxonomicServices = async ({ pageNumber, pageSize, searchFilters }: { p
/* Get result data from JSON */
const data: CordraResultArray = result.data;

/* Check if there are any results */
if (!data.results.length) {
throw (new Error('No results found', { cause: 200 }));
};

/* Set Taxonomic Services */
data.results.forEach((dataFragment) => {
const taxonomicService = dataFragment.attributes.content as TaxonomicService;
Expand Down
8 changes: 4 additions & 4 deletions src/app/types/TaxonomicService.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ export interface TaxonomicService {
*/
"ods:type": string;
/**
* http://purl.org/dc/terms/license
* http://purl.org/dc/terms/licence
*/
"dcterms:license": string;
"dcterms:licence": string;
/**
* The current state of the object
*/
Expand Down Expand Up @@ -152,9 +152,9 @@ export interface TaxonomicService {
*/
"erp:multimediaUrl": string;
/**
* http://purl.org/dc/terms/license
* http://purl.org/dc/terms/licence
*/
"dcterms:license"?: string;
"dcterms:licence"?: string;
[k: string]: unknown;
}[];
[k: string]: unknown;
Expand Down
37 changes: 20 additions & 17 deletions src/components/search/Search.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,22 @@ const Search = () => {

/* Base variables */
const paginator = usePaginator({
Initiate: () => dispatch(setTaxonomicServices([])),
Initiate: () => {
dispatch(setTaxonomicServices([]));
setNoMoreResults(false);
},
Method: GetTaxonomicServices,
Handler: (taxonomicServices: TaxonomicService[]) => {
/* On receival of a new page with records, add them to the total */
dispatch(concatToTaxonomicServices(taxonomicServices));
dispatch(setIsApiOnline(true))

if (!taxonomicServices.length) {
setNoMoreResults(true);
}
},
ErrorHandler: (error: Error) => {
if (error.cause === 200) {
setNoMoreResults(true);
} else {
dispatch(setIsApiOnline(false));
};
dispatch(setIsApiOnline(false));
},
pageSize: 12,
resultKey: 'taxonomicServices',
Expand Down Expand Up @@ -125,23 +128,23 @@ const Search = () => {
{/* Load more button */}
<Row className={loadMoreBlockClass}>
<Col className="d-flex justify-content-center">
{(!paginator.loading && !paginator.errorMessage && paginator.totalRecords > 0) ?
{(!paginator.loading && !noMoreResults && paginator.totalRecords > 0) &&
<Button type="button"
variant={searchParams.get('taxonomicServiceType') === 'referenceCollection' ? 'secondary' : 'primary'}
OnClick={() => paginator.Next?.()}
>
Load more
</Button>
: <>
{(!noMoreResults && paginator.totalRecords > 0) ?
<Spinner />
: <Row className="h-100 align-items-center">
<Col>
<p>{paginator.errorMessage}</p>
</Col>
</Row>
}
</>
}
{(!paginator.loading && noMoreResults && paginator.totalRecords > 0) &&
<Row className="h-100 align-items-center">
<Col>
<p>{`No ${paginator.totalRecords > 0 ? 'more ' : ''}results found`}</p>
</Col>
</Row>
}
{paginator.loading &&
<Spinner />
}
</Col>
</Row>
Expand Down
2 changes: 1 addition & 1 deletion src/components/taxonomicService/TaxonomicService.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ const TaxonomicService = () => {
<DetailsBlock name="Service Details"
properties={{
category: taxonomicService.taxonomicService['erp:category'],
license: taxonomicService.taxonomicService['dcterms:license'],
licence: taxonomicService.taxonomicService['dcterms:licence'],
version: taxonomicService.taxonomicService['erp:version'],
lastUpdated: moment(taxonomicService.taxonomicService['erp:lastUpdate']).format('MMM DD - YYYY'),
paymentModel: taxonomicService.taxonomicService['erp:paymentModel'],
Expand Down
10 changes: 5 additions & 5 deletions src/sources/dataModel/cordra-schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"required": [
"erp:id",
"ods:type",
"dcterms:license",
"dcterms:licence",
"cetaf:state",
"erp:languageAvailabilities",
"erp:name",
Expand Down Expand Up @@ -38,9 +38,9 @@
"taxonomicService"
]
},
"dcterms:license": {
"dcterms:licence": {
"type": "string",
"title": "License"
"title": "Licence"
},
"cetaf:state": {
"type": "string",
Expand Down Expand Up @@ -230,9 +230,9 @@
"type": "string",
"title": "Multimedia URL"
},
"dcterms:license": {
"dcterms:licence": {
"type": "string",
"title": "Multimedia License"
"title": "Multimedia Licence"
}
}
}
Expand Down
14 changes: 7 additions & 7 deletions src/sources/dataModel/taxonomic-service.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
"description": "The FDO type of the object",
"$comment": "Unclear what value goes here"
},
"dcterms:license": {
"dcterms:licence": {
"type": "string",
"description": "http://purl.org/dc/terms/license",
"$comment": "Determine available licenses",
"description": "http://purl.org/dc/terms/licence",
"$comment": "Determine available licences",
"examples": [
"CC0"
]
Expand Down Expand Up @@ -281,10 +281,10 @@
"type": "string",
"description": "Link to video, screenshots or slides showing details of the Resource."
},
"dcterms:license": {
"dcterms:licence": {
"type": "string",
"description": "http://purl.org/dc/terms/license",
"$comment": "Determine available licenses",
"description": "http://purl.org/dc/terms/licence",
"$comment": "Determine available licences",
"examples": [
"CC0"
]
Expand All @@ -301,7 +301,7 @@
"ods:created",
"dcterms:modified",
"ods:type",
"dcterms:license",
"dcterms:licence",
"cetaf:state",
"erp:languageAvailabilities",
"erp:name",
Expand Down
2 changes: 1 addition & 1 deletion src/sources/mock/ReferenceCollection.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"ods:created": "2024-04-01T11:31:26.038070Z",
"dcterms:modified": "2024-05-01T11:31:26.038070Z",
"ods:type": "taxonomic_service",
"dcterms:license": "CC0",
"dcterms:licence": "CC0",
"cetaf:state": "published",
"erp:languageAvailabilities": [
"en"
Expand Down
2 changes: 1 addition & 1 deletion src/sources/mock/TaxonomicServiceAccepted.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"ods:created": "2024-04-01T11:31:26.038070Z",
"dcterms:modified": "2024-05-01T11:31:26.038070Z",
"ods:type": "taxonomic_service",
"dcterms:license": "CC0",
"dcterms:licence": "CC0",
"cetaf:state": "published",
"erp:languageAvailabilities": [
"en"
Expand Down
2 changes: 1 addition & 1 deletion src/sources/mock/TaxonomicServiceSuggested.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"ods:created": "2024-04-01T11:31:26.038070Z",
"dcterms:modified": "2024-05-01T11:31:26.038070Z",
"ods:type": "taxonomic_service",
"dcterms:license": "CC0",
"dcterms:licence": "CC0",
"cetaf:state": "draft",
"erp:languageAvailabilities": [
"en"
Expand Down

0 comments on commit affacca

Please sign in to comment.