diff --git a/app/assets/javascripts/admin/controllers/admin-dashboard-next-general.js.es6 b/app/assets/javascripts/admin/controllers/admin-dashboard-next-general.js.es6 index 047c3fae3d9..42bdcc78241 100644 --- a/app/assets/javascripts/admin/controllers/admin-dashboard-next-general.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-dashboard-next-general.js.es6 @@ -13,13 +13,6 @@ const ACTIVITY_METRICS_REPORTS = [ "user_to_user_private_messages_with_replies" ]; -function dynamicReport(reportType) { - return function() { - if (this.get("period") !== "monthly") return null; - return this.get("reports").find(x => x.type === reportType); - }.property("reports.[]", "period"); -} - function staticReport(reportType) { return function() { return this.get("reports").find(x => x.type === reportType); @@ -47,15 +40,6 @@ export default Ember.Controller.extend(PeriodComputationMixin, { return { table: { total: false, limit: 8 } }; }, - signupsReport: dynamicReport("signups"), - topicsReport: dynamicReport("topics"), - postsReport: dynamicReport("posts"), - dauByMauReport: dynamicReport("dau_by_mau"), - dailyEngagedUsersReport: dynamicReport("daily_engaged_users"), - newContributorsReport: dynamicReport("new_contributors"), - - topReferredTopicsReport: staticReport("top_referred_topics"), - trendingSearchReport: staticReport("trending_search"), usersByTypeReport: staticReport("users_by_type"), usersByTrustLevelReport: staticReport("users_by_trust_level"), diff --git a/app/assets/javascripts/admin/controllers/admin-dashboard-next-moderation.js.es6 b/app/assets/javascripts/admin/controllers/admin-dashboard-next-moderation.js.es6 index 95075ef906c..0958bc9d622 100644 --- a/app/assets/javascripts/admin/controllers/admin-dashboard-next-moderation.js.es6 +++ b/app/assets/javascripts/admin/controllers/admin-dashboard-next-moderation.js.es6 @@ -1,11 +1,7 @@ import computed from "ember-addons/ember-computed-decorators"; -import Report from "admin/models/report"; -import AdminDashboardNext from "admin/models/admin-dashboard-next"; import PeriodComputationMixin from "admin/mixins/period-computation"; export default Ember.Controller.extend(PeriodComputationMixin, { - isLoading: false, - dashboardFetchedAt: null, exceptionController: Ember.inject.controller("exception"), @computed @@ -18,46 +14,6 @@ export default Ember.Controller.extend(PeriodComputationMixin, { }; }, - @computed("reports.[]") - flagsStatusReport(reports) { - return reports.find(x => x.type === "flags_status"); - }, - - @computed("reports.[]") - postEditsReport(reports) { - return reports.find(x => x.type === "post_edits"); - }, - - fetchDashboard() { - if (this.get("isLoading")) return; - - if ( - !this.get("dashboardFetchedAt") || - moment() - .subtract(30, "minutes") - .toDate() > this.get("dashboardFetchedAt") - ) { - this.set("isLoading", true); - - AdminDashboardNext.fetchModeration() - .then(model => { - const reports = model.reports.map(x => Report.create(x)); - this.setProperties({ - dashboardFetchedAt: new Date(), - model, - reports - }); - }) - .catch(e => { - this.get("exceptionController").set("thrown", e.jqXHR); - this.replaceRoute("exception"); - }) - .finally(() => { - this.set("isLoading", false); - }); - } - }, - _reportsForPeriodURL(period) { return Discourse.getURL(`/admin/dashboard/moderation?period=${period}`); } diff --git a/app/assets/javascripts/admin/models/admin-dashboard-next.js.es6 b/app/assets/javascripts/admin/models/admin-dashboard-next.js.es6 index bec0c139bae..5ad85c0399e 100644 --- a/app/assets/javascripts/admin/models/admin-dashboard-next.js.es6 +++ b/app/assets/javascripts/admin/models/admin-dashboard-next.js.es6 @@ -13,17 +13,6 @@ AdminDashboardNext.reopenClass({ }); }, - fetchModeration() { - return ajax("/admin/dashboard/moderation.json").then(json => { - const model = AdminDashboardNext.create(); - model.setProperties({ - reports: json.reports, - loaded: true - }); - return model; - }); - }, - fetchGeneral() { return ajax("/admin/dashboard/general.json").then(json => { const model = AdminDashboardNext.create(); diff --git a/app/assets/javascripts/admin/routes/admin-dashboard-next-moderation.js.es6 b/app/assets/javascripts/admin/routes/admin-dashboard-next-moderation.js.es6 deleted file mode 100644 index 6c6dfc7864a..00000000000 --- a/app/assets/javascripts/admin/routes/admin-dashboard-next-moderation.js.es6 +++ /dev/null @@ -1,5 +0,0 @@ -export default Discourse.Route.extend({ - activate() { - this.controllerFor("admin-dashboard-next-moderation").fetchDashboard(); - } -}); diff --git a/app/assets/javascripts/admin/templates/dashboard_next_general.hbs b/app/assets/javascripts/admin/templates/dashboard_next_general.hbs index f6f81f1c8bf..dc23e075201 100644 --- a/app/assets/javascripts/admin/templates/dashboard_next_general.hbs +++ b/app/assets/javascripts/admin/templates/dashboard_next_general.hbs @@ -16,7 +16,6 @@
{{admin-report dataSourceName="signups" - report=signupsReport showTrend=true forcedModes="chart" startDate=startDate @@ -24,7 +23,6 @@ {{admin-report dataSourceName="topics" - report=topicsReport showTrend=true forcedModes="chart" startDate=startDate @@ -32,7 +30,6 @@ {{admin-report dataSourceName="posts" - report=postsReport showTrend=true forcedModes="chart" startDate=startDate @@ -40,7 +37,6 @@ {{admin-report dataSourceName="dau_by_mau" - report=dauByMauReport showTrend=true forcedModes="chart" startDate=startDate @@ -48,7 +44,6 @@ {{admin-report dataSourceName="daily_engaged_users" - report=dailyEngagedUsersReport showTrend=true forcedModes="chart" startDate=startDate @@ -56,7 +51,6 @@ {{admin-report dataSourceName="new_contributors" - report=newContributorsReport showTrend=true forcedModes="chart" startDate=startDate @@ -171,13 +165,11 @@
- {{admin-report - report=topReferredTopicsReport - reportOptions=topReferredTopicsTopions}} + {{admin-report dataSourceName="top_referred_topics" reportOptions=topReferredTopicsTopions}} {{admin-report + dataSourceName="trending_search" reportOptions=trendingSearchOptions - report=trendingSearchReport isEnabled=logSearchQueriesEnabled disabledLabel="admin.dashboard.reports.trending_search.disabled" startDate=startDate diff --git a/app/assets/javascripts/admin/templates/dashboard_next_moderation.hbs b/app/assets/javascripts/admin/templates/dashboard_next_moderation.hbs index ddbaf1c39a6..133519fb98c 100644 --- a/app/assets/javascripts/admin/templates/dashboard_next_moderation.hbs +++ b/app/assets/javascripts/admin/templates/dashboard_next_moderation.hbs @@ -1,44 +1,41 @@ -{{#conditional-loading-spinner condition=isLoading}} -
- {{plugin-outlet name="admin-dashboard-moderation-top"}} +
+ {{plugin-outlet name="admin-dashboard-moderation-top"}} -
-
-

- - {{i18n "admin.dashboard.moderators_activity"}} - -

- {{period-chooser - period=period - action="changePeriod" - content=availablePeriods - fullDay=true}} -
- -
- {{admin-report - startDate=startDate - endDate=endDate - showHeader=false - dataSourceName="moderators_activity"}} -
+
+
+

+ + {{i18n "admin.dashboard.moderators_activity"}} + +

+ {{period-chooser + period=period + action="changePeriod" + content=availablePeriods + fullDay=true}}
-
+
{{admin-report - report=flagsStatusReport - startDate=lastWeek - reportOptions=flagsStatusOptions - endDate=endDate}} - - {{admin-report - report=postEditsReport - startDate=lastWeek - endDate=endDate}} - - {{plugin-outlet name="admin-dashboard-moderation-bottom"}} + startDate=startDate + endDate=endDate + showHeader=false + dataSourceName="moderators_activity"}}
-{{/conditional-loading-spinner}} +
+ {{admin-report + dataSourceName="flags_status" + startDate=lastWeek + reportOptions=flagsStatusOptions + endDate=endDate}} + + {{admin-report + dataSourceName="post_edits" + startDate=lastWeek + endDate=endDate}} + + {{plugin-outlet name="admin-dashboard-moderation-bottom"}} +
+
diff --git a/app/controllers/admin/dashboard_next_controller.rb b/app/controllers/admin/dashboard_next_controller.rb index 4ce90949535..d2dc8e79a22 100644 --- a/app/controllers/admin/dashboard_next_controller.rb +++ b/app/controllers/admin/dashboard_next_controller.rb @@ -11,10 +11,6 @@ class Admin::DashboardNextController < Admin::AdminController render json: data end - def moderation - render json: AdminDashboardNextModerationData.fetch_cached_stats - end - def general data = AdminDashboardNextGeneralData.fetch_cached_stats diff --git a/app/jobs/scheduled/dashboard_stats.rb b/app/jobs/scheduled/dashboard_stats.rb index 9fa0056ff71..15cb9b0ce89 100644 --- a/app/jobs/scheduled/dashboard_stats.rb +++ b/app/jobs/scheduled/dashboard_stats.rb @@ -1,7 +1,6 @@ require_dependency 'admin_dashboard_data' require_dependency 'admin_dashboard_next_index_data' require_dependency 'admin_dashboard_next_general_data' -require_dependency 'admin_dashboard_next_moderation_data' require_dependency 'group' require_dependency 'group_message' @@ -18,9 +17,7 @@ module Jobs end # TODO: decide if we want to keep caching this every 30 minutes - AdminDashboardNextIndexData.refresh_stats AdminDashboardNextGeneralData.refresh_stats - AdminDashboardNextModerationData.refresh_stats AdminDashboardData.refresh_stats end end diff --git a/app/models/admin_dashboard_next_general_data.rb b/app/models/admin_dashboard_next_general_data.rb index 84d1a1a49b2..fcd79207ad3 100644 --- a/app/models/admin_dashboard_next_general_data.rb +++ b/app/models/admin_dashboard_next_general_data.rb @@ -1,22 +1,14 @@ class AdminDashboardNextGeneralData < AdminDashboardNextData def reports @reports ||= %w{ - signups - topics - posts - dau_by_mau - daily_engaged_users - new_contributors page_view_total_reqs visits time_to_first_response likes flags user_to_user_private_messages_with_replies - top_referred_topics users_by_type users_by_trust_level - trending_search } end diff --git a/app/models/admin_dashboard_next_moderation_data.rb b/app/models/admin_dashboard_next_moderation_data.rb deleted file mode 100644 index b97375b048f..00000000000 --- a/app/models/admin_dashboard_next_moderation_data.rb +++ /dev/null @@ -1,19 +0,0 @@ -class AdminDashboardNextModerationData < AdminDashboardNextData - def reports - @reports ||= %w{ - flags_status - post_edits - } - end - - def get_json - { - reports: self.class.reports(reports), - updated_at: Time.zone.now.as_json - } - end - - def self.stats_cache_key - 'moderation-dashboard-data' - end -end diff --git a/config/routes.rb b/config/routes.rb index 936ea26cc80..b09cf206b4f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -238,7 +238,6 @@ Discourse::Application.routes.draw do get "dashboard-next" => "dashboard_next#index" get "dashboard-old" => "dashboard#index" - get "dashboard/moderation" => "dashboard_next#moderation" get "dashboard/general" => "dashboard_next#general" resources :dashboard, only: [:index] do