In-memory cache for speed-up (#88)

* Experiment with local cache

* Commit

* Cache all we can, invalidate later

* Commit

* separate cache class

* More cached

* Proper invalidate

* Complete the repos

* Fix the build

* Fix build

* Status reporting
This commit is contained in:
Andrey Pokhilko
2022-11-22 15:17:32 +00:00
committed by GitHub
parent 34a7dc57b2
commit bedb356b02
12 changed files with 788 additions and 68 deletions

View File

@@ -119,7 +119,7 @@ $("#upgradeModal .btn-confirm").click(function () {
if (data.version) {
setHashParam("section", null)
const ns = $("#upgradeModal .rel-ns").val();
setHashParam("namespace", ns ? ns : "default")
setHashParam("namespace", ns ? ns : "default") // TODO: relaets issue #51
setHashParam("chart", $("#upgradeModal .rel-name").val())
setHashParam("revision", data.version)
window.location.reload()

View File

@@ -49,6 +49,15 @@
<li>
<hr class="dropdown-divider">
</li>
<li>
<!-- TODO: this should go under the "user menu" -->
<button class="dropdown-item" id="cacheClear"><i
class="bi-arrow-repeat"></i> Reset Cache
</button>
</li>
<li>
<hr class="dropdown-divider">
</li>
<li><a class="dropdown-item disabled" href="#">Version <span id="toolVersion"></span></a></li>
</ul>
</li>

View File

@@ -29,7 +29,7 @@ function buildChartCard(elm) {
<div class="col-1 rel-date text-nowrap"><span>today</span><div>Updated</div></div>
</div>`)
const chartName = elm.chart.substr(0, elm.chart.lastIndexOf("-"))
const chartName = elm.chart.substring(0, elm.chart.lastIndexOf("-"))
$.getJSON("/api/helm/repo/search?name=" + chartName).fail(function (xhr) {
reportError("Failed to get repo name for charts", xhr)
}).done(function (data) {

View File

@@ -13,12 +13,12 @@ $(function () {
fillClusterList(data, context);
initView(); // can only do it after loading cluster list
$.getJSON("/api/kube/namespaces").fail(function (xhr) {
reportError("Failed to get namespaces", xhr)
}).done(function(res) {
}).done(function (res) {
const ns = res.items.map(i => i.metadata.name)
$.each(ns, function(i, item) {
$.each(ns, function (i, item) {
$("#upgradeModal #ns-datalist").append($("<option>", {
value: item,
text: item
@@ -218,6 +218,7 @@ $(".bi-power").click(function () {
url: "/",
type: 'DELETE',
}).done(function () {
// TODO: display explanation overlay here
window.close();
})
})
@@ -248,4 +249,13 @@ function fillToolVersion(data) {
$("#toolVersionUpgrade").text(data.LatestVer)
$(".upgrade-possible").show()
}
}
}
$("#cacheClear").click(function () {
$.ajax({
url: "/api/cache",
type: 'DELETE',
}).done(function () {
window.location.reload()
})
})