Merge pull request #583 from Kamidu/master

cloud ui and enable location without das
revert-70aa11f8
Kamidu Sachith Punchihewa 8 years ago committed by GitHub
commit 5f8f4a82d1

@ -1,5 +1,6 @@
{
"appContext": "/devicemgt/",
"isCloud": false,
"httpsURL" : "https://%iot.gateway.host%:%iot.gateway.https.port%",
"httpURL" : "http://%iot.gateway.host%:%iot.gateway.http.port",
"wssURL" : "https://%iot.analytics.host%:%iot.analytics.https.port%",

@ -125,6 +125,13 @@ batchProviders = function () {
result = connector.getRecordsByRange(loggedInUser, tablename, from, to, 0, limit, null).getMessage();
}
// error handling ----
var resultString = result.toString();
if (resultString.contains("Failed to get records from table")) {
return null;
}
result = JSON.parse(result);
var data = [];
for (var i = 0; i < result.length; i++) {

@ -71,7 +71,7 @@ deviceModule = function () {
var userName = carbonUser.username + "@" + carbonUser.domain;
var locationDataSet = [];
switch(deviceType) {
switch (deviceType) {
case 'android':
locationDataSet = batchProvider.getData(userName, deviceId, deviceType);
break;
@ -80,24 +80,24 @@ deviceModule = function () {
break;
}
var locationData = [];
var locationTimeData = [];
for (var i = 0 ; i < locationDataSet.length; i++) {
var gpsReading = {};
var gpsReadingTimes = {};
gpsReading.lat = locationDataSet[i].latitude;
gpsReading.lng = locationDataSet[i].longitude;
if (deviceType == "android") {
gpsReadingTimes.time = locationDataSet[i].timeStamp;
} else {
gpsReadingTimes.time = locationDataSet[i].meta_timestamp;
if (locationDataSet != null) {
for (var i = 0; i < locationDataSet.length; i++) {
var gpsReading = {};
var gpsReadingTimes = {};
gpsReading.lat = locationDataSet[i].latitude;
gpsReading.lng = locationDataSet[i].longitude;
if (deviceType == "android") {
gpsReadingTimes.time = locationDataSet[i].timeStamp;
} else {
gpsReadingTimes.time = locationDataSet[i].meta_timestamp;
}
locationData.push(gpsReading);
locationTimeData.push(gpsReadingTimes);
}
locationData.push(gpsReading);
locationTimeData.push(gpsReadingTimes);
}
var utility = require('/app/modules/utility.js')["utility"];
try {
utility.startTenantFlow(carbonUser);

@ -127,14 +127,7 @@
<p class="page-sub-title">User was added successfully.</p>
<p>
An invitation mail will be sent to this user to initiate device enrollment.
Below QR code can also be used to enroll a device.
</p>
<div class="panel panel-default">
<div id="qr-code-modal" class="hidden" data-enrollment-url="{{enrollmentURL}}"></div>
<div class="panel-body">
<div class="qr-code col-lg-5 col-md-6 col-centered"></div>
</div>
</div>
<br>Please click <b>"Add Another User"</b>, if you wish to add another user or click
<b>"View User List"</b> to complete the process and go back to the user list.

@ -0,0 +1,219 @@
{{!
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.
}}
<ul class="nav navbar-right float-remove-xs text-center-xs">
<li class="visible-inline-block">
<a href="#" target="_self" title="kachiex">
<span class="icon fw-stack fw-lg">
<i class="fw fw-organization fw-stack-1x" title=" {{@user.domain}}"></i>
</span>
<span class="hidden-xs">
{{@user.domain}}
</span>
</a>
</li>
<li class="visible-inline-block">
<a href="#" target="_blank" class="dropdown" data-toggle="dropdown" title="Account">
<span class="icon fw-stack fw-lg" style="color: red">
<i class="fw fw-resource fw-stack-1x" title="Account"></i>
</span>
<span class="hidden-xs" style="color: red">
Trial 14 days to upgrade
</span>
<span class="caret"></span>
</a>
<ul class="dropdown-menu dropdown-menu-right float-remove-xs position-static-xs text-center-xs remove-margin-xs slideInDown"
role="menu">
<li>
<a title="Upgrade Now"
href="https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/payment-plans.jag?cloud-type=device_cloud"
target="_self">
<i class="fw fw-export" title="Upgrade Now"></i> Upgrade Now
</a>
</li>
<li>
<a title="Monetization"
href="https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/monetization-dashboard.jag"
target="_self">
<i class="fa fa-money fa-lg" title="Monetization"></i> Monetization
</a>
</li>
<li>
<a title="Request Extension"
href="https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/contact-us.jag?cloud-type=device_cloud&amp;request-extension=true"
target="_blank">
<i class="fw fw-mail" title="Request Extension"></i> Request Extension
</a>
</li>
</ul>
</li>
<li class="visible-inline-block">
<a href="#" target="null" class="dropdown" data-toggle="dropdown" title="Configure">
<span class="icon fw-stack fw-lg">
<i class="fw fw-settings fw-stack-1x" title="Configure"></i>
</span>
<span class="hidden-xs">
Configure
</span>
<span class="caret"></span>
</a>
<ul class="dropdown-menu dropdown-menu-right float-remove-xs position-static-xs text-center-xs remove-margin-xs slideInDown"
role="menu">
</ul>
</li>
<li class="visible-inline-block">
<a href="https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/contact-us.jag" target="_self" title="Support">
<span class="icon fw-stack fw-lg" style="color: #ff8c27;">
<i class="fw fw-mail fw-stack-1x" title="Support"></i>
</span>
<span class="hidden-xs" style="color: #ff8c27;">
Support
</span>
</a>
</li>
<li class="visible-inline-block">
<a href="#" target="null" class="dropdown" data-toggle="dropdown" title="Documentation">
<span class="icon fw-stack fw-lg">
<i class="fw fw-document fw-stack-1x" title="Documentation"></i>
</span>
<span class="hidden-xs">
Documentation
</span>
<span class="caret"></span>
</a>
<ul class="dropdown-menu dropdown-menu-right float-remove-xs position-static-xs text-center-xs remove-margin-xs slideInDown"
role="menu">
<li>
<a title="API Cloud" href="https://docs.wso2.com/display/APICloud/WSO2+API+Cloud+Documentation"
target="_blank">
<i class="fw fw-api" title="API Cloud"></i> API Cloud
</a>
</li>
<li>
<a title="App Cloud" href="https://docs.wso2.com/display/AppCloud/WSO2+App+Cloud+Documentation"
target="_blank">
<i class="fw fw-application" title="App Cloud"></i> App Cloud
</a>
</li>
<li>
<a title="App Cloud" href="https://docs.wso2.com/display/AppCloud/WSO2+Device+Cloud+Documentation"
target="_blank">
<i class="fw fw-application" title="App Cloud"></i> Device Cloud
</a>
</li>
<li>
<a title="API Cloud Walkthrough" href="https://api.clouddev.wso2.com/publisher?interactiveTutorial=true"
target="_self">
<i class="fw fw-document" title="API Cloud Walkthrough"></i> API Cloud Walkthrough
</a>
</li>
</ul>
</li>
<li class="visible-inline-block">
<a title="Mobile App Publisher" href="https://devicemgt.clouddev.wso2.com/publisher" target="_self">
<i class="fw fw-user" title="Mobilr App Publisher"></i> App Publisher
</a>
</li>
<li class="visible-inline-block">
<a title="App Store " href="https://devicemgt.clouddev.wso2.com/store"
target="_self">
<i class="fw fw-store" title="App Store"></i> App Store
</a>
</li>
<li class="visible-inline-block">
<a href="#" class="dropdown" data-toggle="dropdown" title="user">
<span class="icon fw-stack fw-lg">
<i class="fw fw-circle-outline fw-stack-2x" title="User"></i>
<i class="fw fw-user fw-stack-1x" title="User"></i>
</span>
<span class="hidden-xs">
{{#if isSuperTenant }}
{{@user.username}}</span><span class="caret"></span>
{{else}}
{{@user.username}}@{{@user.domain}}</span><span class="caret"></span>
{{/if}}
</a>
<ul class="dropdown-menu dropdown-menu-right float-remove-xs position-static-xs text-center-xs remove-margin-xs slideInDown"
role="menu">
<li>
<a title="Profile" href="https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/user-profile.jag"
target="_self">
<i class="fw fw-user" title="Profile"></i> Profile
</a>
</li>
<li>
<a title="Change Password"
href="https://cloudmgt.clouddev.wso2.com/cloudmgt/site/pages/change-password.jag" target="_self">
<i class="fw fw-lock" title="Change Password"></i> Change Password
</a>
</li>
<li>
<a title="Logout" href="https://api.clouddev.wso2.com/publisher/site/pages/logout.jag" target="_self">
<i class="fw fw-sign-out" title="Logout"></i> Logout
</a>
</li>
</ul>
</li>
<li class="visible-inline-block cloud-menu">
<a href="#" id="cloud-menu-popover">
<span class="icon fw-stack fw-lg">
<i class="fw fw-tiles fw-stack-1x" data-toggle="popover" data-placement="bottom"
data-original-title="" title=""></i>
</span>
<span class="hidden-xs">
</span>
</a>
</li>
</ul>

@ -0,0 +1,30 @@
/*
* Copyright (c) 2015, 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.
*/
function onRequest(context) {
var constants = require("/app/modules/constants.js");
var user = context.user;
var isSuperTenant = false;
if (user.tenantId == -1234){
isSuperTenant = true;
}
var viewModal = {};
viewModal.isSuperTenant = isSuperTenant;
viewModal.USER_SESSION_KEY = session.get(constants["USER_SESSION_KEY"]);
return viewModal;
}

@ -0,0 +1,123 @@
{{!
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.
}}
<ul class="nav navbar-right float-remove-xs text-center-xs">
<li class="visible-inline-block">
<a href="#" class="dropdown" data-toggle="dropdown">
<i class="fw fw-user fw-lg fw-helper fw-helper-inverse fw-helper-circle"></i>
<span class="hidden-xs add-padding-left-1x">
{{#if isSuperTenant }}
{{@user.username}} "SERVER" <span class="caret"></span>
{{else}}
{{@user.username}}@{{@user.domain}} <span class="caret"></span>
{{/if}}
</span>
</a>
<ul class="dropdown-menu dropdown-menu-right slideInDown"
role="menu">
<li>
<a href="javascript:void(0)" id="change-password">Change Password</a>
</li>
<li>
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/logout">Sign out</a>
</li>
<div id="change-password-window" class="hide">
<input type="hidden" id="user" value=" {{@user.username}} ">
<div class="modal-header">
<h4 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-user fw-stack-2x"></i>
<span class="fw-stack fw-move-right fw-move-bottom">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-circle fw-stack-2x fw-stroke text-info"></i>
<i class="fw fw-edit fw-stack-1x fw-inverse"></i>
</span>
</span>
Change password is not a option
</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i
class="fw fw-cancel"></i></button>
</div>
<hr>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<div id="change-password-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<h5>
Type your current password *
<br><br>
<div>
<input id="current-password" type="password" autocomplete="off" class="form-control modal-input"/>
</div>
<br><br>
Type a new password *
<br><br>
<div>
<input id="new-password" type="password" autocomplete="off" class="form-control modal-input"
placeholder="[ Password should be in minimum 5 characters long and should not include any whitespaces ]"/>
</div>
<br><br>
Reconfirm your new password *
<br><br>
<div>
<input id="retyped-new-password" type="password" autocomplete="off" class="form-control modal-input"/>
</div>
<br><br>
</h5>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="change-password-yes-link" class="btn-operations">Change</a>
<a href="#" id="change-password-cancel-link" class="btn-operations">Cancel</a>
</div>
</div>
</div>
<div id="change-password-success-content" class="hide">
<div class="modal-header">
<h4 class="pull-left modal-title">
<span class="fw-stack fw-move-right fw-move-bottom">
<i class="fw fw-circle fw-stack-2x fw-stroke text-success"></i>
<i class="fw fw-check fw-stack-1x fw-inverse"></i>
</span>
Password has been successfully updated
</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i
class="fw fw-cancel"></i></button>
</div>
<hr>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h5 class="text-center">
You can now try to login using your new password.
</h5>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="change-password-success-link" class="btn-operations">Ok</a>
</div>
</div>
</div>
</ul>
</li>
</ul>
{{#zone "bottomJs"}}
{{js "/js/user-menu.js"}}
{{/zone}}

@ -0,0 +1,30 @@
/*
* Copyright (c) 2015, 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.
*/
function onRequest(context) {
var constants = require("/app/modules/constants.js");
var user = context.user;
var isSuperTenant = false;
if (user.tenantId == -1234){
isSuperTenant = true;
}
var viewModal = {};
viewModal.isSuperTenant = isSuperTenant;
viewModal.USER_SESSION_KEY = session.get(constants["USER_SESSION_KEY"]);
return viewModal;
}

@ -15,110 +15,11 @@
specific language governing permissions and limitations
under the License.
}}
{{#zone "userMenu"}}
<ul class="nav navbar-right float-remove-xs text-center-xs">
<li class="visible-inline-block">
<a href="#" class="dropdown" data-toggle="dropdown">
<i class="fw fw-user fw-lg fw-helper fw-helper-inverse fw-helper-circle"></i>
<span class="hidden-xs add-padding-left-1x">
{{#if isSuperTenant }}
{{@user.username}}<span class="caret"></span>
{{else}}
{{@user.username}}@{{@user.domain}}<span class="caret"></span>
{{/if}}
</span>
</a>
<ul class="dropdown-menu dropdown-menu-right slideInDown"
role="menu">
<li>
<a href="javascript:void(0)" id="change-password">Change password</a>
</li>
<li>
<!--suppress HtmlUnknownTarget -->
<a href="{{@app.context}}/logout">Sign out</a>
</li>
<div id="change-password-window" class="hide">
<input type="hidden" id="user" value="{{@user.username}}">
<div class="modal-header">
<h4 class="pull-left modal-title">
<span class="fw-stack">
<i class="fw fw-user fw-stack-2x"></i>
<span class="fw-stack fw-move-right fw-move-bottom">
<i class="fw fw-circle-outline fw-stack-2x"></i>
<i class="fw fw-circle fw-stack-2x fw-stroke text-info"></i>
<i class="fw fw-edit fw-stack-1x fw-inverse"></i>
</span>
</span>
Change password
</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i
class="fw fw-cancel"></i></button>
</div>
<hr>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<div id="change-password-error-msg" class="alert alert-danger hidden" role="alert">
<i class="icon fw fw-error"></i><span></span>
</div>
<h5>
Type your current password *
<br><br>
<div>
<input id="current-password" type="password" autocomplete="off" class="form-control modal-input"/>
</div>
<br><br>
Type a new password *
<br><br>
<div>
<input id="new-password" type="password" autocomplete="off" class="form-control modal-input"
placeholder="[ Password should be in minimum 5 characters long and should not include any whitespaces ]"/>
</div>
<br><br>
Reconfirm your new password *
<br><br>
<div>
<input id="retyped-new-password" type="password" autocomplete="off" class="form-control modal-input"/>
</div>
<br><br>
</h5>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="change-password-yes-link" class="btn-operations">Change</a>
<a href="#" id="change-password-cancel-link" class="btn-operations">Cancel</a>
</div>
</div>
</div>
<div id="change-password-success-content" class="hide">
<div class="modal-header">
<h4 class="pull-left modal-title">
<span class="fw-stack fw-move-right fw-move-bottom">
<i class="fw fw-circle fw-stack-2x fw-stroke text-success"></i>
<i class="fw fw-check fw-stack-1x fw-inverse"></i>
</span>
Password has been successfully updated
</h4>
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i
class="fw fw-cancel"></i></button>
</div>
<hr>
<div class="modal-body add-margin-top-2x add-margin-bottom-2x">
<h5 class="text-center">
You can now try to login using your new password.
</h5>
</div>
<div class="modal-footer">
<div class="buttons">
<a href="#" id="change-password-success-link" class="btn-operations">Ok</a>
</div>
</div>
</div>
</ul>
</li>
</ul>
{{/zone}}
{{#zone "bottomJs"}}
{{js "/js/user-menu.js"}}
{{#zone "userMenu"}}
{{#if isCloud}}
{{unit "cdmf.unit.ui.header.cloud.user-menu"}}
{{else}}
{{unit "cdmf.unit.ui.header.default.user-menu"}}
{{/if}}
{{/zone}}

@ -17,14 +17,8 @@
*/
function onRequest(context) {
var constants = require("/app/modules/constants.js");
var user = context.user;
var isSuperTenant = false;
if (user.tenantId == -1234){
isSuperTenant = true;
}
var mdmProps = require("/app/modules/conf-reader/main.js")["conf"];
var viewModal = {};
viewModal.isSuperTenant = isSuperTenant;
viewModal.USER_SESSION_KEY = session.get(constants["USER_SESSION_KEY"]);
viewModal.isCloud = mdmProps["isCloud"];
return viewModal;
}

@ -6517,7 +6517,7 @@ select > option:hover {
}
.header .fw:before {
color: #000;
}
/* Adding style for required fields */

@ -21,6 +21,9 @@
<div class="pull-left brand">
{{defineZone "brand"}}
</div>
<div class="pull-left brand">
{{defineZone "cloudMenu"}}
</div>
<div class="pull-right auth">
{{defineZone "userMenu"}}
</div>

Loading…
Cancel
Save