/usr/share/maas/web/static/js/angular/factories/tags.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 | /* Copyright 2015 Canonical Ltd. This software is licensed under the
* GNU Affero General Public License version 3 (see the file LICENSE).
*
* MAAS Tag Manager
*
* Manages all of the tags in the browser. The manager uses the
* RegionConnection to load the tags, update the tags, and listen for
* notification events about tags.
*/
angular.module('MAAS').factory(
'TagsManager',
['$q', '$rootScope', 'RegionConnection', 'Manager', function(
$q, $rootScope, RegionConnection, Manager) {
function TagsManager() {
Manager.call(this);
this._pk = "id";
this._handler = "tag";
// Listen for notify events for the tag object.
var self = this;
RegionConnection.registerNotifier("tag",
function(action, data) {
self.onNotify(action, data);
});
}
TagsManager.prototype = new Manager();
// Helper for autocomplete that will return a string of tags that
// contain the query text.
TagsManager.prototype.autocomplete = function(query) {
var matching = [];
angular.forEach(this._items, function(item) {
if(item.name.indexOf(query) > -1) {
matching.push(item.name);
}
});
return matching;
};
return new TagsManager();
}]);
|