### Run Development Server Source: https://github.com/axelor/axelor-open-suite/blob/master/axelor-base/map-viewer/README.md Use 'yarn dev' to start the application in development mode. ```bash yarn dev ``` -------------------------------- ### Build for Production Source: https://github.com/axelor/axelor-open-suite/blob/master/axelor-base/map-viewer/README.md Use 'yarn build' to create a production-ready build of the application. ```bash yarn build ``` -------------------------------- ### Configure Test Instance Proxy Source: https://github.com/axelor/axelor-open-suite/blob/master/axelor-base/map-viewer/README.md Set VITE_PROXY_TARGET and VITE_PROXY_CONTEXT in the .env file for the distant test instance. Adjust VITE_PROXY_CONTEXT if the server lacks a suburl. ```env VITE_PROXY_TARGET=http://preview.axelor.com VITE_PROXY_CONTEXT=/demo/ ``` -------------------------------- ### Generate CHANGELOG.md Source: https://github.com/axelor/axelor-open-suite/blob/master/changelogs/README.md Run this Gradle task to generate the CHANGELOG.md file from unreleased entries. It also automatically removes the processed entries. Use the --preview argument to preview without modifying files. ```bash ./gradlew generateChangeLog ``` -------------------------------- ### Initialize and Populate Leaflet Map Source: https://github.com/axelor/axelor-open-suite/blob/master/axelor-base/src/main/webapp/osm-objs/index.html This snippet initializes a Leaflet map, fetches data from a URL, and adds markers to the map based on the fetched data. It handles data parsing, marker creation, and map bounds fitting. Ensure Leaflet library is included and the 'map' element exists in your HTML. ```javascript function getQueryVariable(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i = 0; i < vars.length; i++) { var pair = vars[i].split("="); if (pair[0] == variable) { return pair[1]; } } return (false); } function getPathname() { var pathname = location.pathname.split('/'); return ['osm-objs',''].indexOf(pathname[1]) == -1 ? ('/' + pathname[1]) : ''; } var map = L.map('map'); mapLink = 'OpenStreetMap'; L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution : '© ' + mapLink + ' Contributors', maxZoom : 18, }).addTo(map); var bounds = new L.LatLngBounds(); var object = getQueryVariable("object"); var url = getAppHome() + getPathname() + "/ws/map/" + object; var id = getQueryVariable("id"); if (id) { url += "/" + id; } fetch(url, { method: "GET", headers: {"Content-Type": "application/json"} }) .then(response => response.json()) .then(data => { if (data.status == 0) { for (var i = 0; i < data.data.length; i++) { var d = data.data[i] var title = d['fullName'] ? d['fullName'].trim() : ''; var address = d['address'] ? d['address'] + '
' : ''; var fixedPhone = d['fixedPhone'] ? " " + d['fixedPhone'] + '
' : ''; var emailAddress = d['emailAddress'] ? " " + d['emailAddress'] : ''; var content = "" + title + "
" + address + fixedPhone + emailAddress; var lat = d['latit']; var lon = d['longit']; if (lat != null && lon != null) { marker = new L.marker([ lat, lon ]).bindPopup( content).addTo(map); bounds.extend(marker.getLatLng()); } } } }) .catch(error => alert("Request failed: " + error) ) .finally(() => { if (bounds.isValid()) { map.fitBounds(bounds); } else { map.setView([ 44.907852, 7.673789 ], 16); } }); ``` -------------------------------- ### Configure Local Server Proxy Source: https://github.com/axelor/axelor-open-suite/blob/master/axelor-base/map-viewer/README.md Set VITE_PROXY_TARGET and VITE_PROXY_CONTEXT in the .env file to connect to a local Axelor server. Ensure VITE_PROXY_CONTEXT matches the server's suburl. ```env VITE_PROXY_TARGET=http://localhost:8080 VITE_PROXY_CONTEXT=/axelor-erp/ ``` -------------------------------- ### Changelog Entry YAML Format Source: https://github.com/axelor/axelor-open-suite/blob/master/changelogs/README.md Defines the structure for a changelog entry file. Use the 'title' for user-facing summaries and 'developer' for technical details impacting custom modules. Avoid technical field names in the 'title'. ```yaml --- title: Some text module: axelor-base developer: | some description here with technical details about breaking changes and migrations steps. ``` $ find -iregex ".*domains.*.xml" | xargs -l sed -i 's|cachable=\"|cacheable=\"|g' ``` ``` -------------------------------- ### Generate Print Template XML Source: https://github.com/axelor/axelor-open-suite/blob/master/axelor-base/src/main/resources/data-export/export-print-template.txt This Groovy script iterates through print template data and constructs an XML string representing the template structure. It includes nested loops for print template lines and context lines. ```Groovy <% __ids__.each({ u = com.axelor.inject.Beans.get('com.axelor.apps.base.db.repo.PrintTemplateRepository' as Class).find(it) printTemplateLineListService = "" u.printTemplateLineList.each( {pt-> printTemplateLineListService += "" printTemplateLineListService += " ${pt.sequence}" printTemplateLineListService += " ${pt.title}" printTemplateLineListService += " ${pt.content}" printTemplateLineListService += " ${pt.conditions}" printTemplateLineListService += " ${pt.isEditable}" printTemplateLineListService += " ${pt.ignoreTheLine}" printTemplateLineListService += " " pt.printTemplateLineList.each( {pti -> printTemplateLineListService += " " printTemplateLineListService += " ${pti.sequence}" printTemplateLineListService += " ${pti.title}" printTemplateLineListService += " ${pti.content}" printTemplateLineListService += " ${pti.conditions}" printTemplateLineListService += " ${pti.isEditable}" printTemplateLineListService += " ${pti.ignoreTheLine}" printTemplateLineListService += " " pti.templateContextList.each( {tcl -> printTemplateLineListService += " " printTemplateLineListService += " ${tcl.name}" printTemplateLineListService += " ${tcl.value}" printTemplateLineListService += " " }) printTemplateLineListService += " " printTemplateLineListService += " " }) printTemplateLineListService += " " printTemplateLineListService += " " pt.templateContextList.each( {tcl -> printTemplateLineListService += " " printTemplateLineListService += " ${tcl.name}" printTemplateLineListService += " ${tcl.value}" printTemplateLineListService += " " }) printTemplateLineListService += " " printTemplateLineListService += "" }) printingTemplateSetService = "" u.printingTemplateSet.each( {pt-> printingTemplateSetService += "" printingTemplateSetService += " ${pt.name}" printingTemplateSetService += " ${pt.format}" printingTemplateSetService += " ${pt.templateLink}" printingTemplateSetService += "" }) printTemplateSetService = "" u.printTemplateSet.each( {pt-> printTemplateSetService += "" printTemplateSetService += " ${pt.name}" printTemplateSetService += " " printTemplateSetService += " ${pt?.metaModel?.name}" printTemplateSetService += " ${pt?.metaModel?.fullName}" printTemplateSetService += " ${pt?.metaModel?.packageName}" printTemplateSetService += " " printTemplateSetService += " " printTemplateSetService += " ${pt?.company?.code}" printTemplateSetService += " ${pt?.company?.name}" printTemplateSetService += " " printTemplateSetService += " " printTemplateSetService += " ${pt?.language?.code}" printTemplateSetService += " ${pt?.language?.name}" printTemplateSetService += " " printTemplateSetService += " ${u.formatSelect}" printTemplateSetService += " ${u.displayTypeSelect}" printTemplateSetService += " ${u.documentName}" printTemplateSetService += " ${u.metaFileField}" printTemplateSetService += " ${u.metaModelDefaultPath}" printTemplateSetService += " ${u.attach}" printTemplateSetService += " ${u.isEditable}" printTemplateSetService += " ${u.hidePrintSettings}" printTemplateSetService += "" }) out << """ ${u.name} ${u?.metaModel?.name} ${u?.metaModel?.fullName} ${u?.metaModel?.packageName} ${u?.company?.code} ${u?.company?.name} """ }) ``` -------------------------------- ### Dynamically Resize Iframe Height Source: https://github.com/axelor/axelor-open-suite/blob/master/axelor-human-resource/axelor-react-timesheet/public/test.html This function recursively adjusts the height of an iframe to match its content's height. It uses `setTimeout` for continuous monitoring. Ensure the iframe object is passed correctly. ```javascript function setSize(obj) { if (parseInt(obj.style.height) !== parseInt(obj.contentDocument.body.offsetHeight)) { obj.style.height = obj.contentDocument.body.offsetHeight + 'px'; } setTimeout(function () { setSize(obj); }, 100); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.