Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import {
useRoute, useRouter,
} from 'vue-router/composables';

import { debounce } from 'lodash';

import { makeDistinctValueHandler } from '@cloudforet/core-lib/component-util/query-search';
import { QueryHelper } from '@cloudforet/core-lib/query';
import { SpaceConnector } from '@cloudforet/core-lib/space-connector';
Expand Down Expand Up @@ -197,7 +199,25 @@ const handleNavigateToDetail = (serviceId: string) => {
}).catch(() => {});
};

// ✅ event listener to change healthy page size (6 -> 8) when window width is 1920px or more
const handleResize = debounce(async () => {
const width = window.innerWidth;
const newPageSize = width >= 1920 ? 8 : 6;

if (newPageSize !== serviceListPageStore.healthyPageSize) {
const oldPageSize = serviceListPageStore.healthyPageSize;
const oldPage = serviceListPageStore.healthyThisPage;
const startIndex = (oldPage - 1) * oldPageSize;
const newPage = Math.floor(startIndex / newPageSize) + 1;

serviceListPageStore.setHealthyPageSize(newPageSize);
serviceListPageStore.setHealthyPage(newPage);
fetchHealthyServiceList();
}
}, 300);

onMounted(async () => {
await handleResize();
const { serviceName, unhealthyPage, healthyPage } = route.query;

if (serviceName && typeof serviceName === 'string') {
Expand Down Expand Up @@ -254,7 +274,7 @@ watch(() => serviceListPageStore.healthyThisPage, (val) => {
handleHealthyPageChange();
});

watch(async () => route.query.serviceName, async (newServiceName) => {
watch(async () => route.query.serviceName, async (newServiceName: any) => {
Copy link

Copilot AI Jun 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider replacing 'any' with a more explicit type to improve type safety in the watch callback.

Suggested change
watch(async () => route.query.serviceName, async (newServiceName: any) => {
watch(async () => route.query.serviceName, async (newServiceName: string | null | undefined) => {

Copilot uses AI. Check for mistakes.
if (typeof newServiceName === 'string') {
const nameValues = newServiceName.split(',').map((name) => ({
key: { name: 'name' },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const handleClickEscalationPolicy = (id: string, escalationPolicyId: string) =>
/>
<span>{{ state.title }}</span>
</div>
<div class="collapsible-contents flex flex-wrap gap-4">
<div class="collapsible-contents">
<p-select-card v-for="(item, idx) in props.list"
:key="`service-item-${idx}`"
class="card"
Expand Down Expand Up @@ -253,7 +253,34 @@ const handleClickEscalationPolicy = (id: string, escalationPolicyId: string) =>
.collapsible-contents {
opacity: 1;
transition: opacity 0.3s ease, visibility 0.3s ease;

@apply grid grid-cols-3 gap-4;
}

@media (min-width: 120rem) {
.collapsible-contents {
@apply grid grid-cols-4 gap-4;
}
}

@screen laptop {
.collapsible-contents {
@apply grid grid-cols-3 gap-4;
}
}

@screen tablet {
.collapsible-contents {
@apply grid grid-cols-2 gap-4;
}
}

@screen mobile {
.collapsible-contents {
@apply grid grid-cols-1 gap-4;
}
}

&.is-collapsed {
.collapsible-title {
.arrow-button {
Expand All @@ -270,8 +297,7 @@ const handleClickEscalationPolicy = (id: string, escalationPolicyId: string) =>
}
}
.card {
width: 28rem;
max-width: 28rem;
min-width: 25rem;
padding: 1.25rem 1.5rem 1rem 1.5rem;
box-shadow: 0 2px 4px 0 rgba(0, 0, 0, 0.06);
.card-inner-wrapper {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import type { ConsoleFilter } from '@cloudforet/core-lib/query/type';
export const useServiceListPageStore = defineStore('page-service-list', {
state: () => ({
unhealthyThisPage: 1,
unhealthyPageSize: 10,
unhealthyPageSize: 12,
healthyThisPage: 1,
healthyPageSize: 6,
searchFilters: [] as ConsoleFilter[],
Expand All @@ -20,5 +20,8 @@ export const useServiceListPageStore = defineStore('page-service-list', {
setSearchFilters(filters: ConsoleFilter[]) {
this.searchFilters = filters;
},
setHealthyPageSize(size: number) {
this.healthyPageSize = size;
},
},
});
Loading