FIX: missing default params group reports (#50)

This commit is contained in:
tshenry 2020-06-05 09:56:53 -07:00 committed by GitHub
parent 0dcaa990b4
commit f04422244d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -8,8 +8,14 @@ export default DiscourseRoute.extend({
const group = this.modelFor("group");
return ajax(`/g/${group.name}/reports/${params.query_id}`)
.then(response => {
const queryParamInfo = response.query.param_info;
const queryParams = queryParamInfo.reduce((acc, param) => {
acc[param.identifier] = param.default;
return acc;
}, {});
return {
model: Object.assign({ params: {} }, response.query),
model: Object.assign({ params: queryParams }, response.query),
group
};
})

View File

@ -19,7 +19,11 @@
{{#link-to 'group.reports.show' group.name query.id}}{{query.name}}{{/link-to}}
</td>
<td>{{query.description}}</td>
<td>{{bound-date query.last_run_at}}</td>
<td>
{{#if query.last_run_at}}
{{bound-date query.last_run_at}}
{{/if}}
</td>
</tr>
{{/each}}
</tbody>