Fix for EMM-1575

revert-70aa11f8
kamidu 8 years ago
parent 75df243a33
commit 0ab9db2afd

@ -103,12 +103,12 @@
<label class=" hidden error email-invalid" for="summary">Invalid Email
Address.</label>
</div>
{{#if canViewRoles}}
<label class="wr-input-label"
title="Optional field that can have 0-to-many roles for the user">
User Roles
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</label>
{{#if canViewRoles}}
<div class="wr-input-control">
<select id="roles" class="form-control select2" multiple="multiple">
{{#each roles}}

@ -179,6 +179,7 @@ $("#userStore").change(
$("select option:selected").each(function () {
str += $(this).text() + "";
});
if ($("#roles").length > 0) {
var getRolesAPI = deviceMgtAPIsBasePath + "/roles?user-store=" + str + "&limit=100";
invokerUtil.get(
@ -200,6 +201,8 @@ $("#userStore").change(
}
);
}
}).change();
$(document).ready(function () {
@ -224,7 +227,10 @@ $(document).ready(function () {
var firstname = firstnameInput.val();
var lastname = lastnameInput.val();
var emailAddress = $("input#emailAddress").val();
var roles = $("select#roles").val();
var roles ;
if ($("#roles").length > 0) {
roles = $("select#roles").val();
}
var errorMsgWrapper = "#user-create-error-msg";
var errorMsg = "#user-create-error-msg span";
if (!username) {
@ -272,7 +278,9 @@ $(document).ready(function () {
$("input#firstname").val("");
$("input#lastname").val("");
$("input#email").val("");
if ($("#roles").length > 0) {
$("select#roles").select2("val", "");
}
// Refreshing with success message
$("#user-create-form").addClass("hidden");
$("#user-created-msg").removeClass("hidden");

@ -51,7 +51,8 @@
<div id="user-create-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<label class="wr-input-label" title="Select the domain of the user store from the drop-down given below. The domain of the default user store is PRIMARY">
<label class="wr-input-label"
title="Select the domain of the user store from the drop-down given below. The domain of the default user store is PRIMARY">
User Store Domain
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</label>
@ -94,8 +95,10 @@
<span class="glyphicon glyphicon-remove form-control-feedback hidden emailError"></span>
<label class=" hidden error email-required" for="summary">This field is
required.</label>
<label class=" hidden error email-invalid" for="summary">Invalid Email Address.</label>
<label class=" hidden error email-invalid" for="summary">Invalid Email
Address.</label>
</div>
{{#if canViewRoles}}
<label class="wr-input-label"
title="Optional field that can have 0-to-many roles for the user">
User Roles
@ -109,6 +112,7 @@
{{/each}}
</select>
</div>
{{/if}}
</div>
</div>
<br>

@ -63,6 +63,9 @@ function onRequest() {
if (userModule.isAuthorized("/permission/admin/device-mgt/users/manage")) {
page.canManage = true;
}
if (userModule.isAuthorized("/permission/admin/device-mgt/roles/view")) {
page.canViewRoles = true;
}
page["usernameJSRegEx"] = devicemgtProps["userValidationConfig"]["usernameJSRegEx"];
page["usernameRegExViolationErrorMsg"] = devicemgtProps["userValidationConfig"]["usernameRegExViolationErrorMsg"];

@ -168,11 +168,16 @@ $(document).ready(function () {
$("select.select2[multiple=multiple]").select2({
tags: false
});
var roleList = $("#roles").attr("selectedVals").trim().replace(/ /g, "");
var roleList, roleArr;
if ($("#roles").length > 0) {
roleList = $("#roles").attr("selectedVals").trim().replace(/ /g, "");
roleList = roleList.replace(/(\r\n|\n|\r)/gm, "");
var roleArr = roleList.split(",");
$("#roles").val(roleArr).trigger("change");
roleArr = roleList.split(",");
}
if ($("#roles").length > 0) {
$("#roles").val(roleArr).trigger("change");
}
/**
* Following click function would execute
* when a user clicks on "Add User" button
@ -188,7 +193,10 @@ $(document).ready(function () {
var firstname = firstnameInput.val();
var lastname = lastnameInput.val();
var emailAddress = $("input#emailAddress").val();
var roles;
if ($("#roles").length > 0) {
var roles = $("select#roles").val();
}
var errorMsgWrapper = "#user-create-error-msg";
var errorMsg = "#user-create-error-msg span";
if (!username) {

Loading…
Cancel
Save