Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ui: UI Release Merge (ui-staging merge) #7177

Merged
merged 8 commits into from
Jan 30, 2020
Merged
7 changes: 5 additions & 2 deletions ui-v2/GNUmakefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,18 @@ start-consul: deps
start-api: deps
yarn run start:api

test: deps
test: deps test-node
yarn run test

test-view: deps
test-view: deps test-node
yarn run test:view

test-parallel: deps
yarn run test:parallel

test-node:
yarn run test:node

lint: deps
yarn run lint:hbs && yarn run lint:js

Expand Down
30 changes: 28 additions & 2 deletions ui-v2/app/components/discovery-chain.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,33 @@ export default Component.extend({
return getSplitters(get(this, 'chain.Nodes'));
}),
routes: computed('chain.Nodes', function() {
return getRoutes(get(this, 'chain.Nodes'), this.dom.guid);
const routes = getRoutes(get(this, 'chain.Nodes'), this.dom.guid);
// if we have no routes with a PathPrefix of '/' or one with no definition at all
// then add our own 'default catch all'
if (
!routes.find(item => get(item, 'Definition.Match.HTTP.PathPrefix') === '/') &&
!routes.find(item => typeof item.Definition === 'undefined')
) {
let nextNode = `resolver:${this.chain.ServiceName}.${this.chain.Namespace}.${this.chain.Datacenter}`;
const splitterID = `splitter:${this.chain.ServiceName}`;
if (typeof this.chain.Nodes[splitterID] !== 'undefined') {
nextNode = splitterID;
}
routes.push({
Default: true,
ID: `route:${this.chain.ServiceName}`,
Name: this.chain.ServiceName,
Definition: {
Match: {
HTTP: {
PathPrefix: '/',
},
},
},
NextNode: nextNode,
});
}
return routes;
}),
resolvers: computed('chain.{Nodes,Targets}', function() {
return getResolvers(
Expand All @@ -73,7 +99,7 @@ export default Component.extend({
switch (item.Type) {
case 'splitter':
item.Splits.forEach(splitter => {
graph.addLink(`splitter:${item.Name}`, splitter.NextNode);
graph.addLink(item.ID, splitter.NextNode);
});
break;
case 'router':
Expand Down
1 change: 1 addition & 0 deletions ui-v2/app/components/policy-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default FormComponent.extend({
datacenterRepo: service('repository/dc/component'),
type: 'policy',
name: 'policy',
allowServiceIdentity: true,
classNames: ['policy-form'],

isScoped: false,
Expand Down
1 change: 1 addition & 0 deletions ui-v2/app/components/policy-selector.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default ChildSelectorComponent.extend({
datacenterRepo: service('repository/dc/component'),
name: 'policy',
type: 'policy',
allowServiceIdentity: true,
classNames: ['policy-selector'],
init: function() {
this._super(...arguments);
Expand Down
8 changes: 7 additions & 1 deletion ui-v2/app/instance-initializers/event-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export function initialize(container) {
if (env('CONSUL_UI_DISABLE_REALTIME')) {
return;
}
['node', 'coordinate', 'session', 'service', 'proxy', 'discovery-chain']
['node', 'coordinate', 'session', 'service', 'proxy', 'discovery-chain', 'intention']
.concat(env('CONSUL_NSPACES_ENABLED') ? ['nspace/enabled'] : [])
.map(function(item) {
// create repositories that return a promise resolving to an EventSource
Expand Down Expand Up @@ -70,6 +70,12 @@ export function initialize(container) {
proxyRepo: 'repository/proxy/event-source',
},
},
{
route: 'dc/intentions/index',
services: {
repo: 'repository/intention/event-source',
},
},
{
service: 'form',
services: {
Expand Down
3 changes: 3 additions & 0 deletions ui-v2/app/styles/base/components/menu-panel/layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
padding: 10px;
padding-left: 36px;
}
%menu-panel .is-active {
position: relative;
}
%menu-panel .is-active > *::after {
position: absolute;
top: 50%;
Expand Down
3 changes: 3 additions & 0 deletions ui-v2/app/styles/routes/dc/nodes/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ html.template-node.template-list .unhealthy h2 {
html.template-node.template-show #meta-data table tr {
cursor: default;
}
html.template-node.template-show #services table tbody td em {
display: inline-block;
}
.healthy > div > ul > li {
padding-top: 16px;
}
Expand Down
2 changes: 2 additions & 0 deletions ui-v2/app/templates/application.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{{head-layout}}
{{title 'Consul' separator=' - '}}
{{#if (not loading)}}
{{outlet}}
{{else}}
Expand Down
8 changes: 6 additions & 2 deletions ui-v2/app/templates/components/policy-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@
{{#yield-slot name='template'}}
{{else}}
<header>
Policy or service identity?
Policy{{if allowServiceIdentity ' or service identity?' ''}}
</header>
{{#if allowServiceIdentity}}
<p>
A Service Identity is default policy with a configurable service name. This saves you some time and effort you're using Consul for Connect features.
</p>
Expand All @@ -13,10 +14,13 @@
{{#each templates as |template|}}
<label>
<span>{{template.name}}</span>
<input data-test-radiobutton={{concat 'template_' template.template}} type="radio" name="{{name}}[template]" value={{template.template}} checked={{eq item.template template.template}} onchange={{action (changeset-set item 'template') value='target.value'}}/>
<input data-test-radiobutton={{concat 'template_' template.template}} type="radio" name={{concat name '[template]'}} value={{template.template}} checked={{eq item.template template.template}} onchange={{action (changeset-set item 'template') value='target.value'}}/>
</label>
{{/each}}
</div>
{{else}}
<input type="hidden" name={{concat name '[template]'}} value="" />
{{/if}}
{{/yield-slot}}
<label class="type-text{{if (and item.error.Name (not item.isPristine)) ' has-error'}}">
<span>Name</span>
Expand Down
2 changes: 1 addition & 1 deletion ui-v2/app/templates/components/policy-selector.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<h2>New Policy</h2>
{{/block-slot}}
{{#block-slot name='body'}}
{{policy-form form=form dc=dc}}
{{policy-form form=form dc=dc allowServiceIdentity=allowServiceIdentity}}
{{/block-slot}}
{{#block-slot name='actions' as |close|}}
<button type="submit" {{action 'save' item items (queue (action close) (action 'reset'))}} disabled={{if (or item.isSaving item.isPristine item.isInvalid) 'disabled'}}>
Expand Down
31 changes: 23 additions & 8 deletions ui-v2/app/templates/components/resolver-card.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,29 @@
{{#each item.Children as |child|}}
<li onclick={{onclick}} id={{concat 'resolver:' child.ID}}>
<a name="">
{{#if child.Failover}}
{{#if child.Redirect}}
<dl class="redirect">
<dt data-tooltip="Redirect">Redirect</dt>
<dd>
{{child.Name}}
</dd>
</dl>
{{#if child.Failover}}
<dl class="failover">
<dt data-tooltip={{concat child.Failover.Type ' failover'}}>{{concat child.Failover.Type ' failover'}}</dt>
<dd>
<ol>
{{#each child.Failover.Targets as |target|}}
<li>
<span>{{target}}</span>
</li>
{{/each}}
</ol>
</dd>
</dl>
{{/if}}
{{else if child.Failover}}
{{child.Name}}
<dl class="failover">
<dt data-tooltip={{concat child.Failover.Type ' failover'}}>{{concat child.Failover.Type ' failover'}}</dt>
<dd>
Expand All @@ -36,13 +58,6 @@
</ol>
</dd>
</dl>
{{else if child.Redirect}}
<dl class="redirect">
<dt data-tooltip="Redirect">Redirect</dt>
<dd>
{{child.Name}}
</dd>
</dl>
{{else}}
{{child.Name}}
{{/if}}
Expand Down
9 changes: 9 additions & 0 deletions ui-v2/app/templates/dc/acls/policies/edit.hbs
Original file line number Diff line number Diff line change
@@ -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'}}
Expand Down
5 changes: 5 additions & 0 deletions ui-v2/app/templates/dc/acls/policies/index.hbs
Original file line number Diff line number Diff line change
@@ -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'}}
Expand Down
9 changes: 9 additions & 0 deletions ui-v2/app/templates/dc/acls/roles/edit.hbs
Original file line number Diff line number Diff line change
@@ -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'}}
Expand Down
5 changes: 5 additions & 0 deletions ui-v2/app/templates/dc/acls/roles/index.hbs
Original file line number Diff line number Diff line change
@@ -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'}}
Expand Down
9 changes: 9 additions & 0 deletions ui-v2/app/templates/dc/acls/tokens/edit.hbs
Original file line number Diff line number Diff line change
@@ -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'}}
Expand Down
5 changes: 5 additions & 0 deletions ui-v2/app/templates/dc/acls/tokens/index.hbs
Original file line number Diff line number Diff line change
@@ -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'}}
Expand Down
6 changes: 6 additions & 0 deletions ui-v2/app/templates/dc/intentions/edit.hbs
Original file line number Diff line number Diff line change
@@ -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'}}
Expand Down
1 change: 1 addition & 0 deletions ui-v2/app/templates/dc/intentions/index.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{title 'Intentions'}}
{{#app-view class="intention list"}}
{{#block-slot name='notification' as |status type|}}
{{partial 'dc/intentions/notifications'}}
Expand Down
5 changes: 5 additions & 0 deletions ui-v2/app/templates/dc/kv/edit.hbs
Original file line number Diff line number Diff line change
@@ -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'}}
Expand Down
1 change: 1 addition & 0 deletions ui-v2/app/templates/dc/kv/index.hbs
Original file line number Diff line number Diff line change
@@ -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'}}
Expand Down
1 change: 1 addition & 0 deletions ui-v2/app/templates/dc/nodes/index.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{title 'Nodes'}}
{{#app-view class="node list"}}
{{#block-slot name='header'}}
<h1>
Expand Down
1 change: 1 addition & 0 deletions ui-v2/app/templates/dc/nodes/show.hbs
Original file line number Diff line number Diff line change
@@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion ui-v2/app/templates/dc/nspaces/-form.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<p>
By adding policies to this namespaces, you will apply them to all tokens created within this namespace.
</p>
{{policy-selector dc=dc nspace='default' items=item.ACLs.PolicyDefaults}}
{{policy-selector dc=dc nspace='default' allowServiceIdentity=false items=item.ACLs.PolicyDefaults}}
</fieldset>
{{/if}}
<div>
Expand Down
5 changes: 5 additions & 0 deletions ui-v2/app/templates/dc/nspaces/edit.hbs
Original file line number Diff line number Diff line change
@@ -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'}}
Expand Down
1 change: 1 addition & 0 deletions ui-v2/app/templates/dc/nspaces/index.hbs
Original file line number Diff line number Diff line change
@@ -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'}}
Expand Down
1 change: 1 addition & 0 deletions ui-v2/app/templates/dc/services/index.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{title 'Services'}}
{{#app-view class="service list"}}
{{#block-slot name='notification' as |status type|}}
{{partial 'dc/services/notifications'}}
Expand Down
1 change: 1 addition & 0 deletions ui-v2/app/templates/dc/services/instance.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{title item.ID}}
{{#app-view class="instance show"}}
{{#block-slot name='notification' as |status type|}}
{{partial 'dc/services/notifications'}}
Expand Down
1 change: 1 addition & 0 deletions ui-v2/app/templates/dc/services/show.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{title item.Service.Service}}
{{#app-view class="service show"}}
{{#block-slot name='notification' as |status type|}}
{{partial 'dc/services/notifications'}}
Expand Down
1 change: 1 addition & 0 deletions ui-v2/app/templates/head.hbs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<title>{{model.title}}</title>
3 changes: 2 additions & 1 deletion ui-v2/app/templates/settings.hbs
Original file line number Diff line number Diff line change
@@ -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'}}
Expand Down Expand Up @@ -27,7 +28,7 @@
{{#if (not (env 'CONSUL_UI_DISABLE_REALTIME'))}}
<fieldset>
<h2>Blocking Queries</h2>
<p>Keep catalog info up-to-date without refreshing the page. Any changes made to services and nodes would be reflected in real time.</p>
<p>Keep catalog info up-to-date without refreshing the page. Any changes made to services, nodes and intentions would be reflected in real time.</p>
<div class="type-toggle">
<label>
<input type="checkbox" name="client[blocking]" checked={{if item.client.blocking 'checked'}} onchange={{action 'change'}} />
Expand Down
Loading