diff --git a/modules/core/distribution/src/assembly/bin.xml b/modules/core/distribution/src/assembly/bin.xml index 78690354..6e524874 100644 --- a/modules/core/distribution/src/assembly/bin.xml +++ b/modules/core/distribution/src/assembly/bin.xml @@ -1456,5 +1456,31 @@ 755 + + + src/repository/cloud/portal/common.css + + ${pom.artifactId}-${pom.version}/repository/deployment/server/jaggeryapps/portal/css + + + + + + src/repository/cloud/portal/portal.js + + ${pom.artifactId}-${pom.version}/repository/deployment/server/jaggeryapps/portal/js + + + + + + src/repository/cloud/portal/global-navigation.jag + + ${pom.artifactId}-${pom.version}/repository/deployment/server/jaggeryapps/portal/theme/templates + + + + + diff --git a/modules/core/distribution/src/repository/cloud/portal/common.css b/modules/core/distribution/src/repository/cloud/portal/common.css new file mode 100644 index 00000000..091a6501 --- /dev/null +++ b/modules/core/distribution/src/repository/cloud/portal/common.css @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed 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. + */ + +.truncate { + white-space: nowrap; + overflow: hidden; + text-overflow: ellipsis; +} + +/** + * Validation messages + */ +.required { + color: #e74c3c; +} + +.required-error { + background: #a94442; + border: 1px solid #a94442; + padding: 6px 12px; + color: #fff; +} + +/** + * Theme overrides + */ +.breadcrumb li .fw-home { + float: left; + padding-top: 2px; + margin-right: 5px; +} + +/** + * Auth menu + */ +.auth .hidden-xs { + line-height: 38px; +} + +.auth-xs { + color: #fff; +} + +.auth-xs ul { + list-style: none; + padding: 0; + margin: 0; + line-height: 28px; + background-color: #2a80b9; +} + +.auth-xs li { + color: #ccc; +} + +.auth-xs li a { + display: block; + color: #fff; +} + +.auth-xs li a:hover { + background-color: #499dd5; +} + +ul.dropdown-menu.more-actions-button { + list-style-type: none; + margin: 0; + padding: 0; + overflow: hidden; + width: 40px; + background: #F9F9F9; + border-bottom: 1px solid #EFEFEF; + min-width: 45px; + +} + +ul.dropdown-menu.more-actions-button > li { + height: 40px; + width: 40px; + border: 1px; +} + +ul.dropdown-menu.more-actions-button > li > button { + border-bottom: 1px solid #e4e4e4; + border-top: 1px solid darkred; +} + +.btn-group.open .dropdown-toggle { + -webkit-box-shadow: none; + box-shadow: none; + border: 0px; +} + +.btn-custom { + border-width: 1px; +} + + +.cloud-menu .popover { + border-radius: 0px; + width: 24em; + left: -21.1em !important; + max-width: 32em; + background-color: #006690 +} +.cloud-menu .popover-title,.navbar-header .popover-title { + background-color: #006690; + font-size: 16px; + border-bottom: none; + font-weight: 400; +} +.cloud-menu .popover.bottom>.arrow{ + margin-left:-2px; +} +.cloud-menu .popover.bottom>.arrow:after,.navbar-header .popover.bottom>.arrow:after{ + border-bottom-color: #006690; +} +.cloud-block { + float: left; + width: 8.2em; + height: 8.2em; + background-color: #fff; + margin: 0.5em 0em 0.5em 0.5em; + text-align: center; + vertical-align: middle; +} +.cloud-name { + font-size:14px; + margin-top: .5em; + font-weight: 400; +} +.cloud-menu-popover { + position: relative; + float: right; + padding: 0px 8px; + background-color: transparent; + background-image: none; + border: 1px solid transparent; + border-radius: 4px; + color: #fff; + cursor: pointer; +} +#cloud-menu-popover-xs { + color: #fff; + line-height:24px; + border: none; + margin-right: 15px!important; +} +.navbar-toggle{ + border:none; + border-radius: 0px; +} +.navbar-header .popover { + border-radius: 0px; + width: 21em; + max-width:32em; + background-color: #006690; +} +.navbar-header .popover .popover-content{ + padding:0px; +} +.cloud-menu .popover-content { + padding: 0px; +} +.cloud-actions { + background-color: #005578; + float: left; + position: absolute; + width: 100%; + left: 0px; + overflow:hidden; +} +.cloud-actions h3 { + font-size: 16px; + font-weight: 400; + padding-left: 14px; + margin-top: 10px; +} +.cloud-block-invert { + color: #fff; + float: left; + width: 8.2em; + height: 8.2em; + background-color: #1f1f1f; + margin: 0.5em 0em 0.5em 0.5em; + text-align: center; + cursor: pointer; +} + +.cloud-block-default { + color: #006690; + background-color: #fff; + cursor: pointer; +} +.cloud-actions a:hover { + color: #d7d5d5; + background-color: #3d3d3d; + text-decoration: none +} +.cloud-apps a { + text-decoration: none; + color: #006690 !important; + cursor: pointer +} +.cloud-apps a:hover { + text-decoration: none; + color: #006690; + background-color: #c5c5c5; +} +.cloud-apps .cloud-actions a { + color: #fff +} + +.add-padding-top-3x { + padding-top: 15px !important; +} + +.nav li a{ + color: #fff; +} + +.cloud-menu-content li a{ + color:inherit; +} + +html{ + height: 100%; +} + +body{ + height: calc(100% - 50px); +} \ No newline at end of file diff --git a/modules/core/distribution/src/repository/cloud/portal/global-navigation.jag b/modules/core/distribution/src/repository/cloud/portal/global-navigation.jag new file mode 100644 index 00000000..e4f22cc2 --- /dev/null +++ b/modules/core/distribution/src/repository/cloud/portal/global-navigation.jag @@ -0,0 +1,289 @@ +<% +/* + * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed 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 query = request.getQueryString(); +var dest = encodeURIComponent(originalURI + (query ? '?' + query : '')); +%> +
+
+ + + <% } else { %> + + <%= i18n.localize("login.label")%> + + <% } %> +
+ + +
+
Navigate to Cloud
+ +
+ + + + +
diff --git a/modules/core/distribution/src/repository/cloud/portal/portal.js b/modules/core/distribution/src/repository/cloud/portal/portal.js new file mode 100644 index 00000000..0a7386a1 --- /dev/null +++ b/modules/core/distribution/src/repository/cloud/portal/portal.js @@ -0,0 +1,204 @@ +/* + * Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed 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 () { + + var dashboardsApi = ues.utils.tenantPrefix() + 'apis/dashboards'; + var dashboards = []; + var isStillLoading = false; + var nextStart = 0; + var hasMore = true; + + /** + * Page count. + * @const + */ + var PAGE_COUNT = 10; + + // Pre-compiling handlebar templates + var dashboardsListHbs = Handlebars.compile($("#ues-dashboards-list-hbs").html()); + var dashboardThumbnailHbs = Handlebars.compile($("#ues-dashboard-thumbnail-hbs").html()); + var dashboardConfirmHbs = Handlebars.compile($("#ues-dashboard-confirm-hbs").html()); + var dashboardsEmptyHbs = Handlebars.compile($("#ues-dashboards-empty-hbs").html()); + Handlebars.registerPartial('ues-dashboard-thumbnail-hbs', dashboardThumbnailHbs); + + /** + * Find the dashboard using dashboard id. + * @param id + * @return {object} + * @private + * */ + var findDashboard = function (id) { + var i; + var dashboard; + var length = dashboards.length; + for (i = 0; i < length; i++) { + dashboard = dashboards[i]; + if (dashboard.id === id) { + return dashboard; + } + } + }; + + /** + * Delete the selected dashboard + * @param el:-selected dashboard element + * @private + * */ + var deleteDashboard = function (el) { + var button = Ladda.create(el[0]); + button.start(); + var id = el.closest('.ues-dashboard').data('id'); + $.ajax({ + url: dashboardsApi + '/' + id, + method: 'DELETE', + async : false, + success: function () { + button.stop(); + location.reload(); + }, + error: function () { + button.stop(); + } + }); + }; + + /** + * Load the list of dashboards available. + * @private + * */ + var loadDashboards = function () { + isStillLoading = true; + + if (!hasMore) { + isStillLoading = false; + $('.ues-dashboard').each(function (i, obj) { + if ($(this).find('.ues-dashboard-share').length) { + $(this).addClass("shared"); + } + }); + return; + } + ues.store.assets('dashboard', { + start: nextStart, + count: PAGE_COUNT + }, function (err, data) { + var dashboardsEl = $('#ues-portal').find('.ues-dashboards'); + hasMore = data.length; + if (!hasMore && nextStart === 0) { + dashboardsEl.append(dashboardsEmptyHbs()); + return; + } + + nextStart += PAGE_COUNT; + dashboards = dashboards.concat(data); + dashboardsEl.append(dashboardsListHbs(data)); + + var win = $(window); + var doc = $(document); + isStillLoading = false; + if (doc.height() > win.height()) { + return; + } + + loadDashboards(); + + $(".disable").on('click', function (event) { + event.preventDefault(); + }); + }); + }; + + /** + * Initialize the UI functionality such as binding events. + * @private + * */ + var initUI = function () { + var portal = $('#ues-portal'); + portal.on('click', '.ues-dashboards .ues-dashboard-trash-handle', function (e) { + e.preventDefault(); + var thiz = $(this); + var dashboardEl = thiz.closest('.ues-dashboard'); + var id = dashboardEl.data('id'); + var dashboard = findDashboard(id); + dashboardEl.html(dashboardConfirmHbs(dashboard)); + }); + + portal.on('click', '.ues-dashboards .ues-dashboard-trash-confirm', function (e) { + e.preventDefault(); + deleteDashboard($(this)); + }); + + portal.on('click', '.ues-dashboards .ues-dashboard-trash-cancel', function (e) { + e.preventDefault(); + var thiz = $(this); + var dashboardEl = thiz.closest('.ues-dashboard'); + var id = dashboardEl.data('id'); + var dashboard = findDashboard(id); + dashboardEl.html(dashboardThumbnailHbs(dashboard)); + }); + + portal.on('click', '.ues-view:not(.disable)', function(e) { + e.preventDefault(); + window.open($(this).attr('href'), '_blank'); + }); + + $('#filter-dashboards a').on('click', function () { + $('#filter').html($(this).text()); + var filter = $(this).data('filter'); + + $('.ues-dashboard-container').each(function (i, obj) { + if (filter === "All") { + $(this).show(); + } else { + if ($(this).find('.ues-dashboard-share').length) { + filter === "Shared" ? $(this).show() : $(this).hide(); + } else { + filter === "Shared" ? $(this).hide() : $(this).show(); + } + } + }); + }); + + $(window).scroll(function () { + var win = $(window); + var doc = $(document); + if (win.scrollTop() + win.height() < doc.height() - 100) { + return; + } + + if (!isStillLoading) { + loadDashboards(); + } + }); + }; + + + $(document).ready(function () { + $('#cloud-menu-popover i.fw-tiles').popover({ + html: true, + trigger:'click', + title: function() { + return $("#popover-head").html(); + }, + content: function() { + return $("#popover-content").html(); + } + }); + }); + + initUI(); + loadDashboards(); +}); \ No newline at end of file diff --git a/modules/distribution/src/assembly/dist.xml b/modules/distribution/src/assembly/dist.xml index fdd91e0f..d14ebd4f 100644 --- a/modules/distribution/src/assembly/dist.xml +++ b/modules/distribution/src/assembly/dist.xml @@ -46,12 +46,12 @@ - - - - - - + + + + + + ${basedir}/src/resources/plugins @@ -60,37 +60,38 @@ */** 644 - true + true - - ${basedir}/src/resources/samples - wso2iot-${product.iot.version}/samples - - */** - + + ${basedir}/src/resources/samples + wso2iot-${product.iot.version}/samples + + */** + **/*samples-deployer.xml **/*connectedcup/pom.xml - 644 - + 644 + - - - + + + ${basedir}/src/resources/samples/samples-deployer.xml - - wso2iot-${product.iot.version}/samples/ - true - 644 - - - + + wso2iot-${product.iot.version}/samples/ + true + 644 + + + ${basedir}/src/resources/samples/connectedcup/pom.xml - - wso2iot-${product.iot.version}/samples/connectedcup - true - 644 - - + + wso2iot-${product.iot.version}/samples/connectedcup + true + 644 + + +