From 24e353698f0714894ef4e37eb175091b424fb911 Mon Sep 17 00:00:00 2001 From: mharindu Date: Mon, 16 May 2016 12:12:47 +0530 Subject: [PATCH 01/13] Added permission annotations to virtual fire alarm API --- .../impl/AndroidSenseControllerService.java | 5 +++++ .../impl/AndroidSenseManagerService.java | 5 +++++ .../VirtualFireAlarmControllerService.java | 4 ++-- .../impl/VirtualFireAlarmManagerService.java | 6 ++++++ .../src/main/webapp/META-INF/permissions.xml | 20 +++---------------- 5 files changed, 21 insertions(+), 19 deletions(-) diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseControllerService.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseControllerService.java index 43792b859b..bbd8358a8d 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseControllerService.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseControllerService.java @@ -19,6 +19,7 @@ package org.wso2.carbon.device.mgt.iot.androidsense.service.impl; import org.wso2.carbon.apimgt.annotations.api.API; +import org.wso2.carbon.apimgt.annotations.api.Permission; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.Feature; import javax.ws.rs.Consumes; @@ -44,6 +45,7 @@ public interface AndroidSenseControllerService { @Path("device/{deviceId}/words") @POST @Feature(code = "keywords", name = "Add Keywords", description = "Send keywords to the device", type = "operation") + @Permission(scope = "android_sense_user", permissions = {"/permission/admin/device-mgt/user/operations"}) Response sendKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("keywords") String keywords); /** @@ -56,12 +58,14 @@ public interface AndroidSenseControllerService { @POST @Feature(code = "threshold", name = "Add a Threshold", description = "Set a threshold for word in the device", type = "operation") + @Permission(scope = "android_sense_user", permissions = {"/permission/admin/device-mgt/user/operations"}) Response sendThreshold(@PathParam("deviceId") String deviceId, @QueryParam("threshold") String threshold); @Path("device/{deviceId}/words") @DELETE @Feature(code = "remove", name = "Remove Keywords", description = "Remove the keywords", type = "operation") + @Permission(scope = "android_sense_user", permissions = {"/permission/admin/device-mgt/user/operations"}) Response removeKeyWords(@PathParam("deviceId") String deviceId, @QueryParam("words") String words); /** @@ -71,6 +75,7 @@ public interface AndroidSenseControllerService { @GET @Consumes("application/json") @Produces("application/json") + @Permission(scope = "android_sense_device", permissions = {"/permission/admin/device-mgt/user/stats"}) Response getAndroidSenseDeviceStats(@PathParam("deviceId") String deviceId, @PathParam("sensorName") String sensor, @QueryParam("from") long from, @QueryParam("to") long to); diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseManagerService.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseManagerService.java index 68e48074ac..1e03db16ea 100644 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseManagerService.java +++ b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseManagerService.java @@ -19,6 +19,7 @@ package org.wso2.carbon.device.mgt.iot.androidsense.service.impl; import org.wso2.carbon.apimgt.annotations.api.API; +import org.wso2.carbon.apimgt.annotations.api.Permission; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; @@ -36,20 +37,24 @@ public interface AndroidSenseManagerService { @Path("/devices/{device_id}") @POST + @Permission(scope = "android_sense_user", permissions = {"/permission/admin/device-mgt/user/devices"}) Response register(@PathParam("device_id") String deviceId, @QueryParam("deviceName") String deviceName); @Path("/devices/{device_id}") @DELETE + @Permission(scope = "android_sense_user", permissions = {"/permission/admin/device-mgt/user/devices/remove"}) Response removeDevice(@PathParam("device_id") String deviceId); @Path("/devices/{device_id}") @PUT + @Permission(scope = "android_sense_user", permissions = {"/permission/admin/device-mgt/user/devices/update"}) Response updateDevice(@PathParam("device_id") String deviceId, @QueryParam("name") String name); @Path("/devices/{device_id}") @GET @Consumes("application/json") @Produces("application/json") + @Permission(scope = "android_sense_user", permissions = {"/permission/admin/device-mgt/user/devices/list"}) Response getDevice(@PathParam("device_id") String deviceId); } diff --git a/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmControllerService.java b/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmControllerService.java index 3bbbe3ad49..30523c4444 100644 --- a/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmControllerService.java +++ b/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmControllerService.java @@ -49,7 +49,7 @@ public interface VirtualFireAlarmControllerService { */ @POST @Path("device/{deviceId}/buzz") - @Permission(scope = "virtual_firealarm_user", permissions = {"device-mgt/virtual_firealarm/user"}) + @Permission(scope = "virtual_firealarm_user", permissions = {"/permission/admin/device-mgt/user/operation"}) @Feature(code = "buzz", name = "Buzzer On / Off", type = "operation", description = "Switch on/off Virtual Fire Alarm Buzzer. (On / Off)") Response switchBuzzer(@PathParam("deviceId") String deviceId, @QueryParam("protocol") String protocol, @@ -61,7 +61,7 @@ public interface VirtualFireAlarmControllerService { */ @Path("device/stats/{deviceId}") @GET - @Permission(scope = "virtual_firealarm_user", permissions = {"device-mgt/virtual_firealarm/user"}) + @Permission(scope = "virtual_firealarm_user", permissions = {"/permission/admin/device-mgt/user/stats"}) @Consumes("application/json") @Produces("application/json") Response getVirtualFirealarmStats(@PathParam("deviceId") String deviceId, @QueryParam("from") long from, diff --git a/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmManagerService.java b/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmManagerService.java index 7b5bdaf097..4b0f3c13fd 100644 --- a/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmManagerService.java +++ b/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/java/org/wso2/carbon/device/mgt/iot/virtualfirealarm/service/impl/VirtualFireAlarmManagerService.java @@ -19,6 +19,7 @@ package org.wso2.carbon.device.mgt.iot.virtualfirealarm.service.impl; import org.wso2.carbon.apimgt.annotations.api.API; +import org.wso2.carbon.apimgt.annotations.api.Permission; import org.wso2.carbon.device.mgt.extensions.feature.mgt.annotations.DeviceType; import javax.ws.rs.Consumes; @@ -38,28 +39,33 @@ public interface VirtualFireAlarmManagerService { @Path("/devices/{device_id}") @DELETE + @Permission(scope = "virtual_firealarm_user", permissions = {"/permission/admin/device-mgt/user/devices/remove"}) Response removeDevice(@PathParam("device_id") String deviceId); @Path("/devices/{device_id}") @PUT + @Permission(scope = "virtual_firealarm_user", permissions = {"/permission/admin/device-mgt/user/devices/update"}) Response updateDevice(@PathParam("device_id") String deviceId, @QueryParam("name") String name); @Path("/devices/{device_id}") @GET @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) + @Permission(scope = "virtual_firealarm_user", permissions = {"/permission/admin/device-mgt/user/devices/list"}) Response getDevice(@PathParam("device_id") String deviceId); @Path("/devices") @GET @Consumes(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON) + @Permission(scope = "virtual_firealarm_user", permissions = {"/device-mgt/user/devices/list"}) Response getFirealarmDevices(); @Path("/devices/download") @GET @Produces("application/zip") + @Permission(scope = "virtual_firealarm_user", permissions = {"/permission/admin/device-mgt/user"}) Response downloadSketch(@QueryParam("deviceName") String deviceName, @QueryParam("sketchType") String sketchType); } \ No newline at end of file diff --git a/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/webapp/META-INF/permissions.xml b/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/webapp/META-INF/permissions.xml index 8b8957385b..072cd1e74a 100644 --- a/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/webapp/META-INF/permissions.xml +++ b/components/iot-plugins/virtual-fire-alarm-plugin/org.wso2.carbon.device.mgt.iot.virtualfirealarm.api/src/main/webapp/META-INF/permissions.xml @@ -44,7 +44,7 @@ Download device - /device-mgt/virtual_firealarm/user + /device-mgt/user /enrollment/devices/download GET virtual_firealarm_user @@ -63,32 +63,18 @@ GET virtual_firealarm_user - - Register Device - /device-mgt/user/operations - /device/register/*/*/* - POST - virtual_firealarm_device - Control Buzz - /device-mgt/user/operations + /device-mgt/user/operation /device/*/buzz POST virtual_firealarm_user - - Push Temperature - /device-mgt/user/stats - /device/temperature - POST - virtual_firealarm_device - Get Stats /device-mgt/user/stats /device/stats/* GET - virtual_firealarm_device + virtual_firealarm_user \ No newline at end of file From d7b84cf9e4bd17337af509702d143329fe816cdc Mon Sep 17 00:00:00 2001 From: mharindu Date: Mon, 16 May 2016 14:14:39 +0530 Subject: [PATCH 02/13] Fixed conflicts --- .../impl/AndroidSenseManagerService.java | 53 ------------------- 1 file changed, 53 deletions(-) delete mode 100644 components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseManagerService.java diff --git a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseManagerService.java b/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseManagerService.java deleted file mode 100644 index ffb9a2d49f..0000000000 --- a/components/iot-plugins/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.api/src/main/java/org/wso2/carbon/device/mgt/iot/androidsense/service/impl/AndroidSenseManagerService.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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. - */ - -package org.wso2.carbon.device.mgt.iot.androidsense.service.impl; - -import org.wso2.carbon.apimgt.annotations.api.API; -import org.wso2.carbon.apimgt.annotations.api.Permission; - -import javax.ws.rs.*; -import javax.ws.rs.core.Response; -@Path("enrollment") -@API(name = "android_sense_mgt", version = "1.0.0", context = "/android_sense_mgt", tags = {"android_sense"}) -public interface AndroidSenseManagerService { - - @Path("/devices/{device_id}") - @POST - @Permission(scope = "android_sense_user", permissions = {"/permission/admin/device-mgt/user/devices"}) - Response register(@PathParam("device_id") String deviceId, @QueryParam("deviceName") String deviceName); - - @Path("/devices/{device_id}") - @DELETE - @Permission(scope = "android_sense_user", permissions = {"/permission/admin/device-mgt/user/devices/remove"}) - Response removeDevice(@PathParam("device_id") String deviceId); - - @Path("/devices/{device_id}") - @PUT - @Permission(scope = "android_sense_user", permissions = {"/permission/admin/device-mgt/user/devices/update"}) - Response updateDevice(@PathParam("device_id") String deviceId, @QueryParam("name") String name); - - @Path("/devices/{device_id}") - @GET - @Consumes("application/json") - @Produces("application/json") - @Permission(scope = "android_sense_user", permissions = {"/permission/admin/device-mgt/user/devices/list"}) - Response getDevice(@PathParam("device_id") String deviceId); - -} - From eec796732e02b535b41f0ccb62bdeb678d1af3f8 Mon Sep 17 00:00:00 2001 From: Shabirmean Date: Tue, 17 May 2016 17:40:03 +0530 Subject: [PATCH 03/13] Correction to the RaspberryPi table from which the batch data to be pulled --- .../iot/raspberrypi/plugin/constants/RaspberrypiConstants.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/plugin/constants/RaspberrypiConstants.java b/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/plugin/constants/RaspberrypiConstants.java index 0a99f61ccd..c7a8f2c40c 100644 --- a/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/plugin/constants/RaspberrypiConstants.java +++ b/components/iot-plugins/raspberrypi-plugin/org.wso2.carbon.device.mgt.iot.raspberrypi.plugin/src/main/java/org/wso2/carbon/device/mgt/iot/raspberrypi/plugin/constants/RaspberrypiConstants.java @@ -37,7 +37,7 @@ public class RaspberrypiConstants { //type of the sensor public static final String SENSOR_TEMPERATURE = "temperature"; //sensor events summerized table name - public static final String TEMPERATURE_EVENT_TABLE = "ORG_WSO2_IOT_DEVICES_TEMPERATURE"; + public static final String TEMPERATURE_EVENT_TABLE = "DEVICE_TEMPERATURE_SUMMARY"; public static final String DATA_SOURCE_NAME = "jdbc/RaspberryPiDM_DB"; public final static String DEVICE_TYPE_PROVIDER_DOMAIN = "carbon.super"; From b081f0259410d7646a2029064fc4b0d27f5a12b3 Mon Sep 17 00:00:00 2001 From: charitha Date: Tue, 17 May 2016 23:33:55 +0530 Subject: [PATCH 04/13] Bug fixes --- .../public/js/policy-create.js | 178 +++++++++++++----- .../units/iot.unit.policy.wizard/wizard.hbs | 104 ++++++---- .../units/iot.unit.policy.wizard/wizard.js | 4 + .../operation-mod.json | 8 +- 4 files changed, 206 insertions(+), 88 deletions(-) diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.policy.wizard/public/js/policy-create.js b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.policy.wizard/public/js/policy-create.js index 84e9886436..4c838a1c48 100644 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.policy.wizard/public/js/policy-create.js +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.policy.wizard/public/js/policy-create.js @@ -73,7 +73,6 @@ validateStep["policy-profile"] = function () { }; stepForwardFrom["policy-profile"] = function () { - policy["profile"] = operationModule.generateProfile(policy["platform"], configuredOperations); // updating next-page wizard title with selected platform $("#policy-criteria-page-wizard-title").text("ADD " + deviceTypeLabel + " POLICY"); }; @@ -105,6 +104,8 @@ stepForwardFrom["policy-criteria"] = function () { policy["selectedUsers"] = $("#users-input").val(); } else if ($(this).attr("id") == "user-roles-radio-btn") { policy["selectedUserRoles"] = $("#user-roles-input").val(); + } else if ($(this).attr("id") == "groups-radio-btn") { + policy["selectedUserGroups"] = $("#groups-input").val(); } } } @@ -247,12 +248,15 @@ var savePolicy = function (policy, state) { invokerUtil.post( serviceURL, payload, - function () { - $(".add-policy").addClass("hidden"); - $(".policy-naming").addClass("hidden"); - $(".policy-message").removeClass("hidden"); - if (state == "publish") { - publishToDevice(); + function (response) { + response = JSON.parse(response); + if (response["statusCode"] == 201) { + $(".add-policy").addClass("hidden"); + $(".policy-naming").addClass("hidden"); + $(".policy-message").removeClass("hidden"); + if (state == "publish") { + publishToDevice(); + } } }, function (err) { @@ -351,6 +355,31 @@ function formatRepoSelection(user) { return user.username || user.text; } +function formatGroupRepo(group) { + if (group.loading) { + return group.text + } + if (!group.name) { + return; + } + var markup = '
' + + '
' + + '
' + + '
' + group.name + '
'; + if (group.name) { + markup += '
' + group.name + '
'; + } + if (group.owner) { + markup += '
' + group.owner + '
'; + } + markup += '
'; + return markup; +} + +function formatGroupRepoSelection(group) { + return group.name || group.text; +} + // End of functions related to grid-input-view @@ -372,46 +401,85 @@ $(document).ready(function () { }); $("#users-input").select2({ - multiple: true, - tags: true, - ajax: { - url: window.location.origin + "/devicemgt/api/invoker/execute/", - method: "POST", - dataType: 'json', - delay: 250, - id: function (user) { - return user.username; - }, - data: function (params) { - var postData = {}; - postData.actionMethod = "GET"; - postData.actionUrl = "/devicemgt_admin/users"; - postData.actionPayload = JSON.stringify({ - q: params.term, // search term - page: params.page - }); - - return JSON.stringify(postData); - }, - processResults: function (data, page) { - var newData = []; - $.each(data.responseContent, function (index, value) { - value.id = value.username; - newData.push(value); - }); - return { - results: newData - }; - }, - cache: true - }, - escapeMarkup: function (markup) { - return markup; - }, // let our custom formatter work - minimumInputLength: 1, - templateResult: formatRepo, // omitted for brevity, see the source of this page - templateSelection: formatRepoSelection // omitted for brevity, see the source of this page - }); + multiple: true, + tags: true, + ajax: { + url: window.location.origin + "/devicemgt/api/invoker/execute/", + method: "POST", + dataType: 'json', + delay: 250, + id: function (user) { + return user.username; + }, + data: function (params) { + var postData = {}; + postData.actionMethod = "GET"; + postData.actionUrl = "/devicemgt_admin/users"; + postData.actionPayload = JSON.stringify({ + q: params.term, // search term + page: params.page + }); + + return JSON.stringify(postData); + }, + processResults: function (data, page) { + var newData = []; + $.each(data.responseContent, function (index, value) { + value.id = value.username; + newData.push(value); + }); + return { + results: newData + }; + }, + cache: true + }, + escapeMarkup: function (markup) { + return markup; + }, // let our custom formatter work + minimumInputLength: 1, + templateResult: formatRepo, // omitted for brevity, see the source of this page + templateSelection: formatRepoSelection // omitted for brevity, see the source of this page + }); + + $("#groups-input").select2({ + multiple: true, + tags: true, + ajax: { + url: window.location.origin + "/devicemgt/api/invoker/execute/", + method: "POST", + dataType: 'json', + delay: 250, + id: function (group) { + return group.name; + }, + data: function (params) { + var postData = {}; + postData.actionMethod = "GET"; + var username = $("#platform").data("username"); + postData.actionUrl = "/devicemgt_admin/groups/user/" + username + + "/search?groupName=" + params.term; + return JSON.stringify(postData); + }, + processResults: function (data, page) { + var newData = []; + $.each(data, function (index, value) { + value.id = value.name; + newData.push(value); + }); + return { + results: newData + }; + }, + cache: true + }, + escapeMarkup: function (markup) { + return markup; + }, // let our custom formatter work + minimumInputLength: 1, + templateResult: formatGroupRepo, // omitted for brevity, see the source of this page + templateSelection: formatGroupRepoSelection // omitted for brevity, see the source of this page + }); // Adding initial state of wizard-steps. $("#policy-profile-wizard-steps").html($(".wr-steps").html()); @@ -427,16 +495,24 @@ $(document).ready(function () { }); $("#users-select-field").hide(); + $("#groups-select-field").hide(); $("#user-roles-select-field").show(); $("input[type='radio'].select-users-radio").change(function () { + if ($("#user-roles-radio-btn").is(":checked")) { + $("#user-roles-select-field").show(); + $("#users-select-field").hide(); + $("#groups-select-field").hide(); + } if ($("#users-radio-btn").is(":checked")) { $("#user-roles-select-field").hide(); $("#users-select-field").show(); + $("#groups-select-field").hide(); } - if ($("#user-roles-radio-btn").is(":checked")) { + if ($("#groups-radio-btn").is(":checked")) { + $("#user-roles-select-field").hide(); $("#users-select-field").hide(); - $("#user-roles-select-field").show(); + $("#groups-select-field").show(); } }); @@ -657,7 +733,9 @@ $(document).ready(function () { // hiding current section of the wizard and showing next section. $("." + currentStep).addClass("hidden"); - $("." + nextStep).removeClass("hidden"); + if (nextStep !== "policy-message") { + $("." + nextStep).removeClass("hidden"); + } } }); }); diff --git a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.policy.wizard/wizard.hbs b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.policy.wizard/wizard.hbs index 4cc6fa2726..1c661f0002 100644 --- a/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.policy.wizard/wizard.hbs +++ b/components/iot-plugins/iot-base-plugin/org.wso2.carbon.device.mgt.iot.ui/src/main/resources/jaggeryapps/devicemgt/app/units/iot.unit.policy.wizard/wizard.hbs @@ -2,7 +2,7 @@ {{css "css/codemirror.css"}} {{/zone}} + data-platform-label="{{type.label}}" data-username="{{username}}">