From ca16132f91d4e0f6831fc5f22eed1918228b248f Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Thu, 21 Jan 2021 09:04:54 +0000 Subject: [PATCH] Reverted dashboard route no issue - removing dashboard prototype from master ready to re-apply in 4.0 branch --- app/components/gh-nav-menu.hbs | 5 -- app/router.js | 1 - app/routes/dashboard.js | 12 ---- app/routes/home.js | 9 +-- app/templates/dashboard.hbs | 7 --- tests/acceptance/dashboard-test.js | 98 ------------------------------ 6 files changed, 1 insertion(+), 131 deletions(-) delete mode 100644 app/routes/dashboard.js delete mode 100644 app/templates/dashboard.hbs delete mode 100644 tests/acceptance/dashboard-test.js diff --git a/app/components/gh-nav-menu.hbs b/app/components/gh-nav-menu.hbs index 7ddf747c6..f07323aba 100644 --- a/app/components/gh-nav-menu.hbs +++ b/app/components/gh-nav-menu.hbs @@ -17,11 +17,6 @@
    - {{#if (enable-developer-experiments)}} -
  • - {{svg-jar "house"}} Dashboard -
  • - {{/if}}
  • diff --git a/app/router.js b/app/router.js index f10dfc350..3fe7e8b0a 100644 --- a/app/router.js +++ b/app/router.js @@ -23,7 +23,6 @@ Router.map(function () { this.route('about'); this.route('site'); - this.route('dashboard'); this.route('billing', function () { this.route('billing-sub', {path: '/*sub'}); diff --git a/app/routes/dashboard.js b/app/routes/dashboard.js deleted file mode 100644 index 7ca22b18e..000000000 --- a/app/routes/dashboard.js +++ /dev/null @@ -1,12 +0,0 @@ -import AuthenticatedRoute from 'ghost-admin/routes/authenticated'; -import {inject as service} from '@ember/service'; - -export default class DashboardRoute extends AuthenticatedRoute { - @service config; - - beforeModel() { - if (!this.config.get('enableDeveloperExperiments')) { - this.transitionTo('site'); - } - } -} diff --git a/app/routes/home.js b/app/routes/home.js index 871b90766..a96a35125 100644 --- a/app/routes/home.js +++ b/app/routes/home.js @@ -1,14 +1,7 @@ import Route from '@ember/routing/route'; -import {inject as service} from '@ember/service'; export default class HomeRoute extends Route { - @service config; - beforeModel() { - if (this.config.get('enableDeveloperExperiments')) { - this.transitionTo('dashboard'); - } else { - this.transitionTo('site'); - } + this.transitionTo('site'); } } diff --git a/app/templates/dashboard.hbs b/app/templates/dashboard.hbs deleted file mode 100644 index 9824a9e4a..000000000 --- a/app/templates/dashboard.hbs +++ /dev/null @@ -1,7 +0,0 @@ -
    - -

    - Dashboard -

    -
    -
    \ No newline at end of file diff --git a/tests/acceptance/dashboard-test.js b/tests/acceptance/dashboard-test.js deleted file mode 100644 index 3854398c3..000000000 --- a/tests/acceptance/dashboard-test.js +++ /dev/null @@ -1,98 +0,0 @@ -import {authenticateSession} from 'ember-simple-auth/test-support'; -import {click, currentURL, find, visit} from '@ember/test-helpers'; -import {describe, it} from 'mocha'; -import {expect} from 'chai'; -import {setupApplicationTest} from 'ember-mocha'; -import {setupMirage} from 'ember-cli-mirage/test-support'; - -describe('Acceptance: Dashboard', function () { - const hooks = setupApplicationTest(); - setupMirage(hooks); - - it('is not accessible when logged out', async function () { - await visit('/dashboard'); - expect(currentURL()).to.equal('/signin'); - }); - - describe('when logged in', function () { - beforeEach(async function () { - // TODO: remove this setup when out of dev experiments - this.server.loadFixtures('configs'); - const config = this.server.schema.configs.first(); - config.update({ - enableDeveloperExperiments: true - }); - - let role = this.server.create('role', {name: 'Administrator'}); - this.server.create('user', {roles: [role]}); - - return await authenticateSession(); - }); - - it('can visit /dashboard', async function () { - await visit('/dashboard'); - expect(currentURL()).to.equal('/dashboard'); - }); - }); - - // TODO: remove this whole section when out of dev experiments - describe('developer experiments', function () { - describe('when disabled', function () { - beforeEach(async function () { - this.server.loadFixtures('configs'); - const config = this.server.schema.configs.first(); - config.update({ - enableDeveloperExperiments: false - }); - - let role = this.server.create('role', {name: 'Administrator'}); - this.server.create('user', {roles: [role]}); - - return await authenticateSession(); - }); - - it('/dashboard redirects to /site', async function () { - await visit('/dashboard'); - expect(currentURL()).to.equal('/site'); - }); - - it('/ redirects to /site', async function () { - await visit('/'); - expect(currentURL()).to.equal('/site'); - }); - - it('does not have a nav menu item', async function () { - await visit('/posts'); - expect(find('[data-test-nav="dashboard"]')).to.not.exist; - }); - }); - - describe('when enabled', function () { - beforeEach(async function () { - this.server.loadFixtures('configs'); - const config = this.server.schema.configs.first(); - config.update({ - enableDeveloperExperiments: true - }); - - let role = this.server.create('role', {name: 'Administrator'}); - this.server.create('user', {roles: [role]}); - - return await authenticateSession(); - }); - - it('/ redirects to /dashboard', async function () { - await visit('/'); - expect(currentURL()).to.equal('/dashboard'); - }); - - it('has a nav menu item', async function () { - await visit('/posts'); - expect(currentURL()).to.equal('/posts'); - expect(find('[data-test-nav="dashboard"]')).to.exist; - await click('[data-test-nav="dashboard"]'); - expect(currentURL()).to.equal('/dashboard'); - }); - }); - }); -});