root / snf-cyclades-app / synnefo / ui / new_ui / ui / javascripts / okeanos-ember.js @ 13de11ea
History | View | Annotate | Download (7.7 kB)
1 | d0fe8c12 | Athina Bekakou | /* Init Application */
|
---|---|---|---|
2 | d0fe8c12 | Athina Bekakou | |
3 | d0fe8c12 | Athina Bekakou | window.Okeanos = Ember.Application.create({ |
4 | d0fe8c12 | Athina Bekakou | currentPath: 'vms', |
5 | d0fe8c12 | Athina Bekakou | LOG_TRANSITIONS: true, // To have Ember write out transition events to the log (it can be helpful to see exactly what is going on with the router) |
6 | d0fe8c12 | Athina Bekakou | }); |
7 | d0fe8c12 | Athina Bekakou | |
8 | 13de11ea | Athina Bekakou | Okeanos.ApplicationAdapter = DS.FixtureAdapter.extend();;Ember.Inflector.inflector.uncountable('account');
|
9 | d0fe8c12 | Athina Bekakou | |
10 | b3523ce4 | Athina Bekakou | Okeanos.Account = DS.Model.extend({ |
11 | b3523ce4 | Athina Bekakou | email: DS.attr('string') |
12 | b3523ce4 | Athina Bekakou | }); |
13 | b3523ce4 | Athina Bekakou | |
14 | b3523ce4 | Athina Bekakou | // CHECK can i use a single obj and not an array of obj
|
15 | 13de11ea | Athina Bekakou | Okeanos.Account.FIXTURES = { |
16 | b3523ce4 | Athina Bekakou | id: 001, |
17 | b3523ce4 | Athina Bekakou | email: "athina@mail.com" |
18 | 13de11ea | Athina Bekakou | }; |
19 | b3523ce4 | Athina Bekakou | |
20 | b3523ce4 | Athina Bekakou | |
21 | b3523ce4 | Athina Bekakou | |
22 | b3523ce4 | Athina Bekakou | Okeanos.Vm = DS.Model.extend({ |
23 | b3523ce4 | Athina Bekakou | // id: DS.attr('number'), we do not define it ;)
|
24 | b3523ce4 | Athina Bekakou | name: DS.attr('string'), |
25 | b3523ce4 | Athina Bekakou | hostname: DS.attr('string'), |
26 | b3523ce4 | Athina Bekakou | status: DS.attr('string'), |
27 | b3523ce4 | Athina Bekakou | os: DS.attr()
|
28 | b3523ce4 | Athina Bekakou | }); |
29 | b3523ce4 | Athina Bekakou | |
30 | b3523ce4 | Athina Bekakou | Okeanos.Vm.FIXTURES = |
31 | b3523ce4 | Athina Bekakou | [{ |
32 | b3523ce4 | Athina Bekakou | id: 125355, |
33 | b3523ce4 | Athina Bekakou | name: "web-server", |
34 | b3523ce4 | Athina Bekakou | hostname: "user@snf-38389.vm.okeanos.grnet.gr", |
35 | b3523ce4 | Athina Bekakou | status: "running", |
36 | b3523ce4 | Athina Bekakou | os: "kubuntu" |
37 | b3523ce4 | Athina Bekakou | }, |
38 | b3523ce4 | Athina Bekakou | { |
39 | b3523ce4 | Athina Bekakou | id: 12, |
40 | b3523ce4 | Athina Bekakou | name: "another-server", |
41 | b3523ce4 | Athina Bekakou | hostname: "user@snf-33333.vm.okeanos.grnet.gr", |
42 | b3523ce4 | Athina Bekakou | status: "off", |
43 | b3523ce4 | Athina Bekakou | os: "fedora" |
44 | b3523ce4 | Athina Bekakou | }]; |
45 | b3523ce4 | Athina Bekakou | |
46 | b3523ce4 | Athina Bekakou | Okeanos.Net = DS.Model.extend({ |
47 | b3523ce4 | Athina Bekakou | name: DS.attr('string'), |
48 | b3523ce4 | Athina Bekakou | status: DS.attr('string'), |
49 | b3523ce4 | Athina Bekakou | vms: DS.attr(),
|
50 | b3523ce4 | Athina Bekakou | ips: DS.attr()
|
51 | b3523ce4 | Athina Bekakou | }); |
52 | b3523ce4 | Athina Bekakou | |
53 | b3523ce4 | Athina Bekakou | Okeanos.Net.FIXTURES = |
54 | b3523ce4 | Athina Bekakou | [{ |
55 | b3523ce4 | Athina Bekakou | |
56 | b3523ce4 | Athina Bekakou | }]; |
57 | b3523ce4 | Athina Bekakou | |
58 | b3523ce4 | Athina Bekakou | |
59 | b3523ce4 | Athina Bekakou | |
60 | b3523ce4 | Athina Bekakou | |
61 | b3523ce4 | Athina Bekakou | Okeanos.places = [{ |
62 | b3523ce4 | Athina Bekakou | destination: "vms", |
63 | b3523ce4 | Athina Bekakou | title: "Virtual Machines", |
64 | b3523ce4 | Athina Bekakou | icon: "snf-pc-outline" |
65 | b3523ce4 | Athina Bekakou | }, |
66 | b3523ce4 | Athina Bekakou | { |
67 | b3523ce4 | Athina Bekakou | destination: "nets", |
68 | b3523ce4 | Athina Bekakou | title: "Network", |
69 | b3523ce4 | Athina Bekakou | icon: "snf-network-outline" |
70 | b3523ce4 | Athina Bekakou | |
71 | b3523ce4 | Athina Bekakou | }, |
72 | b3523ce4 | Athina Bekakou | { |
73 | b3523ce4 | Athina Bekakou | destination: "volumes", |
74 | b3523ce4 | Athina Bekakou | title: "Volumes", |
75 | b3523ce4 | Athina Bekakou | icon: "snf-volume-outline" |
76 | b3523ce4 | Athina Bekakou | }, |
77 | b3523ce4 | Athina Bekakou | { |
78 | b3523ce4 | Athina Bekakou | destination: "pithos", |
79 | b3523ce4 | Athina Bekakou | title: "Pithos", |
80 | b3523ce4 | Athina Bekakou | icon: "snf-pithos-outline" |
81 | b3523ce4 | Athina Bekakou | }, |
82 | b3523ce4 | Athina Bekakou | { |
83 | b3523ce4 | Athina Bekakou | destination: "images", |
84 | b3523ce4 | Athina Bekakou | title: "Images", |
85 | b3523ce4 | Athina Bekakou | icon: "snf-image-outline" |
86 | b3523ce4 | Athina Bekakou | }, |
87 | b3523ce4 | Athina Bekakou | { |
88 | b3523ce4 | Athina Bekakou | destination: "snapshots", |
89 | b3523ce4 | Athina Bekakou | title: "Snapshots", |
90 | b3523ce4 | Athina Bekakou | icon: "snf-snapshot-outline" |
91 | b3523ce4 | Athina Bekakou | }, |
92 | b3523ce4 | Athina Bekakou | { |
93 | b3523ce4 | Athina Bekakou | destination: "ips", |
94 | b3523ce4 | Athina Bekakou | title: "IPs", |
95 | b3523ce4 | Athina Bekakou | icon: "snf-nic-outline" |
96 | b3523ce4 | Athina Bekakou | }, |
97 | b3523ce4 | Athina Bekakou | { |
98 | b3523ce4 | Athina Bekakou | destination: "sshkeys", |
99 | b3523ce4 | Athina Bekakou | title: "SSh Keys", |
100 | b3523ce4 | Athina Bekakou | icon: "snf-key-outline" |
101 | b3523ce4 | Athina Bekakou | }]; |
102 | b3523ce4 | Athina Bekakou | |
103 | b3523ce4 | Athina Bekakou | |
104 | b3523ce4 | Athina Bekakou | Okeanos.AllActions = [{ |
105 | b3523ce4 | Athina Bekakou | description:'start', |
106 | b3523ce4 | Athina Bekakou | 'snf-components':['vms'], |
107 | b3523ce4 | Athina Bekakou | 'enabled-status': ['off'], |
108 | b3523ce4 | Athina Bekakou | action: 'is this a function?' |
109 | b3523ce4 | Athina Bekakou | }, |
110 | b3523ce4 | Athina Bekakou | { |
111 | b3523ce4 | Athina Bekakou | description:'destroyElement', |
112 | b3523ce4 | Athina Bekakou | 'snf-components': ['vms', 'nets'], |
113 | b3523ce4 | Athina Bekakou | 'enabled-status': ['all'], |
114 | b3523ce4 | Athina Bekakou | action: 'is this a function?', |
115 | b3523ce4 | Athina Bekakou | }, |
116 | b3523ce4 | Athina Bekakou | { |
117 | b3523ce4 | Athina Bekakou | description:'shutdown', |
118 | b3523ce4 | Athina Bekakou | 'snf-components': ['vms'], |
119 | b3523ce4 | Athina Bekakou | 'enabled-status': ['running'], |
120 | b3523ce4 | Athina Bekakou | action: 'is this a function?' |
121 | b3523ce4 | Athina Bekakou | }, |
122 | b3523ce4 | Athina Bekakou | { |
123 | b3523ce4 | Athina Bekakou | description:'add machine', |
124 | b3523ce4 | Athina Bekakou | 'snf-components': ['nets'], |
125 | b3523ce4 | Athina Bekakou | 'enabled-status': ['active'], |
126 | b3523ce4 | Athina Bekakou | action: 'is this a function?' |
127 | b3523ce4 | Athina Bekakou | }, |
128 | b3523ce4 | Athina Bekakou | { |
129 | b3523ce4 | Athina Bekakou | description:'action for all', |
130 | b3523ce4 | Athina Bekakou | 'snf-components': ['vms', 'nets'], |
131 | b3523ce4 | Athina Bekakou | 'enabled-status': ['all'], |
132 | b3523ce4 | Athina Bekakou | action: 'is this a function?' |
133 | b3523ce4 | Athina Bekakou | }];/* Mapping */
|
134 | d0fe8c12 | Athina Bekakou | |
135 | d0fe8c12 | Athina Bekakou | Okeanos.Router.map(function() {
|
136 | d0fe8c12 | Athina Bekakou | |
137 | d0fe8c12 | Athina Bekakou | for(var i=0; i<Okeanos.places.length; i++) |
138 | d0fe8c12 | Athina Bekakou | this.resource(Okeanos.places[i].destination);
|
139 | d0fe8c12 | Athina Bekakou | }); |
140 | d0fe8c12 | Athina Bekakou | |
141 | d0fe8c12 | Athina Bekakou | |
142 | d0fe8c12 | Athina Bekakou | /* Routes */
|
143 | d0fe8c12 | Athina Bekakou | |
144 | d0fe8c12 | Athina Bekakou | Okeanos.ApplicationRoute = Ember.Route.extend({ |
145 | d0fe8c12 | Athina Bekakou | model: function() { |
146 | d0fe8c12 | Athina Bekakou | |
147 | d0fe8c12 | Athina Bekakou | return {email: 'athina@mail.com'}; |
148 | d0fe8c12 | Athina Bekakou | } |
149 | d0fe8c12 | Athina Bekakou | }); |
150 | d0fe8c12 | Athina Bekakou | |
151 | d0fe8c12 | Athina Bekakou | Okeanos.VmsRoute = Ember.Route.extend({ |
152 | d0fe8c12 | Athina Bekakou | model: function() { |
153 | d0fe8c12 | Athina Bekakou | return this.store.find('vm'); |
154 | d0fe8c12 | Athina Bekakou | }, |
155 | d0fe8c12 | Athina Bekakou | renderTemplate: function(controller) { |
156 | d0fe8c12 | Athina Bekakou | this.render('snfElems', {controller: controller}) |
157 | d0fe8c12 | Athina Bekakou | } |
158 | d0fe8c12 | Athina Bekakou | }); |
159 | d0fe8c12 | Athina Bekakou | |
160 | d0fe8c12 | Athina Bekakou | Okeanos.NetsRoute = Ember.Route.extend({ |
161 | d0fe8c12 | Athina Bekakou | model: function() { |
162 | d0fe8c12 | Athina Bekakou | return [{id: '1', name:'net1', status: 'active'}, {id: '2', name:'net2', status: 'error'}]; |
163 | d0fe8c12 | Athina Bekakou | }, |
164 | d0fe8c12 | Athina Bekakou | renderTemplate: function(controller) { |
165 | d0fe8c12 | Athina Bekakou | this.render('snfElems', {controller: controller}) |
166 | d0fe8c12 | Athina Bekakou | } |
167 | d0fe8c12 | Athina Bekakou | }); |
168 | d0fe8c12 | Athina Bekakou | |
169 | d0fe8c12 | Athina Bekakou | |
170 | d0fe8c12 | Athina Bekakou | /* Controllers */
|
171 | d0fe8c12 | Athina Bekakou | |
172 | d0fe8c12 | Athina Bekakou | Okeanos.ApplicationController = Ember.Controller.extend({ |
173 | d0fe8c12 | Athina Bekakou | updateCurrentPath: function() { |
174 | 13de11ea | Athina Bekakou | // Okeanos.set('currentPath', this.get('currentPath'))
|
175 | 13de11ea | Athina Bekakou | // console.log('AppController: CurrentPath ->', this.get('currentPath'));
|
176 | d0fe8c12 | Athina Bekakou | return this.get('currentPath'); |
177 | d0fe8c12 | Athina Bekakou | }.observes('currentPath'),
|
178 | d0fe8c12 | Athina Bekakou | actions: {
|
179 | d0fe8c12 | Athina Bekakou | test: function() { |
180 | d0fe8c12 | Athina Bekakou | console.log('This is test from Okeanos.ApplicationController');
|
181 | d0fe8c12 | Athina Bekakou | return 0; |
182 | d0fe8c12 | Athina Bekakou | } |
183 | d0fe8c12 | Athina Bekakou | }, |
184 | d0fe8c12 | Athina Bekakou | |
185 | d0fe8c12 | Athina Bekakou | pageTitle : function() { |
186 | d0fe8c12 | Athina Bekakou | var currentPath =this.get('currentPath'); |
187 | d0fe8c12 | Athina Bekakou | if(currentPath!== 'index') return Okeanos.places.findBy('destination', this.get('currentPath')).title; |
188 | d0fe8c12 | Athina Bekakou | else return 'Home'; |
189 | d0fe8c12 | Athina Bekakou | }.property('currentPath'),
|
190 | d0fe8c12 | Athina Bekakou | |
191 | d0fe8c12 | Athina Bekakou | // name: "okeanos application",
|
192 | d0fe8c12 | Athina Bekakou | }); |
193 | d0fe8c12 | Athina Bekakou | |
194 | d0fe8c12 | Athina Bekakou | |
195 | d0fe8c12 | Athina Bekakou | Okeanos.ElemsController = Ember.ArrayController.extend({ |
196 | d0fe8c12 | Athina Bekakou | // ElementController: 'vm',
|
197 | d0fe8c12 | Athina Bekakou | type: undefined, |
198 | d0fe8c12 | Athina Bekakou | itemController: function(){ |
199 | d0fe8c12 | Athina Bekakou | var type = this.type; |
200 | d0fe8c12 | Athina Bekakou | console.log('type ', type.substring(0, type.length - 1)) |
201 | d0fe8c12 | Athina Bekakou | return type.substring(0, type.length - 1); |
202 | d0fe8c12 | Athina Bekakou | }.property(), |
203 | d0fe8c12 | Athina Bekakou | icon: function() { |
204 | d0fe8c12 | Athina Bekakou | return Okeanos.places.findBy('destination', this.get('type')).icon.replace('outline', 'full'); |
205 | d0fe8c12 | Athina Bekakou | }.property(), |
206 | d0fe8c12 | Athina Bekakou | hasOS: function(){ |
207 | d0fe8c12 | Athina Bekakou | if(Okeanos.get('currentPath') == "vms") |
208 | d0fe8c12 | Athina Bekakou | return true; |
209 | d0fe8c12 | Athina Bekakou | else return false; |
210 | d0fe8c12 | Athina Bekakou | }.property(), |
211 | b3523ce4 | Athina Bekakou | hasTags: function(){ |
212 | b3523ce4 | Athina Bekakou | if(Okeanos.get('currentPath') == "vms") |
213 | b3523ce4 | Athina Bekakou | return true; |
214 | b3523ce4 | Athina Bekakou | else return false; |
215 | b3523ce4 | Athina Bekakou | }.property(), |
216 | d0fe8c12 | Athina Bekakou | }); |
217 | d0fe8c12 | Athina Bekakou | |
218 | d0fe8c12 | Athina Bekakou | Okeanos.VmsController = Okeanos.ElemsController.extend({ |
219 | d0fe8c12 | Athina Bekakou | type: 'vms' |
220 | d0fe8c12 | Athina Bekakou | }); |
221 | d0fe8c12 | Athina Bekakou | |
222 | d0fe8c12 | Athina Bekakou | |
223 | d0fe8c12 | Athina Bekakou | Okeanos.NetsController = Okeanos.ElemsController.extend({ |
224 | d0fe8c12 | Athina Bekakou | type: 'nets' |
225 | d0fe8c12 | Athina Bekakou | }); |
226 | d0fe8c12 | Athina Bekakou | |
227 | d0fe8c12 | Athina Bekakou | |
228 | d0fe8c12 | Athina Bekakou | Okeanos.ElemController = Ember.ObjectController.extend({ |
229 | d0fe8c12 | Athina Bekakou | needs: [],
|
230 | d0fe8c12 | Athina Bekakou | actionsList: Okeanos.AllActions,
|
231 | d0fe8c12 | Athina Bekakou | setAvailableActions: function() { |
232 | d0fe8c12 | Athina Bekakou | var parent = this.needs; |
233 | d0fe8c12 | Athina Bekakou | var self = this; |
234 | d0fe8c12 | Athina Bekakou | return this.actionsList.filter(function(el) { |
235 | d0fe8c12 | Athina Bekakou | return _.contains(el['snf-components'], self.get('controllers.'+parent).type) &&( _.contains(el['enabled-status'], self.get('model.status')) || _.contains(el['enabled-status'], 'all')); |
236 | d0fe8c12 | Athina Bekakou | }) |
237 | d0fe8c12 | Athina Bekakou | // return this.actionsList
|
238 | d0fe8c12 | Athina Bekakou | }.property(), |
239 | d0fe8c12 | Athina Bekakou | createBtn: false, |
240 | d0fe8c12 | Athina Bekakou | actions: {
|
241 | d0fe8c12 | Athina Bekakou | shutdown: function(param) { |
242 | d0fe8c12 | Athina Bekakou | console.log(this.get('model.status')); |
243 | d0fe8c12 | Athina Bekakou | this.set('model.status', 'shutting') |
244 | d0fe8c12 | Athina Bekakou | console.log(this.get('model.status')); |
245 | d0fe8c12 | Athina Bekakou | // this.set('building')
|
246 | d0fe8c12 | Athina Bekakou | }, |
247 | d0fe8c12 | Athina Bekakou | destroyElement: function(param) { |
248 | d0fe8c12 | Athina Bekakou | var element = this.get('model'); |
249 | d0fe8c12 | Athina Bekakou | element.deleteRecord(); |
250 | d0fe8c12 | Athina Bekakou | element.save(); |
251 | d0fe8c12 | Athina Bekakou | } |
252 | d0fe8c12 | Athina Bekakou | } |
253 | d0fe8c12 | Athina Bekakou | }); |
254 | d0fe8c12 | Athina Bekakou | |
255 | d0fe8c12 | Athina Bekakou | Okeanos.VmController = Okeanos.ElemController.extend({ |
256 | d0fe8c12 | Athina Bekakou | needs: ['vms'] |
257 | d0fe8c12 | Athina Bekakou | }); |
258 | d0fe8c12 | Athina Bekakou | |
259 | d0fe8c12 | Athina Bekakou | Okeanos.NetController = Okeanos.ElemController.extend({ |
260 | d0fe8c12 | Athina Bekakou | needs: ['nets'] |
261 | d0fe8c12 | Athina Bekakou | }); |
262 | d0fe8c12 | Athina Bekakou | |
263 | d0fe8c12 | Athina Bekakou | |
264 | d0fe8c12 | Athina Bekakou | /* Views */
|
265 | d0fe8c12 | Athina Bekakou | |
266 | d0fe8c12 | Athina Bekakou | Okeanos.NavIconView = Ember.View.extend({ |
267 | d0fe8c12 | Athina Bekakou | tagName: 'span', |
268 | d0fe8c12 | Athina Bekakou | click: function(e) { |
269 | d0fe8c12 | Athina Bekakou | var parentEl = this.$().parent('a'); |
270 | d0fe8c12 | Athina Bekakou | var currentEl = this.$().parents('li').siblings('li').find('a.current'); |
271 | d0fe8c12 | Athina Bekakou | |
272 | d0fe8c12 | Athina Bekakou | ui.replaceClass(currentEl, 'full', 'outline', 'snf-'); |
273 | d0fe8c12 | Athina Bekakou | ui.replaceClass(parentEl, 'outline', 'full', 'snf-'); |
274 | d0fe8c12 | Athina Bekakou | } |
275 | d0fe8c12 | Athina Bekakou | |
276 | d0fe8c12 | Athina Bekakou | }); |
277 | d0fe8c12 | Athina Bekakou | |
278 | d0fe8c12 | Athina Bekakou | Okeanos.NavigationView = Ember.CollectionView.extend({ |
279 | d0fe8c12 | Athina Bekakou | tagName: "ul", |
280 | d0fe8c12 | Athina Bekakou | classNames: ['icons-nav'], |
281 | d0fe8c12 | Athina Bekakou | |
282 | d0fe8c12 | Athina Bekakou | content: Okeanos.places,
|
283 | d0fe8c12 | Athina Bekakou | itemViewClass: Ember.View.extend({
|
284 | d0fe8c12 | Athina Bekakou | template: Ember.TEMPLATES["navigationItem"] |
285 | d0fe8c12 | Athina Bekakou | }), |
286 | d0fe8c12 | Athina Bekakou | }); |
287 | d0fe8c12 | Athina Bekakou | |
288 | d0fe8c12 | Athina Bekakou | |
289 | d0fe8c12 | Athina Bekakou | Okeanos.ElemView = Ember.View.extend({ |
290 | d0fe8c12 | Athina Bekakou | // templateName: 'elem',
|
291 | b3523ce4 | Athina Bekakou | addNewBtn: false, |
292 | d0fe8c12 | Athina Bekakou | template: Ember.TEMPLATES['snfElem'], |
293 | d0fe8c12 | Athina Bekakou | tagName: 'li', |
294 | d0fe8c12 | Athina Bekakou | classNameBindings: ['status'], |
295 | d0fe8c12 | Athina Bekakou | attributeBindings: ['data-status'], |
296 | d0fe8c12 | Athina Bekakou | 'data-status': function() { |
297 | d0fe8c12 | Athina Bekakou | return this.status; |
298 | d0fe8c12 | Athina Bekakou | }.property(), |
299 | d0fe8c12 | Athina Bekakou | status: function() { |
300 | d0fe8c12 | Athina Bekakou | return this.get('controller.status'); |
301 | d0fe8c12 | Athina Bekakou | }.property('controller.status')
|
302 | b3523ce4 | Athina Bekakou | }); |
303 | d0fe8c12 | Athina Bekakou | |
304 | d0fe8c12 | Athina Bekakou | |
305 | d0fe8c12 | Athina Bekakou | /* Components */
|
306 | d0fe8c12 | Athina Bekakou | |
307 | 13de11ea | Athina Bekakou | Okeanos.Btn1Component = Ember.Component.extend({ |
308 | d0fe8c12 | Athina Bekakou | tagName: 'a', |
309 | d0fe8c12 | Athina Bekakou | click: function() { |
310 | d0fe8c12 | Athina Bekakou | this.sendAction("action", this.get('param')); |
311 | d0fe8c12 | Athina Bekakou | } |
312 | d0fe8c12 | Athina Bekakou | }); |
313 | d0fe8c12 | Athina Bekakou | |
314 | b3523ce4 | Athina Bekakou | Okeanos.AddNewComponent = Ember.Component.extend({ |
315 | b3523ce4 | Athina Bekakou | template: Ember.TEMPLATES['snfElem'], |
316 | b3523ce4 | Athina Bekakou | addNewBtn: true, |
317 | b3523ce4 | Athina Bekakou | icon: function() { |
318 | b3523ce4 | Athina Bekakou | baseIcon = Okeanos.places.findBy('destination', this.get('type')).icon; |
319 | b3523ce4 | Athina Bekakou | return baseIcon.replace('outline', 'create-full'); |
320 | b3523ce4 | Athina Bekakou | }.property(), |
321 | b3523ce4 | Athina Bekakou | tagName: 'li', |
322 | b3523ce4 | Athina Bekakou | status: 'add-new', |
323 | b3523ce4 | Athina Bekakou | classNameBindings: ['status'], |
324 | b3523ce4 | Athina Bekakou | attributeBindings: ['data-status'], |
325 | b3523ce4 | Athina Bekakou | 'data-status': function() { |
326 | b3523ce4 | Athina Bekakou | return this.status; |
327 | b3523ce4 | Athina Bekakou | }.property(), |
328 | b3523ce4 | Athina Bekakou | name: function() { |
329 | b3523ce4 | Athina Bekakou | var msg = 'Add New '; |
330 | b3523ce4 | Athina Bekakou | var btnType = this.get('type') |
331 | b3523ce4 | Athina Bekakou | if(btnType === 'vms') |
332 | b3523ce4 | Athina Bekakou | return msg + 'Machine'; |
333 | b3523ce4 | Athina Bekakou | else if(btnType === 'nets') |
334 | b3523ce4 | Athina Bekakou | return msg + 'Network'; |
335 | b3523ce4 | Athina Bekakou | }.property() |
336 | b3523ce4 | Athina Bekakou | |
337 | b3523ce4 | Athina Bekakou | }) |
338 | d0fe8c12 | Athina Bekakou | |
339 | d0fe8c12 | Athina Bekakou | Okeanos.LoginMenuComponent = Ember.Component.extend({ |
340 | d0fe8c12 | Athina Bekakou | classNames: ['login'], |
341 | d0fe8c12 | Athina Bekakou | didInsertElement: function() { |
342 | d0fe8c12 | Athina Bekakou | console.log('didInsertElement');
|
343 | d0fe8c12 | Athina Bekakou | var self = this.$(); |
344 | d0fe8c12 | Athina Bekakou | self.mouseenter(function(e){
|
345 | d0fe8c12 | Athina Bekakou | self.find('ul').stop(true, true).slideDown(200); |
346 | d0fe8c12 | Athina Bekakou | }); |
347 | d0fe8c12 | Athina Bekakou | self.mouseleave(function(e){
|
348 | d0fe8c12 | Athina Bekakou | self.find('ul').stop(true, true).slideUp(200); |
349 | d0fe8c12 | Athina Bekakou | }); |
350 | d0fe8c12 | Athina Bekakou | |
351 | d0fe8c12 | Athina Bekakou | } |
352 | d0fe8c12 | Athina Bekakou | }); |