ui: Implements the ember-page-title addon to the UI (#7118)

* Installs ember-page-title 5.x

* Adds a page title to all template files that need one

* Adds an assertion step to test the page titles
This commit is contained in:
Kenia 2020-01-28 09:25:52 -05:00 committed by GitHub
parent 1ff8678df7
commit ff315c95fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
53 changed files with 262 additions and 4 deletions

View File

@ -1,3 +1,5 @@
{{head-layout}}
{{title 'Consul' separator=' - '}}
{{#if (not loading)}}
{{outlet}}
{{else}}

View File

@ -1,3 +1,12 @@
{{#if isAuthorized }}
{{#if create }}
{{title 'New Policy'}}
{{else}}
{{title 'Edit Policy'}}
{{/if}}
{{else}}
{{title 'Access Controls'}}
{{/if}}
{{#app-view class=(concat 'policy ' (if (or isAuthorized isEnabled) 'edit' 'list')) loading=isLoading authorized=isAuthorized enabled=isEnabled}}
{{#block-slot name='notification' as |status type|}}
{{partial 'dc/acls/policies/notifications'}}

View File

@ -1,3 +1,8 @@
{{#if isAuthorized }}
{{title 'Policies'}}
{{else}}
{{title 'Access Controls'}}
{{/if}}
{{#app-view class=(concat 'policy ' (if (not isAuthorized) 'edit' 'list')) loading=isLoading authorized=isAuthorized enabled=isEnabled}}
{{#block-slot name='notification' as |status type|}}
{{partial 'dc/acls/policies/notifications'}}

View File

@ -1,3 +1,12 @@
{{#if isAuthorized }}
{{#if item.ID}}
{{title 'Edit Role'}}
{{else}}
{{title 'New Role'}}
{{/if}}
{{else}}
{{title 'Access Controls'}}
{{/if}}
{{#app-view class=(concat 'role ' (if (or isAuthorized isEnabled) 'edit' 'list')) loading=isLoading authorized=isAuthorized enabled=isEnabled}}
{{#block-slot name='notification' as |status type|}}
{{partial 'dc/acls/roles/notifications'}}

View File

@ -1,3 +1,8 @@
{{#if isAuthorized }}
{{title 'Roles'}}
{{else}}
{{title 'Access Controls'}}
{{/if}}
{{#app-view class=(concat 'role ' (if (not isAuthorized) 'edit' 'list')) loading=isLoading authorized=isAuthorized enabled=isEnabled}}
{{#block-slot name='notification' as |status type|}}
{{partial 'dc/acls/roles/notifications'}}

View File

@ -1,3 +1,12 @@
{{#if isAuthorized }}
{{#if create}}
{{title 'New Token'}}
{{else}}
{{title 'Edit Token'}}
{{/if}}
{{else}}
{{title 'Access Controls'}}
{{/if}}
{{#app-view class=(concat 'token ' (if (or isAuthorized isEnabled) 'edit' 'list')) loading=isLoading authorized=isAuthorized enabled=isEnabled}}
{{#block-slot name='notification' as |status type|}}
{{partial 'dc/acls/tokens/notifications'}}

View File

@ -1,3 +1,8 @@
{{#if isAuthorized }}
{{title 'Tokens'}}
{{else}}
{{title 'Access Controls'}}
{{/if}}
{{#app-view class=(concat 'token ' (if (and isEnabled (not isAuthorized)) 'edit' 'list')) loading=isLoading authorized=isAuthorized enabled=isEnabled}}
{{#block-slot name='notification' as |status type subject|}}
{{partial 'dc/acls/tokens/notifications'}}

View File

@ -1,3 +1,9 @@
{{#if item.ID }}
{{title 'Edit Intention'}}
{{else}}
{{title 'New Intention'}}
{{/if}}
{{#app-view class="intention edit" loading=isLoading}}
{{#block-slot name='notification' as |status type|}}
{{partial 'dc/intentions/notifications'}}

View File

@ -1,3 +1,4 @@
{{title 'Intentions'}}
{{#app-view class="intention list"}}
{{#block-slot name='notification' as |status type|}}
{{partial 'dc/intentions/notifications'}}

View File

@ -1,3 +1,8 @@
{{#if create }}
{{title 'New Key/Value'}}
{{else}}
{{title 'Edit Key/Value'}}
{{/if}}
{{#app-view class="kv edit" loading=isLoading}}
{{#block-slot name='notification' as |status type|}}
{{partial 'dc/kv/notifications'}}

View File

@ -1,3 +1,4 @@
{{title 'Key/Value'}}
{{#app-view class="kv list" loading=isLoading}}
{{#block-slot name='notification' as |status type|}}
{{partial 'dc/kv/notifications'}}

View File

@ -1,3 +1,4 @@
{{title 'Nodes'}}
{{#app-view class="node list"}}
{{#block-slot name='header'}}
<h1>

View File

@ -1,3 +1,4 @@
{{title item.Node}}
{{#app-view class="node show"}}
{{#block-slot name='notification' as |status type|}}
{{!TODO: Move sessions to its own folder within nodes }}

View File

@ -1,3 +1,8 @@
{{#if create }}
{{title 'New Namespace'}}
{{else}}
{{title 'Edit Namespace'}}
{{/if}}
{{#app-view class="nspace edit" loading=isLoading}}
{{#block-slot name='notification' as |status type|}}
{{partial 'dc/nspaces/notifications'}}

View File

@ -1,3 +1,4 @@
{{title 'Namespaces'}}
{{#app-view class="nspace list" loading=isLoading}}
{{#block-slot name='notification' as |status type subject|}}
{{partial 'dc/nspaces/notifications'}}

View File

@ -1,3 +1,4 @@
{{title 'Services'}}
{{#app-view class="service list"}}
{{#block-slot name='notification' as |status type|}}
{{partial 'dc/services/notifications'}}

View File

@ -1,3 +1,4 @@
{{title item.ID}}
{{#app-view class="instance show"}}
{{#block-slot name='notification' as |status type|}}
{{partial 'dc/services/notifications'}}

View File

@ -1,3 +1,4 @@
{{title item.Service.Service}}
{{#app-view class="service show"}}
{{#block-slot name='notification' as |status type|}}
{{partial 'dc/services/notifications'}}

View File

@ -0,0 +1 @@
<title>{{model.title}}</title>

View File

@ -1,3 +1,4 @@
{{title "Settings"}}
{{#hashicorp-consul id="wrapper" permissions=permissions dcs=dcs dc=dc nspaces=nspaces nspace=nspace}}
{{#app-view class="settings show"}}
{{#block-slot name='header'}}

View File

@ -86,6 +86,7 @@
"ember-load-initializers": "^2.0.0",
"ember-math-helpers": "^2.4.0",
"ember-maybe-import-regenerator": "^0.1.6",
"ember-page-title": "^5.1.0",
"ember-power-select": "^3.0.3",
"ember-power-select-with-create": "^0.6.0",
"ember-qunit": "^4.4.1",

View File

@ -0,0 +1,14 @@
@setupApplicationTest
Feature: dc / acls / policies / create
Scenario:
Given 1 datacenter model with the value "datacenter"
When I visit the policy page for yaml
---
dc: datacenter
---
Then the url should be /datacenter/acls/policies/create
And the title should be "New Policy - Consul"
@ignore
Scenario: Test we can create a ACLs Policy
Then ok

View File

@ -10,6 +10,7 @@ Feature: dc / acls / policies / index: ACL Policy List
---
Then the url should be /dc-1/acls/policies
Then I see 3 policy models
And the title should be "Policies - Consul"
Scenario: Searching the policies
Given 1 datacenter model with the value "dc-1"
And 3 policy models from yaml

View File

@ -15,6 +15,7 @@ Feature: dc / acls / policies / update: ACL Policy Update
---
Then the url should be /datacenter/acls/policies/policy-id
Then I see 3 token models
And the title should be "Edit Policy - Consul"
Scenario: Update to [Name], [Rules], [Description]
Then I fill in the policy form with yaml
---

View File

@ -0,0 +1,14 @@
@setupApplicationTest
Feature: dc / acls / roles / create
Scenario:
Given 1 datacenter model with the value "datacenter"
When I visit the role page for yaml
---
dc: datacenter
---
Then the url should be /datacenter/acls/roles/create
And the title should be "New Role - Consul"
@ignore
Scenario: Test we can create a ACLs role
Then ok

View File

@ -10,6 +10,7 @@ Feature: dc / acls / roles / index: ACL Roles List
---
Then the url should be /dc-1/acls/roles
Then I see 3 role models
And the title should be "Roles - Consul"
Scenario: Searching the roles
Given 1 datacenter model with the value "dc-1"
And 3 role models from yaml

View File

@ -14,6 +14,7 @@ Feature: dc / acls / roles / update: ACL Role Update
---
Then the url should be /datacenter/acls/roles/role-id
Then I see 3 token models
And the title should be "Edit Role - Consul"
Scenario: Update to [Name], [Rules], [Description]
Then I fill in the role form with yaml
---

View File

@ -0,0 +1,14 @@
@setupApplicationTest
Feature: dc / acls / tokens / create
Scenario:
Given 1 datacenter model with the value "datacenter"
When I visit the token page for yaml
---
dc: datacenter
---
Then the url should be /datacenter/acls/tokens/create
And the title should be "New Token - Consul"
@ignore
Scenario: Test we can create a ACLs Token
Then ok

View File

@ -9,6 +9,7 @@ Feature: dc / acls / tokens / index: ACL Token List
dc: dc-1
---
Then the url should be /dc-1/acls/tokens
And the title should be "Tokens - Consul"
Then I see 3 token models
Scenario: Searching the tokens
Given 1 datacenter model with the value "dc-1"

View File

@ -13,6 +13,7 @@ Feature: dc / acls / tokens / update: ACL Token Update
token: key
---
Then the url should be /datacenter/acls/tokens/key
And the title should be "Edit Token - Consul"
Scenario: Update to [Name]
Then I fill in with yaml
---

View File

@ -19,6 +19,7 @@ Feature: dc / intentions / create: Intention Create
dc: datacenter
---
Then the url should be /datacenter/intentions/create
And the title should be "New Intention - Consul"
# Set source
And I click "[data-test-source-element] .ember-power-select-trigger"
And I type "web" into ".ember-power-select-search-input"
@ -39,5 +40,6 @@ Feature: dc / intentions / create: Intention Create
Action: deny
---
Then the url should be /datacenter/intentions
And the title should be "Intentions - Consul"
And "[data-notification]" has the "notification-create" class
And "[data-notification]" has the "success" class

View File

@ -12,6 +12,7 @@ Feature: dc / intentions / update: Intention Update
intention: intention-id
---
Then the url should be /datacenter/intentions/intention-id
And the title should be "Edit Intention - Consul"
Scenario: Update to [Description], [Action]
Then I fill in with yaml
---
@ -25,6 +26,7 @@ Feature: dc / intentions / update: Intention Update
Action: [Action]
---
Then the url should be /datacenter/intentions
And the title should be "Intentions - Consul"
And "[data-notification]" has the "notification-update" class
And "[data-notification]" has the "success" class
Where:

View File

@ -0,0 +1,14 @@
@setupApplicationTest
Feature: dc / kvs / create
Scenario:
Given 1 datacenter model with the value "datacenter"
When I visit the kv page for yaml
---
dc: datacenter
---
Then the url should be /datacenter/kv/create
And the title should be "New Key/Value - Consul"
@ignore
Scenario: Test we can create a KV
Then ok

View File

@ -13,6 +13,7 @@ Feature: dc / kvs / update: KV Update
kv: "[Name]"
---
Then the url should be /datacenter/kv/[EncodedName]/edit
And the title should be "Edit Key/Value - Consul"
# Turn the Code Editor off so we can fill the value easier
And I click "[name=json]"
Then I fill in with yaml
@ -52,6 +53,7 @@ Feature: dc / kvs / update: KV Update
And I submit
Then a PUT request was made to "/v1/kv/key?dc=datacenter&ns=@!namespace" with the body " "
Then the url should be /datacenter/kv
And the title should be "Key/Value - Consul"
And "[data-notification]" has the "notification-update" class
And "[data-notification]" has the "success" class
Scenario: Update to a key change value to ''

View File

@ -14,6 +14,7 @@ Feature: dc / nodes / index
dc: dc-1
---
Then the url should be /dc-1/nodes
And the title should be "Nodes - Consul"
Then I see 3 node models
Scenario: Seeing the leader in unhealthy listing
Given 3 node models from yaml

View File

@ -75,6 +75,7 @@ Feature: dc / nodes / show: Show node
node: node-0
---
Then the url should be /dc1/nodes/node-0
And the title should be "node-0 - Consul"
And the url "/v1/internal/ui/node/node-0" responds with a 404 status
And pause until I see the text "no longer exists" in "[data-notification]"
@ignore

View File

@ -0,0 +1,14 @@
@setupApplicationTest
Feature: dc / acls / nspaces / create
Scenario:
Given 1 datacenter model with the value "datacenter"
When I visit the nspace page for yaml
---
dc: datacenter
---
Then the url should be /datacenter/namespaces/create
And the title should be "New Namespace - Consul"
@ignore
Scenario: Test we can create a Namespace
Then ok

View File

@ -15,6 +15,7 @@ Feature: dc / nspaces / index: Nspaces List
dc: dc-1
---
Then the url should be /dc-1/namespaces
And the title should be "Namespaces - Consul"
Scenario:
Then I see 3 nspace models
Scenario: Searching the nspaces

View File

@ -14,6 +14,7 @@ Feature: dc / nspaces / update: Nspace Update
namespace: namespace
---
Then the url should be /datacenter/namespaces/namespace
And the title should be "Edit Namespace - Consul"
Scenario: Update to [Description]
Then I fill in with yaml
---

View File

@ -26,6 +26,7 @@ Feature: dc / services / index: List Services
dc: dc-1
---
Then the url should be /dc-1/services
And the title should be "Services - Consul"
Then I see 6 service models
And I see externalSource on the services like yaml
---

View File

@ -81,6 +81,7 @@ Feature: dc / services / instances / show: Show Service Instance
When I click metaData on the tabs
And I see metaDataIsSelected on the tabs
And I see 3 of the metaData object
And the title should be "service-0-with-id - Consul"
Scenario: A Service instance warns when deregistered whilst blocking
Given settings from yaml

View File

@ -16,6 +16,8 @@ Feature: dc / services / show: Show Service
service: service-0
---
Then I see externalSource like "consul"
And the title should be "service-0 - Consul"
Scenario: Given a service with an 'unsupported' external source, there is no logo
Given 1 datacenter model with the value "dc1"
And 1 node models

View File

@ -0,0 +1,9 @@
@setupApplicationTest
@notNamespaceable
Feature: settings / show: Show Settings Page
Scenario:
Given 1 datacenter model with the value "datacenter"
When I visit the settings page
Then the url should be /setting
And the title should be "Settings - Consul"

View File

@ -0,0 +1,10 @@
import steps from '../../../steps';
// step definitions that are shared between features should be moved to the
// tests/acceptance/steps/steps.js file
export default function(assert) {
return steps(assert).then('I should find a file', function() {
assert.ok(true, this.step);
});
}

View File

@ -0,0 +1,10 @@
import steps from '../../../steps';
// step definitions that are shared between features should be moved to the
// tests/acceptance/steps/steps.js file
export default function(assert) {
return steps(assert).then('I should find a file', function() {
assert.ok(true, this.step);
});
}

View File

@ -0,0 +1,10 @@
import steps from '../../../steps';
// step definitions that are shared between features should be moved to the
// tests/acceptance/steps/steps.js file
export default function(assert) {
return steps(assert).then('I should find a file', function() {
assert.ok(true, this.step);
});
}

View File

@ -0,0 +1,10 @@
import steps from '../../steps';
// step definitions that are shared between features should be moved to the
// tests/acceptance/steps/steps.js file
export default function(assert) {
return steps(assert).then('I should find a file', function() {
assert.ok(true, this.step);
});
}

View File

@ -0,0 +1,10 @@
import steps from '../../steps';
// step definitions that are shared between features should be moved to the
// tests/acceptance/steps/steps.js file
export default function(assert) {
return steps(assert).then('I should find a file', function() {
assert.ok(true, this.step);
});
}

View File

@ -0,0 +1,10 @@
import steps from '../steps';
// step definitions that are shared between features should be moved to the
// tests/acceptance/steps/steps.js file
export default function(assert) {
return steps(assert).then('I should find a file', function() {
assert.ok(true, this.step);
});
}

View File

@ -3,7 +3,7 @@
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>ConsulUi Tests</title>
<title>Consul</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
{{content-for "head"}}

View File

@ -1,5 +1,5 @@
export default function(visitable, submitable) {
return submitable({
visit: visitable('/settings'),
visit: visitable('/setting'),
});
}

View File

@ -69,5 +69,8 @@ export default function(scenario, assert, pauseUntil, find, currentURL, clipboar
}
const current = currentURL() || '';
assert.equal(current, url, `Expected the url to be ${url} was ${current}`);
})
.then(['the title should be "$title"'], function(title) {
assert.equal(document.title, title, `Expected the document.title to equal "${title}"`);
});
}

View File

@ -4428,7 +4428,7 @@ ember-cli-babel-plugin-helpers@^1.0.0, ember-cli-babel-plugin-helpers@^1.1.0:
resolved "https://registry.yarnpkg.com/ember-cli-babel-plugin-helpers/-/ember-cli-babel-plugin-helpers-1.1.0.tgz#de3baedd093163b6c2461f95964888c1676325ac"
integrity sha512-Zr4my8Xn+CzO0gIuFNXji0eTRml5AxZUTDQz/wsNJ5AJAtyFWCY4QtKdoELNNbiCVGt1lq5yLiwTm4scGKu6xA==
ember-cli-babel@^6.0.0, ember-cli-babel@^6.0.0-beta.4, ember-cli-babel@^6.0.0-beta.7, ember-cli-babel@^6.10.0, ember-cli-babel@^6.12.0, ember-cli-babel@^6.16.0, ember-cli-babel@^6.3.0, ember-cli-babel@^6.6.0, ember-cli-babel@^6.8.1, ember-cli-babel@^6.8.2, ember-cli-babel@^6.9.0, ember-cli-babel@^6.9.2:
ember-cli-babel@^6.0.0, ember-cli-babel@^6.0.0-beta.4, ember-cli-babel@^6.0.0-beta.7, ember-cli-babel@^6.10.0, ember-cli-babel@^6.11.0, ember-cli-babel@^6.12.0, ember-cli-babel@^6.16.0, ember-cli-babel@^6.3.0, ember-cli-babel@^6.6.0, ember-cli-babel@^6.8.1, ember-cli-babel@^6.8.2, ember-cli-babel@^6.9.0, ember-cli-babel@^6.9.2:
version "6.18.0"
resolved "https://registry.yarnpkg.com/ember-cli-babel/-/ember-cli-babel-6.18.0.tgz#3f6435fd275172edeff2b634ee7b29ce74318957"
integrity sha512-7ceC8joNYxY2wES16iIBlbPSxwKDBhYwC8drU3ZEvuPDMwVv1KzxCNu1fvxyFEBWhwaRNTUxSCsEVoTd9nosGA==
@ -4539,6 +4539,14 @@ ember-cli-get-component-path-option@^1.0.0:
resolved "https://registry.yarnpkg.com/ember-cli-get-component-path-option/-/ember-cli-get-component-path-option-1.0.0.tgz#0d7b595559e2f9050abed804f1d8eff1b08bc771"
integrity sha1-DXtZVVni+QUKvtgE8djv8bCLx3E=
ember-cli-head@^0.4.0:
version "0.4.1"
resolved "https://registry.yarnpkg.com/ember-cli-head/-/ember-cli-head-0.4.1.tgz#28b7ee86439746640834b232a3b34ab1329f3cf3"
integrity sha512-MIgshw5nGil7Q/TU4SDRCsgsiA3wPC9WqOig/g1LlHTNXjR4vH7s/ddG7GTfK5Kt4ZQHJEUDXpd/lIbdBkIQ/Q==
dependencies:
ember-cli-babel "^6.11.0"
ember-cli-htmlbars "^2.0.3"
ember-cli-htmlbars-inline-precompile@^2.1.0:
version "2.1.0"
resolved "https://registry.yarnpkg.com/ember-cli-htmlbars-inline-precompile/-/ember-cli-htmlbars-inline-precompile-2.1.0.tgz#61b91ff1879d44ae504cadb46fb1f2604995ae08"
@ -4561,7 +4569,7 @@ ember-cli-htmlbars-inline-precompile@^3.0.0:
heimdalljs-logger "^0.1.9"
silent-error "^1.1.0"
ember-cli-htmlbars@^2.0.1:
ember-cli-htmlbars@^2.0.1, ember-cli-htmlbars@^2.0.3:
version "2.0.5"
resolved "https://registry.yarnpkg.com/ember-cli-htmlbars/-/ember-cli-htmlbars-2.0.5.tgz#b5a105429a6bce4f7c9c97b667e3b8926e31397f"
integrity sha512-3f3PAxdnQ/fhQa8XP/3z4RLRgLHxV8j4Ln75aHbRdemOCjBa048KxL9l+acRLhCulbGQCMnLiIUIC89PAzLrcA==
@ -4904,6 +4912,13 @@ ember-computed-style@^0.3.0:
ember-compatibility-helpers "^1.2.0"
ember-maybe-import-regenerator "^0.1.5"
ember-copy@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/ember-copy/-/ember-copy-1.0.0.tgz#426554ba6cf65920f31d24d0a3ca2cb1be16e4aa"
integrity sha512-aiZNAvOmdemHdvZNn0b5b/0d9g3JFpcOsrDgfhYEbfd7SzE0b69YiaVK2y3wjqfjuuiA54vOllGN4pjSzECNSw==
dependencies:
ember-cli-babel "^6.6.0"
ember-data@~3.12.0:
version "3.12.0"
resolved "https://registry.yarnpkg.com/ember-data/-/ember-data-3.12.0.tgz#ce20c41163ce50124d12a4370641fd9b4a21c3e2"
@ -5037,6 +5052,16 @@ ember-native-dom-helpers@^0.5.3:
broccoli-funnel "^1.1.0"
ember-cli-babel "^6.6.0"
ember-page-title@^5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/ember-page-title/-/ember-page-title-5.1.0.tgz#baf9fc00f95faf638f8493740a1f80daaa5007e9"
integrity sha512-Ou2kwvwlQdDxre20WUMDym54e+5r9g0lTINFiBZUavoBCOUYdBP711LbmmUIIlYblZTOb/TWadNEQZpd2DkIAg==
dependencies:
ember-cli-babel "^7.7.3"
ember-cli-head "^0.4.0"
ember-cli-htmlbars "^3.0.1"
ember-copy "^1.0.0"
ember-power-select-with-create@^0.6.0:
version "0.6.2"
resolved "https://registry.yarnpkg.com/ember-power-select-with-create/-/ember-power-select-with-create-0.6.2.tgz#05faf361c435f5c2c61c24e687aebddefd569897"