Submission table pagination & migrate chart to vue3 (#254)

* Submission table Pagination in background

* migrate chart to vue3

* Form submissions pagination

* Form submissions

* Fix form starts

* Fix openSelect key issue

---------

Co-authored-by: Forms Dev <chirag+new@notionforms.io>
Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
Chirag Chhatrala
2023-12-07 19:01:56 +05:30
committed by GitHub
parent 25c5e00c41
commit 24276f0b95
9 changed files with 58 additions and 44 deletions

View File

@@ -20,15 +20,15 @@
</div>
<loader v-else-if="isLoading" class="h-6 w-6 text-nt-blue mx-auto" />
<LineChart v-else
:chart-options="chartOptions"
:chart-data="chartData"
:options="chartOptions"
:data="chartData"
/>
</div>
</template>
<script>
import axios from 'axios'
import { Line as LineChart } from 'vue-chartjs/legacy'
import { Line as LineChart } from 'vue-chartjs'
import {
Chart as ChartJS,
Title,
@@ -93,7 +93,7 @@ export default {
}
},
responsive: true,
maintainAspectRatio: false
maintainAspectRatio: true
}
}
},

View File

@@ -40,19 +40,19 @@
</div>
</modal>
<loader v-if="!form || isLoading" class="h-6 w-6 text-nt-blue mx-auto" />
<loader v-if="!form || !formInitDone" class="h-6 w-6 text-nt-blue mx-auto" />
<div v-else>
<div class="flex flex-wrap items-end">
<div v-if="form && tableData.length > 0" class="flex flex-wrap items-end">
<div class="flex-grow">
<text-input class="w-64" :form="searchForm" name="search" placeholder="Search..." />
</div>
<div class="font-semibold flex gap-4">
<p v-if="form && !isLoading && formInitDone" class="float-right text-xs uppercase mb-2">
<p class="float-right text-xs uppercase mb-2">
<a
href="javascript:void(0);" class="text-gray-500" @click="showColumnsModal=true"
>Display columns</a>
</p>
<p v-if="form && !isLoading && tableData.length > 0" class="text-right text-xs uppercase">
<p class="text-right text-xs uppercase">
<a
:href="exportUrl" target="_blank"
>Export as CSV</a>
@@ -101,7 +101,6 @@ export default {
}
},
data () {
return {
formInitDone: false,
@@ -153,7 +152,7 @@ export default {
}
},
watch: {
form () {
'form.id' () {
if (this.form === null) {
return
}
@@ -167,7 +166,7 @@ export default {
},
methods: {
initFormStructure () {
if (!this.form || this.formInitDone) {
if (!this.form || !this.form.properties || this.formInitDone) {
return
}
@@ -215,6 +214,7 @@ export default {
const resData = response.data
this.tableData = this.tableData.concat(resData.data.map((record) => record.data))
this.dataChanged()
if (this.currentPage < resData.meta.last_page) {
this.currentPage += 1