Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 30 additions & 6 deletions src/layouts/DashboardLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,9 @@
<span>{{ stats.stoppedContainers }} Stopped</span>
</div>
</div>
<button class="header-btn" @click="refreshAll">
<button class="header-btn" :class="{ refreshing: isRefreshing }" @click="refreshAll">
<i class="pi pi-refresh" />
</button>
<button class="header-btn">
<i class="pi pi-bell" />
</button>
</div>
</header>

Expand All @@ -263,6 +260,7 @@ const route = useRoute();
const router = useRouter();
const statsStore = useStatsStore();
const sidebarCollapsed = ref(false);
const isRefreshing = ref(false);

const expandedGroups = reactive({
stacks: true,
Expand Down Expand Up @@ -364,8 +362,16 @@ const breadcrumbs = computed(() => {
return crumbs;
});

const refreshAll = () => {
statsStore.fetchAll();
const refreshAll = async () => {
if (isRefreshing.value) return;
isRefreshing.value = true;
try {
await statsStore.fetchAll();
} finally {
setTimeout(() => {
isRefreshing.value = false;
}, 500);
}
};

const handleLogout = () => {
Expand Down Expand Up @@ -760,6 +766,24 @@ onMounted(() => {
color: #334155;
}

.header-btn.refreshing {
pointer-events: none;
color: #3b82f6;
}

.header-btn.refreshing i {
animation: spin 0.8s linear infinite;
}

@keyframes spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}

.content-area {
flex: 1;
padding: 1.5rem;
Expand Down