A platform for community discussion. Free, open, simple.
UX: reworks dashboard problems section to be in line with new style
Joffrey JAFFEUX3381a0a42ad7
diff --git a/app/assets/javascripts/admin/controllers/admin-dashboard-next.js.es6 b/app/assets/javascripts/admin/controllers/admin-dashboard-next.js.es6index 433558917b5..f65e2f04fdc 100644--- a/app/assets/javascripts/admin/controllers/admin-dashboard-next.js.es6+++ b/app/assets/javascripts/admin/controllers/admin-dashboard-next.js.es6@@ -23,18 +23,6 @@ export default Ember.Controller.extend({return this.currentUser.get("admin") && (problemsLength || 0) > 0;},- @computed("foundProblems")- thereWereProblems(foundProblems) {- if (!this.currentUser.get("admin")) { return false; }-- if (foundProblems) {- this.set("hadProblems", true);- return true;- } else {- return this.get("hadProblems") || false;- }- },-fetchDashboard() {if (this.get("isLoading")) return;diff --git a/app/assets/javascripts/admin/templates/dashboard-problems.hbs b/app/assets/javascripts/admin/templates/dashboard-problems.hbsindex 94f878bc9e9..81bee62b289 100644--- a/app/assets/javascripts/admin/templates/dashboard-problems.hbs+++ b/app/assets/javascripts/admin/templates/dashboard-problems.hbs@@ -1,36 +1,27 @@{{#if foundProblems}}- <div class="dashboard-stats detected-problems">- <div class="problem-messages">- {{#conditional-loading-spinner condition=loadingProblems}}- <div>- <h3>- <span class="look-here">{{d-icon "exclamation-triangle"}}</span>- {{i18n 'admin.dashboard.problems_found'}}</h3>- <ul class="{{if loadingProblems 'invisible'}}">+ <div class="section dashboard-problems">+ <div class="section-title">+ <h2>+ {{d-icon "exclamation-triangle"}}+ {{i18n 'admin.dashboard.problems_found'}}+ </h2>+ </div>++ <div class="section-body">+ {{#conditional-loading-section isLoading=loadingProblems}}+ <div class="problem-messages">+ <ul>{{#each problems as |problem|}}<li>{{{problem}}}</li>{{/each}}</ul></div>+<p class="actions"><small>{{i18n 'admin.dashboard.last_checked'}}: {{problemsTimestamp}}</small>{{d-button action="refreshProblems" class="btn-small" icon="refresh" label="admin.dashboard.refresh_problems"}}</p>- {{/conditional-loading-spinner}}+ {{/conditional-loading-section}}</div>- <div class="clearfix"></div></div>-{{else}}- {{#if thereWereProblems}}- <div class="dashboard-stats detected-problems">- <div class="look-here"> </div>- <div class="problem-messages">- <p>- {{i18n 'admin.dashboard.no_problems'}}- {{d-button action="refreshProblems" class="btn-small" icon="refresh" label="admin.dashboard.refresh_problems"}}- </p>- </div>- <div class="clearfix"></div>- </div>- {{/if}}{{/if}}diff --git a/app/assets/javascripts/admin/templates/dashboard_next.hbs b/app/assets/javascripts/admin/templates/dashboard_next.hbsindex 91d6e86954f..4930c46bf00 100644--- a/app/assets/javascripts/admin/templates/dashboard_next.hbs+++ b/app/assets/javascripts/admin/templates/dashboard_next.hbs@@ -1,14 +1,14 @@{{plugin-outlet name="admin-dashboard-top"}}-<div class="section-top">- {{#if showVersionChecks}}- <div class="version-checks">+{{#if showVersionChecks}}+ <div class="section-top">+ <div class="version-checks">{{partial 'admin/templates/version-checks'}}+ </div></div>- {{/if}}- {{partial 'admin/templates/dashboard-problems'}}- <div class='clearfix'></div>-</div>+{{/if}}++{{partial 'admin/templates/dashboard-problems'}}<div class="community-health section"><div class="section-title">diff --git a/app/assets/stylesheets/common/admin/dashboard_next.scss b/app/assets/stylesheets/common/admin/dashboard_next.scssindex 837bf8ad177..c71cd97e3f6 100644--- a/app/assets/stylesheets/common/admin/dashboard_next.scss+++ b/app/assets/stylesheets/common/admin/dashboard_next.scss@@ -182,6 +182,18 @@}}}++ .dashboard-problems {+ margin-bottom: 2em;++ .d-icon-exclamation-triangle {+ color: $danger;+ }++ .actions {+ margin: 0;+ }+ }}.dashboard-mini-chart {diff --git a/test/javascripts/acceptance/dashboard-next-test.js.es6 b/test/javascripts/acceptance/dashboard-next-test.js.es6index 46d50d0087a..56aef0402b6 100644--- a/test/javascripts/acceptance/dashboard-next-test.js.es6+++ b/test/javascripts/acceptance/dashboard-next-test.js.es6@@ -1,7 +1,4 @@-import {- acceptance-}-from "helpers/qunit-helpers";+import { acceptance } from "helpers/qunit-helpers";acceptance("Dashboard Next", {loggedIn: true@@ -11,12 +8,33 @@ QUnit.test("Visit dashboard next page", assert => {visit("/admin");andThen(() => {- assert.ok($('.dashboard-next').length, "has dashboard-next class");+ assert.ok($(".dashboard-next").length, "has dashboard-next class");- assert.ok($('.dashboard-mini-chart.signups').length, "has a signups chart");- assert.ok($('.dashboard-mini-chart.posts').length, "has a posts chart");- assert.ok($('.dashboard-mini-chart.dau_by_mau').length, "has a dau_by_mau chart");- assert.ok($('.dashboard-mini-chart.daily_engaged_users').length, "has a daily_engaged_users chart");- assert.ok($('.dashboard-mini-chart.new_contributors').length, "has a new_contributors chart");+ assert.ok($(".dashboard-mini-chart.signups").length, "has a signups chart");++ assert.ok($(".dashboard-mini-chart.posts").length, "has a posts chart");++ assert.ok(+ $(".dashboard-mini-chart.dau_by_mau").length,+ "has a dau_by_mau chart"+ );++ assert.ok(+ $(".dashboard-mini-chart.daily_engaged_users").length,+ "has a daily_engaged_users chart"+ );++ assert.ok(+ $(".dashboard-mini-chart.new_contributors").length,+ "has a new_contributors chart"+ );++ assert.equal(+ $(".section.dashboard-problems .problem-messages ul li:first-child")+ .html()+ .trim(),+ "Houston...",+ "displays problems"+ );});});diff --git a/test/javascripts/fixtures/problems.js.es6 b/test/javascripts/fixtures/problems.js.es6index d9f77979fdb..7e188ee5830 100644--- a/test/javascripts/fixtures/problems.js.es6+++ b/test/javascripts/fixtures/problems.js.es6@@ -1,4 +1,5 @@export default {"/admin/dashboard/problems.json": {+ problems: ["Houston..."]}};