Revision 75e13060
b/snf-cyclades-app/synnefo/ui/new_ui/ui/app/components/reveal-modal.js | ||
---|---|---|
1 | 1 |
App.RevealModalComponent = Ember.Component.extend({ |
2 |
classNames: ['reveal-modal', 'medium'], |
|
3 | 2 |
actions: { |
4 | 3 |
ok: function () { |
5 |
this.sendAction("ok"); |
|
4 |
this.sendAction("ok", this.get('param')); |
|
5 |
$(this.$()[0]).foundation('reveal', 'close'); |
|
6 | 6 |
}, |
7 | 7 |
close: function () { |
8 | 8 |
$(this.$()[0]).foundation('reveal', 'close'); |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/app/controllers/vm.js | ||
---|---|---|
28 | 28 |
}, |
29 | 29 |
|
30 | 30 |
dettachVolume: function(volume){ |
31 |
this.get('model').get('volumes').removeObject(volume);
|
|
31 |
volume.get('vm').get('volumes').removeObject(volume);
|
|
32 | 32 |
}, |
33 | 33 |
|
34 | 34 |
modalConnect: function(){ |
... | ... | |
75 | 75 |
App.VmInfoController = App.VmController.extend(); |
76 | 76 |
|
77 | 77 |
App.VmDiskConnectedController = App.VmController.extend(); |
78 |
|
b/snf-cyclades-app/synnefo/ui/new_ui/ui/app/controllers/volume.js | ||
---|---|---|
17 | 17 |
'icon': 'snf-pc-outline', |
18 | 18 |
}, |
19 | 19 |
], |
20 |
actions: { |
|
21 |
dettachVolume: function(volume){ |
|
22 |
volume.get('vm').get('volumes').removeObject(volume); |
|
23 |
}, |
|
24 |
} |
|
20 | 25 |
}); |
21 | 26 |
|
22 | 27 |
App.DettachVolumeModalController = Ember.Controller.extend(); |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/app/models/port.js | ||
---|---|---|
1 |
App.Port = DS.Model.extend({ |
|
2 |
|
|
3 |
device_id : DS.belongsTo('vm', {async:true}), |
|
4 |
network_id : DS.belongsTo('network', {async:true}), |
|
5 |
|
|
6 |
}); |
|
7 |
|
|
8 |
|
|
9 |
App.Port.FIXTURES = [ |
|
10 |
{ |
|
11 |
id: 1, |
|
12 |
device_id: 1, |
|
13 |
network_id: 1, |
|
14 |
}, |
|
15 |
{ |
|
16 |
id: 2, |
|
17 |
device_id: 1, |
|
18 |
network_id: 1, |
|
19 |
}, |
|
20 |
{ |
|
21 |
id: 3, |
|
22 |
device_id: 1, |
|
23 |
network_id: 1, |
|
24 |
}, |
|
25 |
]; |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/app/models/vm.js | ||
---|---|---|
9 | 9 |
networks : DS.hasMany('network', { async:true }), |
10 | 10 |
tags : DS.hasMany('tag', { async:true }), |
11 | 11 |
volumes : DS.hasMany('volume', { async:true}), |
12 |
ports : DS.hasMany('port', { async: true}), |
|
12 | 13 |
|
13 | 14 |
/*flavor : DS.attr('raw'),*/ |
14 | 15 |
|
... | ... | |
32 | 33 |
networks: [1,2], |
33 | 34 |
tags: [1,2,3], |
34 | 35 |
volumes: [1,2], |
36 |
ports: [1,2], |
|
35 | 37 |
}, |
36 | 38 |
{ |
37 | 39 |
id: 2, |
... | ... | |
43 | 45 |
networks: [1], |
44 | 46 |
tags: [4,5,6], |
45 | 47 |
volumes: [3], |
48 |
ports: [1,2,3] |
|
46 | 49 |
}, |
47 | 50 |
{ |
48 | 51 |
id: 3, |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/app/models/volume.js | ||
---|---|---|
4 | 4 |
status : DS.attr(), |
5 | 5 |
size : DS.attr('number'), |
6 | 6 |
storageType : DS.attr('string', {defaultValue: 'Archipelago'}), |
7 |
vm : DS.belongsTo('vm', { async:true }),
|
|
7 |
vm : DS.belongsTo('vm', { async:false }),
|
|
8 | 8 |
|
9 | 9 |
enabledActions: function() { |
10 | 10 |
return statusActionsVolume[this.get('status')].enabledActions; |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/app/routes/application.js | ||
---|---|---|
1 | 1 |
App.ApplicationRoute = Ember.Route.extend({ |
2 | 2 |
actions: { |
3 |
openModal: function(modalName, model) { |
|
4 |
this.controllerFor(modalName).set('model', model); |
|
5 |
$('#dettach-volume-modal').foundation('reveal','open'); |
|
3 |
openModal: function(modalName, controller, model) { |
|
4 |
|
|
5 |
this.controllerFor(controller).set("model", model); |
|
6 |
this.render(modalName, { |
|
7 |
into: 'application', |
|
8 |
outlet: 'modal', |
|
9 |
controller: controller, |
|
10 |
}); |
|
11 |
$('#app-modal').foundation('reveal','open'); |
|
6 | 12 |
}, |
7 | 13 |
} |
8 | 14 |
}); |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/app/templates/_modals.hbs | ||
---|---|---|
1 | 1 |
<section class="overlay-area-reveal"> |
2 |
{{render 'dettach-volume-modal' volume}} |
|
3 |
|
|
2 |
{{outlet modal}} |
|
4 | 3 |
{{!-- {{reveal-modal id="modal-connect"}} |
5 | 4 |
{{reveal-modal id="modal-start" hasButtons="true"}} |
6 | 5 |
{{reveal-modal id="modal-reboot" hasButtons="true"}} |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/app/templates/application.hbs | ||
---|---|---|
1 | 1 |
{{partial "header"}} |
2 |
{{partial "modals"}} |
|
2 |
<div id="app-modal" class="medium reveal-modal" data-reveal> |
|
3 |
{{outlet modal}} |
|
4 |
</div> |
|
3 | 5 |
|
4 | 6 |
<div class="body-wrapper"> |
5 | 7 |
{{outlet}} |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/app/templates/components/reveal-modal.hbs | ||
---|---|---|
1 | 1 |
{{ yield }} |
2 | 2 |
|
3 | 3 |
{{#if hasButtons}} |
4 |
{{foo}} |
|
4 | 5 |
<p class="buttons"> |
5 | 6 |
<a href="" {{ action "ok" }} class="btn4"><span>Yes</span></a> |
6 | 7 |
<a href="" {{ action "close" }} class="btn4"><span>No</span></a> |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/app/templates/dettach-volume-modal.hbs | ||
---|---|---|
1 |
{{#reveal-modal id="dettach-volume-modal" hasButtons="true" ok="dettachVolume"}} |
|
2 |
<p>Are you sure you want to dettach this Volume?</p>
|
|
1 |
{{#reveal-modal id="dettach-volume-modal" hasButtons="true" ok="dettachVolume" param=model}}
|
|
2 |
<p>Are you sure you want to dettach this Volume from {{model.get('vm').name}}? </p>
|
|
3 | 3 |
{{/reveal-modal}} |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/app/templates/volume-el.hbs | ||
---|---|---|
3 | 3 |
<div class="img-wrap"> |
4 | 4 |
<span class="snf-volume-full snf-font"></span> |
5 | 5 |
</div> |
6 |
<h4>{{volume.name}}</h4>
|
|
6 |
<h4>{{name}}</h4> |
|
7 | 7 |
</div> |
8 | 8 |
<div class="clearfix"> |
9 | 9 |
<ul class="connections"> |
10 | 10 |
<li> |
11 |
<a href="#" {{action 'openModal' 'dettach-volume-modal' model}} class="act" > </a> |
|
11 |
<a href="#" {{action 'openModal' 'dettach-volume-modal' 'volume' model}} class="act" > </a>
|
|
12 | 12 |
<div class="icon"></div> |
13 | 13 |
<div class="data"> |
14 | 14 |
<ul> |
15 | 15 |
<li> |
16 | 16 |
<h5 class="volume-data">Size</h5> |
17 |
<p>{{bytes-to-human volume.size}}</p>
|
|
17 |
<p>{{bytes-to-human size}}</p> |
|
18 | 18 |
</li> |
19 | 19 |
<li> |
20 | 20 |
<h5 class="volume-data">Storage Type</h5> |
b/snf-cyclades-app/synnefo/ui/new_ui/ui/app/templates/volumes-list.hbs | ||
---|---|---|
1 |
{{#each volume in this.volumes}} |
|
1 |
{{#each volume in this.volumes itemController="Volume"}}
|
|
2 | 2 |
{{view App.VolumeElView}} |
3 | 3 |
{{/each}} |
Also available in: Unified diff