Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

admin-ui content-type for create dataset request #2035

Merged
merged 2 commits into from
Aug 19, 2021
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
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>