From d86ef7c99618b929fc6cfc54bde59df9a9cabee9 Mon Sep 17 00:00:00 2001 From: lasantha Date: Wed, 28 Jun 2017 07:46:01 +0530 Subject: [PATCH] Improving Android Sense UI --- .../analytics-view.hbs | 13 +++++++---- .../public/js/device-stats.js | 23 +++++++++++++++---- .../private/config.json | 3 ++- 3 files changed, 30 insertions(+), 9 deletions(-) diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.hbs b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.hbs index 10709fb9e..1c2c2dd69 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.hbs +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/analytics-view.hbs @@ -41,10 +41,15 @@ - - - - + + + + + + + + + diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/device-stats.js b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/device-stats.js index 9ad8614dd..8ef8638ad 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/device-stats.js +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.realtime.analytics-view/public/js/device-stats.js @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * Copyright (c) 2017, 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 @@ -78,6 +78,8 @@ var graphMap = {}; var palette = new Rickshaw.Color.Palette({scheme: "munin"}); +var elemTop; + $(window).load(function () { graphMap["battery"]=lineGraph("battery", batteryData); @@ -321,7 +323,7 @@ function maximizeGraph(graph, width,height){ height: height*2 }); - graph.render(); + graph.update(); } function minimizeGraph(graph){ @@ -329,7 +331,7 @@ function minimizeGraph(graph){ width: 366, height: 300 }); - graph.render(); + graph.update(); } //maximize minimize functionality @@ -339,17 +341,30 @@ $(".fw-expand").click(function(e) { var height = $(".chartWrapper").height(); if($(this).hasClass("default-view")){ + elemTop = $('#'+innerGraph.element.id).parents('.graph')[0].offsetTop; $(this).removeClass("default-view"); + $(this).removeClass("fw-expand"); + $(this).addClass("fw-contract"); maximizeGraph(innerGraph,width,height); $(this).parent().parent().addClass("max"); $(this).closest(".graph").siblings().addClass("max_hide"); $(this).closest(".graph").parent().siblings().addClass("max_hide"); }else{ - $(this).addClass("default-view"); + $(this).addClass("fw-expand"); + $(this).removeClass("fw-contract"); minimizeGraph(innerGraph); $(this).parent().parent().removeClass("max"); $(this).closest(".graph").siblings().removeClass("max_hide"); $(this).closest(".graph").parent().siblings().removeClass("max_hide"); + focusToArea() } }); + +//graph focusing function +function focusToArea(){ + var container = $("body"); + container.animate({ + scrollTop: elemTop + }); +} diff --git a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/private/config.json b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/private/config.json index 16a8963c8..30829092a 100644 --- a/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/private/config.json +++ b/components/device-types/androidsense-plugin/org.wso2.carbon.device.mgt.iot.androidsense.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.device.type.android_sense.type-view/private/config.json @@ -5,6 +5,7 @@ "scopes" : [ "perm:android-sense:enroll" ], - "analyticsView" : "DAS" + "analyticsView" : "DAS", + "analyticsEnabled": false } } \ No newline at end of file