Skip to content

Commit

Permalink
Merge pull request #726 from georchestra/header-config-file
Browse files Browse the repository at this point in the history
Set header to config file
  • Loading branch information
f-necas authored Jan 23, 2025
2 parents d1582f5 + 5ff28b5 commit 8000aa0
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
7 changes: 4 additions & 3 deletions configs/localConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@
},
"stylesheetUri": "",
"header": {
"height": 90,
"height": 80,
"url": "/header/",
"script": "https://cdn.jsdelivr.net/gh/georchestra/header@dist/header.js",
"legacy": false,
"logoUrl": "https://www.georchestra.org/public/georchestra-logo.svg",
"configFile": "",
"script": "https://cdn.jsdelivr.net/gh/georchestra/header@dist/header.js",
"stylesheet": ""
},
"defaultMapOptions": {
Expand Down Expand Up @@ -844,7 +845,7 @@
"containerPosition": "header",
"className": "navbar shadow navbar-home"
}
},
},
"Details",
"AddWidgetDashboard",
"MapConnectionDashboard",
Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
}
#georchestra-header {
width: 100%;
height: 90px;
height: 80px;
border: none;
overflow: visible;
position: absolute;
Expand Down
4 changes: 2 additions & 2 deletions indexTemplate.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@
}
#georchestra-header {
width: 100%;
height: 90px;
height: 80px;
border: none;
overflow: visible;
position: absolute;
}
#container {
position: absolute;
top: 90px;
top: 80px;
bottom: 0;
height: unset !important;
width: 100%;
Expand Down
8 changes: 5 additions & 3 deletions js/plugins/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const Header = ({url = "/header/", page = "mapstore", height = 90, ignore
script = "https://cdn.jsdelivr.net/gh/georchestra/header@dist/header.js",
legacy = false,
logoUrl = "https://www.georchestra.org/public/georchestra-logo.svg",
stylesheet = ""}) => {
stylesheet = "", configFile = ""}) => {
useEffect(() => {
const header = document.getElementById("georchestra-header");
const headerScript = document.getElementById("georchestra-header-script");
Expand All @@ -27,9 +27,10 @@ export const Header = ({url = "/header/", page = "mapstore", height = 90, ignore
header.setAttribute("active-app", page);
header.setAttribute("legacy-url", url);
header.setAttribute("legacy-header", legacy);
header.setAttribute("style", `height:${height}px`);
header.setAttribute("logo-url", logoUrl);
header.setAttribute("stylesheet", stylesheet);
header.setAttribute("config-file", configFile);
header.setAttribute("height", height);
headerScript.src = script;

if (container) {
Expand All @@ -49,6 +50,7 @@ export default createPlugin('Header', {
script: state.localConfig && state.localConfig.header && state.localConfig.header.script,
legacy: state.localConfig && state.localConfig.header && state.localConfig.header.legacy,
logoUrl: state.localConfig && state.localConfig.header && state.localConfig.header.logoUrl,
stylesheet: state.localConfig && state.localConfig.header && state.localConfig.header.stylesheet
stylesheet: state.localConfig && state.localConfig.header && state.localConfig.header.stylesheet,
configFile: state.localConfig && state.localConfig.header && state.localConfig.header.configFile
}))(Header)
});
2 changes: 1 addition & 1 deletion web/src/main/resources/mapstore.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@

datadir.location=${georchestra.extensions:},${georchestra.datadir}/mapstore
overrides.config=../default.properties
overrides.mappings=header.url=headerUrl,header.height=headerHeight,header.script=headerScript,header.legacy=useLegacyHeader,header.logoUrl=logoUrl,header.stylesheet=georchestraStylesheet
overrides.mappings=header.url=headerUrl,header.height=headerHeight,header.script=headerScript,header.legacy=useLegacyHeader,header.logoUrl=logoUrl,header.stylesheet=georchestraStylesheet,header.configFile=headerConfigFile

0 comments on commit 8000aa0

Please sign in to comment.