Merge pull request #933 from menakaj/master

UI improvements for Policy and User views.
revert-70aa11f8
Harshan Liyanage 7 years ago committed by GitHub
commit cb8edc7b3c

@ -237,10 +237,12 @@
data-search="{{status}}"
data-display="{{status}}">
</td>
<td class="text-right content-fill text-left-on-grid-view no-wrap">
<td class="text-right content-fill text-left-on-grid-view no-wrap tooltip-overflow-fix">
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/policy/edit?id={{id}}&deviceType={{platform}}"
data-id="{{id}}"
data-toggle="tooltip"
data-original-title="Edit"
data-click-event="remove-form"
class="btn padding-reduce-on-grid-view policy-update-link">
<span class="fw-stack">

@ -385,4 +385,7 @@ $(document).ready(function () {
$("#policy-listing-status").removeClass("hidden");
}
$("#policy-grid").removeClass("hidden");
$('[data-toggle="tooltip"]').tooltip();
});

@ -37,6 +37,14 @@
</li>
{{/zone}}
{{#zone "navbarActions"}}
{{#if canEdit}}
<li id="policy-edit">
</li>
{{/if}}
{{/zone}}
{{#zone "content"}}
{{unit "cdmf.unit.device.operation-mod"}}
{{unit "cdmf.unit.policy.view"}}

@ -17,7 +17,14 @@
*/
function onRequest(context) {
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var utility = require("/app/modules/utility.js")["utility"];
var deviceType = request.getParameter("type");
return {"deviceTypePolicyView": utility.getTenantedDeviceUnitName(deviceType, "policy-view")};
var canEdit = false;
if(userModule.isAuthorized("/permission/admin/device-mgt/policy/manage")) {
canEdit = true;
}
return {"deviceTypePolicyView": utility.getTenantedDeviceUnitName(deviceType, "policy-view"), "canEdit": canEdit};
}

@ -35,6 +35,21 @@
</li>
{{/zone}}
{{#zone "navbarActions"}}
{{#if canEdit}}
<li>
<a href="{{@app.context}}/user/edit?username={{user.username}}" data-username="{{user.username}}"
data-click-event="edit-form" class="btn padding-reduce-on-grid-view edit-user-link">
<span class="fw-stack">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-edit fw-stack-1x"></i>
</span>
Edit
</a>
</li>
{{/if}}
{{/zone}}
{{#zone "content"}}
{{#if canView}}
{{#if exists}}

@ -48,7 +48,13 @@ function onRequest(context) {
canView = true;
}
var canEdit = false;
if (userModule.isAuthorized("/permission/admin/device-mgt/users/edit")) {
canEdit = true;
}
var isCloud = deviceMgtProps.isCloud;
return {"exists": isExsistingUser, "user": user, "userRoles": userRoles, "devices": devices, "canView": canView, "isCloud" : isCloud};
return {"exists": isExsistingUser, "user": user, "userRoles": userRoles, "devices": devices, "canEdit": canEdit,
"canView": canView, "isCloud" : isCloud};
}

@ -66,6 +66,7 @@ var displayPolicy = function (policyPayloadObj) {
$("#roles-row").addClass("hidden");
}
var policyId = policyPayloadObj["id"];
var deviceType = policy["platform"];
var policyOperations = $("#policy-operations");
var policyViewTemplateSrc = $(policyOperations).data("template");
@ -110,6 +111,23 @@ var displayPolicy = function (policyPayloadObj) {
if (!hasPolicyProfileScript) {
populateGenericProfileOperations(policyPayloadObj["profile"]["profileFeaturesList"]);
}
var policyEditContent =
"<a href=" + context + "/policy/edit?id=" + policyId + "&deviceType=" + deviceType + "\n" +
"data-id=" + policyId +
"data-toggle=\"tooltip\"\n" +
"data-original-title=\"Edit\"\n" +
"data-click-event=\"remove-form\"\n" +
"class=\"btn remove-margin padding-reduce-on-grid-view policy-update-link\">" +
"<span class=\"fw-stack\">" +
"<i class=\"fw fw-circle-outline fw-stack-2x\"></i>" +
"<i class=\"fw fw-edit fw-stack-1x\"></i>" +
"</span>" +
" Edit" +
"</a>";
$("#policy-edit").html(policyEditContent);
};
/**

Loading…
Cancel
Save