\r
\r
\r
- getByName: function (name) {\r
+ getByCid: function (cid) {\r
if (typeof name !== 'string') return;\r
\r
return this.find(function (c) {\r
- return name.toLowerCase() === c.get('name').toLowerCase();\r
- });\r
- }\r
-});\r
-\r
-\r
-\r
-_kiwi.model.NetworkPanelList = Backbone.Collection.extend({\r
- model: _kiwi.model.Network,\r
-\r
- initialize: function() {\r
- this.view = new _kiwi.view.NetworkTabs({model: this});\r
- \r
- this.on('add', this.onNetworkAdd, this);\r
- this.on('remove', this.onNetworkRemove, this);\r
-\r
- // Current active connection / panel\r
- this.active_connection = undefined;\r
- this.active_panel = undefined;\r
-\r
- // TODO: Remove this - legacy\r
- this.active = undefined;\r
- },\r
-\r
- getByConnectionId: function(id) {\r
- return this.find(function(connection){\r
- return connection.get('connection_id') == id;\r
+ return cid === c.cid;\r
});\r
},\r
\r
- panels: function() {\r
- var panels = [];\r
-\r
- this.each(function(network) {\r
- panels = panels.concat(network.panels.models);\r
- });\r
\r
- return panels;\r
- },\r
\r
+ getByName: function (name) {\r
+ if (typeof name !== 'string') return;\r
\r
- onNetworkAdd: function(network) {\r
- network.panels.on('active', this.onPanelActive, this);\r
-\r
- // if it's our first connection, set it active\r
- if (this.models.length === 1) {\r
- this.active_connection = network;\r
- this.active_panel = network.panels.server;\r
-\r
- // TODO: Remove this - legacy\r
- this.active = this.active_panel;\r
- }\r
- },\r
-\r
- onNetworkRemove: function(network) {\r
- network.panels.off('active', this.onPanelActive, this);\r
- },\r
-\r
- onPanelActive: function(panel) {\r
- var connection = this.getByConnectionId(panel.tab.data('connection_id'));\r
- this.trigger('active', panel, connection);\r
-\r
- this.active_connection = connection;\r
- this.active_panel = panel;\r
-\r
- // TODO: Remove this - legacy\r
- this.active = panel;\r
+ return this.find(function (c) {\r
+ return name.toLowerCase() === c.get('name').toLowerCase();\r
+ });\r
}\r
-});
\ No newline at end of file
+});\r