diff --git a/Jenkinsfile b/Jenkinsfile index 463e5211..8f30c56c 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,7 +1,9 @@ pipeline { environment { - registry = "eeacms/ims-frontend" - template = "templates/volto-ims" + registry = "eeacms/eprtr-frontend" + template = "templates/volto-eprtr" + RANCHER_STACKID = "1st1851" + RANCHER_ENVID = "1a332957" dockerImage = '' tagName = '' } diff --git a/src/components/manage/Blocks/DiscodataOpenlayersMapBlock/View.jsx b/src/components/manage/Blocks/DiscodataOpenlayersMapBlock/View.jsx index 91ece9b8..ad0820d8 100644 --- a/src/components/manage/Blocks/DiscodataOpenlayersMapBlock/View.jsx +++ b/src/components/manage/Blocks/DiscodataOpenlayersMapBlock/View.jsx @@ -566,7 +566,7 @@ const OpenlayersMapView = (props) => { /* ======== TILE LAYERS ======== */ // Make TileLayers worldLightGrayBase = makeTileLayer( - 'https://server.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}', + 'https://services.arcgisonline.com/ArcGIS/rest/services/Canvas/World_Light_Gray_Base/MapServer/tile/{z}/{y}/{x}', true, 'World_Light_Gray_Base', ); diff --git a/src/components/manage/Blocks/FiltersBlock/Edit.jsx b/src/components/manage/Blocks/FiltersBlock/Edit.jsx index 36c329aa..1b502971 100644 --- a/src/components/manage/Blocks/FiltersBlock/Edit.jsx +++ b/src/components/manage/Blocks/FiltersBlock/Edit.jsx @@ -6,16 +6,20 @@ import RenderFields from 'volto-addons/Widgets/RenderFields'; import View from './View'; import { settings } from '~/config'; -const getSchema = props => { +const getSchema = (props) => { return { - title: { + modalButtonTitle: { type: 'text', - title: 'Title', + title: 'Modal button title', + }, + searchButtonTitle: { + type: 'text', + title: 'Search button title', }, }; }; -const Edit = props => { +const Edit = (props) => { const [state, setState] = useState({ schema: getSchema({ ...props }), id: _uniqueId('block_'), diff --git a/src/components/manage/Blocks/FiltersBlock/View.jsx b/src/components/manage/Blocks/FiltersBlock/View.jsx index a59e06f6..544fe831 100644 --- a/src/components/manage/Blocks/FiltersBlock/View.jsx +++ b/src/components/manage/Blocks/FiltersBlock/View.jsx @@ -62,15 +62,16 @@ const View = ({ content, ...props }) => { const [sidebar, setSidebar] = useState(false); const searchContainerModal = useRef(null); const searchContainer = useRef(null); - const title = props.data.title?.value; - const locationResultsTexts = locationResults.map(result => result.text); + const modalButtonTitle = props.data.modalButtonTitle?.value; + const searchButtonTitle = props.data.searchButtonTitle?.value; + const locationResultsTexts = locationResults.map((result) => result.text); const searchResults = [ ...sitesResults.slice( 0, locationResults.length < 3 ? 6 - locationResults.length : 3, ), ...locationResults - .map(result => result.text) + .map((result) => result.text) .slice(0, sitesResults.length < 3 ? 6 - sitesResults.length : 3), ]; @@ -105,14 +106,14 @@ const View = ({ content, ...props }) => { type: 'firstElement', } : null, - ].filter(req => req); + ].filter((req) => req); } - reqs.forEach(req => { + reqs.forEach((req) => { promises.push(axios.get(makeUrl(providerUrl, req.sql))); }); Promise.all(promises) - .then(response => { + .then((response) => { const newFactsData = { ...factsData }; response.forEach((res, index) => { const results = JSON.parse(res.request.response).results; @@ -143,15 +144,15 @@ const View = ({ content, ...props }) => { ...newFactsData, }); }) - .catch(error => {}); + .catch((error) => {}); }; - useEffect(function() { + useEffect(function () { setState({ ...state, mounted: true }); updateFactsData(true); document .getElementById(`dynamic-filter`) - .addEventListener('featurechange', e => { + .addEventListener('featurechange', (e) => { if ( JSON.stringify(e.detail.features?.[0]?.getProperties?.()?.country) !== JSON.stringify(alphaFeature?.getProperties?.()?.country) @@ -194,12 +195,12 @@ const View = ({ content, ...props }) => { let metadata = []; const siteCountryFilters = state.filters.siteCountry && - state.filters.siteCountry.filter(country => country); + state.filters.siteCountry.filter((country) => country); const regionFilters = - state.filters.region && state.filters.region.filter(region => region); + state.filters.region && state.filters.region.filter((region) => region); const pollutantGroupFilter = state.filters.pollutantGroup && - state.filters.pollutantGroup.filter(pollutant => pollutant); + state.filters.pollutantGroup.filter((pollutant) => pollutant); const onMountRequests = { sqls: [ // INDUSTRIES QUERY @@ -310,7 +311,7 @@ const View = ({ content, ...props }) => { siteCountryFilters.length > 0 && `SELECT DISTINCT NUTS_ID, NUTS_NAME FROM [IED].[latest].[refNuts_NoGeo] - WHERE CNTR_CODE IN (${siteCountryFilters.map(country => { + WHERE CNTR_CODE IN (${siteCountryFilters.map((country) => { return "'" + country + "'"; })}) AND LEVL_CODE = 1 ORDER BY NUTS_NAME`, @@ -319,7 +320,7 @@ const View = ({ content, ...props }) => { siteCountryFilters.length > 0 && `SELECT DISTINCT thematicIdIdentifier, nameText FROM [IED].[latest].[refRBD_NoGeo] - WHERE countryCode IN (${siteCountryFilters.map(country => { + WHERE countryCode IN (${siteCountryFilters.map((country) => { return "'" + country + "'"; })}) ORDER BY nameText`, @@ -330,7 +331,7 @@ const View = ({ content, ...props }) => { regionFilters.length && `SELECT DISTINCT NUTS_ID, NUTS_NAME FROM [IED].[latest].[refNuts_NoGeo] - WHERE CNTR_CODE IN (${siteCountryFilters.map(country => { + WHERE CNTR_CODE IN (${siteCountryFilters.map((country) => { return "'" + country + "'"; })}) AND (${regionFilters .map((region, index) => { @@ -440,7 +441,7 @@ const View = ({ content, ...props }) => { } }); Promise.all(promises) - .then(response => { + .then((response) => { if (state.mounted) { const filtersMeta = { ...state.filtersMeta, @@ -454,12 +455,12 @@ const View = ({ content, ...props }) => { nrOfRequests++; const results = JSON.parse(res.request.response).results; let filteringInputs = []; - if (state.filtersMeta[(metadata[index]?.key)]?.filteringInputs) { + if (state.filtersMeta[metadata[index]?.key]?.filteringInputs) { filteringInputs = [ ...state.filtersMeta[metadata[index].key].filteringInputs, ]; } - filtersMeta[(metadata[index]?.key)] = { + filtersMeta[metadata[index]?.key] = { filteringInputs: filteringInputs.length ? filteringInputs : [metadata[index]?.firstInput], @@ -469,11 +470,11 @@ const View = ({ content, ...props }) => { static: metadata[index]?.static, options: [ { key: null, value: null, text: 'No value' }, - ...(results.map(item => { + ...(results.map((item) => { return { - key: item[(metadata[index]?.optionKey)], - value: item[(metadata[index]?.optionValue)], - text: item[(metadata[index]?.optionText)], + key: item[metadata[index]?.optionKey], + value: item[metadata[index]?.optionValue], + text: item[metadata[index]?.optionText], }; }) || []), ], @@ -486,7 +487,7 @@ const View = ({ content, ...props }) => { }); } }) - .catch(error => {}); + .catch((error) => {}); } /* eslint-disable-next-line */ }, [ @@ -542,15 +543,15 @@ const View = ({ content, ...props }) => { }); newFiltersKeys - .filter(key => !filtersMetaKeys.includes(key)) - .forEach(key => { + .filter((key) => !filtersMetaKeys.includes(key)) + .forEach((key) => { newFilters[key] = []; }); filtersMetaEntries.forEach(([key, value]) => { if (newFilters[value.queryToSet]) { - const options = value.options.map(item => item.value); + const options = value.options.map((item) => item.value); newFilters[value.queryToSet] = newFilters[value.queryToSet].map( - item => { + (item) => { if (options.includes(item)) return item; return null; }, @@ -603,8 +604,8 @@ const View = ({ content, ...props }) => { const clearFilters = () => { const newFilters = { ...state.filters }; - Object.keys(newFilters).forEach(filter => { - newFilters[filter] = newFilters[filter].map(value => null); + Object.keys(newFilters).forEach((filter) => { + newFilters[filter] = newFilters[filter].map((value) => null); }); setState({ ...state, @@ -637,13 +638,11 @@ const View = ({ content, ...props }) => { return setState({ ...state, searchResultsActive }); } - const autoComplete = data => { + const autoComplete = (data) => { let promises = []; const sqls = [ { - query: `SELECT DISTINCT site FROM [IED].[latest].[Browse3_4_infotable] WHERE [site] LIKE '${ - data.value - }%' ORDER BY [site]`, + query: `SELECT DISTINCT site FROM [IED].[latest].[Browse3_4_infotable] WHERE [site] LIKE '${data.value}%' ORDER BY [site]`, reqKey: 'results', searchKey: 'site', updateState: setSitesResults, @@ -651,16 +650,14 @@ const View = ({ content, ...props }) => { ]; const reqs = [ { - url: `https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/suggest?f=json&text=${ - data.value - }&maxSuggestions=6`, + url: `https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/suggest?f=json&text=${data.value}&maxSuggestions=6`, reqKey: 'suggestions', searchKeys: ['text', 'magicKey'], updateState: setLocationResults, }, ]; if (data.value.length > 1) { - sqls.forEach(sql => { + sqls.forEach((sql) => { promises.push({ get: axios.get( providerUrl + `?query=${encodeURI(sql.query)}&p=1&nrOfHits=6`, @@ -668,25 +665,25 @@ const View = ({ content, ...props }) => { metadata: sql, }); }); - reqs.forEach(req => { + reqs.forEach((req) => { promises.push({ get: axios.get(req.url), metadata: req, }); }); - Promise.all(promises.map(promise => promise.get)) - .then(response => { + Promise.all(promises.map((promise) => promise.get)) + .then((response) => { response.forEach((res, index) => { const data = res.request.response ? JSON.parse(res.request.response) || {} : {}; promises[index].metadata.updateState( - data[promises[index].metadata.reqKey].map(result => { + data[promises[index].metadata.reqKey].map((result) => { if (promises[index].metadata.searchKey) { return result[promises[index].metadata.searchKey]; } else if (promises[index].metadata.searchKeys) { const obj = {}; - promises[index].metadata.searchKeys.forEach(key => { + promises[index].metadata.searchKeys.forEach((key) => { if (result[key]) { obj[key] = result[key]; } @@ -697,10 +694,10 @@ const View = ({ content, ...props }) => { ); }); }) - .catch(error => {}); + .catch((error) => {}); } else { - sqls.forEach(sql => sql.updateState([])); - reqs.forEach(req => req.updateState([])); + sqls.forEach((sql) => sql.updateState([])); + reqs.forEach((req) => req.updateState([])); } setSearchTerm(data.value); }; @@ -729,7 +726,7 @@ const View = ({ content, ...props }) => { setState({ ...state, open: false }); }; - const searchView = ref => ( + const searchView = (ref) => (
{ open={state.open} trigger={ } > @@ -817,7 +814,7 @@ const View = ({ content, ...props }) => { {searchView(searchContainerModal)} {state.filtersMeta && state.filtersMetaOrder && - state.filtersMetaOrder.map(filterKey => { + state.filtersMetaOrder.map((filterKey) => { return (
{state.filtersMeta[filterKey]?.title ? ( @@ -831,7 +828,7 @@ const View = ({ content, ...props }) => { if (input.type === 'select') { const options = state.filtersMeta[ filterKey - ].options.filter(option => { + ].options.filter((option) => { if ( state.filters[ state.filtersMeta[filterKey].queryToSet @@ -945,7 +942,7 @@ const View = ({ content, ...props }) => {
@@ -1006,7 +1003,7 @@ const View = ({ content, ...props }) => {
Quick facts
{state.factsDataOrder && - state.factsDataOrder.map(key => { + state.factsDataOrder.map((key) => { return factsData[key] ? ( {factsData[key]?.title && ( diff --git a/src/components/manage/Blocks/FiltersBlock/style.css b/src/components/manage/Blocks/FiltersBlock/style.css index a6142676..5e665329 100644 --- a/src/components/manage/Blocks/FiltersBlock/style.css +++ b/src/components/manage/Blocks/FiltersBlock/style.css @@ -1,5 +1,5 @@ .filters-container { - width: 80%; + width: 100%; margin: 0 auto; } diff --git a/src/components/manage/Blocks/SidebarBlock/View.jsx b/src/components/manage/Blocks/SidebarBlock/View.jsx index a27daa77..3d66b04a 100644 --- a/src/components/manage/Blocks/SidebarBlock/View.jsx +++ b/src/components/manage/Blocks/SidebarBlock/View.jsx @@ -226,7 +226,9 @@ const makeNewNavigation = ( }, onClick: (pathname) => { if ( - facility.facilityInspireId !== search.facilityInspireId + facility.facilityInspireId !== + search.facilityInspireId || + installation !== search.installationInspireId ) { dispatch( setQueryParam({ diff --git a/src/components/theme/View/RedirectView.jsx b/src/components/theme/View/RedirectView.jsx index 895d7bee..f302464a 100644 --- a/src/components/theme/View/RedirectView.jsx +++ b/src/components/theme/View/RedirectView.jsx @@ -1,5 +1,5 @@ /* REACT IMPORTS */ -import React, { useEffect } from 'react'; +import React, { useEffect, useState } from 'react'; import { useHistory } from 'react-router-dom'; import { connect } from 'react-redux'; /* ROOT IMPORTS */ @@ -8,18 +8,24 @@ import DiscodataView from './DiscodataView'; import { getBasePath } from '~/helpers'; const RedirectView = (props) => { const history = useHistory(); + const [redirect, setRedirect] = useState(false); + const [mounted, setMounted] = useState(false); const currentPage = props.content['@id']; const redirectPage = props.content.relatedItems[0]?.['@id']; useEffect(() => { + setMounted(true); + /* eslint-disable-next-line */ + }, []) + if (mounted && !redirect) { if (redirectPage) { const currentPath = getBasePath(currentPage); const redirectPath = getBasePath(redirectPage); if (currentPath !== redirectPath) { history.push(redirectPath); + setRedirect(true); } } - /* eslint-disable-next-line */ - }, []) + } return (
diff --git a/theme/site/globals/site.overrides b/theme/site/globals/site.overrides index db5ddda8..39fad69d 100644 --- a/theme/site/globals/site.overrides +++ b/theme/site/globals/site.overrides @@ -1086,11 +1086,19 @@ body.has-sidebar { } } .active.item { - border: none !important; background-color: transparent !important; + color: #4296B3 !important; + font-weight: bold; + border-bottom: 2px solid #4296B3; + border-radius: 0; + &:hover { + background: transparent; + color: #3b849e; + } } } &.item { + flex-wrap: wrap !important; text-align: left !important; justify-content: start !important; margin-left: auto !important; @@ -1149,6 +1157,14 @@ body.has-sidebar { // } } +.ui.menu { + &.pagination { + .active.item { + background-color: transparent !important; + } + } +} + .react-grid-item { .block-container { .block-wrapper { @@ -1325,4 +1341,10 @@ h3 { margin-right: 0!important; margin-top: 0!important; margin-bottom: 0!important; +} + +#view { + .documentFirstHeading { + display: none; + } } \ No newline at end of file