Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.11
3.11.9
48 changes: 33 additions & 15 deletions application/frontend/src/pages/MyOpenCRE/MyOpenCRE.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,24 +5,40 @@ import { useEnvironment } from '../../hooks';

export const MyOpenCRE = () => {
const { apiUrl } = useEnvironment();
// console.log('API URL:', apiUrl);

const downloadTemplate = () => {
const headers = ['standard_name', 'standard_section', 'cre_id', 'notes'];
const downloadCreCsv = async () => {
try {
const baseUrl = apiUrl || window.location.origin;

const csvContent = headers.join(',') + '\n';
const backendUrl = baseUrl.includes('localhost') ? 'http://127.0.0.1:5000' : baseUrl;

const blob = new Blob([csvContent], {
type: 'text/csv;charset=utf-8;',
});
const response = await fetch(`${backendUrl}/cre_csv`, {
method: 'GET',
headers: {
Accept: 'text/csv',
},
});

const url = URL.createObjectURL(blob);
const link = document.createElement('a');
if (!response.ok) {
throw new Error(`HTTP error ${response.status}`);
}

link.href = url;
link.setAttribute('download', 'myopencre_mapping_template.csv');
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
const blob = await response.blob();
const url = window.URL.createObjectURL(blob);

const link = document.createElement('a');
link.href = url;
link.download = 'opencre-cre-mapping.csv';
document.body.appendChild(link);
link.click();

document.body.removeChild(link);
window.URL.revokeObjectURL(url);
} catch (err) {
console.error('CSV download failed:', err);
alert('Failed to download CRE CSV');
}
};

return (
Expand All @@ -39,8 +55,10 @@ export const MyOpenCRE = () => {
to CRE IDs.
</p>

<Button primary onClick={downloadTemplate}>
Download Mapping Template (CSV)

<Button primary onClick={downloadCreCsv}>
Download CRE Catalogue (CSV)

</Button>
</Container>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,7 @@
color: var(--muted-foreground);
height: 1rem;
width: 1rem;
pointer-events: none;
z-index: 1;
}

input {
padding: 0.5rem 1rem 0.5rem 2.5rem;
width: 16rem;
Expand Down
2 changes: 0 additions & 2 deletions application/frontend/src/scaffolding/Header/header.scss
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@
display: block;
}
}

.sr-only {
position: absolute;
width: 1px;
Expand All @@ -331,7 +330,6 @@
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
clip-path: inset(50%);
white-space: nowrap;
border: 0;
}
2 changes: 1 addition & 1 deletion application/frontend/www/bundle.js

Large diffs are not rendered by default.

7 changes: 0 additions & 7 deletions application/frontend/www/bundle.js.LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,6 @@ object-assign
* SPDX-License-Identifier: MIT
*/

/**
* @license lucide-react v0.536.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/

/**
* Prism: Lightweight, robust, elegant syntax highlighting
*
Expand Down
2 changes: 1 addition & 1 deletion application/frontend/www/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><head><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=noshrink-to-fit=no"/><title>Open CRE</title><link rel="icon" type="image/svg+xml" href="/logo.svg"/><link rel="alternate icon" href="/favicon.ico"/><link rel="stylesheet" href="//cdn.jsdelivr.net/npm/semantic-ui@2.4.1/dist/semantic.min.css"/><script defer="defer" src="/bundle.js"></script></head><body><div id="mount"></div></body>
<!doctype html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=noshrink-to-fit=no"><title>Open CRE</title><link rel="stylesheet" href="//cdn.jsdelivr.net/npm/semantic-ui@2.4.1/dist/semantic.min.css"/><script defer="defer" src="/bundle.js"></script></head><body><div id="mount"></div></body>
Loading