adding policies

application-manager-new
Rasika Perera 9 years ago
parent f3648800bc
commit 0b5c1b3bc6

@ -124,7 +124,12 @@ if (uriMatcher.match("/{context}/api/device/sketch/download/{downloadId}")) {
var data = {};
//XMLHTTPRequest's GET
result = get(listAllDevicesEndPoint, data, "json");
try {
result = get(listAllDevicesEndPoint, data, "json");
}catch(err){
log.error("Error occured while retrieveing all devices with username: "+user.username);
result=[];
}
} else if (uriMatcher.match("/{context}/api/devices/types")) {

@ -0,0 +1,85 @@
/*
* 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
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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
* specific language governing permissions and limitations
* under the License.
*/
var policyModule;
policyModule = function () {
var log = new Log("modules/policy.js");
var constants = require("/modules/constants.js");
var utility = require("/modules/utility.js").utility;
var userManagementService = utility.getUserManagementService();
var publicMethods = {};
var privateMethods = {};
publicMethods.getPolicies = function () {
//TODO-This method returns includes dummy policy data
var policies = [];
var policyObj = {
"id":1, // Identifier of the policy.
"priorityId":1, // Priority of the policies. This will be used only for simple evaluation.
"profile":{}, // Profile
"policyName":"Turn off light", // Name of the policy.
"generic":true, // If true, this should be applied to all related device.
"roles":{}, // Roles which this policy should be applied.
"ownershipType":{}, // Ownership type (COPE, BYOD, CPE)
"devices":{}, // Individual devices this policy should be applied
"users":{}, // Individual users this policy should be applied
"Compliance":{},
"policyCriterias":{},
"startTime":283468236, // Start time to apply the policy.
"endTime":283468236, // After this time policy will not be applied
"startDate":"", // Start date to apply the policy
"endDate":"", // After this date policy will not be applied.
"tenantId":-1234,
"profileId":1
};
policies.push(policyObj);
policyObj = {
"id":2, // Identifier of the policy.
"priorityId":1, // Priority of the policies. This will be used only for simple evaluation.
"profile":{}, // Profile
"policyName":"Turn on Buzzer", // Name of the policy.
"generic":false, // If true, this should be applied to all related device.
"roles":{}, // Roles which this policy should be applied.
"ownershipType":{}, // Ownership type (COPE, BYOD, CPE)
"devices":{}, // Individual devices this policy should be applied
"users":{}, // Individual users this policy should be applied
"Compliance":{},
"policyCriterias":{},
"startTime":283468236, // Start time to apply the policy.
"endTime":283468236, // After this time policy will not be applied
"startDate":"", // Start date to apply the policy
"endDate":"", // After this date policy will not be applied.
"tenantId":-1234,
"profileId":2
};
policies.push(policyObj);
return policies;
};
return publicMethods;
}();

@ -310,6 +310,34 @@ userModule = function () {
return permissions;
};
/**
* Get User Roles from user store.
* If "Internal/Everyone" role is required - true param needs to be passed.
* @param enableInternalEveryone boolean value true/false to enable Internal/Everyone role
*/
publicMethods.getRoles = function (enableInternalEveryone) {
var carbonModule = require("carbon");
var carbonServer = application.get("carbonServer");
var carbonUser = session.get(constants.USER_SESSION_KEY);
if (!carbonUser) {
log.error("User object was not found in the session");
throw constants.ERRORS.USER_NOT_FOUND;
}
var userManager = new carbonModule.user.UserManager(carbonServer, carbonUser.tenantId);
var allRoles = userManager.allRoles();
var filteredRoles = [];
var i;
for (i = 0; i < allRoles.length; i++) {
if (enableInternalEveryone && allRoles[i] == "Internal/everyone") {
filteredRoles.push(allRoles[i]);
}
if (allRoles[i].indexOf("Internal/") != 0) {
filteredRoles.push(allRoles[i]);
}
}
return filteredRoles;
};
publicMethods.logout = function (successCallback) {
session.invalidate();
successCallback();

@ -20,6 +20,7 @@ var utility;
utility = function () {
var JavaClass = Packages.java.lang.Class;
var PrivilegedCarbonContext = Packages.org.wso2.carbon.context.PrivilegedCarbonContext;
var userManagement = Packages.org.wso2.carbon.device.mgt.iot.common.UserManagement();
var getOsgiService = function (className) {
return PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(JavaClass.forName(className));
@ -32,7 +33,7 @@ utility = function () {
};
publicMethods.getUserManagementService = function () {
return Packages.org.wso2.carbon.device.mgt.iot.common.UserManagement();
return userManagement;
};
publicMethods.getPolicyManagementService = function () {

@ -0,0 +1,9 @@
{{authorized}}
{{layout "fluid"}}
{{#zone "title"}}
WSO2 DC | Add New Policy
{{/zone}}
{{#zone "body"}}
{{unit "appbar" link="policies" title="My Policies"}}
{{unit "policy-create"}}
{{/zone}}

@ -0,0 +1,21 @@
{{authorized}}
{{layout "fluid"}}
{{#zone "title"}}
Policies
{{/zone}}
{{#zone "body"}}
{{unit "appbar" link="policies" title="My Policies"}}
{{unit "extended-search-box"}}
<div class="wr-device-list row">
<div class="wr-hidden-operations wr-advance-operations">
</div>
<div class="col-md-12 wr-page-content">
<!-- content -->
<div>
{{unit "policy-listing"}}
</div>
<!-- /content -->
</div>
</div>
{{/zone}}

@ -45,7 +45,7 @@
{{#if permissions.ADD_USER}}
<li><a href="/iotserver/users"><i class="fw fw-user"></i>User Management</a></li>
{{/if}}
<li><a href="#"><i class="fw fw-policy"></i>Policy Management</a></li>
<li><a href="/iotserver/policies"><i class="fw fw-policy"></i>Policy Management</a></li>
<li><a href="/iotserver/dashboard"><i class="fw fw-settings"></i>Dashboard</a></li>
</ul>
</div>

@ -0,0 +1,243 @@
{{#zone "main"}}
<div class="row">
<div class="col-md-12">
<div class="hidden wr-steps">
<div class="col-md-3 col-xs-3">
<div class="itm-wiz itm-wiz-current" data-step="policy-platform"><div class="wiz-no">1</div><div class="wiz-lbl hidden-xs"><span>Select Platform</span></div></div>
<br class="c-both" />
</div>
<div class="col-md-3 col-xs-3">
<div class="itm-wiz" data-step="policy-profile"><div class="wiz-no">2</div><div class="wiz-lbl hidden-xs"><span>Configure Profile</span></div></div>
<br class="c-both" />
</div>
<div class="col-md-3 col-xs-3">
<div class="itm-wiz" data-step="policy-criteria"><div class="wiz-no">3</div><div class="wiz-lbl hidden-xs"><span>Assign to a group</span></div></div>
<br class="c-both" />
</div>
<div class="col-md-3 col-xs-3">
<div class="itm-wiz" data-step="policy-content"><div class="wiz-no">4</div><div class="wiz-lbl hidden-xs"><span>Publish</span></div></div>
<br class="c-both" />
</div>
</div>
<div class="container col-centered wr-content policy-message hidden">
<div class="wr-form">
<h1 class="wr-title">Policy creation is successful</h1>
Please click <b>"Finish"</b> to complete the process and go back to the policy list
<hr />
<button class="wr-btn wizard-stepper" data-current="policy-message" data-direct="/mdm/policies/" onclick="window.location.href=''">
&nbsp;&nbsp;&nbsp;&nbsp;Finish&nbsp;&nbsp;&nbsp;&nbsp;
</button>
</div>
</div>
<div class="container col-centered wr-content policy-content hidden">
<div class="wr-form">
<h1 class="page-sub-title">Add Policy</h1>
<div class="row wr-wizard"></div>
<div class="row">
<div class="col-lg-12">
<div>
<label class="wr-input-label" title="">
Set a Name to Your Policy
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</label>
<div class="wr-input-control">
<div class="cus-col-50">
<input id="policy-name-input" type="text" value="" placeholder="input text"/>
</div>
<br class="c-both" />
</div>
<label class="wr-input-label" title="">
Set Description
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</label>
<div class="wr-input-control">
<div class="cus-col-50">
<textarea id="policy-description-input" placeholder="description"></textarea>
</div>
<br class="c-both" />
</div>
</div>
<div class="wr-input-control wr-btn-grp">
<a href="#" class="wr-btn wizard-stepper" data-current="policy-content" data-back="true" data-next="policy-criteria">Back</a>
<a href="#" class="wr-btn wizard-stepper" data-current="policy-content" data-next="policy-message">Save</a>
</div>
</div>
</div>
</div>
</div>
<div class="container col-centered wr-content policy-criteria hidden">
<div class="wr-form">
<h1 class="page-sub-title">Add Policy</h1>
<div class="row wr-wizard"></div>
<div class="row">
<div class="col-lg-12">
<div>
<label class="wr-input-label" title="">
Set Device Ownership Type
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</label>
<div class="wr-input-control">
<div class="cus-col-50">
<select id="ownership-input" class="form-control">
<option>COPE</option>
<option>BYOD</option>
</select>
</div>
<br class="c-both" />
</div>
<div class="wr-input-control">
<label class="wr-input-control radio light" rel="assetfilter">
<input id="userRadio" type="radio" name="user-select" value="userSelectField" class="user-select-radio" />
<span class="helper">User</span>
</label>
<label class="wr-input-control radio light">
<input id="userRoleRadio" type="radio" name="user-select" value="userRoleSelectField" class="user-select-radio" />
<span class="helper">User Role</span>
</label>
</div>
<div id="userSelectField" class="user-select">
<label class="wr-input-label" title="">
Set User(s)
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</label>
<div class="wr-input-control">
<div class="cus-col-50">
<select id="users-input" class="form-control select2" multiple="multiple">
{{#each users}}
<option>{{username}}</option>
{{/each}}
</select>
</div>
<br class="c-both" />
</div>
</div>
<div id="userRoleSelectField" class="user-select" style="display:none">
<label class="wr-input-label" title="">
Set User Role(s)
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</label>
<div class="wr-input-control">
<div class="cus-col-50">
<select id="user-roles-input" class="form-control select2" multiple="multiple">
{{#each roles}}
<option>{{this}}</option>
{{/each}}
</select>
</div>
<br class="c-both" />
</div>
</div>
<label class="wr-input-label" title="">
Set Action upon Non-compliance
<span class="wr-help-tip glyphicon glyphicon-question-sign"></span>
</label>
<div class="wr-input-control">
<div class="cus-col-50">
<select id="action-input" class="form-control">
<option data-action="enforce">Enforce</option>
<option data-action="warn">Warn</option>
<option data-action="monitor">Monitor</option>
</select>
</div>
<br class="c-both" />
</div>
</div>
<div class="wr-input-control wr-btn-grp">
<a href="#" class="wr-btn wizard-stepper" data-current="policy-criteria" data-back="true" data-next="policy-profile">Back</a>
<a href="#" class="wr-btn wizard-stepper" data-current="policy-criteria" data-next="policy-content">Continue</a>
</div>
</div>
</div>
</div>
</div>
<div class="container col-centered wr-content policy-profile hidden">
<div class="wr-form">
<h1 class="page-sub-title">Add Policy</h1>
<div class="row wr-wizard"></div>
<div class="row">
<div class="col-lg-12">
<div class="wr-advance-operations">
<label class="wr-input-label col-sm-4" for="maxFailedAttempts">Policy</label>
<div class="wr-input-control">
<input type="text" class="form-control" id="policyDefinition" data-key="policyDefinition" placeholder="Enter the policy">
</div>
</div>
<div class="wr-input-control wr-btn-grp">
<a href="#" class="wr-btn wizard-stepper" data-current="policy-profile" data-back="true" data-next="policy-platform">Back</a>
<a href="#" class="wr-btn wizard-stepper" data-current="policy-profile" data-next="policy-criteria">Continue</a>
</div>
</div>
</div>
</div>
</div>
<div class="container col-centered wr-content policy-platform">
<div class="wr-form">
<h1 class="page-sub-title">Add Policy</h1>
<div class="row wr-wizard">
<div class="col-md-3 col-xs-3">
<div class="itm-wiz itm-wiz-current" data-step="policy-platform"><div class="wiz-no">1</div><div class="wiz-lbl hidden-xs"><span>Select Platform</span></div></div>
<br class="c-both" />
</div>
<div class="col-md-3 col-xs-3">
<div class="itm-wiz" data-step="policy-profile"><div class="wiz-no">2</div><div class="wiz-lbl hidden-xs"><span>Configure Profile</span></div></div>
<br class="c-both" />
</div>
<div class="col-md-3 col-xs-3">
<div class="itm-wiz" data-step="policy-criteria"><div class="wiz-no">3</div><div class="wiz-lbl hidden-xs"><span>Assign to a group</span></div></div>
<br class="c-both" />
</div>
<div class="col-md-3 col-xs-3">
<div class="itm-wiz" data-step="policy-content"><div class="wiz-no">4</div><div class="wiz-lbl hidden-xs"><span>Publish</span></div></div>
<br class="c-both" />
</div>
</div>
<div class="row">
<div class="col-lg-12">
<div class="row wr-tile-buttons-list">
<div class="wr-input-control">
<ul class="tile-buttons row">
<li class="col-lg-4"><a href="#" class="wizard-stepper" data-current="policy-platform" data-next="policy-profile" data-platform="android" data-platform-id="1"><i class="fw fw-android"></i>Android</a></li>
<li class="col-lg-4"><a href="#" class="wizard-stepper" data-current="policy-platform" data-next="policy-profile" data-platform="ios" data-platform-id="2"><i class="fw fw-apple"></i>iOS</a></li>
<li class="col-lg-4"><a href="#" class="wizard-stepper" data-current="policy-platform" data-next="policy-profile" data-platform="windows" data-platform-id="3"><i class="fw fw-windows"></i>Windows</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- content -->
</div>
</div>
{{/zone}}
{{#zone "bottomJs"}}
<script id="hidden-operations-bar-ios" src="{{self.publicURL}}/templates/hidden-operations-ios.hbs" type="text/x-handlebars-template" ></script>
<script id="hidden-operations-bar-android" src="{{self.publicURL}}/templates/hidden-operations-android.hbs" type="text/x-handlebars-template" ></script>
<script src="{{self.publicURL}}/js/policy-create.js"></script>
{{/zone}}

@ -0,0 +1,10 @@
function onRequest(context){
var userModule = require("/modules/user.js").userModule;
var roles = userModule.getRoles(true);
var users = userModule.getUsers();
var actions = ["Enforce"];
context.roles = roles;
context.users = users;
context.actions = actions;
return context;
}

@ -0,0 +1,155 @@
$('select.select2').select2({
placeholder: 'Select..'
});
$('select.select2[multiple=multiple]').select2({
placeholder: 'Select..',
tags: true
});
var stepperRegistry = {},
hiddenOperation = '.wr-hidden-operations-content > div',
advanceOperation = '.wr-advance-operations';
function initStepper(selector){
$(selector).click(function(){
var nextStep = $(this).data("next");
var currentStep = $(this).data("current");
var isBack = $(this).data("back");
if (!isBack){
var action = stepperRegistry[currentStep];
if (action){
action(this);
}
}
if (!nextStep) {
var direct = $(this).data("direct");
window.location.href = direct;
}
$(".itm-wiz").each(function(){
var step = $(this).data("step");
if (step == nextStep){
$(this).addClass("itm-wiz-current");
}else{
$(this).removeClass("itm-wiz-current");
}
});
$(".wr-wizard").html($(".wr-steps").html());
$("." + nextStep).removeClass("hidden");
$("." + currentStep).addClass("hidden");
});
}
function showAdvanceOperation(operation, button){
$(button).addClass('selected');
$(button).siblings().removeClass('selected');
$(hiddenOperation + '[data-operation="' + operation + '"]').show();
$(hiddenOperation + '[data-operation="' + operation + '"]').siblings().hide();
}
var policy = {};
var configuredProfiles = [];
function savePolicy(){
var profilePayloads = [];
for (var key in policy.profile) {
if (policy.profile.hasOwnProperty(key)) {
profilePayloads.push({
featureCode: key,
deviceTypeId: policy.platformId,
content: policy.profile[key]
});
}
}
var payload = {
policyName: policy.policyName,
compliance: policy.selectedAction,
ownershipType: policy.selectedOwnership,
profile: {
profileName: policy.policyName,
deviceType: {
id: policy.platformId
},
profileFeaturesList: profilePayloads
}
};
payload.users = [];
payload.roles = [];
if (policy.selectedUsers){
payload.users = policy.selectedUsers;
}else if (policy.selectedUserRoles){
payload.roles = policy.selectedUserRoles;
}
invokerUtil.post("/mdm-admin/policies", payload, function(){
$(".policy-message").removeClass("hidden");
$(".add-policy").addClass("hidden");
}, function(){
});
}
$(document).ready(function(){
initStepper(".wizard-stepper");
$( "input[type='radio'].user-select-radio" ).change(function() {
$('.user-select').hide();
$('#'+$(this).val()).show();
});
//Adds an event listener to swithc
$(advanceOperation).on("click", ".wr-input-control.switch", function(evt){
var operation = $(this).parents(".operation-data").data("operation");
//prevents event bubbling by figuring out what element it's being called from
if (evt.target.tagName == "INPUT") {
if(!$(this).hasClass('collapsed')){
configuredProfiles.push(operation);
}else {
//splicing the array if operation is present
var index = jQuery.inArray( operation, configuredProfiles );
if (index!= -1){
configuredProfiles.splice( index, 1 );
}
}
console.log(configuredProfiles);
}
});
stepperRegistry['policy-content'] = function (actionButton){
policy.policyName = $("#policy-name-input").val();
policy.policyDescription = $("#policy-description-input").val();
//All data is collected. Policy can now be created.
savePolicy();
};
stepperRegistry['policy-criteria'] = function (actionButton){
$( "input[type='radio'].user-select-radio").each(function(){
if ( $(this).is(':radio')){
if ($(this).is(":checked")){
if($(this).val() == "userSelectField"){
policy.selectedUsers = $("#users-input").val();
}else if($(this).val() == "userRoleSelectField"){
policy.selectedUserRoles = $("#user-roles-input").val();
}
}
}
});
policy.selectedAction = $("#action-input").find(":selected").data("action");
policy.selectedOwnership = $("#ownership-input").val();
};
stepperRegistry['policy-profile'] = function (actionButton){
var deviceType = policy.platform;
var generatedProfile = operationModule.generateProfile(deviceType, configuredProfiles);
policy.profile = generatedProfile;
};
stepperRegistry['policy-platform'] = function (actionButton){
policy.platform = $(actionButton).data("platform");
policy.platformId = $(actionButton).data("platform-id");
};
$(".uu").click(function(){
var policyName = $("#policy-name-input").val();
var selectedProfiles = $("#profile-input").find(":selected");
var selectedProfileId = selectedProfiles.data("id");
var selectedUserRoles = $("#user-roles-input").val();
var selectedUsers = $("#users-input").val();
var selectedAction = $("#action-input").val();
});
});

@ -0,0 +1,251 @@
<div class="row no-gutter">
<div class="wr-hidden-operations-nav col-lg-4">
<a href="javascript:void(0)" onclick="showAdvanceOperation('security', this)" class="selected">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-padlock fw-stack-2x"></i>
</span>
Security
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('restriction', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-settings fw-stack-2x"></i>
</span>
Restrictions
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('application', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-application fw-stack-2x"></i>
</span>
Applications
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('wifi', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-wifi fw-stack-2x"></i>
</span>
Wi-fi
</a>
</div>
<div class="wr-hidden-operations-content col-lg-8">
<!-- security -->
<div class="wr-hidden-operation" data-operation="security" style="display: block">
<div class="panel panel-default operation-data" data-operation="{{features.ENCRYPT_STORAGE.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Encryption Enable/Disable
<label class="wr-input-control switch" data-toggle="collapse" data-target="#enableEncryptionTab">
<span class="text">Enabled</span>
<input type="checkbox">
<span class="helper"></span>
</label>
</h2>
</div>
<div id="enableEncryptionTab" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="enableEncryptionTab">
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="enableEncryption" data-key="enableEncryption" />
<span class="helper" title="Enable Encryption">Enable Encryption<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<!--<a href="javascript:runOperation('{{features.ENCRYPT_STORAGE.code}}')" class="btn-operations">Configure</a>-->
</div>
</div>
<div class="panel panel-default operation-data" data-operation="{{features.PASSCODE_POLICY.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Passcode Policy
<label class="wr-input-control switch" data-toggle="collapse" data-target="#passCodePolicy">
<span class="text">Enabled</span>
<input type="checkbox">
<span class="helper"></span>
</label>
</h2>
</div>
<div id="passCodePolicy" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="passCodePolicy">
<label class="wr-input-label col-sm-4" for="maxFailedAttempts">Maximum Failed Attempts</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="maxFailedAttempts" data-key="maxFailedAttempts" placeholder="Enter maximum Failed Attempts">
</div>
<label class="wr-input-label col-sm-4" for="minLength">Minimum Length</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="minLength" data-key="minLength" placeholder="Enter minimum Length">
</div>
<label class="wr-input-label col-sm-4" for="pinHistory">PIN History</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="pinHistory" data-key="pinHistory" placeholder="Enter PIN History">
</div>
<label class="wr-input-label col-sm-4" for="minComplexChars">Minimum complex characters</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="minComplexChars" data-key="minComplexChars" placeholder="Enter minimum complex characters">
</div>
<label class="wr-input-label col-sm-4" for="lockcode">Minimum PIN Age in days</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="maxPINAgeInDays" data-key="maxPINAgeInDays" placeholder="Enter minimum PIN age in days">
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="requireAlphanumeric" data-key="requireAlphanumeric" />
<span class="helper" title="Require Alphanumeric">Require Alphanumeric<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="allowSimple" data-key="allowSimple" />
<span class="helper" title="Allow simple PIN">Allow simple PIN<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<!--<a href="javascript:runOperation('{{features.PASSCODE_POLICY.code}}')" class="btn-operations">Configure</a>-->
</div>
</div>
</div>
<!-- /security -->
<!-- wi-fi -->
<div class="wr-hidden-operation" data-operation="wifi">
<div class="panel panel-default operation-data" data-operation="{{features.WIFI.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Configure Wifi
<label class="wr-input-control switch" data-toggle="collapse" data-target="#wifi">
<span class="text">Enabled</span>
<input type="checkbox">
<span class="helper"></span>
</label>
</h2>
</div>
<div id="wifi" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="wifi">
<label class="wr-input-label" title="Identification of the wireless network to connect to">Service Set Identifier<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Identification of the wireless network to connect to</span-->
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="ssid" data-key="ssid" placeholder="Enter SSID"/>
</div>
<label class="wr-input-label" title="Password for the wireless network">Password<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Password for the wireless network</span-->
<div class="wr-input-control">
<input type="password" class="form-control operationDataKeys" id="password" data-key="password" placeholder="Password"/>
</div>
<!--<a href="javascript:runOperation('{{features.WIFI.code}}')" class="btn-operations">Configure</a>-->
</div>
</div>
</div>
<!-- /wi-fi -->
<!-- application -->
<div class="wr-hidden-operation" data-operation="application">
<div class="panel panel-default operation-data" data-operation="{{features.INSTALL_APPLICATION.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Install App
<label class="wr-input-control switch" data-toggle="collapse" data-target="#installApp">
<span class="text">Enabled</span>
<input type="checkbox">
<span class="helper"></span>
</label>
</h2>
</div>
<div id="installApp" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="installApp">
<label class="wr-input-label" title="Application Identifier">App Identifier<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="package-name" data-key="packageName" placeholder="Enter App Identifer"/>
</div>
<div class="wr-input-control">
<label class="wr-input-control dropdown">
<span class="helper" title="App Type">App Type<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
<select class="form-control col-sm-8 operationDataKeys appTypesInput" id="type" data-key="type">
<option>Public</option>
<option>Enterprise</option>
</select>
</label>
</div>
<label class="wr-input-label" title="URL">URL<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="url" data-key="url" placeholder="Enter URL"/>
</div>
<!--<a href="javascript:runOperation('{{features.INSTALL_APPLICATION.code}}')" class="btn-operations">Install</a>-->
</div>
</div>
<div class="panel panel-default operation-data" data-operation="{{features.WEBCLIP.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Install Web Clip
<label class="wr-input-control switch" data-toggle="collapse" data-target="#installWebClip">
<span class="text">Enabled</span>
<input type="checkbox">
<span class="helper"></span>
</label>
</h2>
</div>
<div id="installWebClip" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="installWebClip">
<label class="wr-input-label" title="Title of the web clip">Title<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="title" data-key="title" placeholder="Enter Title"/>
</div>
<label class="wr-input-label" title="URL">URL<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="url" data-key="url" placeholder="Enter URL"/>
</div>
<!--<a href="javascript:runOperation('{{features.WEBCLIP.code}}')" class="btn-operations">Install</a>-->
</div>
</div>
<div class="panel panel-default operation-data" data-operation="{{features.UNINSTALL_APPLICATION.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Uninstall App
<label class="wr-input-control switch" data-toggle="collapse" data-target="#uninstallApp">
<span class="text">Enabled</span>
<input type="checkbox">
<span class="helper"></span>
</label>
</h2>
</div>
<div id="uninstallApp" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="uninstallApp">
<label class="wr-input-label" title="Application Identifier">App Identifier<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Identification of the wireless network to connect to</span-->
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="package-name" data-key="packageName" placeholder="Enter App Identifer"/>
</div>
<!--<a href="javascript:runOperation('{{features.UNINSTALL_APPLICATION.code}}')" class="btn-operations">Uninstall</a>-->
</div>
</div>
</div>
<!-- /application -->
<!-- Restriction -->
<div class="wr-hidden-operation" data-operation="restriction">
<div class="panel panel-default operation-data" data-operation="{{features.CAMERA.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
Camera Enable/Disable
<label class="wr-input-control switch" data-toggle="collapse" data-target="#cameraDisable">
<span class="text">Enabled</span>
<input type="checkbox">
<span class="helper"></span>
</label>
</h2>
</div>
<div id="cameraDisable" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="cameraDisable">
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="enableCamera" data-key="enableCamera" checked />
<span class="helper" title="Remove App upon dis-enrollment">Enable Camera<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<!--<a href="javascript:runOperation('{{features.CAMERA.code}}')" class="btn-operations">Configure</a>-->
</div>
</div>
</div>
<!-- /Restriction -->
</div>
</div>

@ -0,0 +1,366 @@
<div class="row no-gutter">
<div class="wr-hidden-operations-nav col-lg-4">
<a href="javascript:void(0)" onclick="showAdvanceOperation('{{features.WIFI.code}}', this)" class="selected">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-wifi fw-stack-2x"></i>
</span>
Wi-fi
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('application', this)" >
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-padlock fw-stack-2x"></i>
</span>
Applications
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('{{features.RESTRICTION.code}}', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-settings fw-stack-2x"></i>
</span>
Restrictions
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('mail', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-message fw-stack-2x"></i>
</span>
Mail
</a>
<a href="javascript:void(0)" onclick="showAdvanceOperation('{{features.AIR_PLAY.code}}', this)">
<span class="wr-hidden-operations-icon fw-stack">
<i class="fw fw-service-provider fw-stack-2x"></i>
</span>
Air Play
</a>
</div>
<div class="wr-hidden-operations-content col-lg-8">
<!-- application -->
<div class="wr-hidden-operation" data-operation="application" style="display: block">
<div class="panel panel-default operation-data" data-operation="{{features.INSTALL_STORE_APPLICATION.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#installPublicAppiOS" aria-expanded="true" aria-controls="installPublicAppiOS">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
</span>
Install Public App
</a>
</h2>
</div>
<div id="installPublicAppiOS" class="panel-collapse panel-body collapse in" role="tabpanel" aria-labelledby="installPublicAppiOS">
<label class="wr-input-label" for="appIdentifier">App identifier</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="appIdentifier" data-key="appIdentifier" placeholder="Enter App Identifier">
</div>
<label class="wr-input-label col-sm-4" for="ituneID">iTunes store ID</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="ituneID" data-key="ituneID" placeholder="Enter iTunes store ID">
</div>
<label class="wr-input-label col-sm-4" for="bundleId">Bundle ID</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="bundleId" data-key="bundleId" placeholder="Enter Bundle ID">
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="appRemoval" data-key="appRemoval" checked />
<span class="helper" title="Remove App upon dis-enrollment">Remove App upon dis-enrollment<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="backupData" data-key="backupData" checked />
<span class="helper" title="Prevent backup of App data">Prevent backup of App data<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<a href="javascript:runOperation('{{features.INSTALL_STORE_APPLICATION.code}}')" class="btn-operations">Install</a>
</div>
</div>
<div class="panel panel-default operation-data" data-operation="{{features.INSTALL_ENTERPRISE_APPLICATION.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#installEnterpriseAppiOS" aria-expanded="true" aria-controls="installPublicAppiOS" class="collapsed">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
</span>
Install Enterprise App
</a>
</h2>
</div>
<div id="installEnterpriseAppiOS" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="installEnterpriseAppiOS">
<label class="wr-input-label" for="appIdentifier">App identifier</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="appIdentifier" data-key="appIdentifier" placeholder="Enter App Identifier">
</div>
<label class="wr-input-label col-sm-4" for="manifestURL">Manifest URL</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="manifestURL" data-key="manifestURL" placeholder="Enter manifest URL">
</div>
<label class="wr-input-label col-sm-4" for="bundleId">Bundle ID</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="bundleId" data-key="bundleId" placeholder="Enter Bundle ID">
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="appRemoval" data-key="appRemoval" checked />
<span class="helper" title="Remove App upon dis-enrollment">Remove App upon dis-enrollment<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="backupData" data-key="backupData" checked />
<span class="helper" title="Prevent backup of App data">Prevent backup of App data<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<a href="javascript:runOperation('{{features.INSTALL_ENTERPRISE_APPLICATION.code}}')" class="btn-operations">Install</a>
</div>
</div>
<div class="panel panel-default operation-data" data-operation="{{features.REMOVE_APPLICATION.code}}">
<div class="panel-heading" role="tab">
<h2 class="sub-title panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#removeApplication" aria-expanded="true" aria-controls="removeApplication" class="collapsed">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
</span>
Uninstall App
</a>
</h2>
</div>
<div id="removeApplication" class="panel-collapse panel-body collapse" role="tabpanel" aria-labelledby="removeApplication">
<label class="wr-input-label col-sm-4" for="bundleId">Bundle ID</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="bundleId" data-key="bundleId" placeholder="Enter Bundle ID">
</div>
<a href="javascript:runOperation('{{features.REMOVE_APPLICATION.code}}')" class="btn-operations">Uninstall</a>
</div>
</div>
</div>
<!-- /application -->
<!-- wi-fi -->
<div class="wr-hidden-operation panel-body operation-data" data-operation="{{features.WIFI.code}}">
<label class="wr-input-label" title="Identification of the wireless network to connect to">Service Set Identifier<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Identification of the wireless network to connect to</span-->
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="ssid" data-key="ssid" placeholder="Enter SSID" />
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="hiddenNetwork" data-key="hiddenNetwork" checked />
<span class="helper" title="Enable if target network is not open or broadcasting">Hidden Network<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="autoJoin" data-key="autoJoin" checked />
<span class="helper" title="Automatically join this wireless network">Auto Join<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Automatically join this wireless network</span-->
</div>
<label class="wr-input-label" title="Configures proxies to be used with this network">Proxy Setup<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Configures proxies to be used with this network</span-->
<div class="wr-input-control">
<select class="form-control">
<option>None</option>
</select>
</div>
<label class="wr-input-label" title="Wireless network encryption to use when connecting">Security Type<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Wireless network encryption to use when connecting</span-->
<div class="wr-input-control">
<select class="form-control operationDataKeys" id="encryptionType" data-key="encryptionType">
<option data-id="WPA">WPA/WPA2 Personal</option>
</select>
</div>
<label class="wr-input-label" title="Password for the wireless network">Password<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Password for the wireless network</span-->
<div class="wr-input-control">
<input type="password" value="" class="operationDataKeys" id="password" data-key="password" placeholder="input text"/>
</div>
<label class="wr-input-label" title="Configures network to appear as legacy or Passport">Network Type<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Configures network to appear as legacy or Passport</span-->
<div class="wr-input-control">
<select class="form-control">
<option>Standard</option>
</select>
</div>
<a href="javascript:runOperation('{{features.WIFI.code}}')" class="btn-operations">Configure</a>
</div>
<!-- /wi-fi -->
<!-- mail -->
<div class="wr-hidden-operation panel-body" data-operation="mail">
<label class="wr-input-label" title="The display name of the account">Account Description<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Identification of the wireless network to connect to</span-->
<div class="wr-input-control">
<input type="text" value="" placeholder="input text"/>
</div>
<label class="wr-input-label" title="The protocol for accessing the email account">Account Type<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Configures proxies to be used with this network</span-->
<div class="wr-input-control">
<div class="cus-col-25">
<select class="form-control">
<option>IMAP</option>
</select>
</div>
<div class="cus-col-50">
<span>Path Prefix</span> <input type="text" value="" placeholder="input text" />
</div>
<br class="c-both" />
</div>
<label class="wr-input-label" title="The display name of the user">User Display Name<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Identification of the wireless network to connect to</span-->
<div class="wr-input-control">
<input type="text" value="" placeholder="input text"/>
</div>
<label class="wr-input-label" title="The address of the account">Email Address<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Identification of the wireless network to connect to</span-->
<div class="wr-input-control">
<input type="text" value="" placeholder="input text"/>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" checked />
<span class="helper" title="Messages can be moved from this account to another">Allow user to move messages from this account<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" checked />
<span class="helper" title="Include this account in recent address syncing">Allow Recent Address syncing<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" checked />
<span class="helper" title="Send outgoing mail from this account only from Mail app">Use Only in Mail<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Send outgoing mail from this account only from Mail app</span-->
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" checked />
<span class="helper" title="Support S/MIME for this account">Enable S/MIME<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Support S/MIME for this account</span-->
</div>
<label class="wr-input-label" title="The protocol for accessing the email account">Mail Server and Port<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>The protocol for accessing the email account</span-->
<div class="wr-input-control">
<div class="cus-col-70">
<input type="text" value="" placeholder="input text"/>
</div>
<div class="cus-col-25">
<span> : </span><input type="text" value="993" placeholder="input text" />
</div>
<br class="c-both" />
</div>
<label class="wr-input-label" title="The username used to connect to the server for incoming mail">Username<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>The Username used to connect to the server for incoming mail</span-->
<div class="wr-input-control">
<input type="text" value="" placeholder="input text"/>
</div>
<label class="wr-input-label" title="The autyentication method for the incoming mail server">Authentication Type<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>Wireless network encryption to use when connecting</span-->
<div class="wr-input-control">
<select class="form-control">
<option>Password</option>
</select>
</div>
<label class="wr-input-label" title="The password for the incoming mail server">Password<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></label>
<!--span>The Username used to connect to the server for incoming mail</span-->
<div class="wr-input-control">
<input type="text" value="" placeholder="input text"/>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" checked />
<span class="helper" title="Retrieve incoming mail through secure socket layer">Use SSL<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
<!--span>Enable if target network is not open or broadcasting</span-->
</div>
</div>
<!-- /mail -->
<!-- general -->
<div class="wr-hidden-operation panel-body operation-data" data-operation="{{features.RESTRICTION.code}}">
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="allowCamera" data-key="allowCamera" checked />
<span class="helper" title="Allow Camera">Allow Camera<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="allowCloudBackup" data-key="allowCloudBackup" checked/>
<span class="helper" title="Allow Cloud Backup">Allow Cloud Backup<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="allowScreenShot" data-key="allowScreenShot" checked/>
<span class="helper" title="Allow Screenshots">Allow Screenshots<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="allowSafari" data-key="allowSafari" checked />
<span class="helper" title="Allow Safari Browser">Allow Safari Browser<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<div class="wr-input-control">
<label class="wr-input-control checkbox">
<input type="checkbox" class="operationDataKeys" id="allowAirDrop" data-key="allowAirDrop" checked />
<span class="helper" title="Allow AirDrop">Allow AirDrop<span class="wr-help-tip glyphicon glyphicon-question-sign"></span></span>
</label>
</div>
<a href="javascript:runOperation('{{features.RESTRICTION.code}}')" class="btn-operations">Configure</a>
</div>
<!-- /general -->
<!-- air play -->
<div class="wr-hidden-operation panel-body operation-data" data-operation="{{features.AIR_PLAY.code}}">
<label class="wr-input-label col-sm-4" for="airPlayLocation">Location</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="airPlayLocation" data-key="location" placeholder="Enter location" />
</div>
<label class="wr-input-label col-sm-4" for="airPlayDeviceName">Device Name</label>
<div class="wr-input-control">
<input type="text" class="form-control operationDataKeys" id="airPlayDeviceName" data-key="deviceName" placeholder="Enter Device Name" />
</div
<label class="wr-input-label col-sm-4" for="airPlayPassword">AirPlay password</label>
<div class="wr-input-control">
<input type="password" class="form-control operationDataKeys" id="airPlayPassword" data-key="password" placeholder="Password" />
</div>
<a href="javascript:runOperation('{{features.AIR_PLAY.code}}')" class="btn-operations">Configure</a>
</div>
<!-- /air play -->
</div>
</div>

@ -0,0 +1,201 @@
{{#zone "main"}}
<div class="row wr-device-board">
<div class="col-lg-12 wr-secondary-bar">
<label class="device-id device-select" data-deviceid="{{device.deviceIdentifier}}" data-type="{{device.type}}">
Device {{device.name}}
<span class="lbl-device">
{{#if device.viewModel.vendor}}
({{device.viewModel.vendor}} {{device.viewModel.model}})
{{/if}}
</span>
</label>
</div>
</div>
<div class="wr-device-list row">
<div class="wr-hidden-operations wr-advance-operations">
</div>
<div class="col-md-12 wr-page-content">
{{unit "operation-bar" deviceType=device.type}}
<div class="row">
<div class="col-md-12 wr-stats-board">
<!-- content -->
<div class="col-lg-2 ast-desc-image">
<div class="row">
<div class="col-lg-12 col-sm-4">
<img src="{{self.publicURL}}/img/device_icons/{{device.type}}.png" style="width:200px" />
</div>
<div class="col-lg-12 col-sm-4 ast-desc">
<div class="ast-device-desc"><b>Owner:</b> {{device.owner}}</div>
<div class="ast-device-desc"><b>Date of Enrollment:</b><br/> <span class="formatDate">{{device.enrollment}}</span></div>
<!--<div class="ast-device-desc"><b>Device:</b> {{device.viewModel.vendor}} {{device.properties.model}}</div>-->
<!--<div class="ast-device-desc"><b>Model:</b> {{device.viewModel.model}}</div>-->
<!--<div class="ast-device-desc"><b>IMEI:</b> {{device.viewModel.imei}}</div>-->
<!--{{#if device.viewModel.udid}}<div class="ast-device-desc"><b>UDID:</b> {{device.viewModel.udid}}</div>{{/if}}-->
<!--{{#if device.viewModel.phoneNumber}}<div class="ast-device-desc"><b>Phone Number:</b> {{device.viewModel.phoneNumber}}</div>{{/if}}-->
</div>
</div>
</div>
<div class="col-lg-10 tiles">
<!-- device summary -->
<div class="row">
<div class="col-lg-6 col-md-6">
{{#if device.viewModel.BatteryLevel}}
<div class="col-lg-4">
<div class="wr-stats-board-tile">
<div class="tile-name">BATTERY</div>
<div>
<div class="tile-icon"><i class="fw fw-battery"></i></div>
<div class="tile-stats">{{device.viewModel.BatteryLevel}}%</div>
</div>
</div>
</div>
{{/if}}
{{#if device.viewModel.DeviceCapacity}}
<div class="col-lg-4">
<div class="wr-stats-board-tile">
<div class="tile-name">STORAGE</div>
<div>
<div class="tile-icon"><i class="fw fw-hdd"></i></div>
<div class="tile-stats">{{device.viewModel.DeviceCapacityPercentage}}%<span class="tile-stats-free">{{device.viewModel.DeviceCapacityUsed}} GB Free</span></div>
</div>
</div>
</div>
{{/if}}
{{#if device.viewModel.internal_memory.FreeCapacity}}
<div class="col-lg-4">
<div class="wr-stats-board-tile">
<div class="tile-name">LOCAL STORAGE</div>
<div>
<div class="tile-icon"><i class="fw fw-hdd"></i></div>
<div class="tile-stats">{{device.viewModel.internal_memory.DeviceCapacityPercentage}}%<span class="tile-stats-free">{{device.viewModel.internal_memory.FreeCapacity}} GB Free</span></div>
</div>
</div>
</div>
{{/if}}
{{#if device.viewModel.external_memory.FreeCapacity}}
<div class="col-lg-4">
<div class="wr-stats-board-tile">
<div class="tile-name">EXTERNAL STORAGE</div>
<div>
<div class="tile-icon"><i class="fw fw-hdd"></i></div>
<div class="tile-stats">{{device.viewModel.external_memory.DeviceCapacityPercentage}}%<span class="tile-stats-free">{{device.viewModel.external_memory.FreeCapacity}} GB Free</span></div>
</div>
</div>
</div>
{{/if}}
</div>
</div>
<!-- /device summary -->
<div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
<!-- statistics -->
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingFour">
<h2 class="sub-title panel-title">
<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseFour" aria-expanded="false" aria-controls="collapseFour">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
</span>
Device Statistics
</a>
</h2>
</div>
<div id="collapseFour" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingFour">
<div class="panel-body">
<a href="../../devices/analytics?deviceId={{deviceId}}&deviceType={{deviceType}}" ><i class="fw fw-charts"></i> Show Statistics</a>
</div>
</div>
</div>
<!-- /statistics -->
<!-- device location -->
<!--<div class="panel panel-default">-->
<!--<div class="panel-heading" role="tab" id="headingOne">-->
<!--<h2 class="sub-title panel-title">-->
<!--<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">-->
<!--<span class="fw-stack">-->
<!--<i class="fw fw-ring fw-stack-2x"></i>-->
<!--<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>-->
<!--</span>-->
<!--Device Location-->
<!--</a>-->
<!--</h2>-->
<!--</div>-->
<!--<div id="collapseOne" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">-->
<!--<div id="device-location" style="height:400px" class="panel-body">-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!-- /device location -->
<!-- policies -->
<div class="panel panel-default">
<div class="panel-heading" role="tab" id="headingTwo">
<h2 class="sub-title panel-title">
<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>
</span>
Policies
</a>
</h2>
</div>
<div id="collapseTwo" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
<div class="panel-body">
Not available yet
</div>
</div>
</div>
<!-- /policies -->
<!-- installed applications -->
<!--<div class="panel panel-default">-->
<!--<div class="panel-heading" role="tab" id="headingThree">-->
<!--<h2 class="sub-title panel-title">-->
<!--<a class="collapsed" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">-->
<!--<span class="fw-stack">-->
<!--<i class="fw fw-ring fw-stack-2x"></i>-->
<!--<i class="fw fw-arrow fw-down-arrow fw-stack-1x"></i>-->
<!--</span>-->
<!--Installed Applications-->
<!--</a>-->
<!--</h2>-->
<!--</div>-->
<!--<div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">-->
<!--<div class="panel-body">-->
<!--Not available yet-->
<!--</div>-->
<!--</div>-->
<!--</div>-->
<!-- /installed applications -->
</div>
</div>
<!-- /content -->
</div>
</div>
</div>
</div>
{{/zone}}
{{#zone "bottomJs"}}
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&signed_in=true"></script>
<script src="{{self.publicURL}}/js/device-detail.js"></script>
{{/zone}}

@ -0,0 +1,58 @@
function onRequest(context) {
var uri = request.getRequestURI();
var uriMatcher = new URIMatcher(String(uri));
var isMatched = uriMatcher.match("/{context}/device/{deviceType}/{+deviceId}");
if (isMatched) {
var matchedElements = uriMatcher.elements();
var deviceType = matchedElements.deviceType;
var deviceId = matchedElements.deviceId;
context.deviceType = deviceType;
context.deviceId = deviceId;
var deviceModule = require("/modules/device.js").deviceModule;
var device = deviceModule.viewDevice(deviceType, deviceId);
if (device){
var viewModel = {};
var deviceInfo = device.properties.DEVICE_INFO;
if (deviceInfo != undefined && String(deviceInfo.toString()).length > 0){
deviceInfo = JSON.parse(deviceInfo);
if (device.type == "ios"){
viewModel.imei = device.properties.IMEI;
viewModel.phoneNumber = deviceInfo.PhoneNumber;
viewModel.udid = deviceInfo.UDID;
viewModel.BatteryLevel = Math.round(deviceInfo.BatteryLevel * 100);
viewModel.DeviceCapacity = Math.round(deviceInfo.DeviceCapacity * 100) / 100;
viewModel.AvailableDeviceCapacity = Math.round(deviceInfo.AvailableDeviceCapacity * 100) / 100;
viewModel.DeviceCapacityUsed = Math.round((viewModel.DeviceCapacity
- viewModel.AvailableDeviceCapacity) * 100) / 100;
viewModel.DeviceCapacityPercentage = Math.round(viewModel.DeviceCapacityUsed
/ viewModel.DeviceCapacity * 10000) /100;
}else if(device.type == "android"){
viewModel.imei = device.properties.IMEI;
viewModel.model = device.properties.DEVICE_MODEL;
viewModel.vendor = device.properties.VENDOR;
viewModel.internal_memory = {};
viewModel.external_memory = {};
viewModel.location = {
latitude: device.properties.LATITUDE,
longitude: device.properties.LONGITUDE
};
viewModel.BatteryLevel = deviceInfo.BATTERY_LEVEL;
viewModel.internal_memory.FreeCapacity = Math.round((deviceInfo.INTERNAL_TOTAL_MEMORY -
deviceInfo.INTERNAL_AVAILABLE_MEMORY) * 100) / 100;
viewModel.internal_memory.DeviceCapacityPercentage = Math.round(deviceInfo.INTERNAL_AVAILABLE_MEMORY
/ deviceInfo.INTERNAL_TOTAL_MEMORY * 10000) / 100;
viewModel.external_memory.FreeCapacity = Math.round((deviceInfo.EXTERNAL_TOTAL_MEMORY -
deviceInfo.EXTERNAL_AVAILABLE_MEMORY) * 100) / 100;
viewModel.external_memory.DeviceCapacityPercentage = Math.round(deviceInfo.EXTERNAL_AVAILABLE_MEMORY
/deviceInfo.EXTERNAL_TOTAL_MEMORY * 10000) /100;
}
viewModel.enrollment = device.enrollment;
device.viewModel = viewModel;
}
}
context.device = device;
} else {
response.sendError(404);
}
return context;
}

@ -0,0 +1,69 @@
/*
* 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
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* 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
* specific language governing permissions and limitations
* under the License.
*/
function formatDates(){
$(".formatDate").each(function(){
var timeStamp = $(this).html();
$(this).html(new Date(parseInt(timeStamp)).toUTCString());
});
}
(function () {
var deviceId = $(".device-id");
var deviceIdentifier = deviceId.data("deviceid");
var deviceType = deviceId.data("type");
var payload = [deviceIdentifier];
if (deviceType == "ios") {
var serviceUrl = "/ios/operation/deviceinfo";
} else if (deviceType == "android") {
var serviceUrl = "/mdm-android-agent/operation/device-info";
}
invokerUtil.post(serviceUrl, payload,
function(message){
console.log(message);
}, function (message) {
console.log(message);
});
$(document).ready(function(){
loadOperationBar(deviceType);
loadMap();
formatDates();
});
function loadMap(){
var map;
function initialize() {
var mapOptions = {
zoom: 18
};
var lat = 6.9098591;
var long = 79.8523753;
map = new google.maps.Map(document.getElementById('device-location'),
mapOptions);
var pos = new google.maps.LatLng(lat,
long);
var marker = new google.maps.Marker({
position: pos,
map: map
});
map.setCenter(pos);
}
google.maps.event.addDomListener(window, 'load', initialize);
}
}());

@ -0,0 +1,80 @@
{{#zone "main"}}
<div class="row">
<div class="col-md-12">
<!-- content -->
<div class="wr-content">
<p class="page-sub-title">Policies</p>
<p>{{listPolicyStatus}}</p>
<div class="wr-list-group wr-sortable">
{{#if policies}}
{{#each policies}}
<span id="{{id}}" class="list-group-item">
<i class="wr-sortable-icon fw fw-sort hide"></i>
<i class="wr-list-icon fw fw-user"></i>
<div class="wr-list-desc">
<h3 class="wr-list-name">{{policyName}}</h3>
<span class="wr-list-username">{{policyName}}</span>
</div>
<span class="list-group-item-actions">
<!--a href="#" class="invite-user-link cu-btn-inner" data-policyname="{{policyName}}">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-invitation fw-stack-1x"></i>
</span>
Invite
</a-->
<a href="#" class="remove-user-link cu-btn-inner" data-policyname="{{policyName}}">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-delete fw-stack-1x"></i>
</span>
Remove
</a>
</span>
<div class="clearfix"></div>
</span>
{{/each}}
{{else}}
<!-- no policies found -->
<div class="container-fluid wr-content-alt">
<div class="ctrl-info-panel col-md-6 col-centered">
<h2>You don't have any Policies added at the moment.</h2>
<p>
</a><a href="/iotserver/policies/add-policy" class="cu-btn">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-add fw-stack-1x"></i>
</span>
Add New Policy
</a>
</p>
</div>
</div>
<!-- /no policies found -->
{{/if}}
</div>
</div>
<!-- /content -->
</div>
</div>
{{/zone}}
{{#zone "common-navigation"}}
<!--Later add the navigation menu from here-->
{{/zone}}
{{#zone "action-bar"}}
{{#if permissions.ADD_POLICY}}
<a href="/iotserver/policies/add-policy" class="cu-btn">
<span class="fw-stack">
<i class="fw fw-ring fw-stack-2x"></i>
<i class="fw fw-add-user fw-stack-1x"></i>
</span>
Add Policy
</a>
{{/if}}
{{/zone}}
{{#zone "bottomJs"}}
<script src="{{self.publicURL}}/js/policy-listing.js"></script>
{{/zone}}

@ -0,0 +1,18 @@
function onRequest(context) {
// var log = new Log("policy-listing");
var policyModule = require("/modules/policy.js").policyModule;
var allPolicies = policyModule.getPolicies();
if (!allPolicies || allPolicies.length == 0) {
context.policies = [];
context.listPolicyStatus = "Oops, Sorry, No other Policies found.";
} else {
var i, filteredPoliciesList = [];
for (i = 0; i < allPolicies.length; i++) {
filteredPoliciesList.push(allPolicies[i]);
}
context.policies = filteredPoliciesList;
context.listPolicyStatus = "Total number of Policies found : " + filteredPoliciesList.length;
}
//context.permissions = policyModule.getUIPermissions();
return context;
}

@ -0,0 +1,131 @@
/**
* Sorting function of users
* listed on User Management page in WSO2 MDM Console.
*/
$(function () {
var sortableElem = '.wr-sortable';
$(sortableElem).sortable({
beforeStop : function () {
var sortedIDs = $(this).sortable('toArray');
console.log(sortedIDs);
}
});
$(sortableElem).disableSelection();
});
var modalPopup = ".wr-modalpopup";
var modalPopupContainer = modalPopup + " .modalpopup-container";
var modalPopupContent = modalPopup + " .modalpopup-content";
var body = "body";
/*
* set popup maximum height function.
*/
function setPopupMaxHeight() {
$(modalPopupContent).css('max-height', ($(body).height() - ($(body).height()/100 * 30)));
$(modalPopupContainer).css('margin-top', (-($(modalPopupContainer).height()/2)));
}
/*
* show popup function.
*/
function showPopup() {
$(modalPopup).show();
setPopupMaxHeight();
}
/*
* hide popup function.
*/
function hidePopup() {
$(modalPopupContent).html('');
$(modalPopup).hide();
}
/**
* Following click function would execute
* when a user clicks on "Invite" link
* on User Management page in WSO2 MDM Console.
*/
$("a.invite-user-link").click(function () {
var username = $(this).data("username");
var inviteUserAPI = "/iotserver/api/users/" + username + "/invite";
$(modalPopupContent).html($('#invite-user-modal-content').html());
showPopup();
$("a#invite-user-yes-link").click(function () {
invokerUtil.get(
inviteUserAPI,
function () {
$(modalPopupContent).html($('#invite-user-success-content').html());
$("a#invite-user-success-link").click(function () {
hidePopup();
});
},
function () {
$(modalPopupContent).html($('#invite-user-error-content').html());
$("a#invite-user-error-link").click(function () {
hidePopup();
});
}
);
});
$("a#invite-user-cancel-link").click(function () {
hidePopup();
});
});
/**
* Following click function would execute
* when a user clicks on "Remove" link
* on User Management page in WSO2 MDM Console.
*/
$("a.remove-user-link").click(function () {
var username = $(this).data("username");
var removeUserAPI = "/iotserver/api/users/" + username + "/remove";
$(modalPopupContent).html($('#remove-user-modal-content').html());
showPopup();
$("a#remove-user-yes-link").click(function () {
invokerUtil.get(
removeUserAPI,
function (data) {
if (data == 200) {
$("#" + username).addClass("hide");
$(modalPopupContent).html($('#remove-user-200-content').html());
$("a#remove-user-200-link").click(function () {
hidePopup();
});
} else if (data == 400) {
$(modalPopupContent).html($('#remove-user-400-content').html());
$("a#remove-user-400-link").click(function () {
hidePopup();
});
} else if (data == 403) {
$(modalPopupContent).html($('#remove-user-403-content').html());
$("a#remove-user-403-link").click(function () {
hidePopup();
});
} else if (data == 409) {
$(modalPopupContent).html($('#remove-user-409-content').html());
$("a#remove-user-409-link").click(function () {
hidePopup();
});
}
},
function () {
$(modalPopupContent).html($('#remove-user-unexpected-error-content').html());
$("a#remove-user-unexpected-error-link").click(function () {
hidePopup();
});
}
);
});
$("a#remove-user-cancel-link").click(function () {
hidePopup();
});
});

@ -547,3 +547,52 @@ header{background-color: #2a2a2a;}
.wiz-lbl {
padding-top:30px;
}
/* wizard */
.wr-wizard {
border-bottom:1px solid #f0f0f0;
padding-bottom:20px;
margin-bottom:20px;
}
.itm-wiz-current .wiz-no {
border:1px solid #444;
color:#fff;
background:#444;
}
.itm-wiz {
font-weight:100;
margin-top:50px;
}
.itm-wiz div {
display:inline-block;
float:left;
}
.wiz-no {
width:50px;
height:50px;
font-size:33px;
font-weight: 100;
border-radius: 80px;
border:1px solid #ccc;
color:#fff;
padding:0px 12px;
padding-bottom:10px;
display:inline-block;
text-align: center;
background:#ccc;
margin-right: 10px;
}
.wiz-lbl {
width:190px;
font-size:17px;
}
.wiz-lbl > span {
padding-top:0px;
display:inline-block;
}
Loading…
Cancel
Save