Skip to content

Commit e93bb71

Browse files
authored
Merge pull request #2944 from nextcloud/fix/results-summary
fix(Results): enhance response loading logic based on active response view
2 parents 4c16b07 + a85372e commit e93bb71

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

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: 21 additions & 11 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,26 @@ 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-
{
560+
let response = null
561+
if (this.activeResponseView.id === 'summary') {
562+
response = await axios.get(
563+
generateOcsUrl('apps/forms/api/v3/forms/{id}/submissions', {
563564
id: this.form.id,
564-
limit: this.limit,
565-
offset: this.offset,
566-
query: this.submissionSearch,
567-
},
568-
),
569-
)
565+
}),
566+
)
567+
} else {
568+
response = await axios.get(
569+
generateOcsUrl(
570+
'apps/forms/api/v3/forms/{id}/submissions?limit={limit}&offset={offset}&query={query}',
571+
{
572+
id: this.form.id,
573+
limit: this.limit,
574+
offset: this.offset,
575+
query: this.submissionSearch,
576+
},
577+
),
578+
)
579+
}
570580
const data = OcsResponse2Data(response)
571581
572582
// Append questions & submissions

0 commit comments

Comments
 (0)