OLD | NEW |
1 'use strict'; | 1 'use strict'; |
2 | 2 |
3 /** | 3 /** |
4 * Provide the service views and mixins. | 4 * Provide the service views and mixins. |
5 * | 5 * |
6 * @module views | 6 * @module views |
7 * @submodule views.services | 7 * @submodule views.services |
8 */ | 8 */ |
9 | 9 |
10 YUI.add('juju-view-service', function(Y) { | 10 YUI.add('juju-view-service', function(Y) { |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 return { | 450 return { |
451 viewName: 'relations', | 451 viewName: 'relations', |
452 tabs: this.getServiceTabs('relations'), | 452 tabs: this.getServiceTabs('relations'), |
453 service: service.getAttrs(), | 453 service: service.getAttrs(), |
454 landscape: this.get('landscape'), | 454 landscape: this.get('landscape'), |
455 serviceModel: service, | 455 serviceModel: service, |
456 relations: relation_data, | 456 relations: relation_data, |
457 charm: charm_attrs, | 457 charm: charm_attrs, |
458 charm_id: charm_id, | 458 charm_id: charm_id, |
459 serviceIsJujuGUI: utils.isGuiCharmUrl(charm_id), | 459 serviceIsJujuGUI: utils.isGuiCharmUrl(charm_id), |
460 serviceRemoteUri: this.get('_nsRouter').url({ gui: '/service/'}) | 460 serviceRemoteUri: this.get('nsRouter').url({ gui: '/service/'}) |
461 }; | 461 }; |
462 }, | 462 }, |
463 | 463 |
464 render: function() { | 464 render: function() { |
465 var container = this.get('container'); | 465 var container = this.get('container'); |
466 var service = this.get('model'); | 466 var service = this.get('model'); |
467 if (!service || !service.get('loaded')) { | 467 if (!service || !service.get('loaded')) { |
468 container.setHTML('<div class="alert">Loading...</div>'); | 468 container.setHTML('<div class="alert">Loading...</div>'); |
469 console.log('waiting on service data'); | 469 console.log('waiting on service data'); |
470 } else { | 470 } else { |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
972 } else { // Otherwise just return all the units we were given. | 972 } else { // Otherwise just return all the units we were given. |
973 return units; | 973 return units; |
974 } | 974 } |
975 }, | 975 }, |
976 | 976 |
977 events: { | 977 events: { |
978 'div.unit': {click: function(ev) { | 978 'div.unit': {click: function(ev) { |
979 var id = ev.currentTarget.get('id'); | 979 var id = ev.currentTarget.get('id'); |
980 console.log('Unit clicked', id); | 980 console.log('Unit clicked', id); |
981 this.fire('navigateTo', { | 981 this.fire('navigateTo', { |
982 url: this.get('_nsRouter').url({ | 982 url: this.get('nsRouter').url({ |
983 gui: '/unit/' + id.replace('/', '-') + '/' | 983 gui: '/unit/' + id.replace('/', '-') + '/' |
984 }) | 984 }) |
985 }); | 985 }); |
986 }} | 986 }} |
987 } | 987 } |
988 }, { | 988 }, { |
989 ATTRS: { | 989 ATTRS: { |
990 /** | 990 /** |
991 Applications router utility methods | 991 Applications router utility methods |
992 | 992 |
993 @attribute _nsRouter | 993 @attribute nsRouter |
994 */ | 994 */ |
995 _nsRouter: {} | 995 nsRouter: {} |
996 } | 996 } |
997 }); | 997 }); |
998 | 998 |
999 views.service = ServiceView; | 999 views.service = ServiceView; |
1000 | 1000 |
1001 }, '0.1.0', { | 1001 }, '0.1.0', { |
1002 requires: ['panel', | 1002 requires: ['panel', |
1003 'juju-view-utils', | 1003 'juju-view-utils', |
1004 'juju-models', | 1004 'juju-models', |
1005 'base-build', | 1005 'base-build', |
1006 'handlebars', | 1006 'handlebars', |
1007 'node', | 1007 'node', |
1008 'view', | 1008 'view', |
1009 'event-key', | 1009 'event-key', |
1010 'transition', | 1010 'transition', |
1011 'event-resize', | 1011 'event-resize', |
1012 'json-stringify'] | 1012 'json-stringify'] |
1013 }); | 1013 }); |
OLD | NEW |