Skip to content

Commit dc13ab7

Browse files
committed
refactor: update pagination handling and improve navigation in settings components
- Refactored pagination setup in multiple settings components to include a name parameter for better context. - Enhanced navigation buttons in the app bar and settings dialog to use 'to' for routing, aligning with Vue Router best practices. - Improved loading state representation in the TwoPan component by replacing the skeleton loader with a spinner for a more user-friendly experience.
1 parent c9dfef6 commit dc13ab7

File tree

7 files changed

+12
-21
lines changed

7 files changed

+12
-21
lines changed

apps/web/src/components/core/twopan.vue

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,10 @@ q-splitter.fit.q-custom-splitter.absolute.q-pa-sm(
3535
dense flat binary-state-sort
3636
)
3737
template(v-slot:loading)
38-
q-inner-loading(showing color='primary')
39-
.full-width.q-px-md
40-
q-skeleton(
41-
v-for='index in loadingSkeletonRows'
42-
:key='`twopan-loading-row-${index}`'
43-
type='text'
44-
height='18px'
45-
class='q-my-sm'
46-
)
38+
q-inner-loading(showing)
39+
.column.items-center.q-gutter-sm
40+
q-spinner-gears(size='46px')
41+
.text-caption Chargement de la liste...
4742
template(v-slot:top="props")
4843
slot(name="before-top" v-bind="{ ...props, selected, clearSelection }")
4944
slot(name="before-top-left" v-bind="{ ...props, selected, clearSelection }")
@@ -244,11 +239,6 @@ export default defineNuxtComponent({
244239
},
245240
},
246241
computed: {
247-
loadingSkeletonRows(): number {
248-
const rowsPerPage = Number(this.pagination?.rowsPerPage) || 12
249-
250-
return Math.min(Math.max(rowsPerPage, 6), 20)
251-
},
252242
visibleColumnsSelected(): QTableProps['visibleColumns'] {
253243
if (!this.visibleColumns || this.visibleColumns.length === 0) {
254244
return (this.columns || []).map((column) => column.name)

apps/web/src/components/layouts/default/appbar.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
)
2626

2727
q-btn(
28-
@click="$router.push('/settings/agents')"
28+
to='/settings/agents'
2929
v-if="hasPermissionStartsWith(['/core', '/settings'])"
3030
icon="mdi-cog"
3131
size="md"

apps/web/src/pages/settings.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ q-dialog(:model-value="true" transition-show='none' transition-hide='none' full-
44
q-toolbar.bg-primary.text-white(flat)
55
q-btn(flat @click="drawer = !drawer" round dense icon="mdi-menu")
66
q-toolbar-title Paramètres
7-
q-btn(icon="mdi-close" flat round dense @click="router.push('/')")
7+
q-btn(icon="mdi-close" flat round dense to='/')
88
.flex.fit(:style='{ flexDirection: $q.screen.gt.sm ? "row" : "column" }')
99
.col-0
1010
q-tabs.full-height.border-right(
@@ -53,7 +53,8 @@ export default defineNuxtComponent({
5353
const tab = computed({
5454
get: () => router.currentRoute.value.path,
5555
set: (val: string) => {
56-
window.location.href = val
56+
// window.location.href = val
57+
router.push(val)
5758
},
5859
})
5960
const drawer = ref(true)

apps/web/src/pages/settings/agents.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export default defineNuxtComponent({
8787
}
8888
},
8989
async setup() {
90-
const { useHttpPaginationOptions, useHttpPaginationReactive } = usePagination()
90+
const { useHttpPaginationOptions, useHttpPaginationReactive } = usePagination({ name: 'settings-agents' })
9191
const { toPathWithQueries, navigateToTab } = useRouteQueries()
9292
9393
const paginationOptions = useHttpPaginationOptions()

apps/web/src/pages/settings/cron.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ export default defineNuxtComponent({
151151
}
152152
},
153153
async setup() {
154-
const { useHttpPaginationOptions, useHttpPaginationReactive } = usePagination()
154+
const { useHttpPaginationOptions, useHttpPaginationReactive } = usePagination({ name: 'settings-cron' })
155155
const { toPathWithQueries, navigateToTab } = useRouteQueries()
156156
const { hasPermission } = useAccessControl()
157157
const { monacoOptions } = useDebug()

apps/web/src/pages/settings/keyrings.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export default defineNuxtComponent({
7171
}
7272
},
7373
async setup() {
74-
const { useHttpPaginationOptions, useHttpPaginationReactive } = usePagination()
74+
const { useHttpPaginationOptions, useHttpPaginationReactive } = usePagination({ name: 'settings-keyrings' })
7575
const { hasPermission } = useAccessControl()
7676
const paginationOptions = useHttpPaginationOptions()
7777

apps/web/src/pages/settings/roles.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export default defineNuxtComponent({
8787
}
8888
},
8989
async setup() {
90-
const { useHttpPaginationOptions, useHttpPaginationReactive } = usePagination()
90+
const { useHttpPaginationOptions, useHttpPaginationReactive } = usePagination({ name: 'settings-roles' })
9191
const { toPathWithQueries, navigateToTab } = useRouteQueries()
9292
const { hasPermission } = useAccessControl()
9393

0 commit comments

Comments
 (0)