From 1d1f399477aa6f154bee6455f02b367eccd8c7da Mon Sep 17 00:00:00 2001 From: Madawa Soysa Date: Mon, 5 Dec 2016 16:57:55 +0530 Subject: [PATCH 1/8] IOTS-322: Infroming users when device types are not installed Currently policy platfom selection page is empty if no device types are installed. This will add an meaningful message to user if no device types are added. This commit resolves IOTS-322 --- .../units/cdmf.unit.policy.create/create.hbs | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.hbs index a39f651378..09e414aa7b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/create.hbs @@ -283,23 +283,29 @@ + {{#unless types}} +

No compatible device types have been installed. + Install device types to add policies.

+ {{/unless}}
From 5b1f97fee376ea24f10df54c2ab38fee24cf59cb Mon Sep 17 00:00:00 2001 From: Harshan Liyanage Date: Tue, 6 Dec 2016 10:32:14 +0530 Subject: [PATCH 2/8] Updated carbon component versions to include security fixes --- pom.xml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pom.xml b/pom.xml index b64a41b69c..ccb5bf93d3 100644 --- a/pom.xml +++ b/pom.xml @@ -1808,7 +1808,7 @@ 7.0.34.wso2v2 - 4.7.0 + 4.7.2 5.2.2 @@ -1816,10 +1816,10 @@ 5.1.1 - 4.6.0 + 4.6.1 - 4.6.4 + 4.6.5 1.2.11-wso2v10 @@ -1845,7 +1845,7 @@ [5.1.3,6.0.0) - 4.5.6 + 4.5.8 [4.4.8, 5.0.0) From 4c1fb558d30e142cc4198f6ee2c312c5b29a8d9d Mon Sep 17 00:00:00 2001 From: Rasika Perera Date: Tue, 6 Dec 2016 10:50:46 +0530 Subject: [PATCH 3/8] Fixing sso infinite redirection --- .../app/pages/cdmf.page.sign-in/sign-in.hbs | 5 +++- .../app/pages/cdmf.page.sign-in/sign-in.js | 28 +++++++++++++++++++ .../app/pages/cdmf.page.sign-in/sign-in.json | 3 +- 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.js diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.hbs index 105c65ac6d..a7f39044dc 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.hbs @@ -31,7 +31,7 @@ {{/if}}
-
+
+ {{#if sessionDataKey}} + + {{/if}} {{#if referer}} {{/if}} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.js new file mode 100644 index 0000000000..df49bf1d04 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.js @@ -0,0 +1,28 @@ +function onRequest(context) { + var devicemgtProps = require("/app/modules/conf-reader/main.js")["conf"]; + var authModuleConfigs = context.app.conf["authModule"]; + var sessionDataKey = request.getParameter("sessionDataKey"); + + //if sso enabled and sessionDataKey is empty redirect + var ssoConfigs = authModuleConfigs["sso"]; + if (ssoConfigs && (ssoConfigs["enabled"].toString() == "true") && !sessionDataKey) { + // SSO is enabled in Auth module. + var redirectUri = context.app.context + "/uuf/login"; + var queryString = request.getQueryString(); + if (queryString && (queryString.length > 0)) { + redirectUri = redirectUri + "?" + queryString; + } + response.sendRedirect(encodeURI(redirectUri)); + exit(); + } + + var viewModel = {}; + var loginActionUrl = context.app.context + "/uuf/login"; + if (sessionDataKey) { + loginActionUrl = devicemgtProps["httpsURL"] + "/commonauth"; + } + + viewModel.sessionDataKey = sessionDataKey; + viewModel.loginActionUrl = loginActionUrl; + return viewModel; +} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.json index 58846893fc..91d4a819bd 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.sign-in/sign-in.json @@ -1,5 +1,6 @@ { "version": "1.0.0", + "layout": "uuf.layout.sign-in", "uri": "/login", - "extends": "uuf.page.sign-in" + "isAnonymous": true } \ No newline at end of file From b4eb86e985f95c20e30af7a95102b9aea6ae28ef Mon Sep 17 00:00:00 2001 From: Harshan Liyanage Date: Tue, 6 Dec 2016 11:54:31 +0530 Subject: [PATCH 4/8] Added security filters to devicemgt jaggery app --- .../jaggeryapps/devicemgt/jaggery.conf | 49 ++++++++++++++++++- 1 file changed, 48 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/jaggery.conf b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/jaggery.conf index dec7a25f8c..76bfb37095 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/jaggery.conf +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/jaggery.conf @@ -55,5 +55,52 @@ "url": "/api/operation/*", "path": "/api/operation-api.jag" } - ] + ], + "filters": [ + { + "name": "URLBasedCachePreventionFilter", + "class": "org.wso2.carbon.ui.filters.cache.URLBasedCachePreventionFilter" + }, + { + "name":"HttpHeaderSecurityFilter", + "class":"org.apache.catalina.filters.HttpHeaderSecurityFilter", + "params" : [{"name" : "hstsEnabled", "value" : "false"}] + } + ], + "filterMappings": [ + { + "name": "URLBasedCachePreventionFilter", + "url": "/api/*" + }, + { + "name":"HttpHeaderSecurityFilter", + "url":"*" + } + ], + "listeners" : [ + { + "class" : "org.owasp.csrfguard.CsrfGuardServletContextListener" + }, + { + "class" : "org.owasp.csrfguard.CsrfGuardHttpSessionListener" + } + ], + "servlets" : [ + { + "name" : "JavaScriptServlet", + "class" : "org.owasp.csrfguard.servlet.JavaScriptServlet" + } + ], + "servletMappings" : [ + { + "name" : "JavaScriptServlet", + "url" : "/csrf.js" + } + ], + "contextParams" : [ + { + "name" : "Owasp.CsrfGuard.Config", + "value" : "/repository/conf/security/Owasp.CsrfGuard.Carbon.properties" + } + ] } \ No newline at end of file From de95c99ea720b3618dacdc3dbc5443d449c23733 Mon Sep 17 00:00:00 2001 From: Madawa Soysa Date: Tue, 6 Dec 2016 12:17:46 +0530 Subject: [PATCH 5/8] IOTS-296: Genaralizing policy view UI This commit inclued the generic policy view UI unit --- .../cdmf.unit.policy.view/public/js/view.js | 142 ++++++++++++++++++ .../app/units/cdmf.unit.policy.view/view.hbs | 33 ++-- 2 files changed, 156 insertions(+), 19 deletions(-) create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/js/view.js diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/js/view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/js/view.js new file mode 100644 index 0000000000..b7bea7684f --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/public/js/view.js @@ -0,0 +1,142 @@ +/* + * 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 policy = {}; + +var displayPolicy = function (policyPayloadObj) { + policy["name"] = policyPayloadObj["policyName"]; + policy["platform"] = policyPayloadObj["profile"]["deviceType"]; + // updating next-page wizard title with selected platform + $("#policy-heading").text(policy["platform"].toUpperCase() + " POLICY - " + policy["name"].toUpperCase()); + $("#policy-platform").text(policy["platform"].toUpperCase()); + $("#policy-assignment").text(policyPayloadObj.deviceGroups); + $("#policy-action").text(policyPayloadObj.compliance.toUpperCase()); + $("#policy-description").text(policyPayloadObj["description"]); + var policyStatus = "Active"; + if (policyPayloadObj["active"] == true && policyPayloadObj["updated"] == true) { + policyStatus = ' Active/Updated'; + } else if (policyPayloadObj["active"] == true && policyPayloadObj["updated"] == false) { + policyStatus = ' Active'; + } else if (policyPayloadObj["active"] == false && policyPayloadObj["updated"] == true) { + policyStatus = ' Inactive/Updated'; + } else if (policyPayloadObj["active"] == false && policyPayloadObj["updated"] == false) { + policyStatus = ' Inactive'; + } + + $("#policy-status").html(policyStatus); + + if (policyPayloadObj.users.length > 0) { + $("#policy-users").text(policyPayloadObj.users.toString().split(",").join(", ")); + } else { + $("#users-row").addClass("hidden"); + } + if (policyPayloadObj.deviceGroups.length > 0) { + debugger; + var deviceGroups = policyPayloadObj.deviceGroups; + var assignedGroups = []; + for (var index in deviceGroups) { + if (deviceGroups.hasOwnProperty(index)) { + assignedGroups.push(deviceGroups[index].name); + } + } + $("#policy-groups").text(assignedGroups.toString().split(",").join(", ")); + } else { + $("#policy-groups").text("NONE"); + } + + if (policyPayloadObj.roles.length > 0) { + $("#policy-roles").text(policyPayloadObj.roles.toString().split(",").join(", ")); + } else { + $("#roles-row").addClass("hidden"); + } + + var deviceType = policy["platform"]; + var policyOperationsTemplateSrc = context + '/public/cdmf.unit.device.type.' + deviceType + + '.policy-view/templates/' + deviceType + '-policy-view.hbs'; + var policyOperationsScriptSrc = context + '/public/cdmf.unit.device.type.' + deviceType + + '.policy-view/js/' + deviceType + '-policy-view.js'; + var policyOperationsStylesSrc = context + '/public/cdmf.unit.device.type.' + deviceType + + '.policy-view/css/' + deviceType + '-policy-view.css'; + var policyOperationsTemplateCacheKey = deviceType + '-policy-operations'; + + $.isResourceExists(policyOperationsTemplateSrc, function (status) { + if (status) { + $.template(policyOperationsTemplateCacheKey, policyOperationsTemplateSrc, function (template) { + var content = template(); + $("#device-type-policy-operations").html(content).removeClass("hidden"); + $(".policy-platform").addClass("hidden"); + $.isResourceExists(policyOperationsScriptSrc, function (status) { + if (status) { + var script = document.createElement('script'); + script.type = 'text/javascript'; + script.src = policyOperationsScriptSrc; + $(".wr-advance-operations").prepend(script); + var previouslyConfiguredOperations = operationModule.populateProfile(policy["platform"], + policyPayloadObj["profile"]["profileFeaturesList"]); + polulateProfileOperations(previouslyConfiguredOperations); + } + }); + }); + + $.isResourceExists(policyOperationsStylesSrc, function (status) { + if (status) { + var style = document.createElement('link'); + style.type = 'text/css'; + style.rel = 'stylesheet'; + style.href = policyOperationsStylesSrc; + $(".wr-advance-operations").prepend(style); + } + }); + } else { + $("#generic-policy-operations").removeClass("hidden"); + } + $(".wr-advance-operations-init").addClass("hidden"); + }); +}; + +/** + * This method will return query parameter value given its name. + * @param name Query parameter name + * @returns {string} Query parameter value + */ +var getParameterByName = function (name) { + name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); + var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"), + results = regex.exec(location.search); + return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); +}; + +$(document).ready(function () { + var policyPayloadObj; + // Adding initial state of wizard-steps. + invokerUtil.get( + "/api/device-mgt/v1.0/policies/" + getParameterByName("id"), + // on success + function (data, textStatus, jqXHR) { + if (jqXHR.status == 200 && data) { + policyPayloadObj = JSON.parse(data); + displayPolicy(policyPayloadObj); + } + }, + // on error + function (jqXHR) { + console.log(jqXHR); + // should be redirected to an error page + } + ); +}); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.hbs index a650c9e151..07cd613442 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.view/view.hbs @@ -24,8 +24,8 @@ - Ownership - + Groups + Action upon non-compliance @@ -60,12 +60,17 @@
-
-
- - Loading platform features . . . -
-
+
+
+ + Loading Platform Features . . . +
+
+
+ +
@@ -82,15 +87,5 @@ {{/if}} {{/zone}} {{#zone "bottomJs"}} - - - - - - {{js "js/view.js"}} -{{/zone}} - +{{/zone}} \ No newline at end of file From ca2a79a0018e077852bdcb6267aec5710216b8b8 Mon Sep 17 00:00:00 2001 From: Menaka Jayawardena Date: Tue, 6 Dec 2016 14:43:05 +0530 Subject: [PATCH 6/8] Added entries for portal app in config files. --- .../main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json | 1 + .../main/resources/jaggeryapps/devicemgt/app/conf/config.json | 1 + 2 files changed, 2 insertions(+) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json index a64219b95d..d12169830e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/app-conf.json @@ -3,6 +3,7 @@ "cachingEnabled": false, "debuggingEnabled": false, "permissionRoot": "/", + "portalURL": "https://${server.ip}:9445", "loginPage": "cdmf.page.sign-in", "adminServicesUrl": "https://${server.ip}:${server.https_port}/admin/services/", "authModule": { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json index 4cdc2b4b6c..5236f8a877 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json @@ -7,6 +7,7 @@ "httpsWebURL" : "%https.ip%", "wssURL" : "https://localhost:9445", "wsURL" : "%http.ip%", + "portalURL": "https://${server.ip}:9445", "dashboardServerURL" : "%https.ip%", "androidEnrollmentDir": "/android-web-agent/enrollment", "windowsEnrollmentDir": "/windows-web-agent/enrollment", From 34225bd9da840631d68759d23e8be52f92f9d5ca Mon Sep 17 00:00:00 2001 From: Ace Date: Tue, 6 Dec 2016 17:13:56 +0530 Subject: [PATCH 7/8] fixing operations loading spinner and other ui issues --- .../public/js/device-view.js | 82 ++++++++++--------- .../lib/theme-wso2_1.0/js/theme-wso2.js | 79 +++++++++--------- 2 files changed, 84 insertions(+), 77 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/js/device-view.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/js/device-view.js index 61c094c3b6..0ca5ddc820 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/js/device-view.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/js/device-view.js @@ -51,7 +51,10 @@ var operationsLogTable = "#operations-log-table"; if (update) { operationTable = $(operationsLogTable).DataTable(); - operationTable.ajax.reload(false); + $("#operations-spinner").removeClass("hidden"); + operationTable.ajax.reload(function ( json ) { + $("#operations-spinner").addClass("hidden"); + }, false); return; } operationTable = $(operationsLogTable).datatables_extended({ @@ -142,53 +145,54 @@ function (template) { var getEffectivePolicyURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/effective-policy"; var getDeviceComplianceURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/compliance-data"; - invokerUtil.get( getEffectivePolicyURL, // success-callback function (data, textStatus, jqXHR) { - if (jqXHR.status == 200 && data) { - data = JSON.parse(data); + if (jqXHR.status == 200) { $("#policy-spinner").addClass("hidden"); - if (data["active"] == true) { - activePolicy = data; - invokerUtil.get( - getDeviceComplianceURL, - // success-callback - function (data, textStatus, jqXHR) { - if (jqXHR.status == 200 && data) { - var viewModel = {}; - viewModel["policy"] = activePolicy; - viewModel["deviceType"] = deviceType; - data = JSON.parse(data); - var content; - if (data["complianceData"]) { - if (data["complianceData"]["complianceFeatures"] && - data["complianceData"]["complianceFeatures"].length > 0) { - viewModel["compliance"] = "NON-COMPLIANT"; - viewModel["complianceFeatures"] = data["complianceData"]["complianceFeatures"]; - content = template(viewModel); - $("#policy-list-container").html(content); + if(data){ + data = JSON.parse(data); + if (data["active"] == true) { + activePolicy = data; + invokerUtil.get( + getDeviceComplianceURL, + // success-callback + function (data, textStatus, jqXHR) { + if (jqXHR.status == 200 && data) { + var viewModel = {}; + viewModel["policy"] = activePolicy; + viewModel["deviceType"] = deviceType; + data = JSON.parse(data); + var content; + if (data["complianceData"]) { + if (data["complianceData"]["complianceFeatures"] && + data["complianceData"]["complianceFeatures"].length > 0) { + viewModel["compliance"] = "NON-COMPLIANT"; + viewModel["complianceFeatures"] = data["complianceData"]["complianceFeatures"]; + content = template(viewModel); + $("#policy-list-container").html(content); + } else { + viewModel["compliance"] = "COMPLIANT"; + content = template(viewModel); + $("#policy-list-container").html(content); + $("#policy-compliance-table").addClass("hidden"); + } } else { - viewModel["compliance"] = "COMPLIANT"; - content = template(viewModel); - $("#policy-list-container").html(content); - $("#policy-compliance-table").addClass("hidden"); + $("#policy-list-container"). + html("

This device " + + "has no policy applied.

"); } - } else { - $("#policy-list-container"). - html("

This device " + - "has no policy applied.

"); } + }, + // error-callback + function () { + $("#policy-list-container"). + html("

Loading policy compliance related data " + + "was not successful. please try refreshing data in a while.

"); } - }, - // error-callback - function () { - $("#policy-list-container"). - html("

Loading policy compliance related data " + - "was not successful. please try refreshing data in a while.

"); - } - ); + ); + } } } }, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/js/theme-wso2.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/js/theme-wso2.js index 13f6bbcad0..21cfb7a654 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/js/theme-wso2.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.theme/public/lib/theme-wso2_1.0/js/theme-wso2.js @@ -78,12 +78,12 @@ var responsiveTextRatio = 0.2, * A function to add data attributes to HTML about the user agent * @return {Null} */ - $.browser_meta = function(){ - $('html') - .attr('data-useragent', navigator.userAgent) - .attr('data-platform', navigator.platform) - .addClass(((!!('ontouchstart' in window) || !!('onmsgesturechange' in window)) ? ' touch' : '')); - }; + $.browser_meta = function(){ + $('html') + .attr('data-useragent', navigator.userAgent) + .attr('data-platform', navigator.platform) + .addClass(((!!('ontouchstart' in window) || !!('onmsgesturechange' in window)) ? ' touch' : '')); + }; /** * @description Data Loader function @@ -96,17 +96,17 @@ var responsiveTextRatio = 0.2, var loadingText = ($(this).attr('data-loading-text') === undefined) ? 'LOADING' : $(this).attr('data-loading-text'); var html = '
' + - '' + - '

'+ loadingText +'

' + - '
' + - '
'; + '' + + '

'+ loadingText +'

' + + '' + + '
'; if (action === 'show') { $(this).prepend(html).addClass('loading'); @@ -230,13 +230,13 @@ var responsiveTextRatio = 0.2, responsive: false, autoWidth: false, dom:'<"dataTablesTop"' + - 'f' + - '<"dataTables_toolbar">' + - '>' + - 'rt' + - '<"dataTablesBottom"' + - 'lip' + - '>', + 'f' + + '<"dataTables_toolbar">' + + '>' + + 'rt' + + '<"dataTablesBottom"' + + 'lip' + + '>', language: { searchPlaceholder: 'Filter by ...', search: '' @@ -244,6 +244,7 @@ var responsiveTextRatio = 0.2, initComplete: function(){ var ROW_SELECTED_CLASS = 'DTTT_selected'; + var table = this; this.api().columns().every(function(){ @@ -301,7 +302,7 @@ var responsiveTextRatio = 0.2, var search_input = $(this).closest('.dataTables_wrapper').find('div[id$=_filter] input'); search_input.before('').removeClass('input-sm'); - // Create sorting dropdown menu for list table advance operations + // Create sorting dropdown menu for list table advance operations var dropdownmenu = $(''); $('.sort-row th', elem).each(function(){ if(!$(this).hasClass('no-sort')){ @@ -313,19 +314,19 @@ var responsiveTextRatio = 0.2, if (!table.hasClass('no-toolbar')) { if (table.hasClass('sorting-enabled')) { return '' + '
  • ' + + '
  • ' + + '
  • ' + + '
  • ' + + '
  • ' + dropdownmenu[0].outerHTML + '
  • ' + + '' } else { return '' + '
  • ' + + '
  • ' + + '
  • ' + + '
  • ' + + '' } } else { return ''; @@ -335,9 +336,11 @@ var responsiveTextRatio = 0.2, /** * append advance operations to list table toolbar */ - $('.dataTable.list-table').closest('.dataTables_wrapper').find('.dataTablesTop .dataTables_toolbar').html( + if (table.hasClass('dataTables_toolbar')) { + $('.dataTable.list-table').closest('.dataTables_wrapper').find('.dataTablesTop .dataTables_toolbar').html( getAdvanceToolBar() - ); + ); + } //Sorting dropdown menu select function $('.dataTables_wrapper .sort-list li a').click(function() { From 161fe62a08d6ed8d0827852f66a86f8a67f4e779 Mon Sep 17 00:00:00 2001 From: charitha Date: Tue, 6 Dec 2016 18:59:43 +0530 Subject: [PATCH 8/8] Fix for https://wso2.org/jira/browse/IOTS-323 --- .../pom.xml | 4 --- .../mgt/jaxrs/api/CertificateMgtService.java | 33 ++++++++++++++++++- .../CertificateManagementAdminService.java | 2 +- .../cdmf.page.certificates/certificates.hbs | 2 +- .../public/js/certificate-listing.js | 3 +- 5 files changed, 36 insertions(+), 8 deletions(-) diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml index e54da97c1a..96d690bc86 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/pom.xml @@ -49,10 +49,6 @@ api#scep-mgt#v1.0 - - org.apache.felix - maven-scr-plugin - diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/CertificateMgtService.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/CertificateMgtService.java index f47ddda3bf..147e6669db 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/CertificateMgtService.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.api/src/main/java/org/wso2/carbon/certificate/mgt/jaxrs/api/CertificateMgtService.java @@ -1,19 +1,50 @@ package org.wso2.carbon.certificate.mgt.jaxrs.api; +import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; import io.swagger.annotations.Authorization; import io.swagger.annotations.AuthorizationScope; +import io.swagger.annotations.Extension; +import io.swagger.annotations.ExtensionProperty; +import io.swagger.annotations.Info; +import io.swagger.annotations.SwaggerDefinition; +import io.swagger.annotations.Tag; import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.certificate.mgt.jaxrs.beans.ErrorResponse; -import javax.ws.rs.*; +import javax.ws.rs.Consumes; +import javax.ws.rs.HeaderParam; +import javax.ws.rs.POST; +import javax.ws.rs.Path; +import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; +@SwaggerDefinition( + info = @Info( + version = "1.0.0", + title = "", + extensions = { + @Extension(properties = { + @ExtensionProperty(name = "name", value = "SCEP Management"), + @ExtensionProperty(name = "context", value = "/api/device-mgt/v1.0/scep"), + }) + } + ), + tags = { + @Tag(name = "scep_management", description = "SCEP management related REST-API. " + + "This can be used to manipulated device " + + "certificate related details.") + } +) @Path("/scep") +@Api(value = "SCEP Management", description = "This API carries all device Certificate management " + + "related operations.") +@Produces(MediaType.APPLICATION_JSON) +@Consumes(MediaType.APPLICATION_JSON) public interface CertificateMgtService { /** diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java index 5e835f2df1..b867998c18 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/src/main/java/org/wso2/carbon/certificate/mgt/cert/jaxrs/api/CertificateManagementAdminService.java @@ -29,7 +29,7 @@ import javax.ws.rs.core.Response; extensions = { @Extension(properties = { @ExtensionProperty(name = "name", value = "Certificate Management"), - @ExtensionProperty(name = "context", value = "api/certificate-mgt/v1.0/admin/certificates"), + @ExtensionProperty(name = "context", value = "/api/certificate-mgt/v1.0/admin/certificates"), }) } ), diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.hbs index f963ef9237..a8b0b2946c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.certificates/certificates.hbs @@ -72,7 +72,7 @@ -
    +