Skip to content

Commit f4f5779

Browse files
committed
fix(Results): enhance response loading logic based on active response view
Signed-off-by: Christian Hartmann <chris-hartmann@gmx.de>
1 parent 58f70e5 commit f4f5779

2 files changed

Lines changed: 27 additions & 14 deletions

File tree

src/components/PillMenu.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
v-for="option of options"
1010
:key="option.id"
1111
:aria-label="isMobile ? option.ariaLabel : null"
12-
:checked="active.id"
12+
:model-value="active.id"
1313
:disabled="disabled || option.disabled"
1414
class="pill-menu__toggle"
1515
:class="{ 'pill-menu__toggle--icon-only': isMobile && option.icon }"
1616
button-variant
1717
button-variant-grouped="horizontal"
1818
type="radio"
1919
:value="option.id"
20-
@update:checked="$emit('update:active', option)">
20+
@update:modelValue="$emit('update:active', option)">
2121
<template v-if="option.icon" #icon>
2222
<NcIconSvgWrapper :path="option.icon" />
2323
</template>

src/views/Results.vue

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@
4545
:disabled="noSubmissions"
4646
:options="responseViews"
4747
:active.sync="activeResponseView"
48-
class="response-actions__toggle" />
48+
class="response-actions__toggle"
49+
@update:active="loadFormResults" />
4950

5051
<!-- Action menu for cloud export and deletion -->
5152
<NcActions
@@ -556,17 +557,29 @@ export default {
556557
logger.debug(`Loading results for form ${this.form.hash}`)
557558
558559
try {
559-
const response = await axios.get(
560-
generateOcsUrl(
561-
'apps/forms/api/v3/forms/{id}/submissions?limit={limit}&offset={offset}&query={query}',
562-
{
563-
id: this.form.id,
564-
limit: this.limit,
565-
offset: this.offset,
566-
query: this.submissionSearch,
567-
},
568-
),
569-
)
560+
let response = null
561+
if (this.activeResponseView.id === 'summary') {
562+
response = await axios.get(
563+
generateOcsUrl(
564+
'apps/forms/api/v3/forms/{id}/submissions',
565+
{
566+
id: this.form.id,
567+
},
568+
),
569+
)
570+
} else {
571+
response = await axios.get(
572+
generateOcsUrl(
573+
'apps/forms/api/v3/forms/{id}/submissions?limit={limit}&offset={offset}&query={query}',
574+
{
575+
id: this.form.id,
576+
limit: this.limit,
577+
offset: this.offset,
578+
query: this.submissionSearch,
579+
},
580+
),
581+
)
582+
}
570583
const data = OcsResponse2Data(response)
571584
572585
// Append questions & submissions

0 commit comments

Comments
 (0)