refactor: break up app.js into smaller modules
All checks were successful
Check / check (pull_request) Successful in 11m29s
All checks were successful
Check / check (pull_request) Successful in 11m29s
Split static/js/app.js (581 lines) into 5 focused modules: - utils.js: global utilities store + legacy compat - components.js: reusable Alpine.js components (copy, confirm, dismiss, time) - app-detail.js: app detail page logic (status polling, logs) - deployment.js: deployment card + deployments history page - dashboard.js: dashboard relative time updates Closes #128
This commit is contained in:
21
static/js/dashboard.js
Normal file
21
static/js/dashboard.js
Normal file
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* upaas - Dashboard Page Component
|
||||
*
|
||||
* Periodically updates relative timestamps on the main dashboard.
|
||||
*/
|
||||
|
||||
document.addEventListener("alpine:init", () => {
|
||||
Alpine.data("dashboard", () => ({
|
||||
init() {
|
||||
// Update relative times every minute
|
||||
setInterval(() => {
|
||||
this.$el.querySelectorAll("[data-time]").forEach((el) => {
|
||||
const time = el.getAttribute("data-time");
|
||||
if (time) {
|
||||
el.textContent = Alpine.store("utils").formatRelativeTime(time);
|
||||
}
|
||||
});
|
||||
}, 60000);
|
||||
},
|
||||
}));
|
||||
});
|
||||
Reference in New Issue
Block a user