100
100
createSnapshot : function () {
101
101
var image = this.getSelectedImage();
102
102
if (image == null) return;
103
var wrap = function(list) {
104
var wrap = function(snapId) {
105
// Replicate the volume tag for this snapshot
106
var tag = me.getSelectedImage().tag;
107
if (tag && tag.length > 0) {
108
ec2ui_session.setResourceTag(snapId, tag);
104
110
if (ec2ui_prefs.isRefreshOnChangeEnabled()) {
105
111
ec2ui_SnapshotTreeView.refresh();
112
ec2ui_SnapshotTreeView.selectByImageId(snapId);
108
115
ec2ui_session.controller.createSnapshot(image.id, wrap);
111
118
createVolume : function () {
112
119
var retVal = {ok:null};
113
window.openDialog("chrome://ec2ui/content/dialog_new_volume.xul", null, "chrome,centerscreen,modal", null, ec2ui_session, retVal);
120
window.openDialog("chrome://ec2ui/content/dialog_new_volume.xul",
122
"chrome,centerscreen,modal",
116
var wrap = function(list) {
117
if (ec2ui_prefs.isRefreshOnChangeEnabled()) {
128
var wrap = function(id) {
130
me.selectByImageId(id);
132
ec2ui_session.controller.createVolume(retVal.size,
137
// Let's tag this volume
139
var vol = this.getSelectedImage();
141
vol.tag = retVal.tag;
142
ec2ui_session.setResourceTag(vol.id, vol.tag);
121
ec2ui_session.controller.createVolume(
149
168
log("Device Selected for instance: " + device);
152
var wrap = function(list) {
171
var wrap = function() {
153
172
if (ec2ui_prefs.isRefreshOnChangeEnabled()) {
158
ec2ui_session.controller.attachVolume(
177
ec2ui_session.controller.attachVolume(volumeId,
165
183
attachVolume : function () {
166
184
var image = this.getSelectedImage();
167
185
if (image == null) return;
168
186
var retVal = {ok:null};
169
window.openDialog("chrome://ec2ui/content/dialog_new_attachment.xul", null, "chrome,centerscreen,modal", image, ec2ui_session, retVal);
171
if (retVal.device.length == 0) {
172
// If this is a Windows instance, the device should be windows_device
188
window.openDialog("chrome://ec2ui/content/dialog_new_attachment.xul",
190
"chrome,centerscreen,modal",
195
// If this is a Windows instance,
196
// the device should be windows_device
197
// and the instance should be ready to use
173
198
var instances = ec2ui_session.model.getInstances();
174
200
for (var i in instances) {
175
if (instances[i].id == retVal.instanceId) {
176
if (isWindows(instances[i].platform)) {
201
instance = instances[i];
202
if (instance.id == retVal.instanceId) {
203
if (!ec2ui_InstancesTreeView.isInstanceReadyToUse(instance)) {
204
// The selected instance is not ready to
208
if (isWindows(instance.platform)) {
177
209
retVal.device = "windows_device";
179
211
// The 2 if conditions aren't folded into 1