Skip to content

Commit

Permalink
Revert "ui code changes for 'id' lambda refactor (#71)"
Browse files Browse the repository at this point in the history
This reverts commit 157c8cc.
  • Loading branch information
bo-lu committed May 29, 2023
1 parent 157c8cc commit 59aaa57
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/common/envglobals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function envglobals(): globalValues {
en: "http://wp-01-1130072660.ca-central-1.elb.amazonaws.com/home/",
fr: "http://wp-01-1130072660.ca-central-1.elb.amazonaws.com/fr/accueil/"
},
APP_API_DOMAIN_URL: "https://0mgqjkl9t0.execute-api.ca-central-1.amazonaws.com/dev",
APP_API_DOMAIN_URL: "https://qgqt1tniy2.execute-api.ca-central-1.amazonaws.com/live",
APP_API_ENDPOINTS: endpoints,
APP_GEOCORE_URL: "https://geocore-dev.metadata.geo.ca",
SITE_NAME: "localhost",
Expand Down
20 changes: 8 additions & 12 deletions src/components/search/metadatapage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const MetaDataPage = (props) => {
axios.get(`${EnvGlobals.APP_API_DOMAIN_URL}${EnvGlobals.APP_API_ENDPOINTS.METADATA}`, { params: searchParams })
.then(response => response.data)
.then((data) => {
const res = data.body.Items[0];
const res = data.Items[0];
res.title = language === 'en' ? res.title_en : res.title_fr;
res.mappingtitle = { en: res.title_en, fr: res.title_fr };
// get related products
Expand Down Expand Up @@ -339,23 +339,20 @@ const MetaDataPage = (props) => {
{t("page.noresult")}
</p> :
[metaresult].map((result, rmIndex) => {
const formattedOption = result.options;
const formattedContact = result.contact;
const formattedgraphicOverview = result.graphicOverview;
const graphicOverview = formattedgraphicOverview !== null && formattedgraphicOverview !== '' ? formattedgraphicOverview : { overviewFileName: '' };
const formattedOption = result.options.replace(/\\"/g, '"').replace(/["]+/g, '"').substring(1, result.options.replace(/\\"/g, '"').replace(/["]+/g, '"').length - 1);
const formattedContact = result.contact.replace(/\\"/g, '"').replace(/["]+/g, '"').substring(1, result.contact.replace(/\\"/g, '"').replace(/["]+/g, '"').length - 1);
const formattedgraphicOverview = result.graphicOverview.replace(/\\"/g, '"').replace(/["]+/g, '"');
const graphicOverview = formattedgraphicOverview !== null && formattedgraphicOverview !== '' ? JSON.parse(formattedgraphicOverview) : { overviewFileName: '' };
const imageFile = graphicOverview.map(o => o.overviewFileName).join(',');
const options = formattedOption
const options = JSON.parse(formattedOption)
.filter(o => { return o.protocol !== null && o.url !== null && o.protocol !== 'null' && o.url !== 'null' })
.map((option) => {
const desc = option.description[language].split(";");
return { name: option.name[language], type: desc[0], format: desc[1], language: t(`page.${desc[2].toLowerCase().replace(',', '')}`), url: option.url };
});

const tcRange = ['N/A', 'N/A'];
tcRange[0] = result.temporalExtent.begin;
tcRange[1] = result.temporalExtent.end;
/*
result.temporalExtent.substring(1, result.temporalExtent.length - 1).split(",").forEach((date) => {
result.temporalExtent.substring(1, result.temporalExtent.length - 1).split(",").forEach((date) => {
const dateStr = date.trim().split("=");
if (dateStr[1] !== undefined && dateStr[1].toLowerCase() !== 'null') {
if (dateStr[0].toLowerCase() === 'begin') {
Expand All @@ -367,11 +364,10 @@ const MetaDataPage = (props) => {

}
});
*/

const activeMap = options.findIndex((o) => o.type.toUpperCase() === 'WMS' || o.type.toUpperCase() === 'WEB SERVICE' || o.type.toUpperCase() === 'SERVICE WEB') > -1;
const mapButtonClass = activeMap ? 'btn btn-search' : 'btn btn-search disabled';
const contact = formattedContact;
const contact = JSON.parse(formattedContact);
const coordinates = JSON.parse(result.coordinates);

const langInd = (language === 'en') ? 0 : 1;
Expand Down

0 comments on commit 59aaa57

Please sign in to comment.