diff --git a/ui/src/app/asset/asset.routes.js b/ui/src/app/asset/asset.routes.js index 79870398f7..cfc4e77315 100644 --- a/ui/src/app/asset/asset.routes.js +++ b/ui/src/app/asset/asset.routes.js @@ -67,29 +67,6 @@ export default function AssetRoutes($stateProvider, types) { ncyBreadcrumb: { label: '{"icon": "domain", "label": "{{ vm.customerAssetsTitle }}", "translate": "false"}' } - }) - .state('home.edges.assets', { - url: '/:edgeId/assets', - params: {'topIndex': 0}, - module: 'private', - auth: ['TENANT_ADMIN'], - views: { - "content@home": { - templateUrl: assetsTemplate, - controllerAs: 'vm', - controller: 'AssetController' - } - }, - data: { - assetsType: 'edge', - searchEnabled: true, - searchByEntitySubtype: true, - searchEntityType: types.entityType.asset, - pageTitle: 'edge.assets' - }, - ncyBreadcrumb: { - label: '{"icon": "domain", "label": "edge.assets"}' - } }); } diff --git a/ui/src/app/dashboard/dashboard.routes.js b/ui/src/app/dashboard/dashboard.routes.js index e78d211b03..43ec230c6d 100644 --- a/ui/src/app/dashboard/dashboard.routes.js +++ b/ui/src/app/dashboard/dashboard.routes.js @@ -124,47 +124,4 @@ export default function DashboardRoutes($stateProvider) { label: '{"icon": "dashboard", "label": "customer.dashboard"}' } }) - .state('home.edges.dashboards', { - url: '/:edgeId/dashboards', - params: {'topIndex': 0}, - module: 'private', - auth: ['TENANT_ADMIN'], - views: { - "content@home": { - templateUrl: dashboardsTemplate, - controllerAs: 'vm', - controller: 'DashboardsController' - } - }, - data: { - dashboardsType: 'edge', - searchEnabled: true, - pageTitle: 'edge.dashboards' - }, - ncyBreadcrumb: { - label: '{"icon": "dashboard", "label": "edge.dashboards"}' - } - }) - .state('home.edges.dashboards.dashboard', { - url: '/:dashboardId?state', - reloadOnSearch: false, - module: 'private', - auth: ['TENANT_ADMIN', 'CUSTOMER_USER'], - views: { - "content@home": { - templateUrl: dashboardTemplate, - controller: 'DashboardController', - controllerAs: 'vm' - } - }, - data: { - widgetEditMode: false, - searchEnabled: false, - pageTitle: 'dashboard.dashboard', - dashboardsType: 'edge', - }, - ncyBreadcrumb: { - label: '{"icon": "dashboard", "label": "{{ vm.dashboard.title }}", "translate": "false"}' - } - }) } diff --git a/ui/src/app/device/device.controller.js b/ui/src/app/device/device.controller.js index a0f9c1b8c0..93f8dad1c4 100644 --- a/ui/src/app/device/device.controller.js +++ b/ui/src/app/device/device.controller.js @@ -219,20 +219,6 @@ export function DeviceController($rootScope, userService, deviceService, custome } }); - deviceActionsList.push( - { - onAction: function ($event, item) { - unassignFromEdge($event, item, false); - }, - name: function() { return $translate.instant('action.unassign') }, - details: function() { return $translate.instant('device.unassign-from-edge') }, - icon: "portable_wifi_off", - isEnabled: function(device) { - return device && device.edgeId && device.edgeId.id !== types.id.nullUid; - } - } - ); - deviceActionsList.push( { onAction: function ($event, item) { diff --git a/ui/src/app/device/device.routes.js b/ui/src/app/device/device.routes.js index 1836aa1326..da7dbb89dc 100644 --- a/ui/src/app/device/device.routes.js +++ b/ui/src/app/device/device.routes.js @@ -67,29 +67,6 @@ export default function DeviceRoutes($stateProvider, types) { ncyBreadcrumb: { label: '{"icon": "devices_other", "label": "{{ vm.customerDevicesTitle }}", "translate": "false"}' } - }) - .state('home.edges.devices', { - url: '/:edgeId/devices', - params: {'topIndex': 0}, - module: 'private', - auth: ['TENANT_ADMIN'], - views: { - "content@home": { - templateUrl: devicesTemplate, - controllerAs: 'vm', - controller: 'DeviceController' - } - }, - data: { - devicesType: 'edge', - searchEnabled: true, - searchByEntitySubtype: true, - searchEntityType: types.entityType.device, - pageTitle: 'edge.devices' - }, - ncyBreadcrumb: { - label: '{"icon": "devices_other", "label": "edge.devices"}' - } }); } diff --git a/ui/src/app/edge/edge.controller.js b/ui/src/app/edge/edge.controller.js index 3afa5323ef..51269ea753 100644 --- a/ui/src/app/edge/edge.controller.js +++ b/ui/src/app/edge/edge.controller.js @@ -577,7 +577,6 @@ export function EdgeController($rootScope, userService, edgeService, customerSer }); } - function assignEdgesToCustomer($event, items) { var edgeIds = []; for (var id in items.selections) { @@ -667,7 +666,6 @@ export function EdgeController($rootScope, userService, edgeService, customerSer $state.go('home.edges.ruleChains', {edgeId: edge.id.id}); } - function openEdgeAssets($event, edge) { if ($event) { $event.stopPropagation(); diff --git a/ui/src/app/edge/edge.routes.js b/ui/src/app/edge/edge.routes.js index c7b7e45752..1afd319609 100644 --- a/ui/src/app/edge/edge.routes.js +++ b/ui/src/app/edge/edge.routes.js @@ -16,6 +16,11 @@ /* eslint-disable import/no-unresolved, import/default */ import edgesTemplate from './edges.tpl.html'; +import entityViewsTemplate from "../entity-view/entity-views.tpl.html"; +import devicesTemplate from "../device/devices.tpl.html"; +import assetsTemplate from "../asset/assets.tpl.html"; +import dashboardsTemplate from "../dashboard/dashboards.tpl.html"; +import dashboardTemplate from "../dashboard/dashboard.tpl.html"; /* eslint-enable import/no-unresolved, import/default */ @@ -45,27 +50,116 @@ export default function EdgeRoutes($stateProvider, types) { label: '{"icon": "transform", "label": "edge.edges"}' } }) - .state('home.customers.edges', { - url: '/:customerId/edges', + .state('home.edges.entityViews', { + url: '/:edgeId/entityViews', params: {'topIndex': 0}, module: 'private', auth: ['TENANT_ADMIN'], views: { "content@home": { - templateUrl: edgesTemplate, + templateUrl: entityViewsTemplate, controllerAs: 'vm', - controller: 'EdgeController' + controller: 'EntityViewController' } }, data: { - edgesType: 'customer', + entityViewsType: 'edge', searchEnabled: true, searchByEntitySubtype: true, - searchEntityType: types.entityType.edge, - pageTitle: 'customer.edges' + searchEntityType: types.entityType.entityView, + pageTitle: 'edge.entity-views' }, ncyBreadcrumb: { - label: '{"icon": "transform", "label": "{{ vm.customerEdgesTitle }}", "translate": "false"}' + label: '{"icon": "view_quilt", "label": "edge.entity-views"}' + } + }) + .state('home.edges.devices', { + url: '/:edgeId/devices', + params: {'topIndex': 0}, + module: 'private', + auth: ['TENANT_ADMIN'], + views: { + "content@home": { + templateUrl: devicesTemplate, + controllerAs: 'vm', + controller: 'DeviceController' + } + }, + data: { + devicesType: 'edge', + searchEnabled: true, + searchByEntitySubtype: true, + searchEntityType: types.entityType.device, + pageTitle: 'edge.devices' + }, + ncyBreadcrumb: { + label: '{"icon": "devices_other", "label": "edge.devices"}' + } + }) + .state('home.edges.assets', { + url: '/:edgeId/assets', + params: {'topIndex': 0}, + module: 'private', + auth: ['TENANT_ADMIN'], + views: { + "content@home": { + templateUrl: assetsTemplate, + controllerAs: 'vm', + controller: 'AssetController' + } + }, + data: { + assetsType: 'edge', + searchEnabled: true, + searchByEntitySubtype: true, + searchEntityType: types.entityType.asset, + pageTitle: 'edge.assets' + }, + ncyBreadcrumb: { + label: '{"icon": "domain", "label": "edge.assets"}' + } + }) + .state('home.edges.dashboards', { + url: '/:edgeId/dashboards', + params: {'topIndex': 0}, + module: 'private', + auth: ['TENANT_ADMIN'], + views: { + "content@home": { + templateUrl: dashboardsTemplate, + controllerAs: 'vm', + controller: 'DashboardsController' + } + }, + data: { + dashboardsType: 'edge', + searchEnabled: true, + pageTitle: 'edge.dashboards' + }, + ncyBreadcrumb: { + label: '{"icon": "dashboard", "label": "edge.dashboards"}' + } + }) + .state('home.edges.dashboards.dashboard', { + url: '/:dashboardId?state', + reloadOnSearch: false, + module: 'private', + auth: ['TENANT_ADMIN', 'CUSTOMER_USER'], + views: { + "content@home": { + templateUrl: dashboardTemplate, + controller: 'DashboardController', + controllerAs: 'vm' + } + }, + data: { + widgetEditMode: false, + searchEnabled: false, + pageTitle: 'dashboard.dashboard', + dashboardsType: 'edge', + }, + ncyBreadcrumb: { + label: '{"icon": "dashboard", "label": "{{ vm.dashboard.title }}", "translate": "false"}' } }); } diff --git a/ui/src/app/entity-view/entity-view.controller.js b/ui/src/app/entity-view/entity-view.controller.js index 4420a3b82d..9c5e7907f5 100644 --- a/ui/src/app/entity-view/entity-view.controller.js +++ b/ui/src/app/entity-view/entity-view.controller.js @@ -294,6 +294,19 @@ export function EntityViewController($rootScope, userService, entityViewService, return {"edgeId": edgeId, "topIndex": vm.topIndex}; }; + entityViewActionsList.push({ + onAction: function ($event, item) { + unassignFromEdge($event, item, false); + }, + name: function() { return $translate.instant('action.unassign') }, + details: function() { return $translate.instant('entity-view.unassign-from-edge') }, + icon: "assignment_return", + isEnabled: function(entityView) { + return entityView && entityView.edgeId && entityView.edgeId.id !== types.id.nullUid; + } + } + ); + entityViewGroupActionsList.push( { onAction: function ($event, items) { @@ -583,4 +596,25 @@ export function EntityViewController($rootScope, userService, entityViewService, }); }); } + + function unassignFromEdge($event, entityView) { + if ($event) { + $event.stopPropagation(); + } + var title = $translate.instant('entity-view.unassign-entity-view-from-edge-title', {entityViewName: entityView.name}); + var content = $translate.instant('entity-view.unassign-entity-view-from-edge-text'); + var label = $translate.instant('entity-view.unassign-entity-view'); + var confirm = $mdDialog.confirm() + .targetEvent($event) + .title(title) + .htmlContent(content) + .ariaLabel(label) + .cancel($translate.instant('action.no')) + .ok($translate.instant('action.yes')); + $mdDialog.show(confirm).then(function () { + entityViewService.unassignEntityViewFromEdge(entityView.id.id).then(function success() { + vm.grid.refreshList(); + }); + }); + } } diff --git a/ui/src/app/entity-view/entity-view.routes.js b/ui/src/app/entity-view/entity-view.routes.js index ad845e32af..4da8c80500 100644 --- a/ui/src/app/entity-view/entity-view.routes.js +++ b/ui/src/app/entity-view/entity-view.routes.js @@ -67,29 +67,5 @@ export default function EntityViewRoutes($stateProvider, types) { ncyBreadcrumb: { label: '{"icon": "view_quilt", "label": "{{ vm.customerEntityViewsTitle }}", "translate": "false"}' } - }) - .state('home.edges.entityViews', { - url: '/:edgeId/entityViews', - params: {'topIndex': 0}, - module: 'private', - auth: ['TENANT_ADMIN'], - views: { - "content@home": { - templateUrl: entityViewsTemplate, - controllerAs: 'vm', - controller: 'EntityViewController' - } - }, - data: { - entityViewsType: 'edge', - searchEnabled: true, - searchByEntitySubtype: true, - searchEntityType: types.entityType.entityView, - pageTitle: 'edge.entity-views' - }, - ncyBreadcrumb: { - label: '{"icon": "view_quilt", "label": "edge.entity-views"}' - } }); - } diff --git a/ui/src/app/rulechain/rulechain-card.scss b/ui/src/app/rulechain/rulechain-card.scss deleted file mode 100644 index 86e86680bd..0000000000 --- a/ui/src/app/rulechain/rulechain-card.scss +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright © 2016-2020 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. - */ -.tb-rule-chain-assigned-edges { - display: block; - display: -webkit-box; /* stylelint-disable-line value-no-vendor-prefix */ - height: 34px; - margin-bottom: 4px; - overflow: hidden; - text-overflow: ellipsis; - -webkit-line-clamp: 2; - -webkit-box-orient: vertical; /* stylelint-disable-line property-no-vendor-prefix */ -} diff --git a/ui/src/app/rulechain/rulechain-card.tpl.html b/ui/src/app/rulechain/rulechain-card.tpl.html index 4e28413327..bab05c0a41 100644 --- a/ui/src/app/rulechain/rulechain-card.tpl.html +++ b/ui/src/app/rulechain/rulechain-card.tpl.html @@ -17,9 +17,6 @@ -->