diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json
index a43bb34bce..3bb62bf46c 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/conf/config.json
@@ -1,5 +1,6 @@
{
"appContext": "/devicemgt/",
+ "isCloud": true,
"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%",
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/batch-provider-api.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/batch-provider-api.js
index 78d026bf1a..b747ae3153 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/batch-provider-api.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/batch-provider-api.js
@@ -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++) {
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js
index 56939377cf..68fa4630d7 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/modules/business-controllers/device.js
@@ -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);
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 6c152b07ee..e69c9d4184 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
@@ -127,14 +127,7 @@
User was added successfully.
An invitation mail will be sent to this user to initiate device enrollment.
- Below QR code can also be used to enroll a device.
-
Please click "Add Another User", if you wish to add another user or click
"View User List" to complete the process and go back to the user list.
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.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.cloud.user-menu/user-menu.hbs
new file mode 100644
index 0000000000..af4e2b767f
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.hbs
@@ -0,0 +1,209 @@
+{{!
+ 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.
+}}
+
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.js
new file mode 100644
index 0000000000..03d61cad53
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.js
@@ -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;
+}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.json b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.json
new file mode 100644
index 0000000000..e4e47235ef
--- /dev/null
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.cloud.user-menu/user-menu.json
@@ -0,0 +1,3 @@
+{
+ "version": "1.0.0",
+}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.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
similarity index 100%
rename from components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/public/js/user-menu.js
rename to 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
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
new file mode 100644
index 0000000000..8bc7d0b35b
--- /dev/null
+++ 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
@@ -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.
+}}
+
+
+
+{{#zone "bottomJs"}}
+ {{js "/js/user-menu.js"}}
+{{/zone}}
\ No newline at end of file
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.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/user-menu.js
new file mode 100644
index 0000000000..03d61cad53
--- /dev/null
+++ 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.js
@@ -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;
+}
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.json 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.json
new file mode 100644
index 0000000000..e4e47235ef
--- /dev/null
+++ 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.json
@@ -0,0 +1,3 @@
+{
+ "version": "1.0.0",
+}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.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.user-menu/user-menu.hbs
index 95d7264473..bd55f2a00d 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.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.user-menu/user-menu.hbs
@@ -15,110 +15,11 @@
specific language governing permissions and limitations
under the License.
}}
-{{#zone "userMenu"}}
-
-{{/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}}
\ No newline at end of file
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/user-menu.js b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/user-menu.js
index 03d61cad53..e63ad073c3 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/user-menu.js
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/devicemgt/app/units/cdmf.unit.ui.header.user-menu/user-menu.js
@@ -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;
}
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.hbs b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.hbs
index fe6c030d27..af3e248189 100644
--- a/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.hbs
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.ui/src/main/resources/jaggeryapps/uuf-template-app/app/units/uuf.unit.header/header.hbs
@@ -21,6 +21,9 @@
{{defineZone "brand"}}
+
+ {{defineZone "cloudMenu"}}
+
{{defineZone "userMenu"}}