Skip to content

Commit f85cb02

Browse files
committed
Merge pull request #44 from vincent99/reskin
Create Project
2 parents d47219e + c13fa08 commit f85cb02

File tree

32 files changed

+430
-49
lines changed

32 files changed

+430
-49
lines changed

app/mixins/github-user-info.js

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,45 @@ export default Ember.Mixin.create({
66
login: null,
77
size: 40,
88

9-
name: 'Loading...',
9+
name: null,
10+
description: 'Loading...',
1011
_avatarUrl: null,
1112

1213
loginOrTypeChanged: function() {
1314
var self = this;
15+
var session = this.get('session');
1416

15-
var cache = self.get('session').get('avatarCache')||{};
16-
17+
var cache = session.get('avatarCache')||{};
1718
var login = this.get('login');
18-
if ( !login )
19+
var type = this.get('type');
20+
var key = type + ':' + login;
21+
22+
if ( !type || !login )
1923
{
2024
return;
2125
}
2226

23-
var type = this.get('type');
24-
var key = type + ':' + login;
27+
// Teams can't be looked up without auth...
28+
if ( type === 'team' )
29+
{
30+
var entry = (session.get('teams')||[]).filterProperty('name', login)[0];
31+
this.set('_avatarUrl', null);
32+
if ( entry )
33+
{
34+
this.set('name', entry.name);
35+
this.set('description', entry.org + ' team');
36+
}
37+
else
38+
{
39+
this.set('name', '('+ login + ')');
40+
this.set('description', '(Unknown team id)');
41+
}
42+
43+
return;
44+
}
45+
46+
this.set('name', login);
47+
2548

2649
if ( cache[key] )
2750
{
@@ -30,21 +53,21 @@ export default Ember.Mixin.create({
3053
else
3154
{
3255
var url = C.GITHUB_API_URL + type + 's/' + login;
33-
Ember.$.ajax({url: url, dataType: 'json'}).then(function(body) {
56+
Ember.$.ajax({url: url, dataType: 'json'}).then((body) => {
3457
cache[key] = body;
3558

3659
// Sub-keys don't get automatically persisted to the session...
37-
self.get('session').set('avatarCache', cache);
60+
session.set('avatarCache', cache);
3861

3962
gotInfo(body);
40-
}, function() {
41-
self.sendAction('notFound', login);
63+
}, () => {
64+
this.sendAction('notFound', login);
4265
});
4366
}
4467

4568
function gotInfo(body)
4669
{
47-
self.set('name', body.name);
70+
self.set('description', body.name);
4871
self.set('_avatarUrl', body.avatar_url);
4972
}
5073
}.observes('login','type').on('init'),

app/pods/apikeys/template.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
</div>
1717

1818
<div>
19-
<div class="clear-fix">
19+
<div class="clearfix">
2020
<label><i class="fa fa-code"></i> API Keys</label>
2121
<div style="float: right">
2222
<button {{action "newApikey"}} class="btn btn-primary"><i class="fa fa-plus"></i> Create an API key</button>

app/pods/components/github-block/component.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ import GithubUserInfoMixin from 'ui/mixins/github-user-info';
44
export default Ember.Component.extend(GithubUserInfoMixin,{
55
classNames: ['gh-block'],
66
avatar: true,
7+
link: true,
8+
9+
isTeam: Ember.computed.equal('type','team'),
710
});

app/pods/components/github-block/template.hbs

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,39 @@
22
{{#if avatar}}
33
<div class="gh-avatar">
44
{{#if avatarUrl}}
5-
<a {{bind-attr href=url}} target="_blank">
5+
{{#if link}}
6+
<a {{bind-attr href=url}} target="_blank">
7+
<img {{bind-attr src=avatarUrl width=size height=size}}>
8+
</a>
9+
{{else}}
610
<img {{bind-attr src=avatarUrl width=size height=size}}>
7-
</a>
11+
{{/if}}
812
{{else}}
9-
<div class="gh-placeholder"></div>
13+
{{#if isTeam}}
14+
<div class="gh-placeholder">
15+
<i class="fa fa-2x fa-github-alt"></i>
16+
</div>
17+
{{else}}
18+
<div class="gh-placeholder"></div>
19+
{{/if}}
1020
{{/if}}
1121
</div>
1222
{{/if}}
1323
<div class="gh-block-content">
1424
<div class="clip">
15-
<a {{bind-attr href=url}} target="_blank">{{login}}</a>
25+
{{#if isTeam}}
26+
{{name}}
27+
{{else}}
28+
{{#if link}}
29+
<a {{bind-attr href=url}} target="_blank">{{name}}</a>
30+
{{else}}
31+
{{name}}
32+
{{/if}}
33+
{{/if}}
1634
</div>
1735
<div class="text-muted clip">
18-
{{#if name}}
19-
{{name}}
36+
{{#if description}}
37+
{{description}}
2038
{{else}}
2139
<i>No Name</i>
2240
{{/if}}

app/pods/components/host-widget/template.hbs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<div class="host-header">
22
<div {{bind-attr class=":host-overlay stateBackground"}}>
3+
<div class="host-name">{{model.displayName}}</div>
34
{{resource-actions model=model choices=model.primaryActions big=true}}
45
</div>
56

app/pods/components/page-header/template.hbs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@
5252
</a>
5353
</li>
5454
{{/each}}
55-
<li role="presentation" class="divider"></li>
56-
<li>{{#link-to "projects"}}Manage Projects{{/link-to}}</li>
5755
</ul>
5856
</div>
5957
</div>

app/pods/container/controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ var ContainerController = Cattle.TransitioningResourceController.extend({
9898
choices.push(byName('purge'));
9999
}
100100

101-
choices.push({ tooltip: 'Details', icon: 'fa-chevron-right', action: 'detail', enabled: true });
101+
choices.push({ tooltip: 'Details', icon: 'fa-info-circle', action: 'detail', enabled: true });
102102
return choices;
103103

104104
function byName(name) {

app/pods/host/controller.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ var HostController = Cattle.TransitioningResourceController.extend({
6161
choices.push(byName('promptDelete'));
6262
}
6363

64-
choices.push({ tooltip: 'Details', icon: 'fa-chevron-right', action: 'detail', enabled: true });
64+
choices.push({ tooltip: 'Details', icon: 'fa-info', action: 'detail', enabled: true });
6565
return choices;
6666

6767
function byName(name) {

app/pods/host/template.hbs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@
4141

4242
<section>
4343
<div class="well instances">
44-
<label>Containers</label>
44+
<div class="clearfix">
45+
<div class="pull-right">{{#link-to "containers.new" (query-params hostId=model.id) class="btn btn-primary btn-sm"}}<i class="fa fa-plus"></i> Add a Container{{/link-to}}</div>
46+
<label>Containers</label>
47+
</div>
4548
{{#each col in view.columns}}
4649
<div class="instance-column">
4750
{{#each item in col itemController="container"}}

app/pods/host/view.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,15 @@ export default Ember.View.extend({
5353

5454
var out = [];
5555
var i;
56+
57+
for ( i = 0 ; i < columnCount ; i++ )
58+
{
59+
out.push([]);
60+
}
61+
5662
var instances = this.get('context.instances');
5763
if ( instances )
5864
{
59-
for ( i = 0 ; i < columnCount ; i++ )
60-
{
61-
out.push([]);
62-
}
6365

6466
for ( i = 0 ; i < instances.get('length') ; i++ )
6567
{

0 commit comments

Comments
 (0)