Skip to content
Merged
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
13 changes: 11 additions & 2 deletions src/slurmcostmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,7 @@ function Details({
account: '',
user: ''
});
const [error, setError] = useState(null);

function toggle(account) {
setExpanded(prev => (prev === account ? null : account));
Expand Down Expand Up @@ -900,9 +901,10 @@ function Details({
'Thank you for your prompt payment. For questions regarding this invoice, please contact our office.'
};
try {
setError(null);
const output = await window.cockpit.spawn(
['python3', `${PLUGIN_BASE}/invoice.py`],
{ input: JSON.stringify(invoiceData), err: 'message' }
{ input: JSON.stringify(invoiceData), err: 'out' }
);
const byteChars = atob(output.trim());
const byteNumbers = new Array(byteChars.length);
Expand All @@ -920,6 +922,7 @@ function Details({
URL.revokeObjectURL(url);
} catch (e) {
console.error(e);
setError(e.message || String(e));
}
}

Expand Down Expand Up @@ -957,7 +960,13 @@ function Details({
);
}),
React.createElement('button', { onClick: exportCSV }, 'Export CSV'),
React.createElement('button', { onClick: exportInvoice }, 'Export Invoice')
React.createElement('button', { onClick: exportInvoice }, 'Export Invoice'),
error &&
React.createElement(
'span',
{ className: 'error', style: { marginLeft: '0.5em' } },
error
)
),
React.createElement(
'div',
Expand Down
Loading