diff --git a/ui/src/app/alarm/alarm-details-dialog.tpl.html b/ui/src/app/alarm/alarm-details-dialog.tpl.html index c09a1fc8b1..b090052228 100644 --- a/ui/src/app/alarm/alarm-details-dialog.tpl.html +++ b/ui/src/app/alarm/alarm-details-dialog.tpl.html @@ -74,8 +74,8 @@ -
alarm.details
-
+
alarm.details
+
diff --git a/ui/src/app/components/dashboard-select-panel.controller.js b/ui/src/app/components/dashboard-select-panel.controller.js new file mode 100644 index 0000000000..c4d94d8a58 --- /dev/null +++ b/ui/src/app/components/dashboard-select-panel.controller.js @@ -0,0 +1,32 @@ +/* + * Copyright © 2016-2017 The Thingsboard Authors + * + * 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. + */ + +/*@ngInject*/ +export default function DashboardSelectPanelController(mdPanelRef, $scope, $filter, dashboards, dashboardId, onDashboardSelected) { + + var vm = this; + vm._mdPanelRef = mdPanelRef; + vm.dashboards = dashboards; + vm.dashboardId = dashboardId; + + vm.dashboardSelected = dashboardSelected; + + function dashboardSelected(dashboardId) { + if (onDashboardSelected) { + onDashboardSelected(dashboardId); + } + } +} diff --git a/ui/src/app/components/dashboard-select-panel.tpl.html b/ui/src/app/components/dashboard-select-panel.tpl.html new file mode 100644 index 0000000000..c9b4f4bfed --- /dev/null +++ b/ui/src/app/components/dashboard-select-panel.tpl.html @@ -0,0 +1,31 @@ + + +
+ + + + + + {{dashboard.title}} + + + + +
+
diff --git a/ui/src/app/components/dashboard-select.directive.js b/ui/src/app/components/dashboard-select.directive.js index c75eb2a6ee..e0de25e0eb 100644 --- a/ui/src/app/components/dashboard-select.directive.js +++ b/ui/src/app/components/dashboard-select.directive.js @@ -21,16 +21,20 @@ import thingsboardApiUser from '../api/user.service'; /* eslint-disable import/no-unresolved, import/default */ import dashboardSelectTemplate from './dashboard-select.tpl.html'; +import dashboardSelectPanelTemplate from './dashboard-select-panel.tpl.html'; /* eslint-enable import/no-unresolved, import/default */ +import DashboardSelectPanelController from './dashboard-select-panel.controller'; + export default angular.module('thingsboard.directives.dashboardSelect', [thingsboardApiDashboard, thingsboardApiUser]) .directive('tbDashboardSelect', DashboardSelect) + .controller('DashboardSelectPanelController', DashboardSelectPanelController) .name; /*@ngInject*/ -function DashboardSelect($compile, $templateCache, $q, types, dashboardService, userService) { +function DashboardSelect($compile, $templateCache, $q, $mdMedia, $mdPanel, $document, types, dashboardService, userService) { var linker = function (scope, element, attrs, ngModelCtrl) { var template = $templateCache.get(dashboardSelectTemplate); @@ -74,6 +78,59 @@ function DashboardSelect($compile, $templateCache, $q, types, dashboardService, scope.updateView(); }); + scope.openDashboardSelectPanel = function (event) { + if (scope.disabled) { + return; + } + var position; + var panelHeight = $mdMedia('min-height: 350px') ? 250 : 150; + var panelWidth = 300; + var offset = element[0].getBoundingClientRect(); + var bottomY = offset.bottom - $(window).scrollTop(); //eslint-disable-line + var leftX = offset.left - $(window).scrollLeft(); //eslint-disable-line + var yPosition; + var xPosition; + if (bottomY + panelHeight > $( window ).height()) { //eslint-disable-line + yPosition = $mdPanel.yPosition.ABOVE; + } else { + yPosition = $mdPanel.yPosition.BELOW; + } + if (leftX + panelWidth > $( window ).width()) { //eslint-disable-line + xPosition = $mdPanel.xPosition.CENTER; + } else { + xPosition = $mdPanel.xPosition.ALIGN_START; + } + position = $mdPanel.newPanelPosition() + .relativeTo(element) + .addPanelPosition(xPosition, yPosition); + var config = { + attachTo: angular.element($document[0].body), + controller: 'DashboardSelectPanelController', + controllerAs: 'vm', + templateUrl: dashboardSelectPanelTemplate, + panelClass: 'tb-dashboard-select-panel', + position: position, + fullscreen: false, + locals: { + dashboards: scope.dashboards, + dashboardId: scope.dashboardId, + onDashboardSelected: (dashboardId) => { + if (scope.panelRef) { + scope.panelRef.close(); + } + scope.dashboardId = dashboardId; + } + }, + openFrom: event, + clickOutsideToClose: true, + escapeToClose: true, + focusOnOpen: false + }; + $mdPanel.open(config).then(function(result) { + scope.panelRef = result; + }); + } + $compile(element.contents())(scope); } diff --git a/ui/src/app/components/dashboard-select.scss b/ui/src/app/components/dashboard-select.scss index 029bf60628..5c16f2bd8f 100644 --- a/ui/src/app/components/dashboard-select.scss +++ b/ui/src/app/components/dashboard-select.scss @@ -14,8 +14,48 @@ * limitations under the License. */ +@import '../../scss/constants'; + tb-dashboard-select { + min-width: 52px; md-select { pointer-events: all; + max-width: 300px; } } + +.tb-dashboard-select { + min-height: 32px; + span { + pointer-events: all; + cursor: pointer; + } +} + +.md-panel { + &.tb-dashboard-select-panel { + position: absolute; + } +} + +.tb-dashboard-select-panel { + max-height: 150px; + @media (min-height: 350px) { + max-height: 250px; + } + max-width: 320px; + @media (min-width: $layout-breakpoint-xs) { + max-width: 100%; + } + min-width: 300px; + background: white; + border-radius: 4px; + box-shadow: 0 7px 8px -4px rgba(0, 0, 0, 0.2), + 0 13px 19px 2px rgba(0, 0, 0, 0.14), + 0 5px 24px 4px rgba(0, 0, 0, 0.12); + overflow-x: hidden; + overflow-y: auto; + md-content { + background-color: #fff; + } +} \ No newline at end of file diff --git a/ui/src/app/components/dashboard-select.tpl.html b/ui/src/app/components/dashboard-select.tpl.html index 01670294fb..6915d6f8b0 100644 --- a/ui/src/app/components/dashboard-select.tpl.html +++ b/ui/src/app/components/dashboard-select.tpl.html @@ -16,7 +16,8 @@ --> - @@ -24,3 +25,11 @@ {{dashboard.title}} +
+ + + {{ 'dashboard.select-dashboard' | translate }} + + dashboards + +
\ No newline at end of file diff --git a/ui/src/app/components/datasource-entity.scss b/ui/src/app/components/datasource-entity.scss index b9e892bf14..df17907907 100644 --- a/ui/src/app/components/datasource-entity.scss +++ b/ui/src/app/components/datasource-entity.scss @@ -31,12 +31,12 @@ } tb-datasource-entity { - @media (min-width: $layout-breakpoint-gt-sm) { + @media (min-width: $layout-breakpoint-sm) { padding-left: 4px; padding-right: 4px; } tb-entity-alias-select { - @media (min-width: $layout-breakpoint-gt-sm) { + @media (min-width: $layout-breakpoint-sm) { width: 200px; max-width: 200px; } diff --git a/ui/src/app/components/datasource-func.scss b/ui/src/app/components/datasource-func.scss index fdda0e47da..e7c6ac18ab 100644 --- a/ui/src/app/components/datasource-func.scss +++ b/ui/src/app/components/datasource-func.scss @@ -16,7 +16,7 @@ @import '../../scss/constants'; .tb-datasource-func { - @media (min-width: $layout-breakpoint-gt-sm) { + @media (min-width: $layout-breakpoint-sm) { padding-left: 8px; } diff --git a/ui/src/app/components/details-sidenav.scss b/ui/src/app/components/details-sidenav.scss index 4fd83b61b9..80257b860e 100644 --- a/ui/src/app/components/details-sidenav.scss +++ b/ui/src/app/components/details-sidenav.scss @@ -45,10 +45,10 @@ md-sidenav.tb-sidenav-details { width: 100% !important; max-width: 100% !important; z-index: 59 !important; - @media (min-width: $layout-breakpoint-gt-sm) { + @media (min-width: $layout-breakpoint-sm) { width: 80% !important; } - @media (min-width: $layout-breakpoint-gt-md) { + @media (min-width: $layout-breakpoint-md) { width: 65% !important; } @media (min-width: $layout-breakpoint-lg) { diff --git a/ui/src/app/components/timewindow.directive.js b/ui/src/app/components/timewindow.directive.js index 3206d47dd2..90f5bbe62c 100644 --- a/ui/src/app/components/timewindow.directive.js +++ b/ui/src/app/components/timewindow.directive.js @@ -69,7 +69,7 @@ function Timewindow($compile, $templateCache, $filter, $mdPanel, $document, $mdM scope.isToolbar = angular.isDefined(attrs.isToolbar); scope.hideLabel = function() { - return scope.isToolbar && !$mdMedia('gt-sm'); + return scope.isToolbar && !$mdMedia('gt-md'); } var translationPending = false; diff --git a/ui/src/app/components/timewindow.scss b/ui/src/app/components/timewindow.scss index 9ea7c345a2..f1f03f4d1d 100644 --- a/ui/src/app/components/timewindow.scss +++ b/ui/src/app/components/timewindow.scss @@ -59,8 +59,16 @@ } tb-timewindow { - span { - pointer-events: all; - cursor: pointer; + min-width: 52px; + section.tb-timewindow { + min-height: 32px; + padding: 0 6px; + span { + pointer-events: all; + cursor: pointer; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } } } diff --git a/ui/src/app/components/timewindow.tpl.html b/ui/src/app/components/timewindow.tpl.html index a5c04a3bcb..c7227346de 100644 --- a/ui/src/app/components/timewindow.tpl.html +++ b/ui/src/app/components/timewindow.tpl.html @@ -15,7 +15,7 @@ limitations under the License. --> -
+
{{ 'timewindow.edit' | translate }} @@ -33,5 +33,5 @@ {{ 'timewindow.edit' | translate }} - +
\ No newline at end of file diff --git a/ui/src/app/components/widget/widget-config.tpl.html b/ui/src/app/components/widget/widget-config.tpl.html index ce179c388a..b0084d7665 100644 --- a/ui/src/app/components/widget/widget-config.tpl.html +++ b/ui/src/app/components/widget/widget-config.tpl.html @@ -65,7 +65,7 @@
{{ 'widget-config.datasources' | translate }}
-
-
-
+
+
{{ 'dashboard.close-toolbar' | translate }} arrow_forward + + @@ -39,8 +41,6 @@ aria-label="{{ 'fullscreen.fullscreen' | translate }}" class="md-icon-button"> - - @@ -79,8 +79,10 @@ customer-id="vm.currentCustomerId">
-
-
+
+ + +
@@ -96,14 +98,12 @@ view_compact
-
- - - - -
+ + + +
@@ -146,7 +146,7 @@ ng-style="{minWidth: vm.rightLayoutWidth(), maxWidth: vm.rightLayoutWidth(), height: vm.rightLayoutHeight(), - zIndex: 1}" + zIndex: 12}" md-component-id="right-dashboard-layout" aria-label="Right dashboard layout" md-is-open="vm.rightLayoutOpened" diff --git a/ui/src/app/dashboard/states/default-state-controller.js b/ui/src/app/dashboard/states/default-state-controller.js index 6f5172417d..eecd1bc3ef 100644 --- a/ui/src/app/dashboard/states/default-state-controller.js +++ b/ui/src/app/dashboard/states/default-state-controller.js @@ -14,6 +14,8 @@ * limitations under the License. */ +import './default-state-controller.scss'; + /*@ngInject*/ export default function DefaultStateController($scope, $timeout, $location, $state, $stateParams, utils, types, dashboardUtils, preservedState) { diff --git a/ui/src/app/dashboard/states/default-state-controller.scss b/ui/src/app/dashboard/states/default-state-controller.scss new file mode 100644 index 0000000000..906ba7a192 --- /dev/null +++ b/ui/src/app/dashboard/states/default-state-controller.scss @@ -0,0 +1,19 @@ +/** + * Copyright © 2016-2017 The Thingsboard Authors + * + * 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. + */ + +md-select.default-state-controller { + margin: 0px; +} \ No newline at end of file diff --git a/ui/src/app/dashboard/states/default-state-controller.tpl.html b/ui/src/app/dashboard/states/default-state-controller.tpl.html index 9de15635ee..62d11f089a 100644 --- a/ui/src/app/dashboard/states/default-state-controller.tpl.html +++ b/ui/src/app/dashboard/states/default-state-controller.tpl.html @@ -15,7 +15,7 @@ limitations under the License. --> - + {{vm.getStateName(stateId, state)}} diff --git a/ui/src/app/dashboard/states/entity-state-controller.scss b/ui/src/app/dashboard/states/entity-state-controller.scss index 2d79157fd1..28cd9484d9 100644 --- a/ui/src/app/dashboard/states/entity-state-controller.scss +++ b/ui/src/app/dashboard/states/entity-state-controller.scss @@ -14,19 +14,33 @@ * limitations under the License. */ +@import '../../../scss/constants'; + +tb-states-component { + min-width: 0px; +} + .entity-state-controller { .state-divider { - font-size: 28px; + font-size: 18px; padding-left: 15px; padding-right: 15px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + pointer-events: none; } .state-entry { - font-size: 22px; + font-size: 18px; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; outline: none; } md-select { + margin: 0px; .md-text { - font-size: 22px; + font-size: 18px; font-weight: bold; } } diff --git a/ui/src/app/dashboard/states/entity-state-controller.tpl.html b/ui/src/app/dashboard/states/entity-state-controller.tpl.html index 4139be6ddf..bb55fc95fd 100644 --- a/ui/src/app/dashboard/states/entity-state-controller.tpl.html +++ b/ui/src/app/dashboard/states/entity-state-controller.tpl.html @@ -15,15 +15,13 @@ limitations under the License. --> -
+
-
- > - - {{vm.getStateName($index)}} - -
+ + {{vm.getStateName($index)}} + > +
diff --git a/ui/src/app/entity/alias/aliases-entity-select-button.tpl.html b/ui/src/app/entity/alias/aliases-entity-select-button.tpl.html index b0b69f5774..3d75803f91 100644 --- a/ui/src/app/entity/alias/aliases-entity-select-button.tpl.html +++ b/ui/src/app/entity/alias/aliases-entity-select-button.tpl.html @@ -16,14 +16,14 @@ --> -
+
{{ 'entity.select-entities' | translate }} devices_other - + {{ 'entity.select-entities' | translate }} diff --git a/ui/src/app/entity/alias/aliases-entity-select.scss b/ui/src/app/entity/alias/aliases-entity-select.scss index 55b0442ca8..cc1061e534 100644 --- a/ui/src/app/entity/alias/aliases-entity-select.scss +++ b/ui/src/app/entity/alias/aliases-entity-select.scss @@ -14,6 +14,12 @@ * limitations under the License. */ +@import '../../../scss/constants'; + +tb-aliases-entity-select { + min-width: 52px; +} + .md-panel { &.tb-aliases-entity-select-panel { position: absolute; @@ -38,9 +44,18 @@ } } -.tb-aliases-entity-select { +section.tb-aliases-entity-select { + min-height: 32px; + padding: 0 6px; + @media (max-width: $layout-breakpoint-sm) { + padding: 0px; + } span { + max-width: 200px; pointer-events: all; cursor: pointer; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; } } diff --git a/ui/src/app/layout/user-menu.tpl.html b/ui/src/app/layout/user-menu.tpl.html index 22acc05731..f0762d45df 100644 --- a/ui/src/app/layout/user-menu.tpl.html +++ b/ui/src/app/layout/user-menu.tpl.html @@ -16,7 +16,7 @@ -->
-