forked from community/device-mgt-core
parent
ea6afee772
commit
586bcae2b8
@ -0,0 +1,77 @@
|
||||
{{!
|
||||
Copyright (c) 2016, 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.
|
||||
}}
|
||||
{{#zone "topCss"}}
|
||||
<style>
|
||||
.thumbnail.icon:before {
|
||||
padding-top: 0;
|
||||
}
|
||||
</style>
|
||||
{{/zone}}
|
||||
|
||||
{{#zone "device-thumbnail"}}
|
||||
<img src="{{@unit.publicUri}}/images/deviceType.png"/>
|
||||
{{/zone}}
|
||||
|
||||
{{#zone "device-opetations"}}
|
||||
<div style="background: #11375B; color: #fff; padding: 10px; margin-bottom: 5px">
|
||||
Operations
|
||||
</div>
|
||||
<div class="add-margin-top-4x">
|
||||
operation comes here
|
||||
</div>
|
||||
{{/zone}}
|
||||
|
||||
{{#zone "device-view-tabs"}}
|
||||
<li class="active"><a class="list-group-item" href="#device_statistics" role="tab"
|
||||
data-toggle="tab" aria-controls="device_statistics">Device
|
||||
Statistics</a>
|
||||
</li>
|
||||
<li><a class="list-group-item" href="#event_log" role="tab" data-toggle="tab"
|
||||
aria-controls="event_log">Operations Log</a></li>
|
||||
{{/zone}}
|
||||
|
||||
{{#zone "device-view-tab-contents"}}
|
||||
<div class="panel panel-default tab-pane active"
|
||||
id="device_statistics" role="tabpanel" aria-labelledby="device_statistics">
|
||||
<div class="panel-heading">Device Statistics</div>
|
||||
unit "cdmf.unit.device.type.senseme.realtime.analytics-view" device=device
|
||||
</div>
|
||||
<div class="panel panel-default tab-pane" id="event_log" role="tabpanel"
|
||||
aria-labelledby="event_log">
|
||||
<div class="panel-heading">Operations Log <span><a href="#"
|
||||
id="refresh-operations"><i
|
||||
class="fw fw-refresh"></i></a></span></div>
|
||||
<div class="panel-body">
|
||||
<div id="operations-spinner" class="wr-advance-operations-init hidden">
|
||||
<br>
|
||||
|
||||
<i class="fw fw-settings fw-spin fw-2x"></i>
|
||||
|
||||
Loading Operations Log . . .
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
<div id="operations-log-container">
|
||||
<div class="panel-body">
|
||||
Not available yet
|
||||
</div>
|
||||
<br class="c-both"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{/zone}}
|
@ -0,0 +1,37 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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 onRequest(context) {
|
||||
var log = new Log("device-view.js");
|
||||
var deviceType = context.uriParams.deviceType;
|
||||
var deviceId = request.getParameter("id");
|
||||
var autoCompleteParams = [
|
||||
{"name" : "deviceId", "value" : deviceId}
|
||||
];
|
||||
|
||||
if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) {
|
||||
var deviceModule = require("/app/modules/business-controllers/device.js")["deviceModule"];
|
||||
var device = deviceModule.viewDevice(deviceType, deviceId);
|
||||
if (device && device.status != "error") {
|
||||
return {"device": device.content, "autoCompleteParams" : autoCompleteParams, "encodedFeaturePayloads": ""};
|
||||
} else {
|
||||
response.sendError(404, "Device Id " + deviceId + " of type " + deviceType + " cannot be found!");
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
{
|
||||
"version": "1.0.0"
|
||||
}
|
After Width: | Height: | Size: 7.6 KiB |
@ -0,0 +1,49 @@
|
||||
{
|
||||
"deviceType": {
|
||||
"label": "Windows",
|
||||
"category": "mobile",
|
||||
"scopes" : [
|
||||
"perm:windows:enroll",
|
||||
"perm:windows:lock-devices",
|
||||
"perm:windows:ring",
|
||||
"perm:windows:wipe",
|
||||
"perm:windows:lock-reset",
|
||||
"perm:windows:reboot",
|
||||
"perm:windows:location",
|
||||
"perm:windows:disenroll"
|
||||
],
|
||||
"analyticsEnabled": "false",
|
||||
"groupingEnabled": "false",
|
||||
"features": {
|
||||
"DEVICE_RING": {
|
||||
"icon": "fw-dial-up",
|
||||
"permission": "/device-mgt/devices/owning-device/operations/android/ring"
|
||||
},
|
||||
"DEVICE_LOCK": {
|
||||
"icon": "fw-lock",
|
||||
"permission": "/device-mgt/devices/owning-device/operations/windows/lock"
|
||||
},
|
||||
"DEVICE_LOCATION": {
|
||||
"icon": "fw-map-location",
|
||||
"permission": "/device-mgt/devices/owning-device/operations/windows/location"
|
||||
},
|
||||
"DEVICE_REBOOT": {
|
||||
"icon": "fw-refresh",
|
||||
"permission": "/device-mgt/devices/owning-device/operations/windows/reboot"
|
||||
},
|
||||
"LOCK_RESET": {
|
||||
"icon": "fw-security",
|
||||
"permission": "/device-mgt/devices/owning-device/operations/windows/lock-reset"
|
||||
|
||||
},
|
||||
"DISENROLL": {
|
||||
"icon": "fw-block",
|
||||
"permission": "/device-mgt/devices/owning-device/operations/windows/disenroll"
|
||||
},
|
||||
"WIPE_DATA": {
|
||||
"icon": "fw-delete",
|
||||
"permission": "/device-mgt/devices/owning-device/operations/windows/wipe"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* Licensed 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.
|
||||
*/
|
||||
.circle {
|
||||
background: none repeat scroll 0 0 #191919;
|
||||
border-radius: 50px;
|
||||
height: 50px;
|
||||
padding: 10px;
|
||||
width: 50px;
|
||||
color: #fff;
|
||||
}
|
||||
.padding-top-double {
|
||||
padding-top: 20px;
|
||||
}
|
||||
.padding-double {
|
||||
padding: 20px;
|
||||
}
|
||||
.grey {
|
||||
color: #333;
|
||||
}
|
||||
hr {
|
||||
display: block;
|
||||
height: 1px;
|
||||
border: 0;
|
||||
border-top: 1px solid #7f7f7f;
|
||||
margin: 1em 0;
|
||||
padding: 0;
|
||||
opacity: 0.2;
|
||||
}
|
||||
.light-grey {
|
||||
color: #7c7c7c;
|
||||
}
|
||||
.uppercase {
|
||||
text-transform: uppercase;
|
||||
}
|
||||
.grey-bg {
|
||||
background-color: #f6f4f4;
|
||||
}
|
||||
|
||||
.doc-link {
|
||||
background: #11375B;
|
||||
padding: 20px;
|
||||
color: white;
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
.doc-link a {
|
||||
color: white;
|
||||
}
|
After Width: | Height: | Size: 7.6 KiB |
After Width: | Height: | Size: 126 KiB |
After Width: | Height: | Size: 7.6 KiB |
@ -0,0 +1,388 @@
|
||||
/*
|
||||
* 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 modalPopup = ".modal",
|
||||
modalPopupContainer = modalPopup + " .modal-content",
|
||||
modalPopupContent = modalPopup + " .modal-content";
|
||||
|
||||
var emmAdminBasePath = "/api/device-mgt/v1.0";
|
||||
|
||||
//function openCollapsedNav() {
|
||||
// $(".wr-hidden-nav-toggle-btn").addClass("active");
|
||||
// $("#hiddenNav").slideToggle("slideDown", function () {
|
||||
// if ($(this).css("display") == "none") {
|
||||
// $(".wr-hidden-nav-toggle-btn").removeClass("active");
|
||||
// }
|
||||
// });
|
||||
//}
|
||||
|
||||
/*
|
||||
* set popup maximum height function.
|
||||
*/
|
||||
function setPopupMaxHeight() {
|
||||
var maxHeight = "max-height";
|
||||
var marginTop = "margin-top";
|
||||
var body = "body";
|
||||
$(modalPopupContent).css(maxHeight, ($(body).height() - ($(body).height() / 100 * 30)));
|
||||
$(modalPopupContainer).css(marginTop, (-($(modalPopupContainer).height() / 2)));
|
||||
}
|
||||
|
||||
/*
|
||||
* show popup function.
|
||||
*/
|
||||
function showPopup() {
|
||||
$(modalPopup).modal('show');
|
||||
}
|
||||
|
||||
/*
|
||||
* hide popup function.
|
||||
*/
|
||||
function hidePopup() {
|
||||
$(modalPopupContent).html("");
|
||||
$(modalPopupContent).removeClass("operation-data");
|
||||
$(modalPopup).modal('hide');
|
||||
$('body').removeClass('modal-open').css('padding-right','0px');
|
||||
$('.modal-backdrop').remove();
|
||||
}
|
||||
|
||||
/*
|
||||
* QR-code generation function.
|
||||
*/
|
||||
function generateQRCode(qrCodeClass) {
|
||||
var enrollmentURL = $("#qr-code-modal").data("enrollment-url");
|
||||
$(qrCodeClass).qrcode({
|
||||
text: enrollmentURL,
|
||||
width: 200,
|
||||
height: 200
|
||||
});
|
||||
}
|
||||
|
||||
function toggleEnrollment() {
|
||||
$(".modal-content").html($("#qr-code-modal").html());
|
||||
generateQRCode(".modal-content .qr-code");
|
||||
modalDialog.show();
|
||||
}
|
||||
|
||||
var updateNotificationCountOnSuccess = function (data, textStatus, jqXHR) {
|
||||
var notificationBubble = "#notification-bubble";
|
||||
if (jqXHR.status == 200 && data) {
|
||||
var responsePayload = JSON.parse(data);
|
||||
var newNotificationsCount = responsePayload["count"];
|
||||
if (newNotificationsCount > 0) {
|
||||
$(notificationBubble).html(newNotificationsCount);
|
||||
$(notificationBubble).show();
|
||||
} else {
|
||||
$(notificationBubble).hide();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function updateNotificationCountOnError() {
|
||||
var notificationBubble = "#notification-bubble";
|
||||
$(notificationBubble).html("Error");
|
||||
$(notificationBubble).show();
|
||||
}
|
||||
|
||||
function loadNewNotificationsOnSideViewPanel() {
|
||||
if ($("#right-sidebar").attr("is-authorized") == "false") {
|
||||
$("#notification-bubble-wrapper").remove();
|
||||
} else {
|
||||
var serviceURL = emmAdminBasePath + "/notifications?status=NEW";
|
||||
invokerUtil.get(serviceURL, updateNotificationCountOnSuccess, updateNotificationCountOnError);
|
||||
loadNewNotifications();
|
||||
}
|
||||
}
|
||||
|
||||
function loadNewNotifications() {
|
||||
var messageSideBar = ".sidebar-messages";
|
||||
if ($("#right-sidebar").attr("is-authorized") == "false") {
|
||||
$(messageSideBar).html("<h4 class ='message-danger'>You are not authorized to view notifications.</h4>");
|
||||
} else {
|
||||
var notifications = $("#notifications");
|
||||
var currentUser = notifications.data("currentUser");
|
||||
|
||||
$.template("notification-listing", notifications.attr("src"), function (template) {
|
||||
var serviceURL = emmAdminBasePath + "/notifications?offset=0&limit=5&status=NEW";
|
||||
invokerUtil.get(
|
||||
serviceURL,
|
||||
// on success
|
||||
function (data, textStatus, jqXHR) {
|
||||
if (jqXHR.status == 200 && data) {
|
||||
var viewModel = {};
|
||||
var responsePayload = JSON.parse(data);
|
||||
if (responsePayload["notifications"]) {
|
||||
if (responsePayload.count > 0) {
|
||||
viewModel["notifications"] = responsePayload["notifications"];
|
||||
viewModel["appContext"] = context;
|
||||
$(messageSideBar).html(template(viewModel));
|
||||
} else {
|
||||
$(messageSideBar).html("<h4 class='text-center'>No New Notifications</h4>" +
|
||||
"<h5 class='text-center text-muted'>" +
|
||||
"Check this section for error notifications<br>related to device operations" +
|
||||
"</h5>");
|
||||
}
|
||||
} else {
|
||||
$(messageSideBar).html("<h4 class ='message-danger'>Unexpected error " +
|
||||
"occurred while loading new notifications.</h4>");
|
||||
}
|
||||
}
|
||||
},
|
||||
// on error
|
||||
function (jqXHR) {
|
||||
if (jqXHR.status = 500) {
|
||||
$(messageSideBar).html("<h4 class ='message-danger'>Unexpected error occurred while trying " +
|
||||
"to retrieve any new notifications.</h4>");
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle function for
|
||||
* notification listing sidebar.
|
||||
* @return {Null}
|
||||
*/
|
||||
$.sidebar_toggle = function (action, target, container) {
|
||||
var elem = '[data-toggle=sidebar]',
|
||||
button,
|
||||
containerOffsetLeft,
|
||||
containerOffsetRight,
|
||||
targetOffsetLeft,
|
||||
targetOffsetRight,
|
||||
targetWidth,
|
||||
targetSide,
|
||||
relationship,
|
||||
pushType,
|
||||
buttonParent;
|
||||
|
||||
var sidebar_window = {
|
||||
update: function (target, container, button) {
|
||||
containerOffsetLeft = $(container).data('offset-left') ? $(container).data('offset-left') : 0;
|
||||
containerOffsetRight = $(container).data('offset-right') ? $(container).data('offset-right') : 0;
|
||||
targetOffsetLeft = $(target).data('offset-left') ? $(target).data('offset-left') : 0;
|
||||
targetOffsetRight = $(target).data('offset-right') ? $(target).data('offset-right') : 0;
|
||||
targetWidth = $(target).data('width');
|
||||
targetSide = $(target).data("side");
|
||||
pushType = $(container).parent().is('body') == true ? 'padding' : 'margin';
|
||||
|
||||
if (button !== undefined) {
|
||||
relationship = button.attr('rel') ? button.attr('rel') : '';
|
||||
buttonParent = $(button).parent();
|
||||
}
|
||||
},
|
||||
|
||||
show: function () {
|
||||
if ($(target).data('sidebar-fixed') == true) {
|
||||
$(target).height($(window).height() - $(target).data('fixed-offset'));
|
||||
}
|
||||
$(target).trigger('show.sidebar');
|
||||
if (targetWidth !== undefined) {
|
||||
$(target).css('width', targetWidth);
|
||||
}
|
||||
$(target).addClass('toggled');
|
||||
if (button !== undefined) {
|
||||
if (relationship !== '') {
|
||||
// Removing active class from all relative buttons
|
||||
$(elem + '[rel=' + relationship + ']:not([data-handle=close])').removeClass("active");
|
||||
$(elem + '[rel=' + relationship + ']:not([data-handle=close])').attr('aria-expanded', 'false');
|
||||
}
|
||||
// Adding active class to button
|
||||
if (button.attr('data-handle') !== 'close') {
|
||||
button.addClass("active");
|
||||
button.attr('aria-expanded', 'true');
|
||||
}
|
||||
if (buttonParent.is('li')) {
|
||||
if (relationship !== '') {
|
||||
$(elem + '[rel=' + relationship + ']:not([data-handle=close])').parent().removeClass("active");
|
||||
$(elem + '[rel=' + relationship + ']:not([data-handle=close])').parent().attr('aria-expanded', 'false');
|
||||
}
|
||||
buttonParent.addClass("active");
|
||||
buttonParent.attr('aria-expanded', 'true');
|
||||
}
|
||||
}
|
||||
// Sidebar open function
|
||||
if (targetSide == 'left') {
|
||||
if ((button !== undefined) && (button.attr('data-container-divide'))) {
|
||||
$(container).css(pushType + '-' + targetSide, targetWidth + targetOffsetLeft);
|
||||
}
|
||||
$(target).css(targetSide, targetOffsetLeft);
|
||||
} else if (targetSide == 'right') {
|
||||
if ((button !== undefined) && (button.attr('data-container-divide'))) {
|
||||
$(container).css(pushType + '-' + targetSide, targetWidth + targetOffsetRight);
|
||||
}
|
||||
$(target).css(targetSide, targetOffsetRight);
|
||||
}
|
||||
$(target).trigger('shown.sidebar');
|
||||
},
|
||||
|
||||
hide: function () {
|
||||
$(target).trigger('hide.sidebar');
|
||||
$(target).removeClass('toggled');
|
||||
if (button !== undefined) {
|
||||
if (relationship !== '') {
|
||||
// Removing active class from all relative buttons
|
||||
$(elem + '[rel=' + relationship + ']:not([data-handle=close])').removeClass("active");
|
||||
$(elem + '[rel=' + relationship + ']:not([data-handle=close])').attr('aria-expanded', 'false');
|
||||
}
|
||||
// Removing active class from button
|
||||
if (button.attr('data-handle') !== 'close') {
|
||||
button.removeClass("active");
|
||||
button.attr('aria-expanded', 'false');
|
||||
}
|
||||
if ($(button).parent().is('li')) {
|
||||
if (relationship !== '') {
|
||||
$(elem + '[rel=' + relationship + ']:not([data-handle=close])').parent().removeClass("active");
|
||||
$(elem + '[rel=' + relationship + ']:not([data-handle=close])').parent().attr('aria-expanded', 'false');
|
||||
}
|
||||
}
|
||||
}
|
||||
// Sidebar close function
|
||||
if (targetSide == 'left') {
|
||||
if ((button !== undefined) && (button.attr('data-container-divide'))) {
|
||||
$(container).css(pushType + '-' + targetSide, targetOffsetLeft);
|
||||
}
|
||||
$(target).css(targetSide, -Math.abs(targetWidth + targetOffsetLeft));
|
||||
} else if (targetSide == 'right') {
|
||||
if ((button !== undefined) && (button.attr('data-container-divide'))) {
|
||||
$(container).css(pushType + '-' + targetSide, targetOffsetRight);
|
||||
}
|
||||
$(target).css(targetSide, -Math.abs(targetWidth + targetOffsetRight));
|
||||
}
|
||||
$(target).trigger('hidden.sidebar');
|
||||
}
|
||||
};
|
||||
if (action === 'show') {
|
||||
sidebar_window.update(target, container);
|
||||
sidebar_window.show();
|
||||
}
|
||||
if (action === 'hide') {
|
||||
sidebar_window.update(target, container);
|
||||
sidebar_window.hide();
|
||||
}
|
||||
// binding click function
|
||||
var body = 'body';
|
||||
$(body).off('click', elem);
|
||||
$(body).on('click', elem, function (e) {
|
||||
e.preventDefault();
|
||||
button = $(this);
|
||||
container = button.data('container');
|
||||
target = button.data('target');
|
||||
sidebar_window.update(target, container, button);
|
||||
/**
|
||||
* Sidebar function on data container divide
|
||||
* @return {Null}
|
||||
*/
|
||||
if (button.attr('aria-expanded') == 'false') {
|
||||
sidebar_window.show();
|
||||
} else if (button.attr('aria-expanded') == 'true') {
|
||||
sidebar_window.hide();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$.fn.collapse_nav_sub = function () {
|
||||
var navSelector = 'ul.nav';
|
||||
|
||||
if (!$(navSelector).hasClass('collapse-nav-sub')) {
|
||||
$(navSelector + ' > li', this).each(function () {
|
||||
var position = $(this).offset().left - $(this).parent().scrollLeft();
|
||||
$(this).attr('data-absolute-position', (position + 5));
|
||||
});
|
||||
|
||||
$(navSelector + ' li', this).each(function () {
|
||||
if ($('ul', this).length !== 0) {
|
||||
$(this).addClass('has-sub');
|
||||
}
|
||||
});
|
||||
|
||||
$(navSelector + ' > li', this).each(function () {
|
||||
$(this).css({
|
||||
'left': $(this).data('absolute-position'),
|
||||
'position': 'absolute'
|
||||
});
|
||||
});
|
||||
|
||||
$(navSelector + ' li.has-sub', this).on('click', function () {
|
||||
var elem = $(this);
|
||||
if (elem.attr('aria-expanded') !== 'true') {
|
||||
elem.siblings().fadeOut(100, function () {
|
||||
elem.animate({'left': '15'}, 200, function () {
|
||||
$(elem).first().children('ul').fadeIn(200);
|
||||
});
|
||||
});
|
||||
elem.siblings().attr('aria-expanded', 'false');
|
||||
elem.attr('aria-expanded', 'true');
|
||||
} else {
|
||||
$(elem).first().children('ul').fadeOut(100, function () {
|
||||
elem.animate({'left': $(elem).data('absolute-position')}, 200, function () {
|
||||
elem.siblings().fadeIn(100);
|
||||
});
|
||||
});
|
||||
elem.siblings().attr('aria-expanded', 'false');
|
||||
elem.attr('aria-expanded', 'false');
|
||||
}
|
||||
});
|
||||
|
||||
$(navSelector + ' > li.has-sub ul', this).on('click', function (e) {
|
||||
e.stopPropagation();
|
||||
});
|
||||
$(navSelector).addClass('collapse-nav-sub');
|
||||
}
|
||||
};
|
||||
|
||||
$(".download-link").click(function(){
|
||||
toggleEnrollment();
|
||||
});
|
||||
|
||||
$(document).ready(function () {
|
||||
$.sidebar_toggle();
|
||||
if (typeof $.fn.collapse == 'function') {
|
||||
$('.navbar-collapse.tiles').on('shown.bs.collapse', function () {
|
||||
$(this).collapse_nav_sub();
|
||||
});
|
||||
}
|
||||
|
||||
loadNewNotificationsOnSideViewPanel();
|
||||
$("#right-sidebar").on("click", ".new-notification", function () {
|
||||
var notificationId = $(this).data("id");
|
||||
var redirectUrl = $(this).data("url");
|
||||
var markAsReadNotificationsEpr = emmAdminBasePath + "/notifications/" + notificationId + "/mark-checked";
|
||||
var messageSideBar = ".sidebar-messages";
|
||||
|
||||
invokerUtil.put(
|
||||
markAsReadNotificationsEpr,
|
||||
null,
|
||||
// on success
|
||||
function (data) {
|
||||
data = JSON.parse(data);
|
||||
if (data.statusCode == responseCodes["ACCEPTED"]) {
|
||||
location.href = redirectUrl;
|
||||
}
|
||||
},
|
||||
// on error
|
||||
function () {
|
||||
var content = "<li class='message message-danger'><h4><i class='icon fw fw-error'></i>Warning</h4>" +
|
||||
"<p>Unexpected error occurred while loading notification. Please refresh the page and" +
|
||||
" try again</p></li>";
|
||||
$(messageSideBar).html(content);
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
@ -0,0 +1,142 @@
|
||||
<div class="col-lg-12 margin-top-double">
|
||||
<h1 class="grey "></h1>
|
||||
<hr>
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-sm-4 col-md-4 col-lg-4 padding-top">
|
||||
<img src="{{@unit.publicUri}}/images/deviceType.png" class="img-responsive">
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-top">
|
||||
|
||||
</div>
|
||||
|
||||
<div class="col-xs-12 col-sm-8 col-md-8 col-lg-8 padding-top">
|
||||
<h3 class="uppercase">Description</h3>
|
||||
<hr>
|
||||
<p class="grey margin-top">Need to get the description from the device</p>
|
||||
<br>
|
||||
<hr>
|
||||
<br>
|
||||
<a href="/api-store/apis/info?name=DeviceManagement&version=1.0.0&provider=admin"
|
||||
class="btn-operations"
|
||||
target="_blank"><i class="fw fw-api add-margin-1x"></i> View API</i>
|
||||
</a>
|
||||
<div id="device-agent-downloading-content" class="hide">
|
||||
<div class="modal-content">
|
||||
<div class="row">
|
||||
<div class="col-md-7 col-centered center-container">
|
||||
<h3>Device Agent will downloading shortly.</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="device-400-content" class="hide">
|
||||
<div class="modal-content">
|
||||
<div class="row">
|
||||
<div class="col-md-7 col-centered center-container">
|
||||
<h3>Exception at backend. Try Later.</h3>
|
||||
<div class="buttons">
|
||||
<a href="#" id="device-400-link" class="btn-operations">
|
||||
OK
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="device-401-content" class="hide">
|
||||
<div class="modal-content">
|
||||
<div class="row">
|
||||
<div class="col-md-7 col-centered center-container">
|
||||
<h3>You have to log in first.</h3><br/>
|
||||
<div class="buttons">
|
||||
<a href="#" id="device-401-link" class="blue-button">
|
||||
Goto Login Page
|
||||
</a>
|
||||
<a href="#" onclick="hidePopup();" class="btn-operations">
|
||||
Cancel
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="device-403-content" class="hide">
|
||||
<div class="modal-content">
|
||||
<div class="row">
|
||||
<div class="col-md-7 col-centered center-container">
|
||||
<h3>Action not permitted.</h3><br/>
|
||||
|
||||
<div class="buttons">
|
||||
<a href="#" id="device-403-link" class="btn-operations">
|
||||
OK
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="device-409-content" class="hide">
|
||||
<div class="modal-content">
|
||||
<div class="row">
|
||||
<div class="col-md-7 col-centered center-container">
|
||||
<h3>Device Sketch does not exist.</h3><br/>
|
||||
<div class="buttons">
|
||||
<a href="#" id="device-409-link" class="btn-operations">
|
||||
OK
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="device-unexpected-error-content" class="hide">
|
||||
<div class="modal-content">
|
||||
<div class="row">
|
||||
<div class="col-md-7 col-centered center-container">
|
||||
<h3>Unexpected error.</h3><br/>
|
||||
<div class="buttons">
|
||||
<a href="#" id="device-unexpected-error-link" class="btn-operations">
|
||||
OK
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br/><br/>
|
||||
</div>
|
||||
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 padding-double grey-bg">
|
||||
<h3 class="uppercase">How To Enroll a Device</h3>
|
||||
<hr>
|
||||
<ul class="list-unstyled">
|
||||
<li class="padding-top-double"><span class="circle">01</span>
|
||||
curl -k -X POST https://localhost:8243/api-application-registration/register -H
|
||||
'authorization: Basic Base64(username:password)' -H 'content-type: application/json'
|
||||
-d '{ "applicationName":"testme", "isAllowedToAllDomains":false, "tags":["device_management"]}'
|
||||
</li>
|
||||
<li class="padding-top-double"><span class="circle">02</span>
|
||||
curl -k -d "grant_type=password&username=%username%&password=%password%&scope=perm:devices:add"
|
||||
-H "Authorization: Basic Base64(client_id:client_secret)"
|
||||
-H "Content-Type: application/x-www-form-urlencoded" https://localhost:8243/token
|
||||
</li>
|
||||
<li class="padding-top-double"><span class="circle">03</span>
|
||||
curl -X POST http://localhost:8280/api/device-mgt/v1.0/devices -H 'accept: application/json'
|
||||
-H 'authorization: Bearer %accessToken%'
|
||||
-H 'content-type: application/json' -d '{ "name": "devicename", "type": "{{deviceType}}",
|
||||
"description": "descritption", "deviceIdentifier": "1234", "enrolmentInfo":
|
||||
{"dateOfEnrolment": 0, "dateOfLastUpdate": 0, "ownership": "BYOD", "status": "ACTIVE", "owner": "username"}
|
||||
,"properties": [{"name": "propertyName","value": "propertyValue"}]}'
|
||||
</li>
|
||||
</ul>
|
||||
<br>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
{{#zone "topCss"}}
|
||||
{{css "css/styles.css"}}
|
||||
{{/zone}}
|
||||
|
||||
{{#zone "bottomJs"}}
|
||||
{{/zone}}
|
@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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 onRequest(context) {
|
||||
var deviceType = context.uriParams.deviceType;
|
||||
return {
|
||||
"deviceType": deviceType
|
||||
};
|
||||
}
|
Loading…
Reference in new issue