Merge pull request #716 from rasika/analytics-url

Enabling Statics URL
4.x.x
Harshan Liyanage 8 years ago committed by GitHub
commit 7744ee2aea

@ -519,7 +519,7 @@
{{/zone}} {{/zone}}
{{#zone "bottomJs"}} {{#zone "bottomJs"}}
<script id="device-listing" data-current-user="{{@user.username}}" data-device-types="{{deviceTypes}}" <script id="device-listing" data-analitics-url="{{analiticsURL}}" data-current-user="{{@user.username}}" data-device-types="{{deviceTypes}}"
type="text/x-handlebars-template"></script> type="text/x-handlebars-template"></script>
{{js "js/listing.js"}} {{js "js/listing.js"}}
{{/zone}} {{/zone}}

@ -78,5 +78,12 @@ function onRequest(context) {
viewModel.deviceTypes = stringify(deviceTypes); viewModel.deviceTypes = stringify(deviceTypes);
} }
} }
var mdmProps = require("/app/modules/conf-reader/main.js")["conf"];
var cUser = userModule.getUser();
var analiticsServer = mdmProps["dashboardServerURL"];
var analiticsURL = analiticsServer + "/portal/t/" + cUser.userDomain + "/dashboards/android-iot/battery?owner=" + cUser.username + "&deviceId=";
viewModel.analiticsURL = analiticsURL;
return viewModel; return viewModel;
} }

@ -323,11 +323,14 @@ function loadDevices(searchType, searchParam) {
var deviceType = row.deviceType; var deviceType = row.deviceType;
var deviceIdentifier = row.deviceIdentifier; var deviceIdentifier = row.deviceIdentifier;
var html = '<span></span>'; var html = '<span></span>';
var statURL = $("#device-listing").data("analitics-url");
if (status != 'REMOVED') { if (status != 'REMOVED') {
html = ''; html = '';
if (analyticsEnabled(row.deviceType)) { if (analyticsEnabled(row.deviceType)) {
html += '<a href="' + context + '/device/' + deviceType + '/analytics?deviceId=' +
html += '<a href="' + statURL +
deviceIdentifier + '&deviceName=' + row.name + '" ' + 'data-click-event="remove-form"' + deviceIdentifier + '&deviceName=' + row.name + '" ' + 'data-click-event="remove-form"' +
' class="btn padding-reduce-on-grid-view" data-placement="top" data-toggle="tooltip" data-original-title="Analytics"><span class="fw-stack">' + ' class="btn padding-reduce-on-grid-view" data-placement="top" data-toggle="tooltip" data-original-title="Analytics"><span class="fw-stack">' +
'<i class="fw fw-circle-outline fw-stack-2x"></i><i class="fw fw-statistics fw-stack-1x"></i></span>' + '<i class="fw fw-circle-outline fw-stack-2x"></i><i class="fw fw-statistics fw-stack-1x"></i></span>' +

Loading…
Cancel
Save