Ember 1.12 updates

This commit is contained in:
Vincent Fiduccia 2015-06-25 10:29:54 -07:00
parent 3efe73cd1a
commit e57d8ecebb
45 changed files with 266 additions and 296 deletions

View File

@ -18,6 +18,7 @@ indent_style = space
indent_size = 2 indent_size = 2
[*.hbs] [*.hbs]
insert_final_newline = false
indent_style = space indent_style = space
indent_size = 2 indent_size = 2

3
.watchmanconfig Normal file
View File

@ -0,0 +1,3 @@
{
"ignore_dirs": ["tmp"]
}

View File

@ -47,7 +47,7 @@ app.import('bower_components/bootstrap-sass-official/assets/javascripts/bootstra
app.import('bower_components/jgrowl/jquery.jgrowl.js'); app.import('bower_components/jgrowl/jquery.jgrowl.js');
app.import('bower_components/jgrowl/jquery.jgrowl.css'); app.import('bower_components/jgrowl/jquery.jgrowl.css');
app.import('bower_components/jquery.cookie/jquery.cookie.js'); app.import('bower_components/jquery.cookie/jquery.cookie.js');
app.import('bower_components/ember-animate/ember-animate.js'); //app.import('bower_components/ember-animate/ember-animate.js');
app.import('bower_components/d3/d3.js'); app.import('bower_components/d3/d3.js');
app.import('bower_components/c3/c3.js'); app.import('bower_components/c3/c3.js');
app.import('bower_components/c3/c3.css'); app.import('bower_components/c3/c3.css');

View File

@ -1,7 +1,7 @@
import Ember from 'ember'; import Ember from 'ember';
import Cattle from 'ui/utils/cattle'; import Cattle from 'ui/utils/cattle';
export default Ember.ObjectController.extend(Cattle.NewOrEditMixin, { export default Ember.Controller.extend(Cattle.NewOrEditMixin, {
queryParams: ['justCreated'], queryParams: ['justCreated'],
justCreated: false, justCreated: false,
cancelAsClose: Ember.computed.alias('justCreated'), cancelAsClose: Ember.computed.alias('justCreated'),

View File

@ -25,12 +25,12 @@
<div class="form-group"> <div class="form-group">
<label for="name">Name</label> <label for="name">Name</label>
{{input id="name" type="text" value=name classNames="form-control" placeholder="e.g. App Servers"}} {{input id="name" type="text" value=primaryResource.name classNames="form-control" placeholder="e.g. App Servers"}}
</div> </div>
<div class="form-group"> <div class="form-group">
<label for="description">Description</label> <label for="description">Description</label>
{{textarea id="description" value=description classNames="form-control no-resize" rows="5" placeholder="e.g. This key is used by the app servers to deploy containers"}} {{textarea id="description" value=primaryResource.description classNames="form-control no-resize" rows="5" placeholder="e.g. This key is used by the app servers to deploy containers"}}
</div> </div>
{{partial "save-cancel"}} {{partial "save-cancel"}}

View File

@ -1,4 +1,4 @@
{{#with controllers.authenticated.project as p controller="project"}} {{#with controllers.authenticated.project controller="project" as |p|}}
<section class="header"> <section class="header">
<h3> <h3>
<span class="right-divider">API &amp; Keys for &quot;{{p.displayName}}&quot; Environment</span> <span class="right-divider">API &amp; Keys for &quot;{{p.displayName}}&quot; Environment</span>

View File

@ -3,9 +3,11 @@ import Resolver from 'ember/resolver';
import loadInitializers from 'ember/load-initializers'; import loadInitializers from 'ember/load-initializers';
import config from './config/environment'; import config from './config/environment';
var App;
Ember.MODEL_FACTORY_INJECTIONS = true; Ember.MODEL_FACTORY_INJECTIONS = true;
var App = Ember.Application.extend({ App = Ember.Application.extend({
modulePrefix: config.modulePrefix, modulePrefix: config.modulePrefix,
podModulePrefix: config.podModulePrefix, podModulePrefix: config.podModulePrefix,
Resolver: Resolver Resolver: Resolver

View File

@ -150,7 +150,38 @@ export default Ember.Route.extend({
if ( agent.indexOf('msie ') >= 0 || agent.indexOf('trident/') >= 0 || agent.indexOf('edge/') >= 0 ) if ( agent.indexOf('msie ') >= 0 || agent.indexOf('trident/') >= 0 || agent.indexOf('edge/') >= 0 )
{ {
this.replaceWith('ie'); this.replaceWith('ie');
return;
} }
// Find out if auth is enabled
return this.get('store').rawRequest({
url: 'token',
headers: {
[C.HEADER.PROJECT]: undefined
}
})
.then((obj) => {
// If we get a good response back, the API supports authentication
var body = JSON.parse(obj.xhr.responseText);
var token = body.data[0];
this.set('app.authenticationEnabled', token.security);
this.set('app.githubClientId', token.clientId);
this.set('app.githubHostname', token.hostname );
if ( !token.security )
{
this.get('github').clearSessionKeys();
}
return Ember.RSVP.resolve(undefined,'API supports authentication');
})
.catch((obj) => {
// Otherwise this API is too old to do auth.
this.set('app.authenticationEnabled', false);
this.set('app.initError', obj);
return Ember.RSVP.resolve(undefined,'Error determining API authentication');
});
}, },
setupController: function(controller/*, model*/) { setupController: function(controller/*, model*/) {

View File

@ -6,6 +6,8 @@ import ActiveArrayProxy from 'ui/utils/active-array-proxy';
import C from 'ui/utils/constants'; import C from 'ui/utils/constants';
export default Ember.Route.extend(AuthenticatedRouteMixin, { export default Ember.Route.extend(AuthenticatedRouteMixin, {
prefs: Ember.inject.service(),
socket: null, socket: null,
pingTimer: null, pingTimer: null,
@ -188,6 +190,77 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
}, },
actions: { actions: {
activate: function() {
var store = this.get('store');
var boundTypeify = store._typeify.bind(store);
var url = "ws://"+window.location.host + this.get('app.wsEndpoint');
var session = this.get('session');
var projectId = session.get(C.SESSION.PROJECT);
if ( projectId )
{
url = Util.addQueryParam(url, 'projectId', projectId);
}
var socket = Socket.create({
url: url
});
socket.on('message', (event) => {
var d = JSON.parse(event.data, boundTypeify);
//this._trySend('subscribeMessage',d);
var str = d.name;
if ( d.resourceType )
{
str += ' ' + d.resourceType;
if ( d.resourceId )
{
str += ' ' + d.resourceId;
}
}
var action;
if ( d.name === 'resource.change' )
{
action = d.resourceType+'Changed';
}
else if ( d.name === 'ping' )
{
action = 'subscribePing';
}
if ( action )
{
this._trySend(action,d);
}
});
socket.on('connected', (tries, after) => {
this._trySend('subscribeConnected', tries, after);
});
socket.on('disconnected', () => {
this._trySend('subscribeDisconnected', this.get('tries'));
});
this.set('socket', socket);
socket.connect();
},
deactivate: function() {
var socket = this.get('socket');
if ( socket )
{
socket.disconnect();
}
// Forget all the things
this.get('store').reset();
},
error: function(err,transition) { error: function(err,transition) {
// Unauthorized error, send back to login screen // Unauthorized error, send back to login screen
if ( err.status === 401 ) if ( err.status === 401 )
@ -355,77 +428,6 @@ export default Ember.Route.extend(AuthenticatedRouteMixin, {
}, },
}, },
enter: function() {
var store = this.get('store');
var boundTypeify = store._typeify.bind(store);
var url = "ws://"+window.location.host + this.get('app.wsEndpoint');
var session = this.get('session');
var projectId = session.get(C.SESSION.PROJECT);
if ( projectId )
{
url = Util.addQueryParam(url, 'projectId', projectId);
}
var socket = Socket.create({
url: url
});
socket.on('message', (event) => {
var d = JSON.parse(event.data, boundTypeify);
//this._trySend('subscribeMessage',d);
var str = d.name;
if ( d.resourceType )
{
str += ' ' + d.resourceType;
if ( d.resourceId )
{
str += ' ' + d.resourceId;
}
}
var action;
if ( d.name === 'resource.change' )
{
action = d.resourceType+'Changed';
}
else if ( d.name === 'ping' )
{
action = 'subscribePing';
}
if ( action )
{
this._trySend(action,d);
}
});
socket.on('connected', (tries, after) => {
this._trySend('subscribeConnected', tries, after);
});
socket.on('disconnected', () => {
this._trySend('subscribeDisconnected', this.get('tries'));
});
this.set('socket', socket);
socket.connect();
},
exit: function() {
var socket = this.get('socket');
if ( socket )
{
socket.disconnect();
}
// Forget all the things
this.get('store').reset();
},
_trySend: function(/*arguments*/) { _trySend: function(/*arguments*/) {
try try
{ {

View File

@ -6,7 +6,7 @@
{{model.ipAddress}} {{model.ipAddress}}
{{else}} {{else}}
{{#if model.instance}} {{#if model.instance}}
{{#with model.instance as container controller="container"}} {{#with model.instance controller="container" as |container|}}
<i {{bind-attr class="container.stateIcon container.stateColor" tooltip=container.displayState}}></i> <i {{bind-attr class="container.stateIcon container.stateColor" tooltip=container.displayState}}></i>
{{#link-to "container" model.instanceId}} {{#link-to "container" model.instanceId}}
{{container.displayName}} {{container.displayName}}

View File

@ -2,6 +2,7 @@ import Ember from 'ember';
import C from 'ui/utils/constants'; import C from 'ui/utils/constants';
export default Ember.Component.extend({ export default Ember.Component.extend({
prefs: Ember.inject.service(),
classNames: ['articles'], classNames: ['articles'],
actions: { actions: {

View File

@ -81,7 +81,7 @@
<div class="btn-group project-btn"> <div class="btn-group project-btn">
<button type="button" class="btn btn-link dropdown-toggle text-left clip" data-toggle="dropdown" aria-expanded="false"> <button type="button" class="btn btn-link dropdown-toggle text-left clip" data-toggle="dropdown" aria-expanded="false">
{{#if project}} {{#if project}}
{{#with project as p controller="project"}} {{#with project controller="project" as |p|}}
<i {{bind-attr class=":fa-fw p.icon"}}></i>&nbsp;{{p.displayName}} <i {{bind-attr class=":fa-fw p.icon"}}></i>&nbsp;{{p.displayName}}
{{/with}} {{/with}}
<span class="caret"></span> <span class="caret"></span>
@ -113,7 +113,7 @@
{{/if}} {{/if}}
{{#if projectIsMissing}} {{#if projectIsMissing}}
<li role="presentation" class="dropdown-header text-uppercase">Selected Environment:</li> <li role="presentation" class="dropdown-header text-uppercase">Selected Environment:</li>
{{#with project as p controller="project"}} {{#with project controller="project" as |p|}}
<li {{bind-attr class="p.active:disabled p.active:selected"}}> <li {{bind-attr class="p.active:disabled p.active:selected"}}>
<a {{action "switchProject" p.id}} class="clip"> <a {{action "switchProject" p.id}} class="clip">
<i {{bind-attr class=":fa-fw p.icon"}}></i> <i {{bind-attr class=":fa-fw p.icon"}}></i>

View File

@ -17,7 +17,7 @@
<div class="pod-info clearfix"> <div class="pod-info clearfix">
<div class="pod-info-line"> <div class="pod-info-line">
{{#each map in model.consumedServicesWithNames}} {{#each map in model.consumedServicesWithNames}}
{{#with map.service as service controller="service"}} {{#with map.service controller="service" as |service|}}
<div class="pod-info-item"> <div class="pod-info-item">
{{#link-to "service" service.environmentId service.id}} {{#link-to "service" service.environmentId service.id}}
<i {{bind-attr class="service.activeIcon"}}></i> <i {{bind-attr class="service.activeIcon"}}></i>

View File

@ -1,7 +1,7 @@
import Ember from 'ember'; import Ember from 'ember';
import EditContainer from 'ui/mixins/edit-container'; import EditContainer from 'ui/mixins/edit-container';
export default Ember.ObjectController.extend(EditContainer, { export default Ember.Controller.extend(EditContainer, {
editing: true, editing: true,
didSave: function() { didSave: function() {

View File

@ -27,9 +27,15 @@ export default OverlayRoute.extend({
setupController: function(controller, model) { setupController: function(controller, model) {
var instance = model.get('instance'); var instance = model.get('instance');
controller.set('originalModel', instance);
model.set('instance', instance.clone()); model.set('instance', instance.clone());
controller.set('model', model); controller.setProperties({
originalModel: instance,
model: model,
instance: model.instance,
ports: model.ports,
instanceLinks: model.instanceLinks,
allHosts: model.allHosts
});
controller.initFields(); controller.initFields();
}, },

View File

@ -1,4 +1,4 @@
{{#with instance as container controller="container"}} {{#with instance controller="container" as |container|}}
<h2> <h2>
<i class="ss-file"></i> Logs: {{container.displayName}} <i class="ss-file"></i> Logs: {{container.displayName}}
</h2> </h2>

View File

@ -1,4 +1,4 @@
{{#with instance as container controller="container"}} {{#with instance controller="container" as |container|}}
<h1><i class="fa fa-terminal"></i> Shell: {{container.displayName}}</h1> <h1><i class="fa fa-terminal"></i> Shell: {{container.displayName}}</h1>
{{/with}} {{/with}}
<div class="console-body clearfix"> <div class="console-body clearfix">

View File

@ -6,7 +6,7 @@
</div> </div>
<span> <span>
{{#if primaryHost}} {{#if primaryHost}}
{{#with primaryHost as host controller="host"}} {{#with primaryHost controller="host" as |host|}}
{{#link-to "hosts"}}Hosts:{{/link-to}} {{#link-to "hosts"}}Hosts:{{/link-to}}
{{#link-to "host" host.id}}{{host.displayName}}:{{/link-to}} {{#link-to "host" host.id}}{{host.displayName}}:{{/link-to}}
{{displayName}} {{displayName}}
@ -35,7 +35,7 @@
<li> <li>
<label>Host IP</label> <label>Host IP</label>
{{#if primaryHost}} {{#if primaryHost}}
{{#with primaryHost as host controller="host"}} {{#with primaryHost controller="host" as |host|}}
{{host.displayIp}} {{zero-clipboard text=host.displayIp}} {{host.displayIp}} {{zero-clipboard text=host.displayIp}}
{{/with}} {{/with}}
{{else}} {{else}}

View File

@ -1,7 +1,7 @@
import Ember from 'ember'; import Ember from 'ember';
import EditContainer from 'ui/mixins/edit-container'; import EditContainer from 'ui/mixins/edit-container';
export default Ember.ObjectController.extend(EditContainer, { export default Ember.Controller.extend(EditContainer, {
queryParams: ['environmentId','containerId'], queryParams: ['environmentId','containerId'],
environmentId: null, environmentId: null,
containerId: null, containerId: null,

View File

@ -77,8 +77,13 @@ export default Ember.Route.extend({
}, },
setupController: function(controller, model) { setupController: function(controller, model) {
controller.set('originalModel', null); controller.setProperties({
controller.set('model', model); originalModel: null,
model: model,
instance: model.instance,
healthCheck: model.healthCheck,
allHosts: model.allHosts,
});
controller.initFields(); controller.initFields();
}, },

View File

@ -1,4 +1,4 @@
{{#with environment as env controller="environment"}} {{#with environment controller="environment" as |env|}}
{{environment-header model=env}} {{environment-header model=env}}
{{/with}} {{/with}}

View File

@ -1,3 +1,3 @@
{{#with model as env controller="environment"}} {{#with model controller="environment" as |env|}}
{{environment-header model=env}} {{environment-header model=env}}
{{/with}} {{/with}}

View File

@ -1,8 +1,8 @@
{{#with model as env controller="environment"}} {{#with model controller="environment" as |env|}}
{{environment-header model=env}} {{environment-header model=env}}
{{#columns-section pods=view.pods emptyMessage="No services yet." as |item| }} {{#columns-section pods=view.pods emptyMessage="No services yet." as |item| }}
{{#with item as service controller="service"}} {{#with item controller="service" as |service|}}
{{service-pod model=service}} {{service-pod model=service}}
{{/with}} {{/with}}
{{/columns-section}} {{/columns-section}}

View File

@ -9,7 +9,7 @@
{{#each item in this}} {{#each item in this}}
{{project-section model=item collapseId=(dom-id item)}} {{project-section model=item collapseId=(dom-id item)}}
{{#columns-section pods=item.unremovedServices id=(dom-id item) classNames="collapse in" emptyMessage="No services yet." as |item| }} {{#columns-section pods=item.unremovedServices id=(dom-id item) classNames="collapse in" emptyMessage="No services yet." as |item| }}
{{#with item as service controller="service"}} {{#with item controller="service" as |service|}}
{{service-pod model=service}} {{service-pod model=service}}
{{/with}} {{/with}}
{{/columns-section}} {{/columns-section}}

View File

@ -7,11 +7,11 @@
{{#columns-section pods=view.pods emptyMessage="No hosts or containers yet." as |item| }} {{#columns-section pods=view.pods emptyMessage="No hosts or containers yet." as |item| }}
{{#if item.isPendingMachine}} {{#if item.isPendingMachine}}
{{#with item.machine as machine controller="machine"}} {{#with item.machine controller="machine" as |machine|}}
{{host-pod model=machine dot=dot}} {{host-pod model=machine dot=dot}}
{{/with}} {{/with}}
{{else}} {{else}}
{{#with item as host controller="host"}} {{#with item controller="host" as |host|}}
{{host-pod model=host dot=dot}} {{host-pod model=host dot=dot}}
{{/with}} {{/with}}
{{/if}} {{/if}}

View File

@ -274,39 +274,47 @@ export default Ember.ObjectController.extend(NewHost, {
}, },
}, },
selectedZone: function(key, val/*, oldVal*/) { selectedZone: Ember.computed('amazonec2Config.{region,zone}', {
var config = this.get('amazonec2Config'); get: function() {
if ( arguments.length > 1 ) var config = this.get('amazonec2Config');
{ if ( config.get('region') && config.get('zone') )
if ( val && val.length ) {
return config.get('region') + config.get('zone');
}
else
{
return null;
}
},
set: function(key, val) {
var config = this.get('amazonec2Config');
config.setProperties({
region: val.substr(0, val.length - 1),
zone: val.substr(val.length - 1),
});
var selectedSubnet = this.get('selectedSubnet');
if ( this.get('subnetChoices').filterProperty('value', selectedSubnet).length === 0 )
{ {
config.setProperties({ config.setProperties({
region: val.substr(0, val.length - 1), region: val.substr(0, val.length - 1),
zone: val.substr(val.length - 1), zone: val.substr(val.length - 1),
vpcId: null,
subnetId: null,
}); });
}
var selectedSubnet = this.get('selectedSubnet'); if ( config.get('region') && config.get('zone') )
if ( this.get('subnetChoices').filterProperty('value', selectedSubnet).length === 0 ) {
{ return config.get('region') + config.get('zone');
config.setProperties({ }
region: val.substr(0, val.length - 1), else
zone: val.substr(val.length - 1), {
vpcId: null, return null;
subnetId: null,
});
}
} }
} }
}),
if ( config.get('region') && config.get('zone') )
{
return config.get('region') + config.get('zone');
}
else
{
return null;
}
}.property('amazonec2Config.{region,zone}'),
zoneChoices: function() { zoneChoices: function() {
return (this.get('allSubnets')||[]).map((subnet) => {return subnet.get('zone');}).sort().uniq(); return (this.get('allSubnets')||[]).map((subnet) => {return subnet.get('zone');}).sort().uniq();
@ -342,39 +350,46 @@ export default Ember.ObjectController.extend(NewHost, {
return out.sortBy('sortKey'); return out.sortBy('sortKey');
}.property('selectedZone','allSubnets.@each.{subnetId,vpcId,zone}'), }.property('selectedZone','allSubnets.@each.{subnetId,vpcId,zone}'),
selectedSubnet: function(key, val/*, oldVal*/) { selectedSubnet: Ember.computed('amazonec2Config.{subnetId,vpcId}', {
var config = this.get('amazonec2Config'); set: function(key, val) {
if ( arguments.length > 1 ) var config = this.get('amazonec2Config');
{ if ( arguments.length > 1 )
if ( val && val.length )
{ {
if ( val.indexOf('vpc-') === 0 ) if ( val && val.length )
{ {
config.setProperties({ if ( val.indexOf('vpc-') === 0 )
vpcId: val, {
subnetId: null, config.setProperties({
}); vpcId: val,
subnetId: null,
});
}
else
{
var subnet = this.subnetById(val);
config.setProperties({
vpcId: subnet.vpcId,
subnetId: subnet.subnetId,
});
}
} }
else else
{ {
var subnet = this.subnetById(val);
config.setProperties({ config.setProperties({
vpcId: subnet.vpcId, vpcId: null,
subnetId: subnet.subnetId, subnetId: null,
}); });
} }
} }
else
{
config.setProperties({
vpcId: null,
subnetId: null,
});
}
}
return config.get('subnetId') || config.get('vpcId'); return config.get('subnetId') || config.get('vpcId');
}.property('amazonec2Config.{subnetId,vpcId}'), },
get: function() {
var config = this.get('amazonec2Config');
return config.get('subnetId') || config.get('vpcId');
},
}),
subnetById: function(id) { subnetById: function(id) {
return (this.get('allSubnets')||[]).filterProperty('subnetId',id)[0]; return (this.get('allSubnets')||[]).filterProperty('subnetId',id)[0];

View File

@ -1,6 +1,9 @@
import Ember from 'ember';
import DriverRoute from 'ui/hosts/new/driver-route'; import DriverRoute from 'ui/hosts/new/driver-route';
export default DriverRoute.extend({ export default DriverRoute.extend({
prefs: Ember.inject.service(),
driverName: 'amazonec2', driverName: 'amazonec2',
newModel: function() { newModel: function() {
var store = this.get('store'); var store = this.get('store');

View File

@ -1,47 +0,0 @@
import Ember from 'ember';
import C from 'ui/utils/constants';
export function initialize(container, application) {
application.deferReadiness();
var store = container.lookup('store:main');
var github = container.lookup('service:github');
var headers = {};
headers[C.HEADER.PROJECT] = undefined; // Explicitly not send project
// Find out if auth is enabled
store.rawRequest({
url: 'token',
headers: headers
})
.then((obj) => {
// If we get a good response back, the API supports authentication
var body = JSON.parse(obj.xhr.responseText);
var token = body.data[0];
application.set('authenticationEnabled', token.security);
application.set('githubClientId', token.clientId);
application.set('githubHostname', token.hostname );
if ( !token.security )
{
github.clearSessionKeys();
}
return Ember.RSVP.resolve(undefined,'API supports authentication');
})
.catch((obj) => {
// Otherwise this API is too old to do auth.
application.set('authenticationEnabled', false);
application.set('initError', obj);
return Ember.RSVP.resolve(undefined,'Error determining API authentication');
})
.finally(function() {
application.advanceReadiness();
});
}
export default {
name: 'authentication',
after: ['store','config'],
initialize: initialize
};

View File

@ -1,14 +1,14 @@
export function initialize(container/*, application*/) { export function initialize(/*container, application*/) {
// Shortcuts for debugging. These should never be used in code. // Shortcuts for debugging. These should never be used in code.
window.l = function(name) { window.l = function(name) {
return container.lookup(name); return Ui.__container__.lookup(name);
}; };
window.lc = function(name) { window.lc = function(name) {
return container.lookup('controller:'+name); return Ui.__container__.lookup('controller:'+name);
}; };
window.s = container.lookup('store:main'); window.s = Ui.__container__.lookup('store:main');
} }
export default { export default {

View File

@ -1,28 +0,0 @@
import UserPreferences from 'ui/utils/user-preferences';
import Serializable from 'ember-api-store/mixins/serializable';
// Don't serialize the injected prefs
Serializable.reopen({
reservedKeys: ['prefs'],
});
export function initialize(container, application) {
var prefs = UserPreferences.create({
// Store isn't automatically injected in
store: container.lookup('store:main'),
app: application,
});
// Inject GitHub lookup as 'github' property
container.register('prefs:main', prefs, {instantiate: false});
application.inject('controller', 'prefs', 'prefs:main');
application.inject('route', 'prefs', 'prefs:main');
application.inject('model', 'prefs', 'prefs:main');
application.inject('component', 'prefs', 'prefs:main');
}
export default {
name: 'prefs',
after: 'store',
initialize: initialize
};

View File

@ -5,7 +5,7 @@ Serializable.reopen({
reservedKeys: ['session'], reservedKeys: ['session'],
}); });
export function initialize(container, application) { export function initialize(registry, application) {
application.inject('controller', 'session', 'service:session'); application.inject('controller', 'session', 'service:session');
application.inject('route', 'session', 'service:session'); application.inject('route', 'session', 'service:session');
application.inject('model', 'session', 'service:session'); application.inject('model', 'session', 'service:session');
@ -14,6 +14,5 @@ export function initialize(container, application) {
export default { export default {
name: 'session', name: 'session',
before: 'store',
initialize: initialize initialize: initialize
}; };

View File

@ -5,7 +5,9 @@ import UnremovedArrayProxy from 'ui/utils/unremoved-array-proxy';
import ActiveArrayProxy from 'ui/utils/active-array-proxy'; import ActiveArrayProxy from 'ui/utils/active-array-proxy';
import C from 'ui/utils/constants'; import C from 'ui/utils/constants';
export function initialize(container, application) { export function initialize(instance) {
var container = instance.container;
var application = container.lookup('application:main');
var store = container.lookup('store:main'); var store = container.lookup('store:main');
var session = container.lookup('service:session'); var session = container.lookup('service:session');
store.set('removeAfterDelete', false); store.set('removeAfterDelete', false);

View File

@ -35,7 +35,7 @@
</td> </td>
<td> <td>
{{#if target.instance}} {{#if target.instance}}
{{#with target.instance as c controller="container"}} {{#with target.instance controller="container" as |c|}}
{{#link-to "container" c.id}}{{c.displayName}}{{/link-to}} {{#link-to "container" c.id}}{{c.displayName}}{{/link-to}}
{{/with}} {{/with}}
{{else}} {{else}}

View File

@ -6,7 +6,7 @@
</section> </section>
{{#columns-section pods=view.pods emptyMessage="No load balancers." as |item| }} {{#columns-section pods=view.pods emptyMessage="No load balancers." as |item| }}
{{#with item as balancer controller="loadbalancer"}} {{#with item controller="loadbalancer" as |balancer|}}
{{loadbalancer-pod model=balancer}} {{loadbalancer-pod model=balancer}}
{{/with}} {{/with}}
{{/columns-section}} {{/columns-section}}

View File

@ -3,6 +3,8 @@ import Cattle from 'ui/utils/cattle';
import C from 'ui/utils/constants'; import C from 'ui/utils/constants';
var ProjectController = Cattle.TransitioningResourceController.extend({ var ProjectController = Cattle.TransitioningResourceController.extend({
prefs: Ember.inject.service(),
actions: { actions: {
edit: function() { edit: function() {
this.transitionToRoute('project.edit',this.get('id')); this.transitionToRoute('project.edit',this.get('id'));

View File

@ -1,12 +1,14 @@
import Ember from 'ember'; import Ember from 'ember';
export default Ember.Route.extend({ export default Ember.Route.extend({
enter: function() { actions: {
$('BODY').addClass('farm'); activate: function() {
}, $('BODY').addClass('farm');
},
exit: function() { deactivate: function() {
$('BODY').removeClass('farm'); $('BODY').removeClass('farm');
},
}, },
model: function() { model: function() {

View File

@ -1,7 +1,9 @@
import Ember from 'ember'; import Ember from 'ember';
export default Ember.Route.extend({ export default Ember.Route.extend({
enter: function() { actions: {
this.transitionTo('authenticated'); activate: function() {
}, this.transitionTo('authenticated');
},
}
}); });

View File

@ -1,4 +1,4 @@
{{#with environment as env controller="environment"}} {{#with environment controller="environment" as |env|}}
<section class="header"> <section class="header">
<h3> <h3>
{{resource-actions-menu model=this choices=availableActions classNames="pull-right"}} {{resource-actions-menu model=this choices=availableActions classNames="pull-right"}}

View File

@ -1,14 +1,7 @@
import Ember from "ember"; import Ember from 'ember';
import UnremovedArrayProxy from 'ui/utils/unremoved-array-proxy'; import UnremovedArrayProxy from 'ui/utils/unremoved-array-proxy';
export default Ember.Object.extend({ export default Ember.Service.extend({
app: null,
store: null,
init: function() {
this._super();
},
unremoved: function() { unremoved: function() {
return UnremovedArrayProxy.create({ return UnremovedArrayProxy.create({
sourceContent: this.get('store').all('userpreference') sourceContent: this.get('store').all('userpreference')
@ -80,4 +73,3 @@ export default Ember.Object.extend({
this.endPropertyChanges(); this.endPropertyChanges();
}, },
}); });

View File

@ -1,9 +0,0 @@
{{#if isTransitioning}}
<div class="page-progress">
<div class="progress progress-striped active">
<div class="progress-bar" role="progressbar" aria-valuemin="0" aria-valuemax="100" {{bind-attr aria-valuenow=displayProgress style=progressStyle}}>
<span class="sr-only">{{displayProgress}}% Complete</span>
</div>
</div>
</div>
{{/if}}

View File

@ -488,21 +488,6 @@ var TransitioningResourceController = ResourceController.extend({
stateBackground: function() { stateBackground: function() {
return this.get('stateColor').replace("text-","bg-"); return this.get('stateColor').replace("text-","bg-");
}.property('stateColor'), }.property('stateColor'),
displayProgress: function() {
var progress = this.get('transitioningProgress');
if ( progress === null || isNaN(progress) )
{
progress = 0;
}
return Math.max(0,Math.min(progress, 100));
}.property('transitioningProgress'),
progressStyle: function() {
return 'width: '+ Math.max(2, this.get('displayProgress')) +'%';
}.property('displayProgress'),
}); });
// Override stateMap with a map of state -> icon classes // Override stateMap with a map of state -> icon classes

View File

@ -1,15 +1,15 @@
{ {
"name": "ui", "name": "ui",
"dependencies": { "dependencies": {
"ember": "1.10.0", "ember": "1.12.0",
"jquery": "^2.1.3", "jquery": "^2.1.4",
"ember-data": "1.0.0-beta.15", "ember-data": "1.0.0-beta.15",
"ember-resolver": "~0.1.12", "ember-resolver": "~0.1.15",
"loader.js": "ember-cli/loader.js#3.2.1", "loader.js": "ember-cli/loader.js#3.2.0",
"ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3", "ember-cli-shims": "ember-cli/ember-cli-shims#0.0.3",
"ember-cli-test-loader": "ember-cli/ember-cli-test-loader#0.1.3", "ember-cli-test-loader": "ember-cli-test-loader#0.1.3",
"ember-load-initializers": "ember-cli/ember-load-initializers#0.0.2", "ember-load-initializers": "ember-cli/ember-load-initializers#0.1.4",
"ember-qunit": "0.2.11", "ember-qunit": "0.3.3",
"ember-qunit-notifications": "0.0.7", "ember-qunit-notifications": "0.0.7",
"qunit": "~1.17.1", "qunit": "~1.17.1",
"ember-animate": "~0.3.6", "ember-animate": "~0.3.6",

View File

@ -20,22 +20,22 @@
"author": "Rancher Labs", "author": "Rancher Labs",
"license": "Apache 2", "license": "Apache 2",
"devDependencies": { "devDependencies": {
"broccoli-asset-rev": "^2.0.0", "broccoli-asset-rev": "^2.0.2",
"broccoli-sass": "0.6.2", "broccoli-sass": "0.6.2",
"ember-api-store": "^1.1.4", "ember-api-store": "^1.1.4",
"ember-browserify": "^0.6.4", "ember-browserify": "^0.6.4",
"ember-cli": "0.2.0", "ember-cli": "0.2.7",
"ember-cli-app-version": "0.3.3", "ember-cli-app-version": "0.3.3",
"ember-cli-auto-register-helpers": "0.0.3", "ember-cli-auto-register-helpers": "0.0.3",
"ember-cli-babel": "^4.0.0", "ember-cli-babel": "^5.0.0",
"ember-cli-content-security-policy": "0.4.0", "ember-cli-content-security-policy": "0.4.0",
"ember-cli-dependency-checker": "0.0.8", "ember-cli-dependency-checker": "^1.0.0",
"ember-cli-font-awesome": "0.0.9", "ember-cli-font-awesome": "0.0.9",
"ember-cli-htmlbars": "^0.7.0", "ember-cli-htmlbars": "^0.7.6",
"ember-cli-inject-live-reload": "^1.3.0", "ember-cli-inject-live-reload": "^1.3.0",
"ember-cli-moment": "0.0.1", "ember-cli-moment": "0.0.1",
"ember-cli-qunit": "0.3.9", "ember-cli-qunit": "0.3.13",
"ember-cli-uglify": "1.0.1", "ember-cli-uglify": "^1.0.1",
"ember-export-application-global": "^1.0.2", "ember-export-application-global": "^1.0.2",
"ember-inline-svg": "^0.1.2", "ember-inline-svg": "^0.1.2",
"ember-truth-helpers": "0.0.5", "ember-truth-helpers": "0.0.5",

View File

@ -1,15 +1,15 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd"> <!DOCTYPE cross-domain-policy SYSTEM "http://www.adobe.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy> <cross-domain-policy>
<!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html --> <!-- Read this: www.adobe.com/devnet/articles/crossdomain_policy_file_spec.html -->
<!-- Most restrictive policy: --> <!-- Most restrictive policy: -->
<site-control permitted-cross-domain-policies="none"/> <site-control permitted-cross-domain-policies="none"/>
<!-- Least restrictive policy: --> <!-- Least restrictive policy: -->
<!-- <!--
<site-control permitted-cross-domain-policies="all"/> <site-control permitted-cross-domain-policies="all"/>
<allow-access-from domain="*" to-ports="*" secure="false"/> <allow-access-from domain="*" to-ports="*" secure="false"/>
<allow-http-request-headers-from domain="*" headers="*" secure="false"/> <allow-http-request-headers-from domain="*" headers="*" secure="false"/>
--> -->
</cross-domain-policy> </cross-domain-policy>

View File

@ -1,6 +1,7 @@
{ {
"framework": "qunit", "framework": "qunit",
"test_page": "tests/index.html?hidepassed", "test_page": "tests/index.html?hidepassed",
"disable_watching": true,
"launch_in_ci": [ "launch_in_ci": [
"PhantomJS" "PhantomJS"
], ],