Skip to content

Commit dd8cda4

Browse files
committed
Merge pull request #138 from vincent99/d3-graph
Bug fixes, restyle container
2 parents 9bd1887 + 6805a92 commit dd8cda4

File tree

13 files changed

+190
-55
lines changed

13 files changed

+190
-55
lines changed

app/components/input-github/component.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default Ember.Component.extend({
2020
this.set('addInput','');
2121
this.send('addObject', info);
2222
}).catch(() => {
23-
this.sendAction('onError','User or or organizatio not found: ' + input);
23+
this.sendAction('onError','User or organization not found: ' + input);
2424
}).finally(() => {
2525
this.set('checking', false);
2626
});

app/container/controller.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ import Ember from 'ember';
22
import Cattle from 'ui/utils/cattle';
33

44
var ContainerController = Cattle.TransitioningResourceController.extend({
5+
mountError: null,
6+
relatedVolumes: null,
7+
ports: null,
8+
59
actions: {
610
restart: function() {
711
return this.doAction('restart');

app/container/edit/route.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ export default OverlayRoute.extend({
99
},
1010

1111
model: function() {
12-
var model = this.modelFor('container');
12+
var data = this.modelFor('container');
13+
var model = data.get('container');
1314
return Ember.RSVP.all([
1415
model.followLink('ports'),
1516
model.followLink('instanceLinks'),

app/container/route.js

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ import Ember from 'ember';
33
export default Ember.Route.extend({
44
model: function(params) {
55
var store = this.get('store');
6+
var ports;
67

78
return store.find('container', params.container_id).then(function(container) {
9+
return container.followLink('ports').then(function(p) {
10+
ports = p;
11+
return container;
12+
});
13+
}).then(function(container) {
814
var opt = {
915
include: ['volume'],
1016
filter: {instanceId: container.get('id')}
@@ -60,18 +66,32 @@ export default Ember.Route.extend({
6066
return volumes;
6167
});
6268
}).then(function(volumesWithInstances) {
63-
container.set('relatedVolumes', volumesWithInstances);
64-
return container;
69+
return Ember.Object.create({
70+
container: container,
71+
relatedVolumes: volumesWithInstances,
72+
ports: ports,
73+
});
6574
}).catch(function(err) {
66-
container.set('mountError',err);
67-
container.set('mounts',[]);
68-
container.set('relatedVolumes',[]);
69-
return container;
75+
return Ember.Object.create({
76+
container: container,
77+
mountError: err,
78+
relatedVolumes: [],
79+
ports: [],
80+
});
7081
});
7182
});
7283
},
7384

85+
setupController: function(controller, data) {
86+
this._super(controller, data.get('container'));
87+
controller.setProperties({
88+
mountError: data.get('mountError'),
89+
relatedVolumes: data.get('relatedVolumes'),
90+
ports: data.get('ports'),
91+
});
92+
},
93+
7494
activate: function() {
75-
this.send('setPageLayout', {label: 'Container', backPrevious: true});
95+
this.send('setPageLayout', {label: 'Container', backPrevious: true, hasAside: 'nav-containers active'});
7696
},
7797
});

app/container/template.hbs

Lines changed: 91 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,98 @@
1-
{{partial "transitioning-progress"}}
1+
<aside>
2+
<label>Container</label>
3+
{{resource-actions-menu model=this choices=availableActions classNames="pull-right"}}
4+
<h3 class="force-wrap">{{displayName}}</h3>
25

3-
<section>
4-
<div class="row">
5-
<div class="col-sm-6">
6-
<h3>{{displayName}}</h3>
7-
<div class="text-muted">
8-
{{displayIp}} {{zero-clipboard text=displayIp}}
9-
</div>
10-
<div class="text-muted">{{imageUuid}} {{zero-clipboard text=imageUuid}}</div>
11-
</div>
12-
<div class="col-sm-6 text-right">
13-
<h3 {{bind-attr class=":instance-status stateColor"}}>
14-
<i {{bind-attr class="stateIcon"}}></i> {{displayState}}
15-
</h3>
16-
<div {{bind-attr class=":force-wrap isError:text-danger:text-muted showTransitioningMessage::hide"}}>
17-
{{transitioningMessage}}
18-
</div>
19-
<div class="instance-actions">
20-
{{resource-actions model=this choices=availableActions}}
21-
</div>
22-
</div>
6+
<hr/>
7+
8+
{{#if description}}
9+
<label style="margin-top: 10px;">Description</label>
10+
<p>{{description}}</p>
11+
<hr/>
12+
{{/if}}
13+
14+
<div class="clearfix">
15+
<label>Info</label>
2316
</div>
17+
18+
<ul class="list-circles">
19+
<li>
20+
<i {{bind-attr class=":fa-fw stateIcon"}}></i>
21+
{{displayState}}
22+
{{#if isTransitioning}}
23+
<div class="progress progress-striped active" style="height: 10px; border: 0;">
24+
<div class="progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" {{bind-attr aria-valuenow=displayProgress style=progressStyle}}>
25+
<span class="sr-only">{{displayProgress}}% Complete</span>
26+
</div>
27+
</div>
28+
{{/if}}
29+
{{#if showTransitioningMessage}}
30+
<div class="force-wrap">
31+
{{transitioningMessage}}
32+
</div>
33+
{{/if}}
34+
</li>
35+
36+
<li>
37+
<i class="fa-fw ss-link"></i>
38+
{{displayIp}}
39+
</li>
40+
</ul>
41+
</aside>
42+
43+
<section>
44+
<div class="text-muted">{{imageUuid}} {{zero-clipboard text=imageUuid}}</div>
2445
</section>
2546

26-
{{#if description}}
27-
<section>
28-
<div class="well">
29-
<label>Description</label>
30-
{{description}}
31-
</div>
32-
</section>
33-
{{/if}}
47+
<section>
48+
{{partial "stats-cpu-memory"}}
49+
</section>
50+
51+
<section>
52+
<div class="well">
53+
<label>Ports</label>
54+
<table class="grid fixed">
55+
<thead>
56+
<tr>
57+
<th width="120">State</th>
58+
<th>IP Address</th>
59+
<th>Public (on Host)</th>
60+
<th>Private (in Container)</th>
61+
<th>Protocol</th>
62+
</tr>
63+
</thead>
64+
<tbody>
65+
{{#each port in ports itemController="port"}}
66+
<tr>
67+
<td>
68+
<span {{bind-attr class=":badge :state port.stateBackground"}}>
69+
{{port.displayState}}
70+
</span>
71+
</td>
72+
<td>
73+
{{port.displayPublicIp}}
74+
</td>
75+
<td>
76+
{{port.publicPort}}
77+
</td>
78+
<td>
79+
{{port.privatePort}}
80+
</td>
81+
<td>
82+
{{upper-case port.protocol}}
83+
</td>
84+
</tr>
85+
{{else}}
86+
<tr>
87+
<td colspan="5">
88+
<div class="text-muted text-center">This container has no ports.</div>
89+
</td>
90+
</tr>
91+
{{/each}}
92+
</tbody>
93+
</table>
94+
</div>
95+
</section>
3496

3597
<section>
3698
<div class="well">
@@ -93,7 +155,3 @@
93155
</table>
94156
</div>
95157
</section>
96-
97-
<section>
98-
{{partial "stats-cpu-memory"}}
99-
</section>

app/host/template.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<aside>
22
<label>Host</label>
33
{{resource-actions-menu model=this choices=availableActions classNames="pull-right"}}
4-
<h3>{{displayName}}</h3>
4+
<h3 class="force-wrap">{{displayName}}</h3>
55

66
<hr/>
77

app/initializers/extend-ember-route.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,16 @@ export function initialize(/* container, application */) {
5555

5656
var args = [];
5757
var info;
58-
for ( var i = 0 ; i < infos.length - 1 ; i++ )
58+
var max = infos.length - 1;
59+
if (infos[infos.length - 1].name === infos[infos.length-2].name+'.index' )
60+
{
61+
max--;
62+
}
63+
64+
for ( var i = 0 ; i < max ; i++ )
5965
{
6066
info = infos[i];
67+
6168
if ( info._names && info._names.length )
6269
{
6370
for ( var j = 0 ; j < info._names.length ; j++ )

app/port/controller.js

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import Cattle from 'ui/utils/cattle';
2+
3+
var PortController = Cattle.TransitioningResourceController.extend({
4+
_publicIp: null,
5+
_publicIpState: 0,
6+
displayPublicIp: function() {
7+
var ip = this.get('_publicIp');
8+
if ( ip )
9+
{
10+
return ip;
11+
}
12+
else if ( this && this.get('_publicIpState') === 2 )
13+
{
14+
return '(Unknown IP)';
15+
}
16+
else if ( this && this.get('_publicIpState') === 0 )
17+
{
18+
this.set('_publicIpState', 1);
19+
this.get('store').find('ipaddress', this.get('publicIpAddressId')).then((ip) => {
20+
this.set('_publicIp', ip.get('address'));
21+
}).catch(() => {
22+
this.set('_publicIpState', 2);
23+
});
24+
25+
return 'Loading...';
26+
}
27+
28+
return null;
29+
}.property('_publicIpState','_publicIp','publicIpAddressId'),
30+
});
31+
32+
PortController.reopenClass({
33+
stateMap: {
34+
'active': {icon: 'ss-record', color: 'text-success'},
35+
'inactive': {icon: 'fa fa-circle',color: 'text-danger'},
36+
'removed': {icon: 'ss-trash', color: 'text-danger'},
37+
'purged': {icon: 'ss-tornado', color: 'text-danger'}
38+
},
39+
});
40+
41+
export default PortController;

app/styles/layout.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ HEADER {
169169
line-height: $header-height - 1;
170170
color: $header-text;
171171
padding-left: 20px;
172+
white-space: nowrap;
173+
text-overflow: ellipsis;
174+
overflow: hidden;
172175

173176
A,
174177
A:visited,
@@ -322,6 +325,11 @@ SECTION {
322325
&.tab-section {
323326
padding: 20px;
324327
}
328+
329+
.well,
330+
.well .grid {
331+
margin-bottom: 0;
332+
}
325333
}
326334

327335
.overlay SECTION {

app/styles/resource-actions.scss

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
}
2525

2626
&.hover {
27+
A.clip {
28+
padding-right: 27px;
29+
}
30+
2731
.resource-actions {
2832
display: block;
2933
}

0 commit comments

Comments
 (0)