Skip to content

Commit 920f91f

Browse files
kaxcodejohncowen
andauthored
ui: Redesign - Instance Detail Proxy Info tab (#7745)
* Fix clickFirstAnchor bug * Create Proxy Info Tab for Instance Detail Page * Create tests for ProxyInfo and update other scenarios with Proxy data * ui: Refactors our app-view/%app-view component (#7752) Co-authored-by: John Cowen <[email protected]>
1 parent 9f97b42 commit 920f91f

File tree

41 files changed

+624
-326
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+624
-326
lines changed

ui-v2/app/components/app-view/index.hbs

+13-7
Original file line numberDiff line numberDiff line change
@@ -45,19 +45,25 @@
4545
</FlashMessage>
4646
{{/each}}
4747
<div>
48-
<div class="actions">
49-
{{#if authorized}}
50-
<YieldSlot @name="actions">{{yield}}</YieldSlot>
51-
{{/if}}
52-
</div>
53-
5448
<div>
5549
{{#if authorized}}
5650
<nav aria-label="Breadcrumb">
5751
<YieldSlot @name="breadcrumbs">{{yield}}</YieldSlot>
5852
</nav>
5953
{{/if}}
60-
<YieldSlot @name="header">{{yield}}</YieldSlot>
54+
<div class="title">
55+
<YieldSlot @name="header">
56+
{{yield}}
57+
</YieldSlot>
58+
<div class="actions">
59+
{{#if authorized}}
60+
<YieldSlot @name="actions">{{yield}}</YieldSlot>
61+
{{/if}}
62+
</div>
63+
</div>
64+
<YieldSlot @name="nav">
65+
{{yield}}
66+
</YieldSlot>
6167
</div>
6268
</div>
6369
{{#if authorized}}
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
import Component from '@ember/component';
22

3-
export default Component.extend({});
3+
export default Component.extend({
4+
tagName: '',
5+
});

ui-v2/app/components/healthcheck-list/index.hbs

+6-1
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@
77
</BlockSlot>
88
<BlockSlot @name="content">
99
<dl>
10+
{{#if (eq item.ServiceName "")}}
11+
<dt>NodeName</dt>
12+
<dd>{{item.Node}}</dd>
13+
{{else}}
1014
<dt>ServiceName</dt>
11-
<dd>{{or item.ServiceName '-'}}</dd>
15+
<dd>{{item.ServiceName}}</dd>
16+
{{/if}}
1217
</dl>
1318
<dl>
1419
<dt>CheckID</dt>

ui-v2/app/components/list-collection/index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default Component.extend(WithResizing, {
4747
},
4848
actions: {
4949
click: function(e) {
50-
return this.dom.clickFirstAnchor(e, 'li');
50+
return this.dom.clickFirstAnchor(e, '.list-collection > ul > li');
5151
},
5252
},
5353
});

ui-v2/app/router.js

+3
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ export const routes = {
3131
healthchecks: {
3232
_options: { path: '/health-checks' },
3333
},
34+
proxy: {
35+
_options: { path: '/proxy' },
36+
},
3437
upstreams: {
3538
_options: { path: '/upstreams' },
3639
},

ui-v2/app/routes/dc/services/instance.js

+14-1
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,25 @@ export default Route.extend({
1616
// its highly unlikely that a service will suddenly change to being a
1717
// connect-proxy or vice versa so leave as is for now
1818
return hash({
19-
proxy:
19+
proxyMeta:
2020
// proxies and mesh-gateways can't have proxies themselves so don't even look
2121
['connect-proxy', 'mesh-gateway'].includes(get(model.item, 'Kind'))
2222
? null
2323
: this.proxyRepo.findInstanceBySlug(params.id, params.node, params.name, dc, nspace),
2424
...model,
25+
}).then(model => {
26+
if (typeof get(model, 'proxyMeta.ServiceID') === 'undefined') {
27+
return model;
28+
}
29+
const proxyName = get(model, 'proxyMeta.ServiceName');
30+
const proxyID = get(model, 'proxyMeta.ServiceID');
31+
const proxyNode = get(model, 'proxyMeta.Node');
32+
return hash({
33+
// Proxies have identical dc/nspace as their parent instance
34+
// No need to use Proxy's dc/nspace response
35+
proxy: this.repo.findInstanceBySlug(proxyID, proxyNode, proxyName, dc, nspace),
36+
...model,
37+
});
2538
});
2639
});
2740
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import Route from '@ember/routing/route';
2+
3+
export default Route.extend({
4+
model: function() {
5+
const parent = this.routeName
6+
.split('.')
7+
.slice(0, -1)
8+
.join('.');
9+
return this.modelFor(parent);
10+
},
11+
setupController: function(controller, model) {
12+
controller.setProperties(model);
13+
},
14+
});

ui-v2/app/styles/app.scss

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
@import 'routes/dc/settings/index';
1616
@import 'routes/dc/nodes/index';
17+
@import 'routes/dc/services/index';
1718
@import 'routes/dc/intention/index';
1819
@import 'routes/dc/kv/index';
1920
@import 'routes/dc/acls/index';

ui-v2/app/styles/base/components/table/layout.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
%table td.no-actions ~ .actions {
3030
display: none;
3131
}
32-
%table td:not(.actions),
3332
%table td:not(.actions) > *:only-child {
3433
overflow-x: hidden;
3534
}
@@ -41,6 +40,7 @@
4140
}
4241
%table td {
4342
height: 50px;
43+
vertical-align: middle;
4444
}
4545
%table caption {
4646
margin-bottom: 0.8em;

ui-v2/app/styles/base/components/tabs/layout.scss

+5-2
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,12 @@
2222
display: inline-block;
2323
padding: 16px 13px;
2424
}
25-
%tab-section section h3 {
26-
margin: 24px 0;
25+
%tab-section section {
26+
padding-bottom: 24px;
2727
}
2828
%tab-section section:not(:last-child) {
2929
border-bottom: 1px solid $gray-200;
3030
}
31+
%tab-section section > h3 {
32+
margin: 24px 0;
33+
}

ui-v2/app/styles/components/app-view.scss

+11-56
Original file line numberDiff line numberDiff line change
@@ -4,66 +4,19 @@
44

55
@import '../base/components/popover-menu/index';
66

7-
%app-view-header .actions > [type='checkbox'] {
8-
@extend %more-popover-menu;
9-
}
10-
%more-popover-menu-panel [type='checkbox']:checked ~ * {
11-
/* this needs to autocalculate */
12-
min-height: 143px;
13-
max-height: 143px;
14-
}
15-
%more-popover-menu-panel [id$='logout']:checked ~ * {
16-
/* this needs to autocalculate */
17-
min-height: 163px;
18-
max-height: 163px;
19-
}
20-
%more-popover-menu-panel [id$='delete']:checked ~ ul label[for$='delete'] + [role='menu'],
21-
%more-popover-menu-panel [id$='logout']:checked ~ ul label[for$='logout'] + [role='menu'],
22-
%more-popover-menu-panel [id$='use']:checked ~ ul label[for$='use'] + [role='menu'] {
23-
display: block;
24-
}
25-
%app-view-header .actions label + div {
26-
// We need this extra to allow tooltips to show
7+
%app-view-actions label + div {
8+
/* We need this extra to allow tooltips to show */
279
overflow: visible !important;
2810
}
2911

3012
main {
3113
@extend %app-view;
3214
}
33-
%app-view > div > header {
34-
@extend %app-view-header;
35-
}
36-
%app-view > div > div {
37-
@extend %app-view-content;
38-
}
39-
%app-view header form {
15+
%app-view-header form {
4016
@extend %filter-bar;
4117
}
42-
@media #{$--lt-spacious-page-header} {
43-
%app-view-header .actions {
44-
margin-top: 9px;
45-
}
46-
}
47-
// TODO: This should be its own component
48-
%app-view h1 {
49-
padding-bottom: 0.2em;
50-
}
51-
%app-view h1 span[data-tooltip] {
52-
@extend %with-external-source-icon;
53-
margin-top: 13px;
54-
}
55-
%app-view h1 span.kind-proxy {
56-
@extend %frame-gray-900;
57-
@extend %pill;
58-
}
59-
%app-view h1 span.kind-proxy::before {
60-
width: 0.3em !important;
61-
}
62-
%app-view h1 em {
63-
color: $gray-600;
64-
}
65-
%app-view-header .actions a,
66-
%app-view-header .actions button {
18+
%app-view-actions a,
19+
%app-view-actions button {
6720
@extend %button-compact;
6821
}
6922
%app-view-content div > dl {
@@ -97,12 +50,14 @@ main {
9750
display: none;
9851
}
9952
}
53+
@media #{$--lt-spacious-page-header} {
54+
%app-view-actions {
55+
margin-top: 9px;
56+
}
57+
}
10058
// reduced search magnifying icon layout
10159
@media #{$--lt-horizontal-selects} {
102-
%app-view header h1 {
103-
display: inline-block;
104-
}
105-
%app-view header h1 {
60+
%app-view-header h1 {
10661
display: inline-block;
10762
}
10863
// on the instance detail page we don't have the magnifier
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,14 @@
11
@import './skin';
22
@import './layout';
3+
%app-view > div > header {
4+
@extend %app-view-header;
5+
}
6+
%app-view-header .title {
7+
@extend %app-view-title;
8+
}
9+
%app-view-header .actions {
10+
@extend %app-view-actions;
11+
}
12+
%app-view > div > div {
13+
@extend %app-view-content;
14+
}

ui-v2/app/styles/components/app-view/layout.scss

+32-37
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,61 @@
11
/* layout */
2-
%app-view-header > div:last-of-type > div:first-child {
3-
flex-grow: 1;
4-
}
52
%app-view {
63
position: relative;
74
}
8-
%app-view-header .actions {
9-
float: right;
5+
%app-view-title {
6+
display: flex;
7+
align-items: center;
8+
}
9+
%app-view-actions {
10+
margin-left: auto;
1011
display: flex;
1112
align-items: flex-start;
12-
margin-top: 9px;
1313
}
1414
%app-view-header dl {
1515
float: left;
16-
margin-top: 25px;
17-
margin-right: 50px;
18-
margin-bottom: 20px;
19-
}
20-
%app-view-header dt {
21-
font-weight: bold;
22-
}
23-
%app-view-header dd > a {
24-
color: $black;
25-
}
26-
%app-view-header .title-bar {
27-
display: flex;
28-
align-items: center;
29-
}
30-
%app-view-header .title-bar > h1 {
31-
border: 0;
32-
}
33-
%app-view-header .title-bar > span {
34-
margin-left: 8px;
3516
}
3617
/* units */
3718
%app-view {
3819
margin-top: 50px;
3920
}
21+
/* give anything after the header a bit of room */
4022
%app-view-header + div > *:first-child {
4123
margin-top: 1.8em;
4224
}
43-
%app-view h2 {
25+
%app-view-title {
4426
padding-bottom: 0.2em;
45-
margin-bottom: 0.5em;
4627
}
47-
%app-view-header .actions > *:not(:last-child) {
28+
%app-view-title > :not(:last-child) {
29+
margin-right: 8px;
30+
}
31+
%app-view-actions {
32+
margin-top: 9px;
33+
}
34+
%app-view-actions > *:not(:last-child) {
4835
margin-right: 12px;
4936
}
50-
51-
// content
52-
%app-view-content div > dl > dt {
53-
position: absolute;
37+
%app-view-header dl {
38+
margin-top: 19px;
39+
margin-bottom: 23px;
40+
margin-right: 50px;
5441
}
55-
%app-view-content div > dl {
56-
position: relative;
42+
43+
/* content */
44+
%app-view-content h2 {
45+
padding-bottom: 0.2em;
46+
margin-bottom: 0.5em;
5747
}
5848
%app-view-content-empty {
5949
margin-top: 0;
6050
padding: 50px;
6151
text-align: center;
6252
}
63-
%app-view-content form:not(:last-child) {
64-
margin-bottom: 2.2em;
53+
/* this should probably be its own component */
54+
%app-view-content div > dl {
55+
position: relative;
56+
}
57+
%app-view-content div > dl > dt {
58+
position: absolute;
6559
}
6660
%app-view-content div > dl > dt {
6761
width: 140px;
@@ -73,7 +67,8 @@
7367
min-height: 1em;
7468
margin-bottom: 0.4em;
7569
}
76-
// TODO: Think about an %app-form or similar
70+
/* */
71+
/* TODO: Think about an %app-form or similar */
7772
%app-view-content fieldset:not(.freetext-filter) {
7873
padding-bottom: 0.3em;
7974
margin-bottom: 2em;

0 commit comments

Comments
 (0)