-
+ {/*
*/}
+
{}}
+ onChange={(event, data) => {
+ const groupId = data.options
+ .filter((opt) => {
+ return opt.value === data.value;
+ })[0]
+ ?.value?.split(',');
+
+ const newPollutants =
+ indexPollutants?.filter(
+ (pollutant) =>
+ pollutant.pollutantId && groupId.includes(pollutant.parentId),
+ ) || [];
+ setCurrentPollutantGroup(
+ indexPollutantGroups.filter(
+ (pollutant) => pollutant.pollutantId === groupId.join(','),
+ )?.[0],
+ );
+ setCurrentPollutants(newPollutants);
+ props.setQueryParam({
+ queryParam: {
+ index_pollutant_group_id: groupId,
+ index_pollutant_id: newPollutants?.[0]?.pollutantId,
+ },
+ });
+ }}
placeholder={'Pollutant Group'}
- options={pollutionType}
+ options={[
+ {
+ key: 'all_groups',
+ value: groupsIds.join(','),
+ text: 'All groups',
+ },
+ ...indexPollutantGroups
+ .filter((pollutantGroup) => pollutantGroup.pollutantId)
+ .map((pollutantGroup) => ({
+ key: pollutantGroup.code,
+ value: pollutantGroup.pollutantId,
+ text: pollutantGroup.name,
+ })),
+ ]}
+ value={indexPollutantGroupId}
/>
{}}
+ onChange={(event, data) => {
+ props.setQueryParam({
+ queryParam: {
+ index_pollutant_id: data.options.filter((opt) => {
+ return opt.value === data.value;
+ })[0]?.value,
+ },
+ });
+ }}
placeholder={'Pollutant'}
- options={pollutionType}
+ options={currentPollutants
+ .filter((pollutant) => pollutant.pollutantId)
+ .map((pollutant) => ({
+ key: pollutant.code,
+ value: pollutant.pollutantId,
+ text: pollutant.name,
+ }))}
+ value={indexPollutantId}
/>
{
onTabChange={(event, data) => {
setActiveTab(data.activeIndex);
}}
+ data={{
+ pollutants: currentPollutants,
+ all_groups: groupsIds.join(',') === indexPollutantGroupId,
+ pollutant: currentPollutant,
+ pollutant_iso: indexPollutantIso,
+ pollutant_group: currentPollutantGroup,
+ other_provisions: currentOtherProvisions,
+ }}
/>
);
};
export default compose(
- connect((state, props) => ({
- query: state.router.location.search,
- search: state.discodata_query.search,
- })),
+ connect(
+ (state, props) => ({
+ query: state.router.location.search,
+ discodata_query: state.discodata_query,
+ discodata_resources: state.discodata_resources,
+ }),
+ {
+ setQueryParam,
+ deleteQueryParam,
+ },
+ ),
)(View);
diff --git a/src/components/manage/Blocks/PollutantIndex/style.css b/src/components/manage/Blocks/PollutantIndex/style.css
index a110d5d0..07215927 100644
--- a/src/components/manage/Blocks/PollutantIndex/style.css
+++ b/src/components/manage/Blocks/PollutantIndex/style.css
@@ -35,6 +35,15 @@
.pollutant-index-container h3 {
font-size: 1.3em;
+ margin-bottom: 0.5em;
+}
+
+.pollutant-index-container p:not(:last-child) {
+ margin-bottom: 0.5em;
+}
+
+.pollutant-index-container p:last-child {
+ margin-bottom: 0;
}
.pollutant-index-container h3.blue {
@@ -60,7 +69,17 @@
background-color: #F4F4F4 !important;
}
-.pollutant-index-container .ui.table.description-table tbody tr td:nth-child(1) {
+/* .pollutant-index-container .ui.table.description-table tbody tr td:nth-child(1) {
color: #EC776A;
font-weight: bold;
+} */
+
+.pollutant-index-container .pollutants-list {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+}
+
+.pollutant-index-container .pollutants-list li {
+ margin-bottom: 0.5em;
}
\ No newline at end of file
diff --git a/src/components/manage/Blocks/SidebarBlock/View.jsx b/src/components/manage/Blocks/SidebarBlock/View.jsx
index 21c8e4d4..50e37a8f 100644
--- a/src/components/manage/Blocks/SidebarBlock/View.jsx
+++ b/src/components/manage/Blocks/SidebarBlock/View.jsx
@@ -70,6 +70,7 @@ const makeNewNavigation = (
search,
history,
dispatch,
+ flags,
) => {
if (
['facilities', 'installations', 'lcps'].includes(preset) &&
@@ -110,37 +111,63 @@ const makeNewNavigation = (
);
},
items: [
- ...item.items?.map((child) => ({
- ...child,
- redirect: (pathname) => {
- // if (
- // search.facilityInspireId !== facility.facilityInspireId &&
- // pathname === child.url
- // ) {
- // history.push(item.url);
- // }
+ ...[
+ {
+ title: 'Pollutant Releases',
+ url: `${item.items[0]?.url}#pollutant_releases_tableau`,
+ flag: 'has_release_data',
},
- active: (pathname) => {
- return (
- search.facilityInspireId === facility.facilityInspireId &&
- pathname.includes(child.url)
- );
+ {
+ title: 'Pollutant Transfers',
+ url: `${item.items[0]?.url}#pollutant_transfers_tableau`,
+ flag: 'has_transfer_data',
},
- onClick: (pathname) => {
- if (facility.facilityInspireId !== search.facilityInspireId) {
- dispatch(
- setQueryParam({
- queryParam: {
- facilityInspireId: facility.facilityInspireId,
- },
- }),
- );
- }
- if (pathname !== child.url) {
- history.push(child.url);
- }
+ {
+ title: 'Waste Transfers',
+ url: `${item.items[0]?.url}#pollutant_waste_tableau`,
+ flag: 'has_waste_data',
},
- })),
+ ]
+ .filter(
+ (child) =>
+ flags.items.facilities?.[facility.facilityInspireId]?.[
+ child.flag
+ ],
+ )
+ ?.map((child) => ({
+ ...child,
+ redirect: (pathname) => {
+ // if (
+ // search.facilityInspireId !== facility.facilityInspireId &&
+ // pathname === child.url
+ // ) {
+ // history.push(item.url);
+ // }
+ },
+ active: (pathname) => {
+ // return (
+ // search.facilityInspireId === facility.facilityInspireId &&
+ // pathname.includes(child.url)
+ // );
+ },
+ onClick: (pathname) => {
+ if (
+ facility.facilityInspireId !== search.facilityInspireId
+ ) {
+ dispatch(
+ setQueryParam({
+ queryParam: {
+ facilityInspireId: facility.facilityInspireId,
+ },
+ }),
+ );
+ }
+
+ if (pathname !== child.url) {
+ history.push(child.url);
+ }
+ },
+ })),
],
}))
: [],
@@ -474,6 +501,7 @@ const View = ({ content, ...props }) => {
props.search,
history,
props.dispatch,
+ props.flags,
),
);
} else if (preset.key) {
@@ -541,6 +569,7 @@ export default compose(
content:
state.prefetch?.[state.router.location.pathname] || state.content.data,
pathname: state.router.location.pathname,
+ flags: state.flags,
search: state.discodata_query.search,
discodata_resources: state.discodata_resources,
navigation: getNavigationByParent(
diff --git a/src/constants/ActionTypes.js b/src/constants/ActionTypes.js
index 49c1c6d0..8596f444 100644
--- a/src/constants/ActionTypes.js
+++ b/src/constants/ActionTypes.js
@@ -9,3 +9,4 @@ export const GET_PARENT_FOLDER_DATA = 'GET_PARENT_FOLDER_DATA';
export const GET_NAV_ITEMS = 'GET_NAV_ITEMS';
export const GET_PAGE = 'GET_PAGE';
export const GET_SPARQL_DATA = 'GET_SPARQL_DATA';
+export const SET_FLAGS = 'SET_FLAGS';
diff --git a/src/localconfig.js b/src/localconfig.js
index 44a05a9f..e2f058a4 100644
--- a/src/localconfig.js
+++ b/src/localconfig.js
@@ -40,6 +40,9 @@ import QueryParamButtonView from '~/components/manage/Blocks/QueryParamButton/Vi
import IframeEdit from '~/components/manage/Blocks/Iframe/Edit';
import IframeView from '~/components/manage/Blocks/Iframe/View';
+import FlagsEdit from '~/components/manage/Blocks/Flags/Edit';
+import FlagsView from '~/components/manage/Blocks/Flags/View';
+
import PollutantIndexEdit from '~/components/manage/Blocks/PollutantIndex/Edit';
import PollutantIndexView from '~/components/manage/Blocks/PollutantIndex/View';
@@ -210,6 +213,15 @@ export function applyConfig(voltoConfig) {
icon: packSVG,
};
+ config.blocks.blocksConfig.eprtr_flags = {
+ id: 'eprtr_flags',
+ title: 'Eprtr flags',
+ group: 'eprtr_blocks',
+ view: FlagsView,
+ edit: FlagsEdit,
+ icon: packSVG,
+ };
+
config.blocks.blocksConfig.eprtr_pollutant_index = {
id: 'eprtr_pollutant_index',
title: 'Eprtr pollutant index',
diff --git a/src/reducers/flags.js b/src/reducers/flags.js
new file mode 100644
index 00000000..3cd5e853
--- /dev/null
+++ b/src/reducers/flags.js
@@ -0,0 +1,36 @@
+import { SET_FLAGS } from '~/constants/ActionTypes';
+
+const initialState = {
+ items: {},
+};
+
+export default function pages(state = initialState, action = {}) {
+ const items = { ...state.items };
+ const packageKey = action.packageKey;
+ const id = action.id;
+ const flags = action.flags || {};
+ switch (action.type) {
+ case SET_FLAGS:
+ if (!items[packageKey]) {
+ items[packageKey] = {};
+ }
+ if (id) {
+ if (!items[packageKey][id]) {
+ items[packageKey][id] = {};
+ }
+ Object.keys(flags).forEach((flag) => {
+ items[packageKey][id][flag] = flags[flag];
+ });
+ } else {
+ items[packageKey] = {
+ ...flags,
+ };
+ }
+ return {
+ ...state,
+ items,
+ };
+ default:
+ return state;
+ }
+}
diff --git a/src/reducers/index.js b/src/reducers/index.js
index 39e2f1ce..8b2fb0dd 100644
--- a/src/reducers/index.js
+++ b/src/reducers/index.js
@@ -8,6 +8,7 @@ import section_tabs from './section_tabs';
import parent_folder_data from './parent_folder_data';
import pages from './pages';
import sparql from './sparql';
+import flags from './flags';
/**
* Root reducer.
* @function
@@ -20,6 +21,7 @@ const reducers = {
parent_folder_data,
pages,
sparql,
+ flags,
...defaultReducers,
// Add your reducers here
};