FIX: simplify filters on admin-report component (#6193)

This commit is contained in:
Joffrey JAFFEUX 2018-07-27 01:22:00 -04:00 committed by GitHub
parent 6740631fdb
commit b7d1864d0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 31 additions and 28 deletions

View File

@ -50,6 +50,7 @@ export default Ember.Component.extend({
reportOptions: null, reportOptions: null,
forcedModes: null, forcedModes: null,
showAllReportsLink: false, showAllReportsLink: false,
filters: null,
startDate: null, startDate: null,
endDate: null, endDate: null,
category: null, category: null,
@ -77,7 +78,7 @@ export default Ember.Component.extend({
didReceiveAttrs() { didReceiveAttrs() {
this._super(...arguments); this._super(...arguments);
const state = this.get("filteringState") || {}; const state = this.get("filters") || {};
this.setProperties({ this.setProperties({
category: Category.findById(state.categoryId), category: Category.findById(state.categoryId),
groupId: state.groupId, groupId: state.groupId,

View File

@ -77,6 +77,11 @@ export default Ember.Controller.extend(PeriodComputationMixin, {
} }
}, },
@computed("startDate", "endDate")
filters(startDate, endDate) {
return { startDate, endDate };
},
@computed("model.attributes.updated_at") @computed("model.attributes.updated_at")
updatedTimestamp(updatedAt) { updatedTimestamp(updatedAt) {
return moment(updatedAt).format("LLL"); return moment(updatedAt).format("LLL");
@ -88,6 +93,6 @@ export default Ember.Controller.extend(PeriodComputationMixin, {
}, },
_reportsForPeriodURL(period) { _reportsForPeriodURL(period) {
return Discourse.getURL(`/admin/dashboard/general?period=${period}`); return Discourse.getURL(`/admin?period=${period}`);
} }
}); });

View File

@ -12,6 +12,16 @@ export default Ember.Controller.extend(PeriodComputationMixin, {
}; };
}, },
@computed("startDate", "endDate")
filters(startDate, endDate) {
return { startDate, endDate };
},
@computed("lastWeek", "endDate")
lastWeekfilters(startDate, endDate) {
return { startDate, endDate };
},
_reportsForPeriodURL(period) { _reportsForPeriodURL(period) {
return Discourse.getURL(`/admin/dashboard/moderation?period=${period}`); return Discourse.getURL(`/admin/dashboard/moderation?period=${period}`);
} }

View File

@ -15,7 +15,7 @@ export default Ember.Controller.extend({
}, },
@computed("category_id", "group_id", "start_date", "end_date") @computed("category_id", "group_id", "start_date", "end_date")
filteringState(categoryId, groupId, startDate, endDate) { filters(categoryId, groupId, startDate, endDate) {
return { return {
categoryId, categoryId,
groupId, groupId,

View File

@ -18,43 +18,37 @@
dataSourceName="signups" dataSourceName="signups"
showTrend=true showTrend=true
forcedModes="chart" forcedModes="chart"
startDate=startDate filters=filters}}
endDate=endDate}}
{{admin-report {{admin-report
dataSourceName="topics" dataSourceName="topics"
showTrend=true showTrend=true
forcedModes="chart" forcedModes="chart"
startDate=startDate filters=filters}}
endDate=endDate}}
{{admin-report {{admin-report
dataSourceName="posts" dataSourceName="posts"
showTrend=true showTrend=true
forcedModes="chart" forcedModes="chart"
startDate=startDate filters=filters}}
endDate=endDate}}
{{admin-report {{admin-report
dataSourceName="dau_by_mau" dataSourceName="dau_by_mau"
showTrend=true showTrend=true
forcedModes="chart" forcedModes="chart"
startDate=startDate filters=filters}}
endDate=endDate}}
{{admin-report {{admin-report
dataSourceName="daily_engaged_users" dataSourceName="daily_engaged_users"
showTrend=true showTrend=true
forcedModes="chart" forcedModes="chart"
startDate=startDate filters=filters}}
endDate=endDate}}
{{admin-report {{admin-report
dataSourceName="new_contributors" dataSourceName="new_contributors"
showTrend=true showTrend=true
forcedModes="chart" forcedModes="chart"
startDate=startDate filters=filters}}
endDate=endDate}}
</div> </div>
</div> </div>
</div> </div>
@ -170,17 +164,13 @@
<div class="section-column"> <div class="section-column">
{{admin-report {{admin-report
dataSourceName="top_referred_topics" dataSourceName="top_referred_topics"
reportOptions=topReferredTopicsTopions reportOptions=topReferredTopicsTopions}}
startDate=startDate
endDate=endDate}}
{{admin-report {{admin-report
dataSourceName="trending_search" dataSourceName="trending_search"
reportOptions=trendingSearchOptions reportOptions=trendingSearchOptions
isEnabled=logSearchQueriesEnabled isEnabled=logSearchQueriesEnabled
disabledLabel="admin.dashboard.reports.trending_search.disabled" disabledLabel="admin.dashboard.reports.trending_search.disabled"}}
startDate=startDate
endDate=endDate}}
{{{i18n "admin.dashboard.reports.trending_search.more"}}} {{{i18n "admin.dashboard.reports.trending_search.more"}}}
</div> </div>
</div> </div>

View File

@ -17,8 +17,7 @@
<div class="section-body"> <div class="section-body">
{{admin-report {{admin-report
startDate=startDate filters=filters
endDate=endDate
showHeader=false showHeader=false
dataSourceName="moderators_activity"}} dataSourceName="moderators_activity"}}
</div> </div>
@ -27,14 +26,12 @@
<div class="main-section"> <div class="main-section">
{{admin-report {{admin-report
dataSourceName="flags_status" dataSourceName="flags_status"
startDate=lastWeek
reportOptions=flagsStatusOptions reportOptions=flagsStatusOptions
endDate=endDate}} filters=lastWeekfilters}}
{{admin-report {{admin-report
dataSourceName="post_edits" dataSourceName="post_edits"
startDate=lastWeek filters=lastWeekfilters}}
endDate=endDate}}
{{plugin-outlet name="admin-dashboard-moderation-bottom"}} {{plugin-outlet name="admin-dashboard-moderation-bottom"}}
</div> </div>

View File

@ -3,7 +3,7 @@
{{admin-report {{admin-report
showAllReportsLink=true showAllReportsLink=true
dataSourceName=model.type dataSourceName=model.type
filteringState=filteringState filters=filters
reportOptions=reportOptions reportOptions=reportOptions
showFilteringUI=true showFilteringUI=true
onRefresh=(action "onParamsChange")}} onRefresh=(action "onParamsChange")}}