-
Notifications
You must be signed in to change notification settings - Fork 356
/
Copy pathdialog_editor_http_service.js
34 lines (30 loc) · 1.08 KB
/
dialog_editor_http_service.js
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
ManageIQ.angular.app.service('DialogEditorHttp', ['$http', 'API', function($http, API) {
this.loadDialog = function(id) {
return API.get('/api/service_dialogs/' + id + '?attributes=content,buttons,label');
};
this.saveDialog = function(id, action, data) {
return API.post('/api/service_dialogs' + id, {
action: action,
resource: data,
}, {
skipErrors: [400],
});
};
this.treeSelectorLoadData = function(fqname) {
var url = '/tree/automate_entrypoint' + (fqname ? '?fqname=' + encodeURIComponent(fqname) : '');
return $http.get(url).then(function(response) {
return response.data;
});
};
this.treeSelectorLazyLoadData = function(node) {
return $http.get('/tree/automate_entrypoint?id=' + encodeURIComponent(node.key)).then(function(response) {
return response.data;
});
};
// Load categories data from API.
this.loadCategories = function() {
return API.get('/api/categories' +
'?expand=resources' +
'&attributes=id,name,description,single_value,children');
};
}]);