mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge pull request #474 from madawas/IOTS-296
IOTS-296: Refactoring generic policy unit code
This commit is contained in:
commit
78bef05e11
@ -18,7 +18,6 @@
|
||||
var stepForwardFrom = {};
|
||||
var stepBackFrom = {};
|
||||
var policy = {};
|
||||
var configuredOperations = [];
|
||||
var validateInline = {};
|
||||
var clearInline = {};
|
||||
var validateStep = {};
|
||||
@ -173,7 +172,11 @@ stepForwardFrom["policy-platform"] = function (actionButton) {
|
||||
* Forward action of policy profile page. Generates policy profile payload.
|
||||
*/
|
||||
stepForwardFrom["policy-profile"] = function () {
|
||||
policy["profile"] = operationModule.generateProfile(policy["platform"], configuredOperations);
|
||||
/*
|
||||
generatePolicyProfile() function should be implemented in plugin side and should include the logic to build the
|
||||
policy profile object.
|
||||
*/
|
||||
policy["profile"] = generatePolicyProfile();
|
||||
// updating next-page wizard title with selected platform
|
||||
$("#policy-criteria-page-wizard-title").text("ADD " + policy["platform"] + " POLICY");
|
||||
};
|
||||
@ -182,8 +185,11 @@ stepForwardFrom["policy-profile"] = function () {
|
||||
* Backward action of policy profile page. Moves back to platform selection step.
|
||||
*/
|
||||
stepBackFrom["policy-profile"] = function () {
|
||||
// reinitialize configuredOperations
|
||||
configuredOperations = [];
|
||||
/*
|
||||
resetPolicyProfile() function should be implemented in plugin side and should include the logic to reset the policy
|
||||
profile object.
|
||||
*/
|
||||
resetPolicyProfile();
|
||||
};
|
||||
|
||||
/**
|
||||
@ -359,18 +365,12 @@ stepForwardFrom["policy-naming"] = function () {
|
||||
};
|
||||
|
||||
var savePolicy = function (policy, isActive, serviceURL) {
|
||||
var profilePayloads = [];
|
||||
// traverses key by key in policy["profile"]
|
||||
var key;
|
||||
for (key in policy["profile"]) {
|
||||
if (policy["profile"].hasOwnProperty(key)) {
|
||||
profilePayloads.push({
|
||||
"featureCode": key,
|
||||
"deviceType": policy["platform"],
|
||||
"content": policy["profile"][key]
|
||||
});
|
||||
}
|
||||
}
|
||||
/*
|
||||
generateProfileFeaturesList() should be implemented in the plugin side and should include logic to build the
|
||||
profilePayloads array which contains objects, {featureCode:"value", deviceType:"value", content:"value"}.
|
||||
policy["profile"] object will be available for the method which returns from the generatePolicyProfile() function.
|
||||
*/
|
||||
var profilePayloads = generateProfileFeaturesList();
|
||||
|
||||
$.each(profilePayloads, function (i, item) {
|
||||
$.each(item.content, function (key, value) {
|
||||
|
||||
@ -20,7 +20,6 @@ var validateStep = {};
|
||||
var skipStep = {};
|
||||
var stepForwardFrom = {};
|
||||
var stepBackFrom = {};
|
||||
var configuredOperations = [];
|
||||
var policy = {};
|
||||
var currentlyEffected = {};
|
||||
|
||||
@ -200,9 +199,11 @@ skipStep["policy-platform"] = function (policyPayloadObj) {
|
||||
script.type = 'text/javascript';
|
||||
script.src = policyOperationsScriptSrc;
|
||||
$(".wr-advance-operations").prepend(script);
|
||||
var configuredOperations = operationModule.populateProfile(policy["platform"],
|
||||
policyPayloadObj["profile"]["profileFeaturesList"]);
|
||||
polulateProfileOperations(configuredOperations);
|
||||
/*
|
||||
This method should be implemented in the relevant plugin side and should include the logic to
|
||||
populate the policy profile in the plugin specific UI.
|
||||
*/
|
||||
polulateProfileOperations(policyPayloadObj["profile"]["profileFeaturesList"]);
|
||||
}
|
||||
});
|
||||
});
|
||||
@ -227,7 +228,11 @@ skipStep["policy-platform"] = function (policyPayloadObj) {
|
||||
* Forward action of policy profile page. Generates policy profile payload.
|
||||
*/
|
||||
stepForwardFrom["policy-profile"] = function () {
|
||||
policy["profile"] = operationModule.generateProfile(policy["platform"], configuredOperations);
|
||||
/*
|
||||
generatePolicyProfile() function should be implemented in plugin side and should include the logic to build the
|
||||
policy profile object.
|
||||
*/
|
||||
policy["profile"] = generatePolicyProfile();
|
||||
// updating next-page wizard title with selected platform
|
||||
$("#policy-criteria-page-wizard-title").text("EDIT " + policy["platform"] + " POLICY - " + policy["name"]);
|
||||
};
|
||||
@ -415,19 +420,12 @@ var getParameterByName = function (name) {
|
||||
};
|
||||
|
||||
var updatePolicy = function (policy, state) {
|
||||
var profilePayloads = [];
|
||||
// traverses key by key in policy["profile"]
|
||||
var key;
|
||||
for (key in policy["profile"]) {
|
||||
|
||||
if (policy["profile"].hasOwnProperty(key)) {
|
||||
profilePayloads.push({
|
||||
"featureCode": key,
|
||||
"deviceType": policy["platform"],
|
||||
"content": policy["profile"][key]
|
||||
});
|
||||
}
|
||||
}
|
||||
/*
|
||||
generateProfileFeaturesList() should be implemented in the plugin side and should include logic to build the
|
||||
profilePayloads array which contains objects, {featureCode:"value", deviceType:"value", content:"value"}.
|
||||
policy["profile"] object will be available for the method which returns from the generatePolicyProfile() function.
|
||||
*/
|
||||
var profilePayloads = generateProfileFeaturesList();
|
||||
|
||||
$.each(profilePayloads, function (i, item) {
|
||||
$.each(item.content, function (key, value) {
|
||||
|
||||
@ -86,9 +86,11 @@ var displayPolicy = function (policyPayloadObj) {
|
||||
script.type = 'text/javascript';
|
||||
script.src = policyOperationsScriptSrc;
|
||||
$(".wr-advance-operations").prepend(script);
|
||||
var previouslyConfiguredOperations = operationModule.populateProfile(policy["platform"],
|
||||
policyPayloadObj["profile"]["profileFeaturesList"]);
|
||||
polulateProfileOperations(previouslyConfiguredOperations);
|
||||
/*
|
||||
This method should be implemented in the relevant plugin side and should include the logic to
|
||||
populate the policy profile in the plugin specific UI.
|
||||
*/
|
||||
polulateProfileOperations(policyPayloadObj["profile"]["profileFeaturesList"]);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user