show known types in form
This commit is contained in:
parent
8e19a1dbad
commit
c763cdb23f
2 changed files with 13 additions and 0 deletions
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
<label for="type">Type</label>
|
<label for="type">Type</label>
|
||||||
<input id="type" type="text">
|
<input id="type" type="text">
|
||||||
|
<p id="knowntypes"></p>
|
||||||
|
|
||||||
<label for="name">Name / Label</label>
|
<label for="name">Name / Label</label>
|
||||||
<input id="name" type="text">
|
<input id="name" type="text">
|
||||||
|
|
|
@ -12,6 +12,7 @@ document.onreadystatechange = function() {
|
||||||
|
|
||||||
function fillForm() {
|
function fillForm() {
|
||||||
const item = items[id];
|
const item = items[id];
|
||||||
|
knownTypes();
|
||||||
|
|
||||||
const is_in = document.getElementById('is_in');
|
const is_in = document.getElementById('is_in');
|
||||||
|
|
||||||
|
@ -52,6 +53,17 @@ function fillForm() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function knownTypes() {
|
||||||
|
let map = {};
|
||||||
|
for (const i of Object.values(items)) {
|
||||||
|
if (i.type) {
|
||||||
|
map[i.type] = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let types = Object.keys(map).sort().join(', ')
|
||||||
|
document.getElementById('knowntypes').textContent = `Known types: ${types}.`;
|
||||||
|
}
|
||||||
|
|
||||||
function save() {
|
function save() {
|
||||||
item = {
|
item = {
|
||||||
id: document.getElementById('id').value || null,
|
id: document.getElementById('id').value || null,
|
||||||
|
|
Loading…
Reference in a new issue