Fixing connected-cup issues.

merge-requests/1/head
thisaripatabendi 8 years ago
parent 93f5ed77f0
commit 67a6eb0db4

@ -1,3 +1,21 @@
{{!
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.
}}
{{#zone "topCss"}}
<style>
.thumbnail.icon:before {
@ -7,19 +25,43 @@
{{/zone}}
{{#zone "device-thumbnail"}}
<img src="{{@unit.publicUri}}/images/thumb.png"/>
<img src="{{@unit.publicUri}}/images/thumb.png" class="img-responsive"/>
{{/zone}}
{{#zone "device-opetations"}}
<div style="background: #11375B; color: #fff; padding: 10px; margin-bottom: 5px">
Operations
</div>
{{#zone "device-details-header"}}
<h1 class="device-id"
data-deviceid="{{device.deviceIdentifier}}"
data-type="{{device.type}}"
data-ownership="{{device.ownership}}"
data-owner="{{device.owner}}">
{{device.enrolmentInfo.owner}}'s {{device.name}}
<a id="device-info-tooltip" href="#" data-toggle="tooltip" title="Device Identifier: {{device.deviceIdentifier}}">
<i class="fw fw-info"></i>
</a>
</h1>
<h4>Ownership - <strong>{{device.enrolmentInfo.ownership}}</strong></h4>
<h4>Device is
<strong>
{{#equal device.enrolmentInfo.status "ACTIVE"}}Active{{/equal}}
{{#equal device.enrolmentInfo.status "INACTIVE"}}Inactive{{/equal}}
{{#equal device.enrolmentInfo.status "BLOCKED"}}Blocked{{/equal}}
{{#equal device.enrolmentInfo.status "REMOVED"}}Removed{{/equal}}
{{#equal device.enrolmentInfo.status "UNREACHABLE"}}Unreachable{{/equal}}
</strong>
</h4>
{{/zone}}
<div class="add-margin-top-4x">
<div class="add-margin-top-4x">
<div class="buttons">
<a class="btn-operations" target="_blank" href="{{../device.ip}}/connected-cup-agent/index.jsp?deviceOwner={{@user.username}}&tenantDomain={{@user.domain}}&deviceId={{../device.deviceIdentifier}}&token={{../device.accessToken}}" >Go To Device</a>
</div>
{{#zone "device-opetations"}}
<div class="operation-container">
<div class="operation-title">
<h4>Device Operations</h4>
</div>
<div class="buttons">
<a class="btn-operations" target="_blank"
href="{{../device.ip}}/connected-cup-agent/index.jsp?deviceOwner={{@user.username}}&tenantDomain={{@user.domain}}&deviceId={{../device.deviceIdentifier}}&token={{../device.accessToken}}" >
Go To Device
</a>
</div>
</div>
{{/zone}}
@ -27,10 +69,8 @@
{{#zone "device-view-tabs"}}
<li class="active"><a class="list-group-item" href="#device_statistics" role="tab"
data-toggle="tab" aria-controls="device_statistics">Device
Statistics</a>
Statistics</a>
</li>
<li><a class="list-group-item" href="#event_log" role="tab" data-toggle="tab"
aria-controls="event_log">Operations Log</a></li>
{{/zone}}
{{#zone "device-view-tab-contents"}}
@ -41,27 +81,4 @@
{{unit "cdmf.unit.device.type.connectedcup.realtime.analytics-view" device=device}}
</div>
<div class="panel panel-default tab-pane" id="event_log" role="tabpanel"
aria-labelledby="event_log">
<div class="panel-heading">Operations Log <span><a href="#"
id="refresh-operations"><i
class="fw fw-refresh"></i></a></span></div>
<div class="panel-body">
<div id="operations-spinner" class="wr-advance-operations-init hidden">
<br>
<i class="fw fw-settings fw-spin fw-2x"></i>
Loading Operations Log . . .
<br>
<br>
</div>
<div id="operations-log-container">
<div class="panel-body">
Not available yet
</div>
<br class="c-both"/>
</div>
</div>
</div>
{{/zone}}

@ -36,7 +36,7 @@ function onRequest(context) {
token = tokenPair.accessToken;
}
websocketEndpoint = websocketEndpoint + "/secured-websocket/org.wso2.iot.devices.temperature/1.0.0?"
+ "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type;
+ "deviceId=" + device.deviceIdentifier + "&deviceType=" + device.type+ "&websocketToken=" + token;
var websocketToken= {'name':'websocket-token','value': token, 'path':'/', "maxAge":18000};
response.addCookie(websocketToken);
}

@ -138,7 +138,7 @@ function doAction(data) {
window.location = '/devicemgt/login';
});
showPopup();
} else if (data == 403) {
} else if (data.status == 403) {
$(modalPopupContent).html($('#device-403-content').html());
$('#device-403-link').click(function () {
window.location = '/devicemgt/login';

Loading…
Cancel
Save