mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Add UI controller method to retrieve all policies by policy type
This commit is contained in:
parent
1e0ca09f12
commit
ca2a1b85c3
@ -62,6 +62,8 @@ policyModule = function () {
|
||||
policyObjectToView["priorityId"] = policyObjectFromRestEndpoint["priorityId"];
|
||||
policyObjectToView["name"] = policyObjectFromRestEndpoint["policyName"];
|
||||
policyObjectToView["platform"] = policyObjectFromRestEndpoint["profile"]["deviceType"];
|
||||
policyObjectFromRestEndpoint["policyType"] = policyListFromRestEndpoint["policyType"];
|
||||
policyObjectFromRestEndpoint["correctiveActions"] = policyListFromRestEndpoint["correctiveActions"];
|
||||
if (policyObjectToView["platform"] == "ios") {
|
||||
policyObjectToView["deviceTypeIcon"] = "apple";
|
||||
} else {
|
||||
@ -168,6 +170,27 @@ policyModule = function () {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieve all policies based on policy type
|
||||
*/
|
||||
publicMethods.getAllPoliciesByType = function (policyType) {
|
||||
var carbonUser = session.get(constants["USER_SESSION_KEY"]);
|
||||
if (!carbonUser) {
|
||||
log.error("User object was not found in the session");
|
||||
userModule.logout(function () {
|
||||
response.sendRedirect(devicemgtProps["appContext"] + "login");
|
||||
});
|
||||
}
|
||||
try {
|
||||
var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] +
|
||||
"/policies/type/" + policyType + "?offset=0&limit=100";
|
||||
return serviceInvokers.XMLHttp.get(url, privateMethods.handleGetAllPoliciesResponse);
|
||||
} catch (e) {
|
||||
log.error("Error occurred while retrieving policies by policy type " + policyType);
|
||||
throw e;
|
||||
}
|
||||
};
|
||||
|
||||
/*
|
||||
Get policies count from backend services.
|
||||
*/
|
||||
|
||||
Loading…
Reference in New Issue
Block a user