add stats and change heap (#108)

* add stats and change heap

* improve analytics

* revert main changes

* add repo
This commit is contained in:
Itiel shwartz
2022-11-24 12:35:45 +02:00
committed by GitHub
parent f7d4dcbff4
commit 0b06036a39
6 changed files with 23 additions and 11 deletions

View File

@@ -3,9 +3,9 @@ xhr.onload = function () {
if (xhr.readyState === XMLHttpRequest.DONE) {
const status = JSON.parse(xhr.responseText);
const version = status.CurVer
if (status.Analytics && version !== "dev") {
if (status.Analytics) {
enableDD(version)
enableHeap()
enableHeap(version)
}
}
}
@@ -42,7 +42,7 @@ function enableDD(version) {
})
}
function enableHeap() {
function enableHeap(version) {
window.heap = window.heap || [], heap.load = function (e, t) {
window.heap.appid = e, window.heap.config = t = t || {};
let r = document.createElement("script");
@@ -55,5 +55,12 @@ function enableHeap() {
}
}, p = ["addEventProperties", "addUserProperties", "clearEventProperties", "identify", "resetIdentity", "removeEventProperty", "setEventProperties", "track", "unsetEventProperty"], o = 0; o < p.length; o++) heap[p[o]] = n(p[o])
};
heap.load("3615793373");
heap.load("4249623943");
window.heap.addEventProperties({'version': version});
}
function sendStats(name, prop){
if (window.heap) {
window.heap.track(name, prop);
}
}

View File

@@ -4,6 +4,7 @@ function loadChartsList() {
const chartsCards = $("#installedList .body")
chartsCards.empty().append("<div><span class=\"spinner-border spinner-border-sm\" role=\"status\" aria-hidden=\"true\"></span> Loading...</div>")
$.getJSON("/api/helm/charts").fail(function (xhr) {
sendStats('Get releases', {'status': 'failed'});
reportError("Failed to get list of charts", xhr)
}).done(function (data) {
chartsCards.empty().hide()
@@ -12,6 +13,7 @@ function loadChartsList() {
let card = buildChartCard(elm);
chartsCards.append(card)
})
sendStats('Get releases', {'status': 'success', length:data.length});
filterInstalledList(chartsCards.find(".row"))
chartsCards.show()
if (!data.length) {

View File

@@ -4,6 +4,7 @@ function loadRepoView() {
$.getJSON("/api/helm/repo").fail(function (xhr) {
reportError("Failed to get list of repositories", xhr)
sendStats('Get repo', {'status': 'fail'});
}).done(function (data) {
const items = $("#sectionRepo .repo-list ul").empty()
data.sort((a, b) => (a.name > b.name) - (a.name < b.name))
@@ -19,7 +20,7 @@ function loadRepoView() {
if (!data.length) {
items.text("No repositories found, try adding one")
}
sendStats('Get repo', {'status': 'success', length:data.length});
items.find("input").click(function () {
$("#inputSearch").val('')
const self = $(this)

View File

@@ -40,13 +40,14 @@ function fillClusters(limNS) {
})
$.getJSON("/api/kube/contexts").fail(function (xhr) {
sendStats('contexts', {'status': 'fail'});
reportError("Failed to get list of clusters", xhr)
}).done(function (data) {
$("body").data("contexts", data)
const context = getHashParam("context")
data.sort((a, b) => (getCleanClusterName(a.Name) > getCleanClusterName(b.Name)) - (getCleanClusterName(a.Name) < getCleanClusterName(b.Name)))
fillClusterList(data, context);
sendStats('contexts', {'status': 'success', length:data.length});
$.getJSON("/api/kube/namespaces").fail(function (xhr) {
reportError("Failed to get namespaces", xhr)
}).done(function (res) {