From 90402107f6e3f93f44e39566ba0b62dbbba174c5 Mon Sep 17 00:00:00 2001 From: Dulitha Wijewantha Date: Thu, 22 Jan 2015 15:51:09 +0530 Subject: [PATCH] Included the UI improvements to cdm jaggery app. Included the sso jaggery module dependency. --- pom.xml | 1 + .../jaggeryapps/cdm/api/mobile/device-api.jag | 38 ++++++++++ .../src/repository/jaggeryapps/cdm/init.js | 33 ++++++++- .../repository/jaggeryapps/cdm/jaggery.conf | 10 ++- .../jaggeryapps/cdm/modules/utility.js | 32 +++++++++ .../jaggeryapps/cdm/pages/dashboard.jag | 69 ++++++++++++++----- .../jaggeryapps/cdm/pages/device.jag | 19 ++++- product/modules/p2-profile-gen/pom.xml | 7 ++ 8 files changed, 187 insertions(+), 22 deletions(-) create mode 100644 product/modules/distribution/src/repository/jaggeryapps/cdm/api/mobile/device-api.jag create mode 100644 product/modules/distribution/src/repository/jaggeryapps/cdm/modules/utility.js diff --git a/pom.xml b/pom.xml index 322c9df85..114eda3ab 100644 --- a/pom.xml +++ b/pom.xml @@ -227,6 +227,7 @@ 1.1.0 1.0.0 1.0.0 + 1.1.0-SNAPSHOT 1.1.0 4.3.1 diff --git a/product/modules/distribution/src/repository/jaggeryapps/cdm/api/mobile/device-api.jag b/product/modules/distribution/src/repository/jaggeryapps/cdm/api/mobile/device-api.jag new file mode 100644 index 000000000..10f37dc40 --- /dev/null +++ b/product/modules/distribution/src/repository/jaggeryapps/cdm/api/mobile/device-api.jag @@ -0,0 +1,38 @@ +<% +/* + * 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. + */ +var utility = require("/modules/utility.js"); +var deviceManagementService = utility.getDeviceManagementService(); +var devices = deviceManagementService.getAllDevices("android"); +var logger = new Log(); +var deviceList = []; +for (i = 0; i < devices.size(); i++) { + var device = devices.get(i); + deviceList.push({ + "identifier": device.getDeviceIdentifier(), + "name": device.getName(), + "ownership": device.getOwnership(), + "owner": device.getOwner(), + "deviceType": device.getType(), + "vendor": device.getProperties().get("vendor"), + "model": device.getProperties().get("model"), + "osVersion": device.getProperties().get("osVersion") + }); +} +print(deviceList); +%> \ No newline at end of file diff --git a/product/modules/distribution/src/repository/jaggeryapps/cdm/init.js b/product/modules/distribution/src/repository/jaggeryapps/cdm/init.js index 27d9cf25c..859dd1037 100644 --- a/product/modules/distribution/src/repository/jaggeryapps/cdm/init.js +++ b/product/modules/distribution/src/repository/jaggeryapps/cdm/init.js @@ -1 +1,32 @@ -//Init js to execute \ No newline at end of file +/* + * 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. + */ +//Init js to execute +var logger = new Log(); +logger.debug("running debug"); +var app_TENANT_CONFIGS = 'tenant.configs'; +var app_carbon = require('carbon'); +var app_configs = { + "HTTPS_URL": "https://localhost:9443" +}; + +var app_server = new app_carbon.server.Server({ + tenanted: app_configs.tenanted, + url: app_configs.HTTPS_URL + '/admin' +}); +application.put("SERVER", app_server); +application.put(app_TENANT_CONFIGS, {}); diff --git a/product/modules/distribution/src/repository/jaggeryapps/cdm/jaggery.conf b/product/modules/distribution/src/repository/jaggeryapps/cdm/jaggery.conf index 3012d6082..efc8b1257 100644 --- a/product/modules/distribution/src/repository/jaggeryapps/cdm/jaggery.conf +++ b/product/modules/distribution/src/repository/jaggeryapps/cdm/jaggery.conf @@ -1,6 +1,6 @@ { "welcomeFiles": ["pages/dashboard.jag"], - "initScripts": ["init.js"], + "initScripts": ["/init.js"], "urlMappings": [ { "url": "/devices/*", @@ -9,12 +9,16 @@ { "url": "/dashboard", "path": "/pages/dashboard.jag" + }, + { + "url": "/api/devices/mobile/*", + "path": "/api/mobile/device-api.jag" } ], "errorPages": { "500": "/error500.jag", "404": "/error404.jag", - "403": "/error403.jag" + "403": "/error403.jag " }, - "logLevel": "info" + "logLevel": "debug" } \ No newline at end of file diff --git a/product/modules/distribution/src/repository/jaggeryapps/cdm/modules/utility.js b/product/modules/distribution/src/repository/jaggeryapps/cdm/modules/utility.js new file mode 100644 index 000000000..47b8862bf --- /dev/null +++ b/product/modules/distribution/src/repository/jaggeryapps/cdm/modules/utility.js @@ -0,0 +1,32 @@ +/* + * 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. + */ + +//temporary + +var PrivilegedCarbonContext = Packages.org.wso2.carbon.context.PrivilegedCarbonContext, + Class = java.lang.Class; + +osgiService = function (clazz) { + return PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(Class.forName(clazz)); +}; +var getDeviceManagementService= function(){ + //server.authenticate("admin", "admin"); + var realmService = osgiService('org.wso2.carbon.device.mgt.core.service.DeviceManagementService'); + //var realmService = null; + return realmService; +} diff --git a/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/dashboard.jag b/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/dashboard.jag index 35d2f255b..46c5cd3da 100644 --- a/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/dashboard.jag +++ b/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/dashboard.jag @@ -1,5 +1,22 @@ -<% +<% +/* + * 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. + */ var title="WSO2 CDM"; %> @@ -14,25 +31,43 @@ var title="WSO2 CDM";

Devices list

+ +
+ + + + + +
+
+
+ + + + + + + + + + + + + + +
IdentifierNameOwnerOwnershipDevice TypeVendorModelOS Version
+
+
+
sdfweroiweuroi
+
+
diff --git a/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/device.jag b/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/device.jag index e4930c190..3005b915c 100644 --- a/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/device.jag +++ b/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/device.jag @@ -1,5 +1,22 @@ -<% +<% +/* + * 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. + */ var title="WSO2 CDM"; %> diff --git a/product/modules/p2-profile-gen/pom.xml b/product/modules/p2-profile-gen/pom.xml index d221a0402..37962ada8 100644 --- a/product/modules/p2-profile-gen/pom.xml +++ b/product/modules/p2-profile-gen/pom.xml @@ -127,6 +127,9 @@ org.jaggeryjs.modules:uuid.feature:${uuid.feature.version} + + org.jaggeryjs.modules:sso.feature:${sso.feature.version} + org.jaggeryjs.modules:jaggery-test.feature:${jaggery-test.feature.version} @@ -281,6 +284,10 @@ org.jaggeryjs.modules.uuid.feature.group ${uuid.feature.version} + + org.jaggeryjs.modules.sso.feature.group + ${sso.feature.version} + org.jaggeryjs.modules.jaggery-test.feature.group ${jaggery-test.feature.version}