Merge branch 'dev' into feature/CTLE-434-oms-update-business-logic

This commit is contained in:
2023-06-06 09:06:24 -05:00
2 changed files with 19 additions and 7 deletions

View File

@ -970,7 +970,9 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
const d = new Date(); const d = new Date();
const dateString = `${d.getFullYear()}-${zp(d.getMonth() + 1)}-${zp(d.getDate())} ${zp(d.getHours())}${zp(d.getMinutes())}`; const dateString = `${d.getFullYear()}-${zp(d.getMonth() + 1)}-${zp(d.getDate())} ${zp(d.getHours())}${zp(d.getMinutes())}`;
const filename = `${tableMetaData.label} Export ${dateString}.${format}`; const filename = `${tableMetaData.label} Export ${dateString}.${format}`;
const url = `/data/${tableMetaData.name}/export/${filename}?filter=${encodeURIComponent(JSON.stringify(buildQFilter(tableMetaData, filterModel)))}&fields=${visibleFields.join(",")}`; const url = `/data/${tableMetaData.name}/export/${filename}`;
const encodedFilterJSON = encodeURIComponent(JSON.stringify(buildQFilter(tableMetaData, filterModel)));
////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////
// open a window (tab) with a little page that says the file is being generated. // // open a window (tab) with a little page that says the file is being generated. //
@ -987,6 +989,11 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
<script> <script>
setTimeout(() => setTimeout(() =>
{ {
//////////////////////////////////////////////////////////////////////////////////////////////////
// need to encode and decode this value, so set it in the form here, instead of literally below //
//////////////////////////////////////////////////////////////////////////////////////////////////
document.getElementById("filter").value = decodeURIComponent("${encodedFilterJSON}");
document.getElementById("exportForm").submit(); document.getElementById("exportForm").submit();
}, 1); }, 1);
</script> </script>
@ -995,6 +1002,8 @@ function RecordQuery({table, launchProcess}: Props): JSX.Element
Generating file <u>${filename}</u>${totalRecords ? " with " + totalRecords.toLocaleString() + " record" + (totalRecords == 1 ? "" : "s") : ""}... Generating file <u>${filename}</u>${totalRecords ? " with " + totalRecords.toLocaleString() + " record" + (totalRecords == 1 ? "" : "s") : ""}...
<form id="exportForm" method="post" action="${url}" > <form id="exportForm" method="post" action="${url}" >
<input type="hidden" name="Authorization" value="${qController.getAuthorizationHeaderValue()}"> <input type="hidden" name="Authorization" value="${qController.getAuthorizationHeaderValue()}">
<input type="hidden" name="fields" value="${visibleFields.join(",")}">
<input type="hidden" name="filter" id="filter">
</form> </form>
</body> </body>
</html>`); </html>`);

View File

@ -318,13 +318,16 @@ function RecordView({table, launchProcess}: Props): JSX.Element
setPageHeader(record.recordLabel); setPageHeader(record.recordLabel);
try if(!launchingProcess)
{ {
HistoryUtils.push({label: `${tableMetaData?.label}: ${record.recordLabel}`, path: location.pathname, iconName: table.iconName}); try
} {
catch(e) HistoryUtils.push({label: `${tableMetaData?.label}: ${record.recordLabel}`, path: location.pathname, iconName: table.iconName});
{ }
console.error("Error pushing history: " + e); catch(e)
{
console.error("Error pushing history: " + e);
}
} }
///////////////////////////////////////////////// /////////////////////////////////////////////////