Merge pull request #933 from menakaj/master

UI improvements for Policy and User views.
merge-requests/1/head
Harshan Liyanage 7 years ago committed by GitHub
commit cb8edc7b3c

@ -237,10 +237,12 @@
data-search="{{status}}" data-search="{{status}}"
data-display="{{status}}"> data-display="{{status}}">
</td> </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 --> <!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/policy/edit?id={{id}}&deviceType={{platform}}" <a href="{{@app.context}}/policy/edit?id={{id}}&deviceType={{platform}}"
data-id="{{id}}" data-id="{{id}}"
data-toggle="tooltip"
data-original-title="Edit"
data-click-event="remove-form" data-click-event="remove-form"
class="btn padding-reduce-on-grid-view policy-update-link"> class="btn padding-reduce-on-grid-view policy-update-link">
<span class="fw-stack"> <span class="fw-stack">

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

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

@ -17,7 +17,14 @@
*/ */
function onRequest(context) { function onRequest(context) {
var userModule = require("/app/modules/business-controllers/user.js")["userModule"];
var utility = require("/app/modules/utility.js")["utility"]; var utility = require("/app/modules/utility.js")["utility"];
var deviceType = request.getParameter("type"); 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> </li>
{{/zone}} {{/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"}} {{#zone "content"}}
{{#if canView}} {{#if canView}}
{{#if exists}} {{#if exists}}

@ -48,7 +48,13 @@ function onRequest(context) {
canView = true; canView = true;
} }
var canEdit = false;
if (userModule.isAuthorized("/permission/admin/device-mgt/users/edit")) {
canEdit = true;
}
var isCloud = deviceMgtProps.isCloud; 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"); $("#roles-row").addClass("hidden");
} }
var policyId = policyPayloadObj["id"];
var deviceType = policy["platform"]; var deviceType = policy["platform"];
var policyOperations = $("#policy-operations"); var policyOperations = $("#policy-operations");
var policyViewTemplateSrc = $(policyOperations).data("template"); var policyViewTemplateSrc = $(policyOperations).data("template");
@ -110,6 +111,23 @@ var displayPolicy = function (policyPayloadObj) {
if (!hasPolicyProfileScript) { if (!hasPolicyProfileScript) {
populateGenericProfileOperations(policyPayloadObj["profile"]["profileFeaturesList"]); 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