mirror of https://github.com/hashicorp/consul
Kenia
3 years ago
committed by
GitHub
16 changed files with 158 additions and 1 deletions
@ -0,0 +1,3 @@
|
||||
```release-note:feature |
||||
ui: Create Routing Configurations route and page |
||||
``` |
@ -0,0 +1,20 @@
|
||||
# Consul::Source |
||||
|
||||
A presentational component for showing a source name. This is a similar component to `Consul::Kind` and `Consul::ExternalSource`, except `Consul::Source` does not relate to a Service. |
||||
|
||||
```hbs preview-template |
||||
<Consul::Source @source='Source Name' /> |
||||
``` |
||||
|
||||
### Arguments |
||||
|
||||
| Argument/Attribute | Type | Default | Description | |
||||
| --- | --- | --- | --- | |
||||
| `source` | `string` | | A string to be passed down and displayed as the source name. | |
||||
|
||||
### See |
||||
|
||||
- [Template Source Code](./index.hbs) |
||||
- [Styling Source Code](./index.scss) |
||||
|
||||
--- |
@ -0,0 +1,25 @@
|
||||
<dl class="tooltip-panel"> |
||||
<dt> |
||||
<span data-test-consul-source class="consul-source"> |
||||
{{@source}} |
||||
</span> |
||||
</dt> |
||||
<dd> |
||||
<MenuPanel @position="left"> |
||||
<BlockSlot @name="header"> |
||||
{{t "components.consul.source.header"}} |
||||
</BlockSlot> |
||||
<BlockSlot @name="menu"> |
||||
<li role="separator"> |
||||
{{t "components.consul.source.menu-title"}} |
||||
</li> |
||||
<li role="none" class="docs-link"> |
||||
<a tabindex="-1" role="menuitem" href="{{env 'CONSUL_DOCS_URL'}}/connect/l7-traffic" rel="noopener noreferrer" target="_blank"> |
||||
{{t "components.consul.source.links.documentation"}} |
||||
</a> |
||||
</li> |
||||
</BlockSlot> |
||||
</MenuPanel> |
||||
</dd> |
||||
</dl> |
||||
|
@ -0,0 +1,3 @@
|
||||
.consul-source { |
||||
@extend %pill-200, %frame-gray-600, %p1; |
||||
} |
@ -0,0 +1,19 @@
|
||||
import Route from 'consul-ui/routing/route'; |
||||
import { inject as service } from '@ember/service'; |
||||
|
||||
export default class RoutingConfigRoute extends Route { |
||||
@service('data-source/service') data; |
||||
|
||||
async model(params) { |
||||
const dc = this.modelFor('dc').dc.Name; |
||||
const nspace = this.optionalParams().nspace; |
||||
const name = params.name; |
||||
|
||||
return { |
||||
dc: dc, |
||||
nspace: nspace, |
||||
slug: name, |
||||
chain: await this.data.source(uri => uri`/${nspace}/${dc}/discovery-chain/${params.name}`), |
||||
}; |
||||
} |
||||
} |
@ -0,0 +1,22 @@
|
||||
{{page-title @model.slug}} |
||||
|
||||
<AppView> |
||||
<BlockSlot @name="breadcrumbs"> |
||||
<ol> |
||||
<li><a data-test-back href={{href-to 'dc.services'}}>All Services</a></li> |
||||
</ol> |
||||
</BlockSlot> |
||||
<BlockSlot @name="header"> |
||||
<h1> |
||||
{{@model.slug}} |
||||
</h1> |
||||
<Consul::Source @source={{t "routes.dc.routing-config.source"}} @withInfo={{true}} /> |
||||
</BlockSlot> |
||||
<BlockSlot @name="content"> |
||||
<div class="container"> |
||||
<Consul::DiscoveryChain |
||||
@chain={{@model.chain.Chain}} |
||||
/> |
||||
</div> |
||||
</BlockSlot> |
||||
</AppView> |
@ -0,0 +1,21 @@
|
||||
@setupApplicationTest |
||||
Feature: dc / routing-config |
||||
Scenario: Viewing a routing config |
||||
Given 1 datacenter model with the value "dc1" |
||||
When I visit the routingConfig page for yaml |
||||
--- |
||||
dc: dc1 |
||||
name: virtual-1 |
||||
--- |
||||
Then the url should be /dc1/routing-config/virtual-1 |
||||
Then I don't see status on the error like "404" |
||||
And the title should be "virtual-1 - Consul" |
||||
Scenario: Viewing a source pill |
||||
Given 1 datacenter model with the value "dc1" |
||||
When I visit the routingConfig page for yaml |
||||
--- |
||||
dc: dc1 |
||||
name: virtual-1 |
||||
--- |
||||
And I see source |
||||
|
@ -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); |
||||
}); |
||||
} |
@ -0,0 +1,8 @@
|
||||
import { text } from 'ember-cli-page-object'; |
||||
|
||||
export default function(visitable, isPresent) { |
||||
return { |
||||
visit: visitable('/:dc/routing-config/:name'), |
||||
source: text('[data-test-consul-source]'), |
||||
}; |
||||
} |
@ -0,0 +1,11 @@
|
||||
import { module, test } from 'qunit'; |
||||
import { setupTest } from 'ember-qunit'; |
||||
|
||||
module('Unit | Route | dc/routing-config', function(hooks) { |
||||
setupTest(hooks); |
||||
|
||||
test('it exists', function(assert) { |
||||
let route = this.owner.lookup('route:dc/routing-config'); |
||||
assert.ok(route); |
||||
}); |
||||
}); |
Loading…
Reference in new issue