Reverted dashboard route

no issue

- removing dashboard prototype from master ready to re-apply in 4.0 branch
This commit is contained in:
Kevin Ansfield 2021-01-21 09:04:54 +00:00
parent e88e8f88e8
commit ca16132f91
6 changed files with 1 additions and 131 deletions

View File

@ -17,11 +17,6 @@
<section class="gh-nav-body">
<div class="gh-nav-top">
<ul class="gh-nav-list gh-nav-main">
{{#if (enable-developer-experiments)}}
<li class="relative">
<LinkTo @route="dashboard" @alt="Dashboard" @title="Dashboard" data-test-nav="dashboard"><span>{{svg-jar "house"}} Dashboard</span></LinkTo>
</li>
{{/if}}
<li class="relative">
<span {{action "transitionToOrRefreshSite" on="click"}}>
<LinkTo @route="site" data-test-nav="site" @current-when={{this.isOnSite}} @preventDefault={{false}}>

View File

@ -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'});

View File

@ -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');
}
}
}

View File

@ -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');
}
}

View File

@ -1,7 +0,0 @@
<section class="gh-canvas">
<GhCanvasHeader class="gh-canvas-header">
<h2 class="gh-canvas-title" data-test-screen-title>
Dashboard
</h2>
</GhCanvasHeader>
</section>

View File

@ -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');
});
});
});
});