diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml index 84eeb63c52..e7760616c9 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.annotations/pom.xml @@ -22,13 +22,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.annotations - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT bundle WSO2 Carbon - API Management Annotations WSO2 Carbon - API Management Custom Annotation Module diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml index 42f14dcc9d..94d3e00b28 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml @@ -21,12 +21,12 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml 4.0.0 - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT org.wso2.carbon.apimgt.application.extension.api war WSO2 Carbon - API Application Management API diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml index 8846a87708..5b72c4d911 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/pom.xml @@ -22,12 +22,12 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml 4.0.0 - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT org.wso2.carbon.apimgt.application.extension bundle WSO2 Carbon - API Application Management diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml index 09b22e6fbd..0ab1e7e2fe 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.handlers/pom.xml @@ -21,13 +21,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.handlers - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT bundle WSO2 Carbon - API Security Handler Component WSO2 Carbon - API Management Security Handler Module diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml index 31f2861f1a..6ca21a382e 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/pom.xml @@ -13,13 +13,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.client - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT bundle WSO2 Carbon - API Management Integration Client WSO2 Carbon - API Management Integration Client diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/IntegrationClientServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/IntegrationClientServiceImpl.java index 7878bcfffd..94c6f7e87c 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/IntegrationClientServiceImpl.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/IntegrationClientServiceImpl.java @@ -22,11 +22,16 @@ import feign.RequestInterceptor; import org.wso2.carbon.apimgt.integration.client.publisher.PublisherClient; import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; import org.wso2.carbon.apimgt.integration.client.store.StoreClient; +import org.wso2.carbon.identity.jwt.client.extension.dto.AccessTokenInfo; + +import java.util.HashMap; +import java.util.Map; public class IntegrationClientServiceImpl implements IntegrationClientService { private static StoreClient storeClient; private static PublisherClient publisherClient; + private static Map tenantUserTokenMap = new HashMap<>(); public IntegrationClientServiceImpl() { RequestInterceptor oAuthRequestInterceptor = new OAuthRequestInterceptor(); @@ -42,4 +47,8 @@ public class IntegrationClientServiceImpl implements IntegrationClientService { public PublisherClient getPublisherClient() { return publisherClient; } + + public static Map getTenantUserTokenMap() { + return tenantUserTokenMap; + } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/OAuthRequestInterceptor.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/OAuthRequestInterceptor.java index a1ab7d6c73..b78f258c27 100755 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/OAuthRequestInterceptor.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.client/src/main/java/org/wso2/carbon/apimgt/integration/client/OAuthRequestInterceptor.java @@ -55,7 +55,6 @@ public class OAuthRequestInterceptor implements RequestInterceptor { private static final long DEFAULT_REFRESH_TIME_OFFSET_IN_MILLIS = 100000; private DCRClient dcrClient; private static OAuthApplication oAuthApplication; - private static Map tenantUserTokenMap = new HashMap<>(); private static final Log log = LogFactory.getLog(OAuthRequestInterceptor.class); /** @@ -89,7 +88,7 @@ public class OAuthRequestInterceptor implements RequestInterceptor { if (!tenantDomain.equals(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME)) { username = username + "@" + tenantDomain; } - AccessTokenInfo tenantBasedAccessTokenInfo = tenantUserTokenMap.get(username); + AccessTokenInfo tenantBasedAccessTokenInfo = IntegrationClientServiceImpl.getTenantUserTokenMap().get(username); if ((tenantBasedAccessTokenInfo == null || ((System.currentTimeMillis() + DEFAULT_REFRESH_TIME_OFFSET_IN_MILLIS) > tenantBasedAccessTokenInfo.getExpiresIn()))) { @@ -106,7 +105,7 @@ public class OAuthRequestInterceptor implements RequestInterceptor { } if (tenantBasedAccessTokenInfo.getScopes().contains(APIM_SUBSCRIBE_SCOPE)) { - tenantUserTokenMap.put(username, tenantBasedAccessTokenInfo); + IntegrationClientServiceImpl.getTenantUserTokenMap().put(username, tenantBasedAccessTokenInfo); } } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml index ae00d30e8b..53ea95da89 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.integration.generated.client/pom.xml @@ -13,13 +13,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.integration.generated.client - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT bundle WSO2 Carbon - API Management Integration Generated Client WSO2 Carbon - API Management Integration Client diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml index 6d4f6346cd..d270c1ce9a 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml @@ -22,13 +22,13 @@ apimgt-extensions org.wso2.carbon.devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.apimgt.webapp.publisher - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT bundle WSO2 Carbon - API Management Webapp Publisher WSO2 Carbon - API Management Webapp Publisher diff --git a/components/apimgt-extensions/pom.xml b/components/apimgt-extensions/pom.xml index 9b50152b8e..3cdb1a0196 100644 --- a/components/apimgt-extensions/pom.xml +++ b/components/apimgt-extensions/pom.xml @@ -22,13 +22,13 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../../pom.xml 4.0.0 apimgt-extensions - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT pom WSO2 Carbon - API Management Extensions Component http://wso2.org 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 a33a4b21d7..9a71296ada 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 @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml index a15840014f..9a975c8fa9 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.cert.admin.api/pom.xml @@ -22,7 +22,7 @@ certificate-mgt org.wso2.carbon.devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml diff --git a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml index b11f4aaec2..abb3e5e07e 100644 --- a/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml +++ b/components/certificate-mgt/org.wso2.carbon.certificate.mgt.core/pom.xml @@ -21,13 +21,13 @@ org.wso2.carbon.devicemgt certificate-mgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml 4.0.0 org.wso2.carbon.certificate.mgt.core - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT bundle WSO2 Carbon - Certificate Management Core WSO2 Carbon - Certificate Management Core diff --git a/components/certificate-mgt/pom.xml b/components/certificate-mgt/pom.xml index f69c7194da..bb4b5aa23a 100644 --- a/components/certificate-mgt/pom.xml +++ b/components/certificate-mgt/pom.xml @@ -22,14 +22,14 @@ org.wso2.carbon.devicemgt carbon-devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../../pom.xml 4.0.0 org.wso2.carbon.devicemgt certificate-mgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT pom WSO2 Carbon - Certificate Management Component http://wso2.org diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml index 68a3419c45..4e1f1ae38a 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml index 4a4d4d1d35..8e9a729ed0 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.pull.notification/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml index aebdfa3cf2..92391bd23f 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.fcm/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml index c67a7d4811..98f49d9ee6 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.http/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml index e15770887b..a433345d3e 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.mqtt/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml index 237fcea344..173151daeb 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.push.notification.provider.xmpp/pom.xml @@ -22,7 +22,7 @@ device-mgt-extensions org.wso2.carbon.devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml diff --git a/components/device-mgt-extensions/pom.xml b/components/device-mgt-extensions/pom.xml index a6944ba509..55847b4c27 100644 --- a/components/device-mgt-extensions/pom.xml +++ b/components/device-mgt-extensions/pom.xml @@ -22,7 +22,7 @@ carbon-devicemgt org.wso2.carbon.devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml index 5f3d808144..83cb191e50 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.dashboard/pom.xml @@ -3,7 +3,7 @@ org.wso2.carbon.devicemgt device-mgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml index a8091d41fc..d62b1aa4f3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.analytics.data.publisher/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml index 4862043806..eae40032d2 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/pom.xml @@ -22,7 +22,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml @@ -362,6 +362,11 @@ org.wso2.carbon.event.stream.persistence.stub provided + + org.wso2.carbon.devicemgt + org.wso2.carbon.apimgt.integration.client + provided + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java index 5118221ac3..6e49f7bdfb 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/impl/DeviceManagementServiceImpl.java @@ -24,7 +24,6 @@ import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.DeviceIdentifier; -import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.EnrolmentInfo; import org.wso2.carbon.device.mgt.common.Feature; @@ -66,7 +65,6 @@ import org.wso2.carbon.policy.mgt.common.PolicyManagementException; import org.wso2.carbon.policy.mgt.core.PolicyManagerService; import org.wso2.carbon.utils.multitenancy.MultitenantUtils; -import javax.security.auth.login.Configuration; import javax.validation.Valid; import javax.validation.constraints.Size; import javax.ws.rs.Consumes; @@ -92,8 +90,8 @@ import java.util.List; @Consumes(MediaType.APPLICATION_JSON) public class DeviceManagementServiceImpl implements DeviceManagementService { - private static final Log log = LogFactory.getLog(DeviceManagementServiceImpl.class); public static final String DATE_FORMAT_NOW = "yyyy-MM-dd HH:mm:ss"; + private static final Log log = LogFactory.getLog(DeviceManagementServiceImpl.class); @GET @Path("/{type}/{id}/status") @@ -499,15 +497,13 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { @QueryParam("offset") int offset, @QueryParam("limit") int limit) { List applications; - //ApplicationList appList; ApplicationManagementProviderService amc; try { RequestValidationUtil.validateDeviceIdentifier(type, id); amc = DeviceMgtAPIUtils.getAppManagementService(); applications = amc.getApplicationListForDevice(new DeviceIdentifier(id, type)); - - //TODO: return app list + return Response.status(Response.Status.OK).entity(applications).build(); } catch (ApplicationManagementException e) { String msg = "Error occurred while fetching the apps of the '" + type + "' device, which carries " + "the id '" + id + "'"; @@ -515,7 +511,6 @@ public class DeviceManagementServiceImpl implements DeviceManagementService { return Response.serverError().entity( new ErrorResponse.ErrorResponseBuilder().setMessage(msg).build()).build(); } - return Response.status(Response.Status.OK).entity(applications).build(); } @GET diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/CredentialManagementResponseBuilder.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/CredentialManagementResponseBuilder.java index 7007aa0d3e..a44444aa3d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/CredentialManagementResponseBuilder.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/util/CredentialManagementResponseBuilder.java @@ -20,7 +20,10 @@ package org.wso2.carbon.device.mgt.jaxrs.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.apimgt.integration.client.IntegrationClientServiceImpl; +import org.wso2.carbon.apimgt.integration.client.service.IntegrationClientService; import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.mgt.jaxrs.beans.ErrorResponse; import org.wso2.carbon.device.mgt.jaxrs.beans.OldPasswordResetWrapper; import org.wso2.carbon.device.mgt.jaxrs.beans.PasswordResetWrapper; @@ -63,6 +66,9 @@ public class CredentialManagementResponseBuilder { username = CarbonContext.getThreadLocalCarbonContext().getUsername(); userStoreManager.updateCredential(username, credentials.getNewPassword(), credentials.getOldPassword()); + IntegrationClientServiceImpl integrationClientService = (IntegrationClientServiceImpl) PrivilegedCarbonContext. + getThreadLocalCarbonContext().getOSGiService(IntegrationClientService.class, null); + integrationClientService.getTenantUserTokenMap().remove(username); return Response.status(Response.Status.OK).entity("UserImpl password by username: " + username + " was successfully changed.").build(); } catch (UserStoreException e) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml index edec7a3ca8..62e9bb0c98 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml @@ -21,7 +21,7 @@ device-mgt org.wso2.carbon.devicemgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml index 5f343285e9..15244bd601 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml @@ -22,7 +22,7 @@ org.wso2.carbon.devicemgt device-mgt - 3.0.74-SNAPSHOT + 3.0.89-SNAPSHOT ../pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java index 37ee12f054..548710691a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/app/mgt/ApplicationManagerProviderServiceImpl.java @@ -198,17 +198,17 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem public void updateApplicationListInstalledInDevice( DeviceIdentifier deviceIdentifier, List applications) throws ApplicationManagementException { + if (log.isDebugEnabled()) { + log.debug("Updating application list for device: " + deviceIdentifier.toString()); + } List installedAppList = getApplicationListForDevice(deviceIdentifier); try { Device device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceIdentifier, false); int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId(); - if (log.isDebugEnabled()) { - log.debug("Device:" + device.getId() + ":identifier:" + deviceIdentifier.getId()); - } if (log.isDebugEnabled()) { - log.debug("num of apps installed:" + installedAppList.size()); + log.debug("Number of apps installed:" + installedAppList.size()); } List appsToAdd = new ArrayList<>(); List appIdsToRemove = new ArrayList<>(installedAppList.size()); @@ -227,11 +227,12 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem List applicationIds = new ArrayList<>(); for (Application application : applications) { - /* - Truncating the application version if length of the version is greater than maximum allowed length. - */ - if (application.getVersion().length() > - DeviceManagementConstants.OperationAttributes.APPLIST_VERSION_MAX_LENGTH) { + // Adding N/A if application doesn't have a version. Also truncating the application version, + // if length of the version is greater than maximum allowed length. + if (application.getVersion() == null) { + application.setVersion("N/A"); + } else if (application.getVersion().length() > + DeviceManagementConstants.OperationAttributes.APPLIST_VERSION_MAX_LENGTH) { application.setVersion(StringUtils.abbreviate(application.getVersion(), DeviceManagementConstants.OperationAttributes.APPLIST_VERSION_MAX_LENGTH)); } @@ -258,24 +259,34 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem if (log.isDebugEnabled()) { log.debug("num of remove app Ids:" + appIdsToRemove.size()); } - DeviceManagementDAOFactory.commitTransaction(); } catch (DeviceManagementDAOException e) { DeviceManagementDAOFactory.rollbackTransaction(); - throw new ApplicationManagementException("Error occurred saving application list to the device", e); + String msg = "Error occurred saving application list of the device " + deviceIdentifier.toString(); + log.error(msg, e); + throw new ApplicationManagementException(msg, e); } catch (TransactionManagementException e) { - throw new ApplicationManagementException("Error occurred while initializing transaction", e); + String msg = "Error occurred while initializing transaction for saving application list to the device " + + deviceIdentifier.toString(); + log.error(msg, e); + throw new ApplicationManagementException(msg, e); } catch (DeviceManagementException e) { - throw new ApplicationManagementException("Error occurred obtaining the device object.", e); + String msg = "Error occurred obtaining the device object for device " + deviceIdentifier.toString(); + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (Exception e) { + String msg = "Exception occurred saving application list of the device " + deviceIdentifier.toString(); + log.error(msg, e); + throw new ApplicationManagementException(msg, e); } finally { DeviceManagementDAOFactory.closeConnection(); } } @Override - public List getApplicationListForDevice( - DeviceIdentifier deviceId) throws ApplicationManagementException { - Device device = null; + public List getApplicationListForDevice(DeviceIdentifier deviceId) + throws ApplicationManagementException { + Device device; try { device = DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceId, false); @@ -286,18 +297,26 @@ public class ApplicationManagerProviderServiceImpl implements ApplicationManagem if (device == null) { if (log.isDebugEnabled()) { log.debug("No device is found upon the device identifier '" + deviceId.getId() + - "' and type '" + deviceId.getType() + "'. Therefore returning null"); + "' and type '" + deviceId.getType() + "'. Therefore returning empty app list"); } - return null; + return new ArrayList<>(); } try { DeviceManagementDAOFactory.openConnection(); return applicationDAO.getInstalledApplications(device.getId()); } catch (DeviceManagementDAOException e) { - throw new ApplicationManagementException("Error occurred while fetching the Application List of '" + - deviceId.getType() + "' device carrying the identifier'" + deviceId.getId(), e); + String msg = "Error occurred while fetching the Application List of device " + deviceId.toString(); + log.error(msg, e); + throw new ApplicationManagementException(msg, e); } catch (SQLException e) { - throw new ApplicationManagementException("Error occurred while opening a connection to the data source", e); + String msg = "Error occurred while opening a connection to the data source to get application " + + "list of the device " + deviceId.toString(); + log.error(msg, e); + throw new ApplicationManagementException(msg, e); + } catch (Exception e) { + String msg = "Exception occurred getting application list of the device " + deviceId.toString(); + log.error(msg, e); + throw new ApplicationManagementException(msg, e); } finally { DeviceManagementDAOFactory.closeConnection(); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/axis2/axis2.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/axis2/axis2.xml index 0f0822fa02..bd4b1d8c4a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/axis2/axis2.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/carbon-home/repository/conf/axis2/axis2.xml @@ -1,5 +1,5 @@ +{{unit "cdmf.unit.ui.title" pageTitle="Advanced Search"}} {{unit "cdmf.unit.ui.modal"}} {{unit "cdmf.unit.data-tables-extended"}} {{#zone "breadcrumbs"}} @@ -81,7 +82,7 @@ required.
- +
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js index 358b95b62e..f81645c457 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.devices/public/js/listing.js @@ -259,7 +259,7 @@ function loadDevices(searchType, searchParam) { var columns = [ { targets: 0, - data: 'name', + data: 'namePattern', class: 'remove-padding icon-only content-fill viewEnabledIcon', render: function (data, type, row, meta) { return '
Advance Search'); + ' class="advance-search add-padding-3x">Advanced Search'); } }, { - "placeholder": "Search By Device Name", - "searchKey": "name" + "placeholder": "Top-Device-Name-Search", + "searchKey": "namePattern" } ); @@ -567,6 +568,9 @@ $(document).ready(function () { } }); + //Hide the search by device-name input + $("input[placeholder='Top-Device-Name-Search']").hide(); + }); var modalPopup = ".modal"; @@ -891,7 +895,7 @@ function removeDevices(deviceIdentifiers) { var serviceURL = "/api/device-mgt/v1.0/devices/type/" + deviceIdentifiers[0].type + "/id/" + deviceIdentifiers[0].id; invokerUtil.delete(serviceURL, function (message) { if (deviceIdentifiers.length > 1) { - deviceIdentifiers.slice(1, deviceIdentifiers.length); + deviceIdentifiers.shift(); removeDevices(deviceIdentifiers); } else { $(modalPopupContent).html($('#remove-device-200-content').html()); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.hbs index 9e6ee54a71..62cea7955e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/create.hbs @@ -73,18 +73,7 @@

Group was created successfully.

-
Please click "Add Another Group", if you wish to add another group or click - "View Group List" to complete the process and go back to the group list. -
- - - - - - - Add Another Group - +
You will be redirected to the Group Listing page in a moment.
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/public/js/group-add.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/public/js/group-add.js index 85b34decd9..1684159e6d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/public/js/group-add.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.group.create/public/js/group-add.js @@ -47,6 +47,9 @@ $(function () { if (resp.status == 201) { $("#group-create-form").addClass("hidden"); $("#group-created-msg").removeClass("hidden"); + setTimeout(function() { + window.location.href = "/devicemgt/groups"; + }, 1000); } else { displayErrors(resp.status); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.hbs index fc8119f547..7e556c556c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/groups.hbs @@ -87,7 +87,7 @@

-

You don't have any device group. Let's add a new device group!

+

You don't have any device groups. Let's add a new device group!

{{#if permissions.ADD_GROUP}}

@@ -236,7 +236,7 @@
-

Do you really want to remove this group from your Group List?

+

Do you really want to remove this group?

@@ -257,7 +257,7 @@
-

Group was successfully removed.

+

Successfully removed the group.

@@ -284,11 +284,15 @@

Enter new name and description for the group

+ Name: +

+ Description: +
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/css/groups.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/css/groups.css similarity index 71% rename from components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/css/groups.css rename to components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/css/groups.css index 07e0846abe..7300a7637c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/css/groups.css +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.groups/public/css/groups.css @@ -1,3 +1,3 @@ -.dataTablesTop .dataTables_toolbar ul li:nth-child(1), .dataTables_toolbar ul li:nth-child(2){ +.dataTablesTop .dataTables_toolbar ul li:nth-child(1), .dataTables_toolbar ul li:nth-child(2) { display: none; } \ 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.roles/public/js/role-listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js index 516aacb7b5..c1acb8e9f2 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.roles/public/js/role-listing.js @@ -140,7 +140,7 @@ function loadRoles() { } }, { - class: "text-right content-fill text-left-on-grid-view no-wrap", + class: "text-right content-fill text-left-on-grid-view no-wrap tooltip-overflow-fix", data: null, render: function (data, type, row, meta) { var isCloud = false; @@ -153,7 +153,9 @@ function loadRoles() { var editLink = '
' + + 'data-toggle="tooltip" ' + + 'data-original-title="Edit Role"' + + 'class="btn padding-reduce-on-grid-view edit-role-link"> ' + '' + '' + '' + @@ -167,7 +169,9 @@ function loadRoles() { var editPermissionLink = '' + '' + '' + @@ -182,6 +186,8 @@ function loadRoles() { var removeLink = '' + '' + '' + @@ -272,4 +278,7 @@ $("#role-grid").on("click", ".remove-role-link", function () { $(document).ready(function () { loadRoles(); + $(function () { + $('[data-toggle="tooltip"]').tooltip() + }); }); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs index e69c9d4184..183e124bfa 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.create/create.hbs @@ -16,7 +16,7 @@ under the License. }} {{unit "cdmf.unit.ui.title" pageTitle="User Management | Add User"}} - +{{unit "cdmf.unit.ui.modal"}} {{#zone "breadcrumbs"}}
  • @@ -122,26 +122,14 @@
  • - diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/public/js/bottomJs.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/public/js/bottomJs.js index 2ecada94ad..c700b06199 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/public/js/bottomJs.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.user.edit/public/js/bottomJs.js @@ -248,6 +248,10 @@ $(document).ready(function () { // Refreshing with success message $("#user-create-form").addClass("hidden"); $("#user-created-msg").removeClass("hidden"); + setTimeout(function () { + window.location.href = "/devicemgt/users" + }, 1000); + } }, function (jqXHR) { var payload = JSON.parse(jqXHR.responseText); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js index c943c53f2d..c3291ef592 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/pages/cdmf.page.users/public/js/listing.js @@ -157,7 +157,7 @@ function resetPassword(username) { domain = username.substr(0, username.indexOf('/')); username = username.substr(username.indexOf('/') + 1); } - var resetPasswordServiceURL = apiBasePath + "/admin/users/" + username + "/credentials"; + var resetPasswordServiceURL = apiBasePath + "/admin/users/" + encodeURIComponent(username) + "/credentials"; if (domain) { resetPasswordServiceURL += '?domain=' + encodeURIComponent(domain); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/css/main.css b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/css/main.css index 60d195c471..2fbb99f134 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/css/main.css +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.view/public/css/main.css @@ -142,6 +142,7 @@ } .tab-actions { margin: 0px; + margin-bottom: 10px; } .tab-actions .action-prop{ padding: 10px; 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 50c6dfa07a..c1531a6d06 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 @@ -33,7 +33,6 @@ $(document).ready(function() { loadPolicyCompliance(); } - $("#refresh-policy").click(function() { $('#policy-spinner').removeClass('hidden'); loadPolicyCompliance(); @@ -44,6 +43,11 @@ $(document).ready(function() { loadOperationsLog(true); }); + $("#refresh-apps").click(function() { + $('#apps-spinner').removeClass('hidden'); + loadApplicationsList(); + }); + }); function getLogStatusIcon(entry) { @@ -159,13 +163,19 @@ function loadOperationsLog(update) { function renderLogDetails(obj,data) { var payload = JSON.parse(data); var logStream = '
    '; + var activityStatus = payload.activityStatus; + var responseMsg = null; - Object.entries(payload.activityStatus).forEach( + if (activityStatus['0'].status == "ERROR") { + responseMsg = activityStatus['0'].responses['0'].response; + } + + Object.entries(activityStatus).forEach( ([key, entry]) => { logStream += '
    ' + '
    ' + '
    ' + - '' + entry.status + '
    ' + + '' + ((responseMsg == null) ? entry.status : responseMsg) + '
    ' + '
    ' + '
    ' + '
    ' + entry.updatedTimestamp + '
    ' + @@ -267,3 +277,47 @@ function loadPolicyCompliance() { } ); } + +function loadApplicationsList() { + var applicationsList = $("#applications-list"); + var applicationListingTemplate = applicationsList.attr("src"); + var deviceId = applicationsList.data("device-id"); + var deviceType = applicationsList.data("device-type"); + + $.template("application-list", applicationListingTemplate, function (template) { + var serviceURL = "/api/device-mgt/v1.0/devices/" + deviceType + "/" + deviceId + "/applications"; + invokerUtil.get( + serviceURL, + // success-callback + function (data, textStatus, jqXHR) { + if (jqXHR.status == 200 && data) { + data = JSON.parse(data); + $("#apps-spinner").addClass("hidden"); + if (data.length > 0) { + for (var i = 0; i < data.length; i++) { + data[i]["name"] = decodeURIComponent(data[i]["name"]); + data[i]["platform"] = deviceType; + } + + var viewModel = {}; + viewModel["applications"] = data; + viewModel["deviceType"] = deviceType; + viewModel["deviceId"] = deviceId; + viewModel["appContext"] = context; + var content = template(viewModel); + $("#applications-list-container").html(content); + var iconSource = $("#applications-list-container").data("public-uri") + "/img/android_app_icon.png"; + $("#applications-list-container img").attr("src",iconSource); + } else { + $("#applications-list-container").html("

    No applications found.

    " + + "

    Please try refreshing the list in a while.

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

     Loading application list " + + "was not successful. please try refreshing the list in a while.

    "); + }); + }); +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_fencing.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_fencing.js index 6aaac5dc09..3ef341187c 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_fencing.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_fencing.js @@ -431,3 +431,76 @@ function viewFence(geoFenceElement,id) { } closeAll(); } + +function viewFenceByData(geoJson, queryName, areaName, stationeryTime, id) { + var matchResults = /(?:"geoFenceGeoJSON"):"{(.*)}"/g.exec(geoJson); + if (matchResults && matchResults.length > 1) { + geoJson = "{" + matchResults[1] + "}"; + } + geoJson = JSON.parse(geoJson.replace(/'/g, '"')); + var geometryShape; + + if(geoJson.type=="Point"){ + + var circleOptions = { + color: '#ff0043' + }; + geometryShape= new L.circle([geoJson.coordinates[1],geoJson.coordinates[0]], geoJson.radius,circleOptions); + // var marker=new L.marker([geoJson.coordinates[1],geoJson.coordinates[0]]); + map.addLayer(geometryShape); + // map.addLayer(marker); + } else if(geoJson.type=="Polygon"){ + geoJson.coordinates[0].pop(); // popout the last coordinate set(lat,lng pair) due to circular chain + var leafletLatLngs = []; + $.each(geoJson.coordinates[0], function (idx, pItem) { + leafletLatLngs.push({lat: pItem[1], lng: pItem[0]}); + }); + geometryShape = new L.Polygon(leafletLatLngs); + map.addLayer(geometryShape); + } + + var geoPublicUri = $("#geo-charts").data("geo-public-uri"); + + if(id=="Stationery"){ + + $('#templateLoader').load(geoPublicUri + "/assets/html_templates/view_fence_popup.html #viewStationeryAlert", function () { + var popupTemplate = $('#templateLoader').find('#viewStationeryAlert'); + popupTemplate.find('#exportGeoJson').attr('leaflet_id', geometryShape._leaflet_id); + popupTemplate.find('#hideViewFence').attr('leaflet_id', geometryShape._leaflet_id); + popupTemplate.find('#viewAreaTime').html(stationeryTime); + geometryShape.bindPopup(popupTemplate.html(), {closeButton: true}).openPopup(); + // transparent the layer .leaflet-popup-content-wrapper + $(geometryShape._popup._container.childNodes[0]).css("background", "rgba(255,255,255,0.8)"); + + }); + } else if(id=="WithIn"){ + + $('#templateLoader').load(geoPublicUri + "/assets/html_templates/view_fence_popup.html #viewWithinAlert", function () { + var popupTemplate = $('#templateLoader').find('#viewWithinAlert'); + popupTemplate.find('#exportGeoJson').attr('leaflet_id', geometryShape._leaflet_id); + popupTemplate.find('#hideViewFence').attr('leaflet_id', geometryShape._leaflet_id); + popupTemplate.find('#viewAreaName').html(areaName); + popupTemplate.find('#withinAlertForm').attr('area-name', areaName); + popupTemplate.find('#withinAlertForm').attr('query-name', queryName); + geometryShape.bindPopup(popupTemplate.html(), {closeButton: true}).openPopup(); + // transparent the layer .leaflet-popup-content-wrapper + $(geometryShape._popup._container.childNodes[0]).css("background", "rgba(255,255,255,0.8)"); + }); + } else if(id=="Exit"){ + + $('#templateLoader').load(geoPublicUri + "/assets/html_templates/view_fence_popup.html #viewExitAlert", function () { + var popupTemplate = $('#templateLoader').find('#viewExitAlert'); + popupTemplate.find('#exportGeoJson').attr('leaflet_id', geometryShape._leaflet_id); + popupTemplate.find('#hideViewFence').attr('leaflet_id', geometryShape._leaflet_id); + popupTemplate.find('#viewAreaName').html(areaName); + popupTemplate.find('#exitAlertForm').attr('area-name', areaName); + popupTemplate.find('#exitAlertForm').attr('query-name', queryName); + geometryShape.bindPopup(popupTemplate.html(), {closeButton: true}).openPopup(); + // transparent the layer .leaflet-popup-content-wrapper + $(geometryShape._popup._container.childNodes[0]).css("background", "rgba(255,255,255,0.8)"); + }); + } else if(id=="Traffic"){ + } + closeAll(); +} + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_remote.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_remote.js index 4f7aa8bfca..a0d755f2a8 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_remote.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.geo-dashboard/public/js/geo_remote.js @@ -278,6 +278,7 @@ function setWithinAlert(leafletId) { responseHandler, function (xhr) { responseHandler(xhr.responseText, xhr.statusText, xhr); }); + viewFenceByData(selectedAreaGeoJson, queryName, areaName, null, 'Within'); } } @@ -335,6 +336,7 @@ function setExitAlert(leafletId) { responseHandler, function (xhr) { responseHandler(xhr.responseText, xhr.statusText, xhr); }); + viewFenceByData(selectedAreaGeoJson, queryName, areaName, null, 'Exit'); } } @@ -407,6 +409,7 @@ function setStationeryAlert(leafletId) { responseHandler, function (xhr) { responseHandler(xhr.responseText, xhr.statusText, xhr); }); + viewFenceByData(selectedProcessedAreaGeoJson, queryName, areaName, time, 'Stationery'); } 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 1bc375a190..e7caea09d2 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 @@ -38,23 +38,10 @@ @@ -82,9 +69,7 @@ + and should be 1-to-30 characters long.

    @@ -285,7 +270,7 @@
    {{#unless types}}

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

    + Install device types to add policies.

    {{/unless}}
    diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/js/policy-create.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/js/policy-create.js index ab7db6eeb4..2c8cb74a4a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/js/policy-create.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.create/public/js/policy-create.js @@ -428,6 +428,10 @@ var savePolicy = function (policy, isActive, serviceURL) { $(".add-policy").addClass("hidden"); $(".policy-naming").addClass("hidden"); $(".policy-message").removeClass("hidden"); + setTimeout(function() { + window.location.href = "/devicemgt/policies"; + }, 1000); + }, function (data) { } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.hbs index 4abf440dc3..e5822f5736 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/edit.hbs @@ -35,20 +35,8 @@

    Policy is successfully re-configured.

    -
    Please click "Add Another Policy", if you wish to add another policy or click - "View policy list" to complete the process and go back to the policy list. -
    - - - - - - - Add another policy - +
    You will be redirected to Policy Listing page in a moment. +
    diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js index e2a7182b6b..6242ec3a55 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.policy.edit/public/js/policy-edit.js @@ -495,6 +495,9 @@ var updatePolicy = function (policy, state) { if (jqXHR.status == 200) { $(".add-policy").addClass("hidden"); $(".policy-message").removeClass("hidden"); + setTimeout(function() { + window.location.href = "/devicemgt/policies"; + }, 1000); } }, // on error @@ -513,6 +516,9 @@ var updatePolicy = function (policy, state) { $(".add-policy").addClass("hidden"); $(".policy-naming").addClass("hidden"); $(".policy-message").removeClass("hidden"); + setTimeout(function() { + window.location.href = "/devicemgt/policies"; + }, 1000); } }, // on error diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit.permission/permission.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit.permission/permission.hbs index 8671888233..30317ac052 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit.permission/permission.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit.permission/permission.hbs @@ -69,19 +69,8 @@ diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit.permission/public/js/bottomJs.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit.permission/public/js/bottomJs.js index 315ab20d22..4259195bb0 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit.permission/public/js/bottomJs.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit.permission/public/js/bottomJs.js @@ -184,6 +184,9 @@ $(document).ready(function () { // Refreshing with success message $("#role-create-form").addClass("hidden"); $("#role-created-msg").removeClass("hidden"); + setTimeout(function() { + window.location.href = "/devicemgt/roles"; + }, 1000); } }, function (data) { var payload = JSON.parse(data.responseText); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.hbs index 979b5c1450..76fc116776 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/edit.hbs @@ -73,20 +73,7 @@ diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/public/js/bottomJs.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/public/js/bottomJs.js index 6ae0e8016f..ee26b9d0b1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/public/js/bottomJs.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.role.edit/public/js/bottomJs.js @@ -210,6 +210,9 @@ $(document).ready(function () { // Refreshing with success message $("#role-create-form").addClass("hidden"); $("#role-created-msg").removeClass("hidden"); + setTimeout(function() { + window.location.href = "/devicemgt/roles"; + }, 1000); } }, function (data) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.default.user-menu/public/js/user-menu.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.default.user-menu/public/js/user-menu.js index ecd93a8bc6..7ef1c320bc 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.default.user-menu/public/js/user-menu.js +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.default.user-menu/public/js/user-menu.js @@ -86,7 +86,9 @@ $(document).ready(function () { $("#change-password-success-link").click(function () { hidePopup(); }); - window.location.href = "/devicemgt/logout"; + setTimeout(function(){ + window.location.href = "/devicemgt/logout"; + },10000); } }, function (jqXHR) { if (jqXHR.status == 400) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.default.user-menu/user-menu.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.default.user-menu/user-menu.hbs index ee2ccdc968..7e0fac5d3e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.default.user-menu/user-menu.hbs +++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.default.user-menu/user-menu.hbs @@ -104,7 +104,7 @@