/usr/share/maas/web/static/js/angular/factories/zones.js is in maas-region-api 2.4.0~beta2-6865-gec43e47e6-0ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | /* Copyright 2015 Canonical Ltd. This software is licensed under the
* GNU Affero General Public License version 3 (see the file LICENSE).
*
* MAAS Zone Manager
*
* Manages all of the zones in the browser. The manager uses the
* RegionConnection to load the zones, update the zones, and listen for
* notification events about zones.
*/
angular.module('MAAS').factory(
'ZonesManager',
['$q', '$rootScope', 'RegionConnection', 'Manager', function(
$q, $rootScope, RegionConnection, Manager) {
function ZonesManager() {
Manager.call(this);
this._pk = "id";
this._handler = "zone";
// Listen for notify events for the zone object.
var self = this;
RegionConnection.registerNotifier("zone",
function(action, data) {
self.onNotify(action, data);
});
}
ZonesManager.prototype = new Manager();
// Return the default zone.
ZonesManager.prototype.getDefaultZone = function() {
if(this._items.length === 0) {
return null;
} else {
var i;
for(i=0;i<this._items.length;i++) {
if(this._items[i].id === 0) {
return this._items[i];
}
}
}
return this._items[0];
};
return new ZonesManager();
}]);
|