Revision d4d51f2d

b/snf-cyclades-app/synnefo/ui/static/snf/js/ui/web/ui_create_view.js
1205 1205
                item_cls: views.CreateColumnIPOptionView,
1206 1206
                empty_msg: 'No IP addresses available. <span><a href="">Create a new IP address.</a></span>',
1207 1207
                select_first_as_default: true,
1208
                filter_items: function(model) { return !model.get_vm() },
1208
                filter_items: function(model) { return model.get_vm() && model.get('state')},
1209 1209
                init_events: function() {
1210
                  var msg = this.$(".empty span a");
1210 1211
                  this.$(".create-ip-address").click(function() {
1211 1212
                      snf.ui.main.public_ips_view.show(create_view);
1212 1213
                  });
1213 1214
                  this.$(".empty a").bind('click', function(e) {
1214 1215
                      e.preventDefault();
1216
                      msg.text("Creating...");
1215 1217
                      synnefo.storage.public_ips.create({address:undefined, pool: undefined}, {
1216 1218
                        error: function() {
1217 1219
                          alert("Cannot create new ip address");
1218 1220
                        },
1219
                        skip_api_errors: true,
1221
                        complete: function() {
1222
                          msg.text("Create a new IP address.");
1223
                          msg.show();
1224
                        },
1225
                        skip_api_error: true,
1220 1226
                      })
1221 1227
                  });
1222 1228
                }

Also available in: Unified diff