Skip to content

Commit b0b5f6c

Browse files
committed
Update default.vue to disable logs and update status
1 parent d27e037 commit b0b5f6c

File tree

3 files changed

+63
-62
lines changed

3 files changed

+63
-62
lines changed

src/components/quasar-jsonform/util/composition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ export const useQuasarControl = <
117117
// console.log('input.control.value.data', input.control.value.data)
118118
if (isEmpty(input.control.value?.data) || isNull(input.control.value?.data)) {
119119
input.handleChange(input.control.value?.path, input.control.value?.schema?.default || undefined)
120-
// console.log('trigger default', input.control.value.schema.default || null)
120+
console.log('trigger default', input.control.value?.path, input.control.value.schema.default || undefined)
121121
}
122122

123123
// if (typeof input.control.value.data === 'undefined' || input.control.value.data === null && input.control.value.errors) {

src/pages/identities/export.vue

Lines changed: 55 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
<template>
22
<q-page class="container q-px-md">
3-
<sesame-searchfilters :fields="fieldsList"></sesame-searchfilters>
4-
<q-table
5-
flat bordered
6-
title="Identités"
7-
dense
8-
:rows="rows1"
9-
:columns="fieldsName"
10-
row-key="uid"
11-
:rows-per-page-options="[20,50,0]"
12-
>
3+
<sesame-searchfilters :fields="fieldsList"></sesame-searchfilters>
4+
<q-table flat bordered title="Identités" dense :rows="rows1" :columns="fieldsName" row-key="_id"
5+
:rows-per-page-options="[20, 50, 0]">
136
<template v-slot:top-left>
147

15-
<q-select outlined v-model="typeExport" :options="optionsExport" label="Format d'export" dense style="width:150px;"/>
8+
<q-select outlined v-model="typeExport" :options="optionsExport" label="Format d'export" dense
9+
style="width:150px;" />
1610
<q-btn color="positive" icon="mdi-cloud-download" size="md" flat @click="exportData" dense>
1711
Exporter
1812

@@ -23,13 +17,13 @@
2317
</template>
2418

2519
<script lang="ts" setup>
26-
import {computed, onMounted, provide, ref} from "vue";
27-
import {useRoute} from "nuxt/app";
20+
import { computed, onMounted, provide, ref } from "vue";
21+
import { useRoute } from "nuxt/app";
2822
const route = useRoute()
2923
const { columns, visibleColumns, columnsType } = useColumnsIdentites()
30-
const typeExport=ref('CSV')
31-
const optionsExport=ref(['CSV','JSON'])
32-
let rowsData=null
24+
const typeExport = ref('CSV')
25+
const optionsExport = ref(['CSV', 'JSON'])
26+
let rowsData = null
3327
3428
// prise de la requete qui est dans l'url mise par le filtre
3529
const queryWithoutRead = computed(() => {
@@ -39,35 +33,35 @@ const queryWithoutRead = computed(() => {
3933
...rest,
4034
}
4135
})
42-
const { data: fieldsName, pending1, error1} = await useHttp('/management/identities/validation', {
36+
const { data: fieldsName, pending1, error1 } = await useHttp('/management/identities/validation', {
4337
method: 'GET',
44-
transform: (result)=>{
45-
const allFields=result.data.flatMap((enr)=>{
38+
transform: (result) => {
39+
const allFields = result.data.flatMap((enr) => {
4640
return Object.keys(enr[enr.name].properties)
4741
})
4842
49-
return allFields.map((enr)=>{
50-
return {name:enr,field:enr,label:enr,align: 'left'}
43+
return allFields.map((enr) => {
44+
return { name: enr, field: enr, label: enr, align: 'left' }
5145
})
5246
}
5347
});
5448
5549
const { data: rows1, pending, error, refresh } = await useHttp('/management/identities?sort[inetOrgPerson.cn]=asc', {
56-
method: 'GET',
57-
query:queryWithoutRead,
58-
transform: (result)=>{
59-
rowsData=result
60-
const allFields=result.data.map((enr)=>{
61-
let addF={}
62-
for (const [key, value] of Object.entries(enr?.additionalFields?.attributes||{})) {
63-
addF = {...addF, ...value}
64-
}
65-
const step1={...enr.inetOrgPerson,...addF}
66-
return step1
67-
})
68-
return allFields
69-
}
70-
});
50+
method: 'GET',
51+
query: queryWithoutRead,
52+
transform: (result) => {
53+
rowsData = result
54+
const allFields = result.data.map((enr) => {
55+
let addF = {}
56+
for (const [key, value] of Object.entries(enr?.additionalFields?.attributes || {})) {
57+
addF = { ...addF, ...value }
58+
}
59+
const step1 = { ...enr.inetOrgPerson, ...addF }
60+
return step1
61+
})
62+
return allFields
63+
}
64+
});
7165
7266
7367
@@ -85,38 +79,38 @@ const fieldsList = computed(() => {
8579
}, [])
8680
})
8781
88-
async function exportData(){
89-
if (typeExport.value === 'CSV'){
90-
const csv=toCsv(fieldsName,rows1)
91-
let blob=new Blob([csv],{type:'text/csv'})
92-
let link=document.createElement('a')
93-
link.href=window.URL.createObjectURL(blob)
94-
link.download="sesame-export.csv"
82+
async function exportData() {
83+
if (typeExport.value === 'CSV') {
84+
const csv = toCsv(fieldsName, rows1)
85+
let blob = new Blob([csv], { type: 'text/csv' })
86+
let link = document.createElement('a')
87+
link.href = window.URL.createObjectURL(blob)
88+
link.download = "sesame-export.csv"
9589
link.click()
96-
}else if(typeExport.value === 'JSON'){
97-
let blob=new Blob([JSON.stringify(rowsData)],{type:'text/json'})
98-
let link=document.createElement('a')
99-
link.href=window.URL.createObjectURL(blob)
100-
link.download="sesame-export.json"
90+
} else if (typeExport.value === 'JSON') {
91+
let blob = new Blob([JSON.stringify(rowsData)], { type: 'text/json' })
92+
let link = document.createElement('a')
93+
link.href = window.URL.createObjectURL(blob)
94+
link.download = "sesame-export.json"
10195
link.click()
10296
10397
}
10498
10599
}
106-
function toCsv(fields,rows){
107-
const f=[]
108-
const fString=[]
109-
for (const [key,value] of Object.entries(fields.value)){
110-
f.push(value.name )
111-
fString.push('"' +value.name + '"')
100+
function toCsv(fields, rows) {
101+
const f = []
102+
const fString = []
103+
for (const [key, value] of Object.entries(fields.value)) {
104+
f.push(value.name)
105+
fString.push('"' + value.name + '"')
112106
}
113-
let csv=f.join(';')
114-
const tabCsv=[]
115-
for (const [key,value] of Object.entries(rows.value)){
116-
const ligne=f.map((k)=>{
117-
if (typeof value[k] === 'string' || typeof value[k] === 'number'){
118-
return '"' + value[k] +'"'
119-
}else{
107+
let csv = f.join(';')
108+
const tabCsv = []
109+
for (const [key, value] of Object.entries(rows.value)) {
110+
const ligne = f.map((k) => {
111+
if (typeof value[k] === 'string' || typeof value[k] === 'number') {
112+
return '"' + value[k] + '"'
113+
} else {
120114
return '""'
121115
}
122116
})

src/pages/identities/index.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@ const {
100100
} = await useHttp<Response>('/management/identities', {
101101
method: 'get',
102102
query: queryWithoutRead,
103+
onResponse(p) {
104+
console.log('p', p.response?._data?.total)
105+
pagination.value.rowsNumber = Math.round(Math.random() * 100)
106+
console.log('pagination.value', pagination.value.rowsNumber)
107+
// pagination.value.rowsNumber = p.response?._data?.total || 0
108+
109+
}
103110
})
104111
105112
if (error.value) {

0 commit comments

Comments
 (0)