mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Resolving conflicts
This commit is contained in:
commit
9fde8c0442
@ -374,7 +374,7 @@ public interface PolicyManagementService {
|
||||
required = true)
|
||||
List<Integer> policyIds);
|
||||
|
||||
@POST
|
||||
@PUT
|
||||
@Path("/deactivate-policy")
|
||||
@ApiOperation(
|
||||
consumes = MediaType.APPLICATION_JSON,
|
||||
|
||||
@ -150,6 +150,9 @@ public class Application implements Serializable {
|
||||
if (applicationIdentifier != null ? !applicationIdentifier.equals(that.applicationIdentifier) : that.applicationIdentifier != null) {
|
||||
return false;
|
||||
}
|
||||
if (version != null ? !version.equals(that.version) : that.version != null) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -217,13 +217,14 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
|
||||
appIdsToRemove.add(installedApp.getId());
|
||||
}
|
||||
}
|
||||
|
||||
applicationMappingDAO.removeApplicationMapping(device.getId(), appIdsToRemove, tenantId);
|
||||
Application installedApp;
|
||||
List<Integer> applicationIds = new ArrayList<>();
|
||||
|
||||
for (Application application : applications) {
|
||||
if (!installedAppList.contains(application)) {
|
||||
installedApp = applicationDAO.getApplication(application.getApplicationIdentifier(), tenantId);
|
||||
installedApp = applicationDAO.getApplication(application.getApplicationIdentifier(),
|
||||
application.getVersion(), tenantId);
|
||||
if (installedApp == null) {
|
||||
appsToAdd.add(application);
|
||||
} else {
|
||||
@ -244,7 +245,7 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("num of remove app Ids:" + appIdsToRemove.size());
|
||||
}
|
||||
applicationMappingDAO.removeApplicationMapping(device.getId(), appIdsToRemove, tenantId);
|
||||
|
||||
DeviceManagementDAOFactory.commitTransaction();
|
||||
} catch (DeviceManagementDAOException e) {
|
||||
DeviceManagementDAOFactory.rollbackTransaction();
|
||||
|
||||
@ -32,5 +32,7 @@ public interface ApplicationDAO {
|
||||
|
||||
Application getApplication(String identifier, int tenantId) throws DeviceManagementDAOException;
|
||||
|
||||
Application getApplication(String identifier, String version,int tenantId) throws DeviceManagementDAOException;
|
||||
|
||||
List<Application> getInstalledApplications(int deviceId) throws DeviceManagementDAOException;
|
||||
}
|
||||
|
||||
@ -228,6 +228,34 @@ public class ApplicationDAOImpl implements ApplicationDAO {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Application getApplication(String identifier, String version, int tenantId) throws DeviceManagementDAOException {
|
||||
Connection conn;
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
Application application = null;
|
||||
try {
|
||||
conn = this.getConnection();
|
||||
stmt = conn.prepareStatement("SELECT ID, NAME, APP_IDENTIFIER, PLATFORM, CATEGORY, VERSION, TYPE, " +
|
||||
"LOCATION_URL, IMAGE_URL, APP_PROPERTIES, MEMORY_USAGE, IS_ACTIVE, TENANT_ID FROM DM_APPLICATION WHERE APP_IDENTIFIER = ? " +
|
||||
"AND VERSION = ? AND TENANT_ID = ?");
|
||||
stmt.setString(1, identifier);
|
||||
stmt.setString(2, version);
|
||||
stmt.setInt(3, tenantId);
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
if (rs.next()) {
|
||||
application = this.loadApplication(rs);
|
||||
}
|
||||
return application;
|
||||
} catch (SQLException e) {
|
||||
throw new DeviceManagementDAOException("Error occurred while retrieving application application '" +
|
||||
identifier + "' and version '" + version + "'.", e);
|
||||
} finally {
|
||||
DeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
}
|
||||
|
||||
private Connection getConnection() throws SQLException {
|
||||
return DeviceManagementDAOFactory.getConnection();
|
||||
}
|
||||
|
||||
@ -239,8 +239,7 @@ var userModule = function () {
|
||||
* Get User Roles from user store (Internal roles not included).
|
||||
* @returns {object} a response object with status and content on success.
|
||||
*/
|
||||
publicMethods.getRolesByUserStore = function () {
|
||||
var ROLE_LIMIT = devicemgtProps["pageSize"];
|
||||
publicMethods.getRolesByUserStore = function (userStore) {
|
||||
var carbonUser = session.get(constants["USER_SESSION_KEY"]);
|
||||
var utility = require("/app/modules/utility.js")["utility"];
|
||||
if (!carbonUser) {
|
||||
@ -249,7 +248,8 @@ var userModule = function () {
|
||||
}
|
||||
try {
|
||||
utility.startTenantFlow(carbonUser);
|
||||
var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] + "/roles?limit=" + ROLE_LIMIT;
|
||||
var url = devicemgtProps["httpsURL"] + devicemgtProps["backendRestEndpoints"]["deviceMgt"] +
|
||||
"/roles?user-store=" + userStore + "&limit=100";
|
||||
var response = privateMethods.callBackend(url, constants["HTTP_GET"]);
|
||||
if (response.status == "success") {
|
||||
response.content = parse(response.content).roles;
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Policy Management"}}
|
||||
{{unit "cdmf.unit.ui.title" pageTitle="Policy Management | Policy Priorities"}}
|
||||
|
||||
{{#zone "breadcrumbs"}}
|
||||
<li>
|
||||
@ -24,10 +24,17 @@
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<!--suppress HtmlUnknownTarget -->
|
||||
<a href="{{@app.context}}/policies">
|
||||
Policies
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<!--suppress HtmlUnknownTarget -->
|
||||
<a href="{{@app.context}}/policy/priority">
|
||||
Priorities
|
||||
</a>
|
||||
</li>
|
||||
{{/zone}}
|
||||
|
||||
{{#zone "content"}}
|
||||
|
||||
@ -67,25 +67,19 @@
|
||||
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
|
||||
</label>
|
||||
<div id="usernameInputField" class="form-group wr-input-control">
|
||||
<input limit="{{charLimit}}" type="text" id="username" data-regex="{{usernameJSRegEx}}"
|
||||
data-errormsg="{{usernameRegExViolationErrorMsg}}" class="form-control"/>
|
||||
<input limit="{{charLimit}}" type="text" id="username" data-regex="{{usernameJSRegEx}}" data-errormsg="{{usernameRegExViolationErrorMsg}}" class="form-control"/>
|
||||
<span class=" usernameError hidden glyphicon glyphicon-remove form-control-feedback"></span>
|
||||
<label class="error usernameEmpty hidden" for="summary">This field is required. Username
|
||||
should be in minimum 3
|
||||
characters long and do not
|
||||
include any whitespaces.</label>
|
||||
<label class="error usernameEmpty hidden" for="summary">This field is required. Username should be in minimum 3 characters long and do not include any whitespaces.</label>
|
||||
</div>
|
||||
<label class="wr-input-label">First Name *</label>
|
||||
<div id="firstNameField" class="form-group wr-input-control">
|
||||
<input type="text" id="firstname" data-regex="{{firstnameJSRegEx}}"
|
||||
data-errormsg="{{firstnameRegExViolationErrorMsg}}" class="form-control"/>
|
||||
<input type="text" id="firstname" data-regex="{{firstnameJSRegEx}}" data-errormsg="{{firstnameRegExViolationErrorMsg}}" class="form-control"/>
|
||||
<span class="glyphicon glyphicon-remove form-control-feedback hidden fnError"></span>
|
||||
<label class=" hidden error fnError" for="summary">This field is required.</label>
|
||||
</div>
|
||||
<label class="wr-input-label">Last Name *</label>
|
||||
<div id="lastNameField" class="form-group wr-input-control">
|
||||
<input type="text" id="lastname" data-regex="{{lastnameJSRegEx}}"
|
||||
data-errormsg="{{lastnameRegExViolationErrorMsg}}" class="form-control"/>
|
||||
<input type="text" id="lastname" data-regex="{{lastnameJSRegEx}}" data-errormsg="{{lastnameRegExViolationErrorMsg}}" class="form-control"/>
|
||||
<span class="glyphicon glyphicon-remove form-control-feedback hidden lnError"></span>
|
||||
<label class=" hidden error lnError" for="summary">This field is required.</label>
|
||||
</div>
|
||||
@ -121,6 +115,8 @@
|
||||
<p class="page-sub-title">User was added successfully.</p>
|
||||
<br>
|
||||
An invitation mail will be sent to this user to initiate device enrollment.
|
||||
Below QR code can also be used to enroll a device.
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<div class="qr-code col-lg-5 col-md-6 col-centered"></div>
|
||||
|
||||
@ -18,18 +18,16 @@
|
||||
|
||||
/**
|
||||
* Returns the dynamic state to be populated by add-user page.
|
||||
*
|
||||
* @param context Object that gets updated with the dynamic state of this page to be presented
|
||||
* @returns {*} A context object that returns the dynamic state of this page to be presented
|
||||
*/
|
||||
function onRequest(context) {
|
||||
function onRequest() {
|
||||
//var log = new Log("/app/pages/cdmf.page.user.create server-side js");
|
||||
|
||||
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
|
||||
var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"];
|
||||
|
||||
var page = {};
|
||||
var response = userModule.getRolesByUserStore();
|
||||
var response = userModule.getRolesByUserStore("PRIMARY");
|
||||
if (response["status"] == "success") {
|
||||
page["roles"] = response["content"];
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -72,8 +72,8 @@ var disableInlineError = function (inputField, errorMsg, errorSign) {
|
||||
* Validate if provided username is valid against RegEx configures.
|
||||
*/
|
||||
validateInline["user-name"] = function () {
|
||||
var usernameinput = $("input#username");
|
||||
if (inputIsValid(usernameinput.data("regex"), usernameinput.val())) {
|
||||
var usernameInput = $("input#username");
|
||||
if (inputIsValid(usernameInput.data("regex"), usernameInput.val())) {
|
||||
disableInlineError("usernameInputField", "usernameEmpty", "usernameError");
|
||||
} else {
|
||||
enableInlineError("usernameInputField", "usernameEmpty", "usernameError");
|
||||
@ -84,8 +84,8 @@ validateInline["user-name"] = function () {
|
||||
* Validate if provided first name is valid against RegEx configures.
|
||||
*/
|
||||
validateInline["first-name"] = function () {
|
||||
var firstnameinput = $("input#firstname");
|
||||
if (firstnameinput.val()) {
|
||||
var firstnameInput = $("input#firstname");
|
||||
if (firstnameInput.val()) {
|
||||
disableInlineError("firstNameField", "fnError");
|
||||
} else {
|
||||
enableInlineError("firstNameField", "fnError");
|
||||
@ -96,8 +96,8 @@ validateInline["first-name"] = function () {
|
||||
* Validate if provided last name is valid against RegEx configures.
|
||||
*/
|
||||
validateInline["last-name"] = function () {
|
||||
var lastnameinput = $("input#lastname");
|
||||
if (lastnameinput.val()) {
|
||||
var lastnameInput = $("input#lastname");
|
||||
if (lastnameInput.val()) {
|
||||
disableInlineError("lastNameField", "lnError");
|
||||
} else {
|
||||
enableInlineError("lastNameField", "lnError");
|
||||
@ -167,7 +167,7 @@ $("#userStore").change(
|
||||
$("select option:selected").each(function () {
|
||||
str += $(this).text() + "";
|
||||
});
|
||||
var getRolesAPI = deviceMgtAPIsBasePath + "/roles/"+ str;
|
||||
var getRolesAPI = deviceMgtAPIsBasePath + "/roles?user-store=" + str + "&limit=100";
|
||||
|
||||
invokerUtil.get(
|
||||
getRolesAPI,
|
||||
@ -188,8 +188,7 @@ $("#userStore").change(
|
||||
|
||||
}
|
||||
);
|
||||
}
|
||||
).change();
|
||||
}).change();
|
||||
|
||||
$(document).ready(function () {
|
||||
$("#emailValidationText").hide();
|
||||
@ -207,7 +206,7 @@ $(document).ready(function () {
|
||||
var usernameInput = $("input#username");
|
||||
var firstnameInput = $("input#firstname");
|
||||
var lastnameInput = $("input#lastname");
|
||||
//var charLimit = parseInt($("input#username").attr("limit"));
|
||||
var charLimit = parseInt($("input#username").attr("limit"));
|
||||
var domain = $("#userStore").val();
|
||||
var username = usernameInput.val().trim();
|
||||
var firstname = firstnameInput.val();
|
||||
|
||||
@ -27,8 +27,10 @@ var invokerUtil = function () {
|
||||
restAPIRequestDetails["requestURL"] = requestURL;
|
||||
restAPIRequestDetails["requestPayload"] = JSON.stringify(requestPayload);
|
||||
|
||||
var appContext = $("#app-context").data("app-context");
|
||||
|
||||
var request = {
|
||||
url: context + "/api/invoker/execute/",
|
||||
url: appContext + "/api/invoker/execute/",
|
||||
type: "POST",
|
||||
contentType: "application/json",
|
||||
data: JSON.stringify(restAPIRequestDetails),
|
||||
|
||||
@ -31,12 +31,15 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="app-context" data-app-context="{{@app.context}}" class="hidden"></div>
|
||||
{{/zone}}
|
||||
|
||||
{{#zone "topJs"}}
|
||||
<script type="text/javascript">
|
||||
var context = "{{@app.context}}"
|
||||
</script>
|
||||
{{/zone}}
|
||||
|
||||
{{#zone "bottomJs"}}
|
||||
{{js "js/js.cookie.js"}}
|
||||
{{js "js/invoker-lib.js"}}
|
||||
|
||||
@ -15,17 +15,16 @@
|
||||
specific language governing permissions and limitations
|
||||
under the License.
|
||||
}}
|
||||
|
||||
<div class="row wr-device-board">
|
||||
<div class="col-lg-12 wr-secondary-bar">
|
||||
<span class="page-sub-title">
|
||||
Policy List by priority order
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<span id="policy-listing-status-msg">{{policyListingStatusMsg}}</span>
|
||||
|
||||
<div class="wr-list-group wr-sortable policy-list">
|
||||
{{#each policyListToView}}
|
||||
<span class="list-group-item " place="place_{{id}}" id="{{id}}">
|
||||
@ -40,15 +39,7 @@
|
||||
</span>
|
||||
</span>
|
||||
<span class="wr-list-icon">
|
||||
{{#equal platform "android"}}
|
||||
<i class=" fw fw-android"></i>
|
||||
{{/equal}}
|
||||
{{#equal platform "windows"}}
|
||||
<i class=" fw fw-windows"></i>
|
||||
{{/equal}}
|
||||
{{#equal platform "ios"}}
|
||||
<i class=" fw fw-apple"></i>
|
||||
{{/equal}}
|
||||
<i class=" fw fw-{{platform}}"></i>
|
||||
</span>
|
||||
<span class="wr-list-desc">
|
||||
<h3 class="wr-list-name">{{name}}</h3>
|
||||
@ -62,19 +53,20 @@
|
||||
<b>Ownership Type : </b> {{ownershipType}}
|
||||
</div>
|
||||
</div>
|
||||
{{#if roles}}
|
||||
<div class="wr-desc-list-configs highlight col-xs-12 col-sm-4 col-md-4 col-lg-4">
|
||||
<div>
|
||||
<b>Assigned Role(s) : </b> {{roles}}
|
||||
</div>
|
||||
</div>
|
||||
{{else}}
|
||||
{{#equal roles "None"}}
|
||||
<div class="wr-desc-list-configs highlight col-xs-12 col-sm-4 col-md-4 col-lg-4">
|
||||
<div>
|
||||
<b>Assigned User(s) : </b> {{users}}
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/equal}}
|
||||
{{#equal users "None"}}
|
||||
<div class="wr-desc-list-configs highlight col-xs-12 col-sm-4 col-md-4 col-lg-4">
|
||||
<div>
|
||||
<b>Assigned Role(s) : </b> {{roles}}
|
||||
</div>
|
||||
</div>
|
||||
{{/equal}}
|
||||
<div class="wr-desc-list-configs col-xs-12 col-sm-4 col-md-4 col-lg-4">
|
||||
<div>
|
||||
<b>Compliance Type :</b> {{compliance}}
|
||||
@ -89,8 +81,7 @@
|
||||
{{#equal noPolicy false}}
|
||||
<div id="save-new-priorities-button" class="wr-input-control wr-btn-grp">
|
||||
<button class="wr-btn hide" id="sortUpdateBtn" data-policycount="{{policyCount}}"
|
||||
data-enabled="{{saveNewPrioritiesButtonEnabled}}" disabled>Save New Priority
|
||||
Order
|
||||
data-enabled="{{saveNewPrioritiesButtonEnabled}}" disabled>Save New Priority Order
|
||||
</button>
|
||||
<button class="wr-btn" id="applyChangesBtn">Apply Changes to Devices</button>
|
||||
</div>
|
||||
@ -98,18 +89,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="change-policy-modal-content" class="hide">
|
||||
<div id="apply-changes-modal-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Do you really want to apply changes to all policies?</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="javascript:void(0)" id="change-policy-yes-link" class="btn-operations">
|
||||
<a href="javascript:void(0)" id="apply-changes-yes-link" class="btn-operations">
|
||||
Yes
|
||||
</a>
|
||||
<a href="javascript:void(0)" id="change-policy-cancel-link"
|
||||
class="btn-operations">
|
||||
<a href="javascript:void(0)" id="apply-changes-cancel-link" class="btn-operations">
|
||||
No
|
||||
</a>
|
||||
</div>
|
||||
@ -118,15 +108,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="change-policy-success-content" class="hide">
|
||||
<div id="apply-changes-success-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>Done. Changes applied successfully.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="javascript:void(0)" id="change-policy-success-link"
|
||||
class="btn-operations">
|
||||
<a href="javascript:void(0)" id="apply-changes-success-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
@ -135,15 +124,14 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="change-policy-error-content" class="hide">
|
||||
<div id="apply-changes-error-content" class="hide">
|
||||
<div class="content">
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>An unexpected error occurred. Please try again later.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="javascript:void(0)" id="change-policy-error-link"
|
||||
class="btn-operations">
|
||||
<a href="javascript:void(0)" id="apply-changes-error-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
@ -159,8 +147,7 @@
|
||||
<h3>An unexpected error occurred. Please try again later.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="javascript:void(0)" id="remove-policy-error-link"
|
||||
class="btn-operations">
|
||||
<a href="javascript:void(0)" id="remove-policy-error-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
@ -176,8 +163,7 @@
|
||||
<h3>Done. New Policy priorities were successfully updated.</h3>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="javascript:void(0)" id="save-policy-priorities-success-link"
|
||||
class="btn-operations">
|
||||
<a href="javascript:void(0)" id="save-policy-priorities-success-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
@ -191,11 +177,8 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-5 col-md-6 col-centered">
|
||||
<h3>An unexpected error occurred. Please try again later.</h3>
|
||||
<h4 class="message-from-server"></h4>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="javascript:void(0)" id="save-policy-priorities-error-link"
|
||||
class="btn-operations">
|
||||
<a href="javascript:void(0)" id="save-policy-priorities-error-link" class="btn-operations">
|
||||
Ok
|
||||
</a>
|
||||
</div>
|
||||
@ -203,6 +186,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{#zone "bottomJs"}}
|
||||
{{js "js/policy-priority.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
|
||||
@ -10,8 +10,8 @@
|
||||
*
|
||||
* 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;
|
||||
}
|
||||
|
||||
@ -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
|
||||
@ -10,8 +10,8 @@
|
||||
*
|
||||
* 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 () {
|
||||
// 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());
|
||||
// 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());
|
||||
showPopup();
|
||||
|
||||
$("a#change-policy-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();
|
||||
});
|
||||
},
|
||||
// on error
|
||||
function () {
|
||||
$(modalPopupContent).html($('#change-policy-error-content').html());
|
||||
showPopup();
|
||||
$("a#change-policy-error-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$("a#change-policy-cancel-link").click(function () {
|
||||
$(applyChangesBtn).click(function () {
|
||||
var applyPolicyChangesAPI = "/api/device-mgt/v1.0/policies/apply-changes";
|
||||
$(modalPopupContent).html($("#apply-changes-modal-content").html());
|
||||
showPopup();
|
||||
|
||||
$("a#apply-changes-yes-link").click(function () {
|
||||
invokerUtil.put(
|
||||
applyPolicyChangesAPI,
|
||||
null,
|
||||
// on success
|
||||
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 (jqXHR) {
|
||||
if (jqXHR.status == 500) {
|
||||
$(modalPopupContent).html($("#apply-changes-error-content").html());
|
||||
showPopup();
|
||||
$("a#apply-changes-error-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
$("a#apply-changes-cancel-link").click(function () {
|
||||
hidePopup();
|
||||
});
|
||||
});
|
||||
|
||||
@ -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();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user