Skip to content

Commit f8766f5

Browse files
committed
Refactor code to use optional chaining for accessing nested properties
1 parent daa9684 commit f8766f5

File tree

5 files changed

+24
-21
lines changed

5 files changed

+24
-21
lines changed

src/components/2pan/index.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ q-splitter(
44
separator-style="width: 8px"
55
background-color="primary"
66
class="full-height"
7-
:limits="!isSimple ? [20,80] : [0,100]"
7+
:limits="!isSimple ? [30,70] : [0,100]"
88
:horizontal='isSimple'
99
:style='{ "padding": isSimple ? "6px 0" : "0" }'
1010
)
@@ -19,7 +19,7 @@ q-splitter(
1919
:visible-columns="visibleColumnsInternal"
2020
:row-key="rowKey"
2121
@request="onRequest($event, props.total)"
22-
:rows-per-page-options="[6, 12, 18]"
22+
:rows-per-page-options="[12, 16, 20]"
2323
:columns="cols"
2424
:loading="pending"
2525
rows-per-page-label="Lignes par page"
@@ -28,7 +28,7 @@ q-splitter(
2828
no-results-label="Aucun résultat"
2929
:pagination-label="(firstRowIndex, endRowIndex, totalRowsNumber) => `${firstRowIndex}-${endRowIndex} sur ${totalRowsNumber} lignes`"
3030
:selected-rows-label="(numberOfRows) => `${numberOfRows} entrée(s) sélectionnée(s)`"
31-
flat
31+
flat dense
3232
)
3333
template(v-for="(_, name) in $slots" v-slot:[name]="slotData")
3434
slot(:name="name" v-bind="slotData")
@@ -151,11 +151,11 @@ const props = defineProps({
151151
},
152152
refresh: {
153153
type: Function,
154-
default: () => {},
154+
default: () => { },
155155
},
156156
total: {
157157
type: Number,
158-
default: 10,
158+
default: 16,
159159
},
160160
defaultRightPanel: {
161161
type: Boolean,
@@ -206,8 +206,8 @@ const props = defineProps({
206206
return row
207207
},
208208
209-
cancel: async () => {},
210-
onMounted: async () => {},
209+
cancel: async () => { },
210+
onMounted: async () => { },
211211
},
212212
},
213213
})
@@ -218,7 +218,7 @@ const isSimple = computed(() => {
218218
return simple.value
219219
})
220220
watch(simple, (v) => {
221-
splitterModel.value = v ? 100 : 50
221+
splitterModel.value = v ? 100 : 75
222222
})
223223
const splitterModel = ref(isSimple.value ? 100 : 50)
224224

src/components/appbar/RightButtons.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
div
33
//q-btn(v-for="button in buttons" :key="button.icon" round flat :icon="button.icon" size="md").q-mx-sm
44
q-tooltip.text-body2(transition-show="scale" transition-hide="scale") {{ button.name }}
5-
q-btn(icon="mdi-sync" square color="amber-9" size="md" :label="badgesValues.TO_SYNC +' items à Synchroniser'" @click="syncAll")
5+
q-btn(v-if="badgesValues.TO_SYNC > 0" icon="mdi-sync" square color="amber-9" size="md" :label="badgesValues.TO_SYNC +' items à Synchroniser'" @click="syncAll")
66
q-btn-dropdown(icon="mdi-account-circle-outline" :label="auth?.user?.displayName" round flat size="md")
77
q-list
88
q-item.q-pa-none(v-for="button in buttons" :key="button.name")

src/composables/useMenu.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,39 +41,39 @@ function useMenu(identityStateStore, identityAffectationStore) {
4141
{
4242
icon: 'mdi-account-check',
4343
label: 'A valider',
44-
path: `/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&limit=10&filters[@state][]=${IdentityState.TO_VALIDATE}`,
44+
path: `/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&filters[@state][]=${IdentityState.TO_VALIDATE}`,
4545
color: 'primary',
4646
part: 'Etats',
4747
badgeValue: 'TO_VALIDATE',
4848
},
4949
{
5050
icon: 'mdi-account-alert',
5151
label: 'A compléter',
52-
path: `/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&limit=10&filters[@state][]=${IdentityState.TO_COMPLETE}`,
52+
path: `/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&filters[@state][]=${IdentityState.TO_COMPLETE}`,
5353
color: 'primary',
5454
part: 'Etats',
5555
badgeValue: 'TO_COMPLETE',
5656
},
5757
{
5858
icon: 'mdi-sync',
5959
label: 'A synchroniser',
60-
path: `/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&limit=10&filters[@state][]=${IdentityState.TO_SYNC}`,
60+
path: `/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&filters[@state][]=${IdentityState.TO_SYNC}`,
6161
color: 'primary',
6262
part: 'Etats',
6363
badgeValue: 'TO_SYNC',
6464
},
6565
{
6666
icon: 'mdi-loading',
6767
label: 'En cours de synchronisation',
68-
path: `/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&limit=10&filters[@state][]=${IdentityState.PROCESSING}`,
68+
path: `/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&filters[@state][]=${IdentityState.PROCESSING}`,
6969
color: 'primary',
7070
part: 'Etats',
7171
badgeValue: 'PROCESSING',
7272
},
7373
{
7474
icon: 'mdi-check',
7575
label: 'Synchronisées',
76-
path: `/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&limit=10&filters[@state][]=${IdentityState.SYNCED}`,
76+
path: `/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&filters[@state][]=${IdentityState.SYNCED}`,
7777
color: 'primary',
7878
part: 'Etats',
7979
badgeValue: 'SYNCED',
@@ -82,31 +82,31 @@ function useMenu(identityStateStore, identityAffectationStore) {
8282
// {
8383
// icon: 'mdi-account-off',
8484
// label: 'Etudiants',
85-
// path: '/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&limit=10&filters[^additionalFields.attributes.supannPerson.supannTypeEntiteAffectation]=/etd/i',
85+
// path: '/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&filters[^additionalFields.attributes.supannPerson.supannTypeEntiteAffectation]=/etd/i',
8686
// color: 'primary',
8787
// part: 'Affectations',
8888
// badgeValue: 'ETD',
8989
// },
9090
// {
9191
// icon: 'mdi-account-tie',
9292
// label: 'Administratifs',
93-
// path: '/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&limit=10&filters[^additionalFields.attributes.supannPerson.supannTypeEntiteAffectation]=/adm/i',
93+
// path: '/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&filters[^additionalFields.attributes.supannPerson.supannTypeEntiteAffectation]=/adm/i',
9494
// color: 'primary',
9595
// part: 'Affectations',
9696
// badgeValue: 'ADM',
9797
// },
9898
// {
9999
// icon: 'mdi-account-group',
100100
// label: 'Enseignants',
101-
// path: '/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&limit=10&filters[^additionalFields.attributes.supannPerson.supannTypeEntiteAffectation]=/esn/i',
101+
// path: '/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&filters[^additionalFields.attributes.supannPerson.supannTypeEntiteAffectation]=/esn/i',
102102
// color: 'primary',
103103
// part: 'Affectations',
104104
// badgeValue: 'ESN',
105105
// },
106106
{
107107
icon: 'mdi-account-remove',
108108
label: 'En erreur',
109-
path: `/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&limit=10&filters[@state][]=${IdentityState.ON_ERROR}`,
109+
path: `/identities?sort[metadata.lastUpdatedAt]=desc&skip=0&filters[@state][]=${IdentityState.ON_ERROR}`,
110110
color: 'primary',
111111
part: 'Etats',
112112
badgeValue: 'ON_ERROR',

src/composables/usePagination.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ export default function usePagination() {
1010
const pagination = ref<QTableProps['pagination']>({
1111
rowsNumber: 0,
1212
page: 1,
13-
rowsPerPage: 10,
13+
rowsPerPage: 16,
1414
sortBy: 'metadata.lastUpdatedAt',
1515
descending: true,
1616
})
1717

1818
async function initializePagination(total: number = 0) {
1919
if (!pagination.value) return
2020
const query = { ...route.query }
21-
const limit = query.limit ?? 10
21+
const limit = query.limit ?? 16
2222
const skip = query.skip ?? 0
2323
pagination.value.rowsPerPage = parseInt(limit as string)
2424
pagination.value.page = parseInt(skip as string) / parseInt(limit as string) + 1

src/pages/identities/index.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,10 @@ const { pagination, onRequest, initializePagination } = usePagination()
8181
8282
const queryWithoutRead = computed(() => {
8383
const { read, ...rest } = route.query
84-
return rest
84+
return {
85+
limit: pagination.value?.rowsPerPage,
86+
...rest,
87+
}
8588
})
8689
8790
const {

0 commit comments

Comments
 (0)