Skip to content

Commit 7324091

Browse files
authored
Merge pull request #6144 from Countly/SER-1966-there-are-some-missing-columns-under-the-edit-column-section-on-the-ratings-page
[SER-1966] There are some missing columns under the edit column section on the ratings page
2 parents 3f5e77b + 8804c18 commit 7324091

File tree

3 files changed

+188
-79
lines changed

3 files changed

+188
-79
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Features:
33
- [dashboards] Added the option to set a refresh rate for dashboards, allowing data to update more frequently for selected dashboards.
44
- [crashed] Fix unescaped SDK logs
55
- [ui] Fix alignment of drawers title and close icon
6+
- [star-rating] Added missing columns to Rating Widgets table edit
67

78
## Version 24.05.29
89
Fixes:

plugins/star-rating/frontend/public/javascripts/countly.views.js

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -403,18 +403,43 @@
403403
data: function() {
404404
return {
405405
cohortsEnabled: countlyGlobal.plugins.indexOf('cohorts') > -1,
406-
persistKey: 'ratingsWidgetsTable_' + countlyCommon.ACTIVE_APP_ID,
407-
tableDynamicCols: [
406+
persistKey: 'ratingsWidgetsTable_' + countlyCommon.ACTIVE_APP_ID
407+
};
408+
},
409+
computed: {
410+
tableDynamicCols() {
411+
const columns = [
412+
{
413+
value: 'rating_score',
414+
label: CV.i18n('feedback.rating-score'),
415+
default: true,
416+
required: true
417+
},
418+
{
419+
value: 'responses',
420+
label: CV.i18n('feedback.responses'),
421+
default: true,
422+
required: true
423+
},
408424
{
409425
value: "target_pages",
410426
label: CV.i18n("feedback.pages"),
411427
default: true,
412428
required: true
413429
}
414-
],
415-
};
416-
},
417-
computed: {
430+
];
431+
432+
if (this.cohortsEnabled) {
433+
columns.unshift({
434+
value: 'targeting',
435+
label: CV.i18n('feedback.targeting'),
436+
default: true,
437+
required: true
438+
});
439+
}
440+
441+
return columns;
442+
},
418443
widgets: function() {
419444
for (var i = 0; i < this.rows.length; i++) {
420445
var ratingScore = 0;
Lines changed: 156 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,159 @@
11
<cly-datatable-n
2-
:force-loading="loading"
3-
:rows="widgets"
4-
:exportFormat="formatExportFunction"
5-
:persist-key="persistKey"
6-
:available-dynamic-cols="tableDynamicCols"
7-
width="100%"
8-
test-id="ratings-widgets-data-table"
9-
@row-click="goWidgetDetail"
10-
row-class-name="bu-is-clickable"
2+
:available-dynamic-cols="tableDynamicCols"
3+
:force-loading="loading"
4+
:exportFormat="formatExportFunction"
5+
:persist-key="persistKey"
6+
row-class-name="bu-is-clickable"
7+
:rows="widgets"
8+
test-id="ratings-widgets-data-table"
9+
width="100%"
10+
@row-click="goWidgetDetail"
11+
>
12+
<template v-slot="scope">
13+
<el-table-column
14+
data-test-id="ratings-widgets-data-table-status-column"
15+
fixed
16+
:label="i18n('feedback.status')"
17+
prop="status"
18+
sortable
19+
type="switch"
20+
width="100"
1121
>
12-
<template v-slot="scope">
13-
<el-table-column width="100" fixed type="switch" sortable prop="status" data-test-id="ratings-widgets-data-table-status-column" :label="i18n('feedback.status')">
14-
<template v-slot="rowScope">
15-
<el-switch :value="rowScope.row.status"
16-
:test-id="'ratings-widgets-data-table-status-' + rowScope.$index"
17-
:disabled="!canUserUpdate"
18-
@input="scope.patch(rowScope.row, { status: !rowScope.row.status})"
19-
@change="$emit('set-status', rowScope.row, !rowScope.row.status)">
20-
</el-switch>
21-
</template>
22-
</el-table-column>
23-
<el-table-column min-width="300" prop="popup_header_text" fixed data-test-id="ratings-widgets-data-table-widget-name-column" :label="i18n('feedback.ratings-widget-name')">
24-
<template v-slot="rowScope">
25-
<div>
26-
<div :data-test-id="'ratings-widgets-data-table-widget-name-' + rowScope.$index">
27-
{{unescapeHtml(rowScope.row.popup_header_text)}}
28-
</div>
29-
<div>
30-
<span :data-test-id="'ratings-widgets-data-table-widget-id-label-' + rowScope.$index" class="color-cool-gray-40 text-small bu-has-text-weight-semibold"> {{ i18n('feedback.widget-id') }} </span>
31-
<span :data-test-id="'ratings-widgets-data-table-widget-id-value-' + rowScope.$index" class="color-cool-gray-40 text-small">{{rowScope.row._id}}</span>
32-
</div>
33-
</div>
34-
</template>
35-
</el-table-column>
36-
<el-table-column min-width="300" prop="internalName" fixed data-test-id="ratings-widgets-data-table-internal-widget-name-column" :label="i18n('feedback.ratings-widget-internal-name')">
37-
<template v-slot="rowScope">
38-
<div>
39-
<div :data-test-id="'ratings-widgets-data-table-internal-widget-name-' + rowScope.$index">
40-
{{rowScope.row.internalName}}
41-
</div>
42-
</div>
43-
</template>
44-
</el-table-column>
45-
<el-table-column min-width="150" v-if="cohortsEnabled" prop="targeting" :label="i18n('feedback.targeting')">
46-
<template v-slot="rowScope">
47-
<cly-cohort-targeting :test-id="'ratings-widgets-data-table-targeting-' + rowScope.$index" inline :targeting="rowScope.row.targeting">
48-
</cly-cohort-targeting>
49-
</template>
50-
</el-table-column>
51-
<el-table-column min-width="150" sortable="true" prop="rating_score" column-key="ratingScore" :label="i18n('feedback.rating-score')">
52-
<template v-slot="rowScope" class="bu-is-flex bu-is-justify-content-center">
53-
<span class="bu-is-size-4" :data-test-id="'ratings-widgets-data-table-rating-score-' + rowScope.$index">
54-
{{ rowScope.row.ratingScore }}
55-
</span>
56-
</template>
57-
</el-table-column>
58-
<el-table-column min-width="130" sortable="true" prop="responses" column-key="ratingsCount" :label="i18n('feedback.responses')">
59-
<template v-slot="rowScope" class="bu-is-flex bu-is-justify-content-center">
60-
<span class="text-medium" :data-test-id="'ratings-widgets-data-table-responses-' + rowScope.$index">
61-
{{ rowScope.row.ratingsCount }}
62-
</span>
63-
</template>
64-
</el-table-column>
65-
<template v-for="(col,idx) in scope.dynamicCols" :prop="col.value">
66-
<el-table-column v-if="col.value === 'target_pages'" :key="idx"
67-
min-width="120" sortable="true" prop="target_pages" :label="col.label">
68-
<template v-slot="rowScope" class="bu-is-flex bu-is-justify-content-center">
69-
<span class="text-medium" :data-test-id="'ratings-widgets-data-table-pages-' + rowScope.$index">
70-
{{ rowScope.row.target_pages }}
71-
</span>
72-
</template>
73-
</el-table-column>
74-
</template>
22+
<template v-slot="rowScope">
23+
<el-switch
24+
:disabled="!canUserUpdate"
25+
:test-id="'ratings-widgets-data-table-status-' + rowScope.$index"
26+
:value="rowScope.row.status"
27+
@change="$emit('set-status', rowScope.row, !rowScope.row.status)"
28+
@input="scope.patch(rowScope.row, { status: !rowScope.row.status})"
29+
/>
7530
</template>
76-
</cly-datatable-n>
31+
</el-table-column>
32+
<el-table-column
33+
data-test-id="ratings-widgets-data-table-widget-name-column"
34+
fixed
35+
:label="i18n('feedback.ratings-widget-name')"
36+
min-width="300"
37+
prop="popup_header_text"
38+
>
39+
<template v-slot="rowScope">
40+
<div>
41+
<div :data-test-id="'ratings-widgets-data-table-widget-name-' + rowScope.$index">
42+
{{ unescapeHtml(rowScope.row.popup_header_text) }}
43+
</div>
44+
<div>
45+
<span
46+
class="color-cool-gray-40 text-small bu-has-text-weight-semibold"
47+
:data-test-id="'ratings-widgets-data-table-widget-id-label-' + rowScope.$index"
48+
>
49+
{{ i18n('feedback.widget-id') }}
50+
</span>
51+
<span
52+
class="color-cool-gray-40 text-small"
53+
:data-test-id="'ratings-widgets-data-table-widget-id-value-' + rowScope.$index"
54+
>
55+
{{ rowScope.row._id }}
56+
</span>
57+
</div>
58+
</div>
59+
</template>
60+
</el-table-column>
61+
<el-table-column
62+
data-test-id="ratings-widgets-data-table-internal-widget-name-column"
63+
fixed
64+
:label="i18n('feedback.ratings-widget-internal-name')"
65+
min-width="300"
66+
prop="internalName"
67+
>
68+
<template v-slot="rowScope">
69+
<div>
70+
<div :data-test-id="'ratings-widgets-data-table-internal-widget-name-' + rowScope.$index">
71+
{{ rowScope.row.internalName }}
72+
</div>
73+
</div>
74+
</template>
75+
</el-table-column>
76+
<template
77+
v-for="(col,idx) in scope.dynamicCols"
78+
:prop="col.value"
79+
>
80+
<el-table-column
81+
v-if="col.value === 'targeting'"
82+
:key="idx"
83+
:label="i18n('feedback.targeting')"
84+
min-width="150"
85+
prop="targeting"
86+
>
87+
<template v-slot="rowScope">
88+
<cly-cohort-targeting
89+
inline
90+
:targeting="rowScope.row.targeting"
91+
:test-id="'ratings-widgets-data-table-targeting-' + rowScope.$index"
92+
/>
93+
</template>
94+
</el-table-column>
95+
<el-table-column
96+
v-if="col.value === 'responses'"
97+
:key="idx"
98+
column-key="ratingsCount"
99+
:label="i18n('feedback.responses')"
100+
min-width="130"
101+
prop="responses"
102+
sortable="true"
103+
>
104+
<template
105+
v-slot="rowScope"
106+
class="bu-is-flex bu-is-justify-content-center"
107+
>
108+
<span
109+
class="text-medium"
110+
:data-test-id="'ratings-widgets-data-table-responses-' + rowScope.$index"
111+
>
112+
{{ rowScope.row.ratingsCount }}
113+
</span>
114+
</template>
115+
</el-table-column>
116+
<el-table-column
117+
v-if="col.value === 'rating_score'"
118+
:key="idx"
119+
column-key="ratingScore"
120+
:label="i18n('feedback.rating-score')"
121+
min-width="150"
122+
prop="rating_score"
123+
sortable="true"
124+
>
125+
<template
126+
v-slot="rowScope"
127+
class="bu-is-flex bu-is-justify-content-center"
128+
>
129+
<span
130+
class="bu-is-size-4"
131+
:data-test-id="'ratings-widgets-data-table-rating-score-' + rowScope.$index"
132+
>
133+
{{ rowScope.row.ratingScore }}
134+
</span>
135+
</template>
136+
</el-table-column>
137+
<el-table-column
138+
v-if="col.value === 'target_pages'"
139+
:key="idx"
140+
:label="col.label"
141+
min-width="120"
142+
prop="target_pages"
143+
sortable="true"
144+
>
145+
<template
146+
v-slot="rowScope"
147+
class="bu-is-flex bu-is-justify-content-center"
148+
>
149+
<span
150+
class="text-medium"
151+
:data-test-id="'ratings-widgets-data-table-pages-' + rowScope.$index"
152+
>
153+
{{ rowScope.row.target_pages }}
154+
</span>
155+
</template>
156+
</el-table-column>
157+
</template>
158+
</template>
159+
</cly-datatable-n>

0 commit comments

Comments
 (0)