-
-
Do you really want to apply changes to all policies?
- - -
-
-
-
-
Done. Changes applied successfully.
- - -
-
-
-
-
An unexpected error occurred. Please try again later.
- - -
-
-
-
-
An unexpected error occurred. Please try again later.
- - -
-
-
-
-
Done. New Policy priorities were successfully updated.
- - -
-
-
-
-
An unexpected error occurred. Please try again later.
- - -
-
- Ok
-
+
+
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.priority/priority.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.priority/priority.js
index 2ba2155ac2..a6afb10f6b 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.priority/priority.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.priority/priority.js
@@ -1,17 +1,17 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@@ -27,8 +27,9 @@ function onRequest(context) {
return options.fn(this);
}
});
- var policyModule = require("/app/modules/business-controllers/group.js")["groupModule"];
+ var policyModule = require("/app/modules/business-controllers/policy.js")["policyModule"];
var response = policyModule.getAllPolicies();
+
if (response["status"] == "success") {
var policyListToView = response["content"];
context["policyListToView"] = policyListToView;
@@ -38,7 +39,7 @@ function onRequest(context) {
context["saveNewPrioritiesButtonEnabled"] = false;
context["noPolicy"] = true;
} else if (policyCount == 1) {
- context["policyListingStatusMsg"] = "Add more policies to set up a priority order.";
+ context["policyListingStatusMsg"] = "Two or more policies should be available to set up a priority order.";
context["saveNewPrioritiesButtonEnabled"] = false;
context["noPolicy"] = false;
} else {
@@ -47,9 +48,11 @@ function onRequest(context) {
context["noPolicy"] = false;
}
} else {
+ // here, response["status"] == "error"
context["policyListToView"] = [];
- context["policyListingStatusMsg"] = response["content"];
+ context["policyListingStatusMsg"] = "Error in retrieving policies. Please try reloading the page.";
context["saveNewPrioritiesButtonEnabled"] = false;
}
+
return context;
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.priority/public/js/policy-priority.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.priority/public/js/policy-priority.js
index f2ccc3b9d1..f6b5514d7e 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.priority/public/js/policy-priority.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.priority/public/js/policy-priority.js
@@ -1,17 +1,17 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
@@ -78,58 +78,66 @@ $(document).ready(function () {
newPolicyPriorityList.push(policy);
}
- var updatePolicyAPI = "/devicemgt_admin/policies/priorities";
+ var updatePolicyAPI = "/api/device-mgt/v1.0/policies/priorities";
invokerUtil.put(
updatePolicyAPI,
newPolicyPriorityList,
- function () {
- $(modalPopupContent).html($('#save-policy-priorities-success-content').html());
- showPopup();
- $("a#save-policy-priorities-success-link").click(function () {
- hidePopup();
- });
+ // on success
+ function (data, textStatus, jqXHR) {
+ if (jqXHR.status == 200) {
+ $(modalPopupContent).html($('#save-policy-priorities-success-content').html());
+ showPopup();
+ $("a#save-policy-priorities-success-link").click(function () {
+ hidePopup();
+ });
+ }
},
- function () {
- $("#save-policy-priorities-error-content").find(".message-from-server").html(
- "Message From Server : " + data["statusText"]);
- $(modalPopupContent).html($('#save-policy-priorities-error-content').html());
- showPopup();
- $("a#save-policy-priorities-error-link").click(function () {
- hidePopup();
- });
+ // on error
+ function (jqXHR) {
+ if (jqXHR.status == 400 || jqXHR.status == 500) {
+ $(modalPopupContent).html($("#save-policy-priorities-error-content").html());
+ showPopup();
+ $("a#save-policy-priorities-error-link").click(function () {
+ hidePopup();
+ });
+ }
}
);
});
$(applyChangesBtn).click(function () {
- var applyPolicyChangesAPI = "/devicemgt_admin/policies/apply-changes";
- $(modalPopupContent).html($('#change-policy-modal-content').html());
+ var applyPolicyChangesAPI = "/api/device-mgt/v1.0/policies/apply-changes";
+ $(modalPopupContent).html($("#apply-changes-modal-content").html());
showPopup();
- $("a#change-policy-yes-link").click(function () {
+ $("a#apply-changes-yes-link").click(function () {
invokerUtil.put(
applyPolicyChangesAPI,
null,
// on success
- function () {
- $(modalPopupContent).html($('#change-policy-success-content').html());
- showPopup();
- $("a#change-policy-success-link").click(function () {
- hidePopup();
- });
+ function (data, textStatus, jqXHR) {
+ if (jqXHR.status == 200) {
+ $(modalPopupContent).html($("#apply-changes-success-content").html());
+ showPopup();
+ $("a#apply-changes-success-link").click(function () {
+ hidePopup();
+ });
+ }
},
// on error
- function () {
- $(modalPopupContent).html($('#change-policy-error-content').html());
- showPopup();
- $("a#change-policy-error-link").click(function () {
- hidePopup();
- });
+ function (jqXHR) {
+ if (jqXHR.status == 500) {
+ $(modalPopupContent).html($("#apply-changes-error-content").html());
+ showPopup();
+ $("a#apply-changes-error-link").click(function () {
+ hidePopup();
+ });
+ }
}
);
});
- $("a#change-policy-cancel-link").click(function () {
+ $("a#apply-changes-cancel-link").click(function () {
hidePopup();
});
});
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.priority/public/js/sortable-list.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.priority/public/js/sortable-list.js
index c4f78b1bc1..c436e2ac56 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.priority/public/js/sortable-list.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.priority/public/js/sortable-list.js
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+ * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
@@ -47,7 +47,7 @@ var sortableListFunction = (function () {
}
/**
- * on input text field focus autocomplete bind function
+ * on input text field focus auto-complete bind function
*/
$(sortableElem).on('focus', '.wr-sort-index input.index', function () {
currentElemId = $(this).val();
+
+
An unexpected error occurred. Please try again later.
+
+
+ Ok
+
+