count websites and workers at start

This commit is contained in:
Nariman Jelveh
2025-08-03 18:39:14 -07:00
parent 2691818f6e
commit 3df0bac9dc
2 changed files with 8 additions and 8 deletions
+5 -4
View File
@@ -40,6 +40,10 @@ window.refresh_websites_list = async (show_loading = false) => {
async function init_websites() {
puter.hosting.list().then((websites) => {
window.websites = websites;
count_websites();
});
}
$(document).on('click', '.create-a-website-btn', async function (e) {
@@ -173,10 +177,7 @@ function sort_websites() {
}
function count_websites() {
let count = 0;
$('.website-card').each(function () {
count++;
})
let count = window.websites.length;
$('.website-count').html(count ? count : '');
return count;
}
+3 -4
View File
@@ -46,6 +46,8 @@ window.refresh_worker_list = async (show_loading = false) => {
async function init_workers() {
window.workers = await puter.workers.list();
count_workers();
}
$(document).on('click', '.create-a-worker-btn', async function (e) {
@@ -206,10 +208,7 @@ function sort_workers() {
}
function count_workers() {
let count = 0;
$('.worker-card').each(function () {
count++;
})
let count = window.workers.length;
$('.worker-count').html(count ? count : '');
return count;
}