Revision f8aa9fc3 snf-cyclades-app/synnefo/ui/static/snf/js/neutron.js

b/snf-cyclades-app/synnefo/ui/static/snf/js/neutron.js
345 345
            return attachment.firewallProfile
346 346
          } 
347 347
        ],
348
        
348
        'ext_status': [
349
          ['status'], function() {
350
            if (_.contains(["DISCONNECTING"], this.get('ext_status'))) {
351
              return this.get("ext_status")
352
            }
353
            return this.get("status")
354
          }
355
        ],
356
        'in_progress': [
357
          ['ext_status'], function() {
358
            return _.contains(["DISCONNECTING", "CONNECTING"], this.get("status"))
359
          }
360
        ],
349 361
        'firewall_running': [
350 362
          ['firewall_status', 'pending_firewall'], function(status, pending) {
351 363
              var pending = this.get('pending_firewall');
......
376 388
        var network = this.get('network');
377 389
        network.pending_disconnects++;
378 390
        network.update_connecting_status();
379
        this.destroy({complete: cb, silent: true});
391
        var complete = _.bind(function() {
392
          this.set({'status': 'DISCONNECTING'});
393
          cb();
394
        }, this);
395
        this.destroy({complete: complete, silent: true});
380 396
      }
381 397
    });
382 398

  
......
417 433
          return status_ok
418 434
        }],
419 435
        'disconnect': [['status'], function() {
420
          var status_ok = _.contains(['CONNECTED'], this.get('status'))
436
          var status_ok = _.contains(['ACTIVE', 'CONNECTED'], this.get('status'))
421 437
          return status_ok
422 438
        }]
423 439
      },
424 440

  
425 441
      proxy_attrs: {
442
        'ext_status': [
443
          ['status'], function() {
444
           if (_.contains(["DISCONNECTING"], this.get("ext_status"))) {
445
            return this.get("ext_status")
446
           }
447
           return this.get("status")
448
        }],
426 449
        'ip': [
427 450
          ['floating_ip_adress'], function() {
428 451
            return this.get('floating_ip_address'); 
......
439 462
          ['port_id', 'port'], function() {
440 463
            var val = this.get('port_id');
441 464
            if (!val) {
442
              return 'DISCONNECTED'
465
                return 'DISCONNECTED'
443 466
            } else {
444 467
              if (this.get('port')) {
445 468
                return 'CONNECTED'
......
452 475
      },
453 476

  
454 477
      disconnect: function(cb) {
455
        var self = this;
456
        var complete = function() {
457
          self.set({status: 'DISCONNECTING'});
458
          cb();
459
        }
460 478
        this.get('port').disconnect(cb);
461 479
      }
462 480
    });

Also available in: Unified diff