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

b/snf-cyclades-app/synnefo/ui/static/snf/js/neutron.js
68 68
            return this.get('router:external') || this.get('public')
69 69
          } 
70 70
        ],
71
        'cidr': [
72
          ['subnet'], function() {
73
            var subnet = this.get('subnet');
74
            if (subnet && subnet.get('cidr')) {
75
              return subnet.get('cidr')
76
            } else {
77
              return undefined
78
            }
79
          }
80
        ],
71 81
        'ext_status': [
72
          ['status'], function(st) {
82
          ['status', 'cidr'], function(st) {
73 83
            if (this.get('ext_status') == 'REMOVING') {
74 84
              return 'REMOVING'
75 85
            }
......
78 88
            } else if (this.pending_disconnects) {
79 89
              return 'DISCONNECTING'
80 90
            } else {
81
              return st
91
              return this.get('status')
82 92
            }
83 93
        }],
84 94
        'in_progress': [
......
91 101
        ]
92 102
      },
93 103
      
104
      storage_attrs: {
105
        'subnets': ['subnets', 'subnet', function(model, attr) {
106
          var subnets = model.get(attr);
107
          if (subnets.length) { return subnets[0] }
108
        }]
109
      },
110

  
94 111
      // call rename api
95 112
      rename: function(new_name, cb) {
96 113
          this.sync("update", this, {
......
113 130
      pending_disconnects: 0,
114 131

  
115 132
      initialize: function() {
116
        models.Network.__super__.initialize.apply(this, arguments);
117 133
        var self = this;
118 134
        this.subnets = new Backbone.FilteredCollection(undefined, {
119 135
          collection: synnefo.storage.subnets,
120 136
          collectionFilter: function(m) {
121 137
            return self.id == m.get('network_id')
122
          }
123
        });
138
        }});
139
        models.Network.__super__.initialize.apply(this, arguments);
124 140
        this.ports = new Backbone.FilteredCollection(undefined, {
125 141
          collection: synnefo.storage.ports,
126 142
          collectionFilter: function(m) {
......
186 202
        'status': 'ACTIVE',
187 203
        'router:external': true,
188 204
        'shared': false,
189
        'rename_disabled': true
205
        'rename_disabled': true,
206
        'subnets': []
190 207
      },
191 208
      
192 209
      initialize: function() {

Also available in: Unified diff