Skip to content

Commit

Permalink
fixes admin ui templates
Browse files Browse the repository at this point in the history
Signed-off-by: Max Thonagel <12283268+thoniTUB@users.noreply.github.com>
  • Loading branch information
thoniTUB committed Apr 25, 2024
1 parent 849028c commit cdcb67b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public class CsrfTokenSetFilter implements ContainerRequestFilter, ContainerResp
public static final String CSRF_TOKEN_PROPERTY = "csrf_token";
public static final int TOKEN_LENGTH = 30;

Random random = new SecureRandom();
private final Random random = new SecureRandom();

@Override
public void filter(ContainerRequestContext requestContext) throws IOException {
Expand Down
17 changes: 10 additions & 7 deletions backend/src/main/resources/assets/custom/js/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,9 @@ function postFile(event, url) {
let reader = new FileReader();
reader.onload = function () {
let json = reader.result;
fetch(url, {
method: 'post', credentials: 'same-origin', body: json, headers: {
"Content-Type": "application/json"
}
rest(url, {
method: 'post',
body: json
})
.then(function (response) {
if (response.ok) {
Expand Down Expand Up @@ -230,7 +229,11 @@ const uploadFormMapping = {
uri: "internToExtern",
accept: "*.mapping.json",
},
table: { name: "table_schema", uri: "tables", accept: "*.table.json" },
table: {
name: "table_schema",
uri: "tables",
accept: "*.table.json"
},
concept: {
name: "concept_schema",
uri: "concepts",
Expand All @@ -243,7 +246,7 @@ const uploadFormMapping = {
},
};

function updateDatasetUploadForm(select) {
function updateDatasetUploadForm(select, datasetId) {
const data = uploadFormMapping[select.value];
const fileInput = $(select).next();
fileInput.value = "";
Expand All @@ -253,7 +256,7 @@ function updateDatasetUploadForm(select) {
.parent()
.attr(
"onsubmit",
"postFile(event, '/admin/datasets/${c.ds.id}/" + data.uri + "')"
`postFile(event, '/admin/datasets/${datasetId}/${data.uri}')`
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<select
class="custom-select"
data-test-id="upload-select"
onchange="updateDatasetUploadForm(this)"
onchange="updateDatasetUploadForm(this, '${c.ds.id}')"
required
>
<option value="mapping" selected>Mapping JSON</option>
Expand Down

0 comments on commit cdcb67b

Please sign in to comment.