mirror of
https://github.com/ansible/awx.git
synced 2026-03-01 16:58:46 -03:30
Update project structure
This commit is contained in:
38
awx/ui/client/lib/services/event.service.js
Normal file
38
awx/ui/client/lib/services/event.service.js
Normal file
@@ -0,0 +1,38 @@
|
||||
function addListeners (scope, list) {
|
||||
let listeners = [];
|
||||
|
||||
list.forEach(args => {
|
||||
listeners.push(addListener.call(null, scope, ...args));
|
||||
});
|
||||
|
||||
return listeners;
|
||||
}
|
||||
|
||||
function addListener (scope, el, name, fn, type) {
|
||||
type = type || '$apply';
|
||||
|
||||
let listener = {
|
||||
fn: () => scope[type](fn),
|
||||
name,
|
||||
el
|
||||
};
|
||||
|
||||
listener.el.addEventListener(listener.name, listener.fn);
|
||||
|
||||
return listener;
|
||||
}
|
||||
|
||||
function remove (listeners) {
|
||||
listeners.forEach(listener => {
|
||||
listener.el.removeEventListener(listener.name, listener.fn);
|
||||
});
|
||||
}
|
||||
|
||||
function EventService () {
|
||||
return {
|
||||
addListeners,
|
||||
remove
|
||||
};
|
||||
}
|
||||
|
||||
export default EventService;
|
||||
7
awx/ui/client/lib/services/index.js
Normal file
7
awx/ui/client/lib/services/index.js
Normal file
@@ -0,0 +1,7 @@
|
||||
import EventService from './event.service';
|
||||
import PathService from './path.service';
|
||||
|
||||
angular
|
||||
.module('at.lib.services', [])
|
||||
.factory('EventService', EventService)
|
||||
.factory('PathService', PathService);
|
||||
16
awx/ui/client/lib/services/path.service.js
Normal file
16
awx/ui/client/lib/services/path.service.js
Normal file
@@ -0,0 +1,16 @@
|
||||
function getPartialPath (path) {
|
||||
return `/static/partials/${path}.partial.html`;
|
||||
}
|
||||
|
||||
function getViewPath (path) {
|
||||
return `/static/views/${path}.view.html`;
|
||||
}
|
||||
|
||||
function PathService () {
|
||||
return {
|
||||
getPartialPath,
|
||||
getViewPath
|
||||
};
|
||||
}
|
||||
|
||||
export default PathService;
|
||||
Reference in New Issue
Block a user