Skip to content

Commit

Permalink
Merge pull request #2035 from bakdata/fix/admin-ui-create-dataset
Browse files Browse the repository at this point in the history
admin-ui content-type for create dataset request
  • Loading branch information
thoniTUB authored Aug 19, 2021
2 parents 99c7d0e + c13ad71 commit 6a9ff59
Showing 1 changed file with 22 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@
<div class="row">
<div class="col">
<ul>
<#list c as dataset>
<li>
<a href="/admin-ui/datasets/${dataset.id}">${dataset.label}</a>
<a href="" onclick="deleteDataset('${dataset.id}')"><i class="fas fa-trash-alt text-danger"></i></a>
</li>
</#list>
<#list c as dataset>
<li>
<a href="/admin-ui/datasets/${dataset.id}">${dataset.label}</a>
<a href="" onclick="deleteDataset('${dataset.id}')"><i
class="fas fa-trash-alt text-danger"></i></a>
</li>
</#list>
</ul>
<br/><br/>
<br /><br />
<form>
<div class="form-group">
<h3>Create Dataset</h3>
<label for="entity_name">Name:</label>
<input id="entity_name" name="entity_name" pattern="<#include "templates/namePattern.ftl">" class="form-control text-monospace" style="font-family:monospace;">
<input id="entity_name" name="entity_name" pattern="<#include " templates/namePattern.ftl">"
class="form-control text-monospace" style="font-family:monospace;">
<label for="entity_id">ID:</label>
<input id="entity_id" name="entity_id" class="form-control text-monospace" style="font-family:monospace;">
<input class="btn btn-primary" type="submit" onclick="createDataset()"/>
<input id="entity_id" name="entity_id" class="form-control text-monospace"
style="font-family:monospace;">
<input class="btn btn-primary" type="submit" onclick="createDataset()" />
</div>
</form>

Expand All @@ -32,22 +35,25 @@
'/admin/datasets',
{
method: 'post',
headers: {
'Content-Type': 'application/json'
},
credentials: 'same-origin',
body: JSON.stringify({
name: document.getElementById('entity_id').value,
label: document.getElementById('entity_name').value
})
}).then(function(){location.reload();});
name: document.getElementById('entity_id').value,
label: document.getElementById('entity_name').value
})
}).then(function () { location.reload(); });
}
function deleteDataset(datasetId) {
event.preventDefault();
fetch(
${r"`/admin/datasets/${datasetId}`"},
${ r"`/admin/datasets/${datasetId}`"},
{
method: 'delete',
credentials: "same-origin"
}).then(function(){location.reload();});
}).then(function () { location.reload(); });
}
</script>
</@layout.layout>

0 comments on commit 6a9ff59

Please sign in to comment.