Merge pull request #641 from wso2/cloud-3.1.0

Cloud related fixes
revert-70aa11f8
Kamidu Sachith Punchihewa 8 years ago committed by GitHub
commit 14d517e89d

@ -342,13 +342,13 @@ function loadDevices(searchType, searchParam) {
'<span class="hidden-xs hidden-on-grid-view">Group</span></a>';
}
// html +=
// '<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view edit-device-link" '
// + 'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType
// + '" data-devicename="' + row.name + '" data-placement="top" data-toggle="tooltip" data-original-title="Edit">'
// + '<span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i>'
// + '<i class="fw fw-edit fw-stack-1x"></i></span>'
// + '<span class="hidden-xs hidden-on-grid-view">Edit</span></a>';
html +=
'<a href="#" data-click-event="remove-form" class="btn padding-reduce-on-grid-view edit-device-link" '
+ 'data-deviceid="' + deviceIdentifier + '" data-devicetype="' + deviceType
+ '" data-devicename="' + row.name + '" data-placement="top" data-toggle="tooltip" data-original-title="Edit">'
+ '<span class="fw-stack"><i class="fw fw-circle-outline fw-stack-2x"></i>'
+ '<i class="fw fw-edit fw-stack-1x"></i></span>'
+ '<span class="hidden-xs hidden-on-grid-view">Edit</span></a>';
var groupOwner = $('#group_owner').text();
if (groupId && groupOwner != "wso2.system.user") {
html +=

@ -43,7 +43,8 @@
<div class="row">
<div class="col-md-12">
<!-- content -->
<div id="role-create-form" class="container col-centered wr-content">
<div id="role-create-form" data-cloud={{isCloud}} class="container col-centered wr-content
">
<div class="wr-form">
<p class="page-sub-title">Add Role</p>
<hr/>
@ -87,11 +88,19 @@
<label class="wr-input-label">
( {{roleNameHelpText}} )
</label>
{{#if isCloud}}
<div id="roleNameField" class="form-group wr-input-control input-group">
<!--suppress HtmlFormInputWithoutLabel -->
<span class="input-group-addon" id="basic-addon1">devicemgt</span>
<input aria-describedby="basic-addon1" type="text" id="roleName"
data-regex="{{roleNameJSRegEx}}"
data-error-msg="{{roleNameRegExViolationErrorMsg}}" class="form-control"/>
{{else}}
<div id="roleNameField" class="form-group wr-input-control">
<!--suppress HtmlFormInputWithoutLabel -->
<input type="text" id="roleName" data-regex="{{roleNameJSRegEx}}"
data-error-msg="{{roleNameRegExViolationErrorMsg}}" class="form-control"/>
{{/if}}
<span class="roleNameError hidden glyphicon glyphicon-remove form-control-feedback"></span>
<label class="error roleNameEmpty hidden" for="summary">
Role name is required, should be in minimum 3 characters long and not include any

@ -38,6 +38,7 @@ function onRequest(context) {
if (userModule.isAuthorized("/permission/admin/device-mgt/users/view")) {
displayData.canViewUsers = true;
}
displayData.isCloud = deviceMgtProps.isCloud;
return displayData;
}

@ -33,6 +33,8 @@ var clearInline = {};
var apiBasePath = "/api/device-mgt/v1.0";
var domain = $("#domain").val();
var isCloud = $("#role-create-form").data("cloud");
var enableInlineError = function (inputField, errorMsg, errorSign) {
var fieldIdentifier = "#" + inputField;
@ -114,6 +116,8 @@ function formatRepoSelection (user) {
}
$(document).ready(function () {
isCloud = $("#role-create-form").data("cloud");
var appContext = $("#app-context").data("app-context");
$("#users").select2({
multiple: true,
@ -151,7 +155,9 @@ $(document).ready(function () {
},
cache: true
},
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
escapeMarkup: function (markup) {
return markup;
}, // let our custom formatter work
minimumInputLength: 1,
templateResult: formatRepo, // omitted for brevity, see the source of this page
templateSelection: formatRepoSelection // omitted for brevity, see the source of this page
@ -163,6 +169,7 @@ $(document).ready(function () {
* on Add Role page in WSO2 MDM Console.
*/
$("button#add-role-btn").click(function () {
var domain = $("#domain").val();
var roleNameInput = $("input#roleName");
var roleName = roleNameInput.val();
@ -185,7 +192,11 @@ $(document).ready(function () {
$(errorMsgWrapper).removeClass("hidden");
} else {
var addRoleFormData = {};
if (isCloud) {
addRoleFormData.roleName = "devicemgt" + roleName;
} else {
addRoleFormData.roleName = roleName;
}
if (domain != "PRIMARY") {
addRoleFormData.roleName = domain + "/" + roleName;
}

@ -37,6 +37,7 @@ var modalPopupContainer = modalPopup + " .modal-content";
var modalPopupContent = modalPopup + " .modal-content";
var body = "body";
var isInit = true;
var isCloud = false;
/**
@ -91,6 +92,7 @@ function htmlspecialchars(text){
}
function loadRoles() {
isCloud = $("#role-table").data("cloud");
var loadingContent = $("#loading-content");
loadingContent.show();
@ -98,21 +100,40 @@ function loadRoles() {
data = JSON.parse(data);
var objects = [];
var count = 0;
$(data.roles).each(function (index) {
if (isCloud && data.roles[index].startsWith("devicemgt")) {
count++;
objects.push(
{
name: htmlspecialchars(data.roles[index]),
DT_RowId: "role-" + htmlspecialchars(data.roles[index])
}
)
} else if (!isCloud) {
objects.push(
{
name: htmlspecialchars(data.roles[index]),
DT_RowId: "role-" + htmlspecialchars(data.roles[index])
}
)
}
});
var json = {
var json = {};
if (isCloud) {
json = {
"recordsTotal": count,
"recordsFiltered": count,
"data": objects
};
} else {
json = {
"recordsTotal": data.count,
"recordsFiltered": data.count,
"data": objects
};
}
return JSON.stringify(json);
};

@ -67,8 +67,9 @@
<br>
</div>
<div id="role-table" data-role={{adminRole}}>
<table class="table table-striped table-hover list-table display responsive nowrap data-table grid-view" id="role-grid">
<div id="role-table" data-cloud={{isCloud}} data-role={{adminRole}}>
<table class="table table-striped table-hover list-table display responsive nowrap data-table grid-view"
id="role-grid">
<thead>
<tr class="sort-row">
<th>By Role Name</th>

@ -19,7 +19,7 @@
<div class="row">
<div class="col-md-12">
<!-- content -->
<div id="role-create-form" class="container col-centered wr-content">
<div id="role-create-form" data-cloud={{isCloud}} class="container col-centered wr-content">
<div class="wr-form">
<p class="page-sub-title">Edit Role</p>
<p>Please note that * sign represents required fields of data.</p>
@ -42,11 +42,23 @@
<label class="wr-input-label" id="roleNameValidationText">
( {{roleNameHelpText}} )
</label>
{{#if isCloud}}
<div id="roleNameField" class="form-group wr-input-control input-group">
<!--suppress HtmlFormInputWithoutLabel -->
<span class="input-group-addon" id="basic-addon1">devicemgt</span>
<input aria-describedby="basic-addon1" type="text" id="rolename"
data-regex="{{roleNameJSRegEx}}"
data-errormsg="{{roleNameRegExViolationErrorMsg}}" class="form-control"
data-currentrole="{{role.roleName}}"
value="{{role.roleName}}"/>
{{else}}
<div id="roleNameField" class="form-group wr-input-control">
<input type="text" id="rolename" data-regex="{{roleNameJSRegEx}}"
data-errormsg="{{roleNameRegExViolationErrorMsg}}" class="form-control"
data-currentrole="{{role.roleName}}"
value="{{role.roleName}}"/>
{{/if}}
<span class=" rolenameError hidden glyphicon glyphicon-remove form-control-feedback"></span>
<label class="error rolenameEmpty hidden" for="summary">Role name is required & Should be in
minimum 3 characters long and do not

@ -29,6 +29,7 @@ function onRequest(context) {
var roleName = request.getParameter("rolename");
var response;
var userStore;
context.isCloud = deviceMgtProps.isCloud;
if (roleName) {
if (roleName.indexOf("/") > -1) {

@ -148,23 +148,29 @@ $(document).ready(function () {
},
cache: true
},
escapeMarkup: function (markup) { return markup; }, // let our custom formatter work
escapeMarkup: function (markup) {
return markup;
}, // let our custom formatter work
minimumInputLength: 1,
templateResult: formatRepo, // omitted for brevity, see the source of this page
templateSelection: formatRepoSelection // omitted for brevity, see the source of this page
});
/**
* Following click function would execute
* when a user clicks on "Add Role" button
* on Add Role page in WSO2 MDM Console.
*/
$("button#add-role-btn").click(function () {
var isCloud = $("#role-create-form").data("cloud");
var rolenameInput = $("input#rolename");
var roleName = rolenameInput.val();
var currentRoleName = $("input#rolename").data("currentrole");
if (isCloud) {
currentRoleName = "devicemgt" + currentRoleName;
}
var domain = $("#domain").val();
var errorMsgWrapper = "#role-create-error-msg";
var errorMsg = "#role-create-error-msg span";
@ -182,12 +188,17 @@ $(document).ready(function () {
$(errorMsgWrapper).removeClass("hidden");
} else {
var addRoleFormData = {};
if (isCloud) {
addRoleFormData.roleName = "devicemgt" + roleName;
} else {
addRoleFormData.roleName = roleName;
}
var addRoleAPI = apiBasePath + "/roles/" + encodeURIComponent(currentRoleName);
if (domain != "PRIMARY") {
addRoleFormData.roleName = domain + "/" + roleName;
addRoleAPI = addRoleAPI + "?user-store=" + encodeURIComponent(domain);
}
invokerUtil.put(
addRoleAPI,
addRoleFormData,
@ -201,6 +212,7 @@ $(document).ready(function () {
$("#role-created-msg").removeClass("hidden");
}
}, function (data) {
var payload = JSON.parse(data.responseText);
$(errorMsg).text(payload.message);
$(errorMsgWrapper).removeClass("hidden");

Loading…
Cancel
Save