mirror of
https://github.com/simon987/sist2.git
synced 2025-04-24 12:45:56 +00:00
Compare commits
No commits in common. "013c54daa0a5d0e93c1df4d66cca08b6607c9c5b" and "638c2a5c1aaff36330f5ea2a7b30a922d50e0920" have entirely different histories.
013c54daa0
...
638c2a5c1a
@ -165,9 +165,6 @@ window.onload = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
initTagTree();
|
|
||||||
updateTagTree();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function saveTag(tag, hit) {
|
function saveTag(tag, hit) {
|
||||||
@ -191,8 +188,6 @@ function saveTag(tag, hit) {
|
|||||||
hideAfter: 3000,
|
hideAfter: 3000,
|
||||||
loaderBg: "#08c7e8",
|
loaderBg: "#08c7e8",
|
||||||
});
|
});
|
||||||
|
|
||||||
window.setTimeout(updateTagTree, 2000);
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -203,7 +198,7 @@ function deleteTag(tag, hit) {
|
|||||||
delete: true,
|
delete: true,
|
||||||
name: tag,
|
name: tag,
|
||||||
doc_id: hit["_id"],
|
doc_id: hit["_id"],
|
||||||
path_md5: md5(relPath)
|
relpath: relPath
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
$.toast({
|
$.toast({
|
||||||
heading: "Tag deleted",
|
heading: "Tag deleted",
|
||||||
@ -215,8 +210,6 @@ function deleteTag(tag, hit) {
|
|||||||
hideAfter: 3000,
|
hideAfter: 3000,
|
||||||
loaderBg: "#08c7e8",
|
loaderBg: "#08c7e8",
|
||||||
});
|
});
|
||||||
|
|
||||||
window.setTimeout(updateTagTree, 2000);
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,8 +313,25 @@ $.jsonPost("es", {
|
|||||||
mimeTree.node("any").select();
|
mimeTree.node("any").select();
|
||||||
});
|
});
|
||||||
|
|
||||||
function initTagTree() {
|
// Tags tree
|
||||||
tagMap = [{text: "All", id: "any"}];
|
$.jsonPost("es", {
|
||||||
|
aggs: {
|
||||||
|
tags: {
|
||||||
|
terms: {
|
||||||
|
field: "tag",
|
||||||
|
size: 10000
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
size: 0,
|
||||||
|
}).then(resp => {
|
||||||
|
resp["aggregations"]["tags"]["buckets"]
|
||||||
|
.sort((a, b) => a["key"].localeCompare(b["key"]))
|
||||||
|
.forEach(bucket => {
|
||||||
|
addTag(tagMap, bucket["key"], bucket["key"], bucket["doc_count"])
|
||||||
|
});
|
||||||
|
|
||||||
|
tagMap.push({"text": "All", "id": "any"});
|
||||||
tagTree = new InspireTree({
|
tagTree = new InspireTree({
|
||||||
selection: {
|
selection: {
|
||||||
mode: 'checkbox'
|
mode: 'checkbox'
|
||||||
@ -336,34 +346,8 @@ function initTagTree() {
|
|||||||
});
|
});
|
||||||
tagTree.on("node.state.changed", handleTreeClick(tagTree));
|
tagTree.on("node.state.changed", handleTreeClick(tagTree));
|
||||||
tagTree.node("any").select();
|
tagTree.node("any").select();
|
||||||
}
|
searchBusy = false;
|
||||||
|
});
|
||||||
function updateTagTree() {
|
|
||||||
$.jsonPost("es", {
|
|
||||||
aggs: {
|
|
||||||
tags: {
|
|
||||||
terms: {
|
|
||||||
field: "tag",
|
|
||||||
size: 10000
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
size: 0,
|
|
||||||
}).then(resp => {
|
|
||||||
tagMap = [];
|
|
||||||
resp["aggregations"]["tags"]["buckets"]
|
|
||||||
.sort((a, b) => a["key"].localeCompare(b["key"]))
|
|
||||||
.forEach(bucket => {
|
|
||||||
addTag(tagMap, bucket["key"], bucket["key"], bucket["doc_count"])
|
|
||||||
});
|
|
||||||
|
|
||||||
tagTree.removeAll();
|
|
||||||
tagMap.push({text: "All", id: "any"})
|
|
||||||
tagTree.addNodes(tagMap);
|
|
||||||
searchBusy = false;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function addTag(map, tag, id, count) {
|
function addTag(map, tag, id, count) {
|
||||||
// let tags = tag.split("#")[0].split(".");
|
// let tags = tag.split("#")[0].split(".");
|
||||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user