From 817d59ada9250223cba7b8350fd9214fb3e5e6aa Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Mon, 21 Dec 2020 18:07:18 +0200 Subject: [PATCH 01/19] Edge management: menu refactored, hide menu section --- ui/src/app/api/user.service.js | 24 +++- ui/src/app/rulechain/rulechain.controller.js | 4 +- ui/src/app/rulechain/rulechain.routes.js | 62 +++++++--- ui/src/app/rulechain/rulechains.controller.js | 6 +- ui/src/app/services/menu.service.js | 113 +++++++++--------- 5 files changed, 129 insertions(+), 80 deletions(-) diff --git a/ui/src/app/api/user.service.js b/ui/src/app/api/user.service.js index b84bcf8428..9d99681b0d 100644 --- a/ui/src/app/api/user.service.js +++ b/ui/src/app/api/user.service.js @@ -29,7 +29,8 @@ function UserService($http, $q, $rootScope, adminService, dashboardService, time allowedDashboardIds = [], redirectParams = null, userTokenAccessEnabled = false, - userLoaded = false; + userLoaded = false, + edgesSupportEnabled = false; var refreshTokenQueue = []; @@ -65,7 +66,9 @@ function UserService($http, $q, $rootScope, adminService, dashboardService, time reloadUser: reloadUser, isUserTokenAccessEnabled: isUserTokenAccessEnabled, loginAsUser: loginAsUser, - setUserCredentialsEnabled: setUserCredentialsEnabled + setUserCredentialsEnabled: setUserCredentialsEnabled, + isEdgesSupportEnabled: isEdgesSupportEnabled, + loadIsEdgesSupportEnabled: loadIsEdgesSupportEnabled } reloadUser(); @@ -451,6 +454,7 @@ function UserService($http, $q, $rootScope, adminService, dashboardService, time function loadSystemParams() { var promises = []; promises.push(loadIsUserTokenAccessEnabled()); + promises.push(loadIsEdgesSupportEnabled()); promises.push(timeService.loadMaxDatapointsLimit()); return $q.all(promises); } @@ -685,4 +689,20 @@ function UserService($http, $q, $rootScope, adminService, dashboardService, time }); } + function isEdgesSupportEnabled() { + return edgesSupportEnabled; + } + + function loadIsEdgesSupportEnabled() { + var deferred = $q.defer(); + var url = '/api/edges/enabled'; + $http.get(url).then(function success(response) { + edgesSupportEnabled = response.data; + deferred.resolve(response.data); + }, function fail() { + deferred.reject(); + }); + return deferred.promise; + } + } diff --git a/ui/src/app/rulechain/rulechain.controller.js b/ui/src/app/rulechain/rulechain.controller.js index 51f82108c2..fee537f309 100644 --- a/ui/src/app/rulechain/rulechain.controller.js +++ b/ui/src/app/rulechain/rulechain.controller.js @@ -1270,9 +1270,9 @@ export function RuleChainController($state, $scope, $compile, $q, $mdUtil, $time vm.isImport = false; $mdUtil.nextTick(() => { if (vm.ruleChain.type === vm.types.ruleChainType.core) { - $state.go('home.ruleChains.core.ruleChain', {ruleChainId: vm.ruleChain.id.id}); + $state.go('home.ruleChains.ruleChain', {ruleChainId: vm.ruleChain.id.id}); } else { - $state.go('home.ruleChains.edge.ruleChain', {ruleChainId: vm.ruleChain.id.id}); + $state.go('home.edges.edgeRuleChains.ruleChain', {ruleChainId: vm.ruleChain.id.id}); } }); } else { diff --git a/ui/src/app/rulechain/rulechain.routes.js b/ui/src/app/rulechain/rulechain.routes.js index 8a5c13cc1d..a1d5da43e2 100644 --- a/ui/src/app/rulechain/rulechain.routes.js +++ b/ui/src/app/rulechain/rulechain.routes.js @@ -29,15 +29,6 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider $stateProvider .state('home.ruleChains', { url: '/ruleChains', - module: 'private', - auth: ['SYS_ADMIN', 'TENANT_ADMIN'], - redirectTo: 'home.ruleChains.core', - ncyBreadcrumb: { - label: '{"icon": "settings_ethernet", "label": "rulechain.rulechains"}' - } - }) - .state('home.ruleChains.core', { - url: '/ruleChains/core', params: {'topIndex': 0}, module: 'private', auth: ['SYS_ADMIN', 'TENANT_ADMIN'], @@ -50,13 +41,13 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider }, data: { searchEnabled: true, - pageTitle: 'rulechain.core-rulechains', + pageTitle: 'rulechain.rulechains', ruleChainsType: 'tenant' }, ncyBreadcrumb: { - label: '{"icon": "settings_ethernet", "label": "rulechain.core-rulechains"}' + label: '{"icon": "settings_ethernet", "label": "rulechain.rulechains"}' } - }).state('home.ruleChains.core.ruleChain', { + }).state('home.ruleChains.ruleChain', { url: '/:ruleChainId', reloadOnSearch: false, module: 'private', @@ -134,8 +125,8 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider ncyBreadcrumb: { label: '{"icon": "settings_ethernet", "label": "{{ (\'rulechain.import\' | translate) + \': \'+ vm.ruleChain.name }}", "translate": "false"}' } - }).state('home.ruleChains.edge', { - url: '/ruleChains/edge', + }).state('home.edges.edgeRuleChains', { + url: '/ruleChains', params: {'topIndex': 0}, module: 'private', auth: ['TENANT_ADMIN'], @@ -154,7 +145,7 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider ncyBreadcrumb: { label: '{"icon": "code", "label": "rulechain.edge-rulechains"}' } - }).state('home.ruleChains.edge.ruleChain', { + }).state('home.edges.edgeRuleChains.ruleChain', { url: '/:ruleChainId', reloadOnSearch: false, module: 'private', @@ -191,5 +182,46 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider ncyBreadcrumb: { label: '{"icon": "code", "label": "{{ vm.ruleChain.name }}", "translate": "false"}' } + }).state('home.edges.edgeRuleChains.importRuleChain', { + url: '/edges/ruleChains/import', + reloadOnSearch: false, + module: 'private', + auth: ['SYS_ADMIN', 'TENANT_ADMIN'], + views: { + "content@home": { + templateUrl: ruleChainTemplate, + controller: 'RuleChainController', + controllerAs: 'vm' + } + }, + params: { + ruleChainImport: {}, + ruleChainType: {} + }, + resolve: { + ruleChain: + /*@ngInject*/ + function($stateParams) { + return $stateParams.ruleChainImport.ruleChain; + }, + ruleChainMetaData: + /*@ngInject*/ + function($stateParams) { + return $stateParams.ruleChainImport.metadata; + }, + ruleNodeComponents: + /*@ngInject*/ + function($stateParams, ruleChainService) { + return ruleChainService.getRuleNodeComponents($stateParams.ruleChainType); + } + }, + data: { + import: true, + searchEnabled: true, + pageTitle: 'edge.rulechain' + }, + ncyBreadcrumb: { + label: '{"icon": "code", "label": "{{ (\'rulechain.import\' | translate) + \': \'+ vm.ruleChain.name }}", "translate": "false"}' + } }); } diff --git a/ui/src/app/rulechain/rulechains.controller.js b/ui/src/app/rulechain/rulechains.controller.js index 65eb62abbe..6de188e4a7 100644 --- a/ui/src/app/rulechain/rulechains.controller.js +++ b/ui/src/app/rulechain/rulechains.controller.js @@ -247,7 +247,7 @@ export default function RuleChainsController(ruleChainService, userService, impo onAction: function ($event) { importExport.importRuleChain($event, types.ruleChainType.edge).then( function(ruleChainImport) { - $state.go('home.ruleChains.importRuleChain', {ruleChainImport:ruleChainImport, ruleChainType: types.ruleChainType.edge}); + $state.go('home.edges.edgeRuleChains.importRuleChain', {ruleChainImport:ruleChainImport, ruleChainType: types.ruleChainType.edge}); } ); }, @@ -401,9 +401,9 @@ export default function RuleChainsController(ruleChainService, userService, impo if (vm.ruleChainsScope === 'edge') { $state.go('home.edges.ruleChains.ruleChain', Object.assign(ruleChainParams, edgeId = vm.edge.id.id)); } else if (vm.ruleChainsScope === 'edges') { - $state.go('home.ruleChains.edge.ruleChain', ruleChainParams); + $state.go('home.edges.edgeRuleChains.ruleChain', ruleChainParams); } else { - $state.go('home.ruleChains.core.ruleChain', ruleChainParams); + $state.go('home.ruleChains.ruleChain', ruleChainParams); } } diff --git a/ui/src/app/services/menu.service.js b/ui/src/app/services/menu.service.js index 4cad286de8..d46c477f4a 100644 --- a/ui/src/app/services/menu.service.js +++ b/ui/src/app/services/menu.service.js @@ -58,6 +58,45 @@ function Menu(userService, $state, $rootScope) { if (authority !== user.authority) { sections = []; authority = user.authority; + var edgeMenuSection = { + side: { + name: 'edge.management', + type: 'toggle', + state: 'home.edges', + height: '80px', + icon: 'router', + pages: [ + { + name: 'edge.edges', + type: 'link', + state: 'home.edges', + icon: 'router' + }, + { + name: 'rulechain.edge-rulechains', + type: 'link', + state: 'home.edges.edgeRuleChains', + icon: 'code' + } + ] + }, + home: { + name: 'edge.management', + places: [ + { + name: 'edge.edges', + icon: 'router', + state: 'home.edges' + }, + { + name: 'rulechain.edge-rulechains', + icon: 'code', + state: 'home.edges.edgeRuleChains' + } + ] + + } + } if (authority === 'SYS_ADMIN') { sections = [ { @@ -156,24 +195,9 @@ function Menu(userService, $state, $rootScope) { }, { name: 'rulechain.rulechains', - type: 'toggle', + type: 'link', state: 'home.ruleChains', - height: '80px', - icon: 'settings_ethernet', - pages: [ - { - name: 'rulechain.core-rulechains', - type: 'link', - state: 'home.ruleChains.core', - icon: 'settings_ethernet' - }, - { - name: 'rulechain.edge-rulechains', - type: 'link', - state: 'home.ruleChains.edge', - icon: 'code' - } - ] + icon: 'settings_ethernet' }, { name: 'customer.customers', @@ -199,12 +223,6 @@ function Menu(userService, $state, $rootScope) { state: 'home.entityViews', icon: 'view_quilt' }, - { - name: 'edge.edges', - type: 'link', - state: 'home.edges', - icon: 'router' - }, { name: 'widget.widget-library', type: 'link', @@ -226,17 +244,12 @@ function Menu(userService, $state, $rootScope) { homeSections = [{ - name: 'rulechain.management', + name: 'rulechain.rulechains', places: [ { - name: 'rulechain.core-rulechains', + name: 'rulechain.rulechains', icon: 'settings_ethernet', - state: 'home.ruleChains.core' - }, - { - name: 'rulechain.edge-rulechains', - icon: 'code', - state: 'home.ruleChains.edge' + state: 'home.ruleChains' } ] }, @@ -280,16 +293,6 @@ function Menu(userService, $state, $rootScope) { } ] }, - { - name: 'edge.management', - places: [ - { - name: 'edge.edges', - icon: 'router', - state: 'home.edges' - } - ] - }, { name: 'dashboard.management', places: [ @@ -316,6 +319,11 @@ function Menu(userService, $state, $rootScope) { ] }]; + if (userService.isEdgesSupportEnabled()) { + sections.splice(6, 0, edgeMenuSection.side); + homeSections.splice(5, 0, edgeMenuSection.home); + } + } else if (authority === 'CUSTOMER_USER') { sections = [ { @@ -342,12 +350,6 @@ function Menu(userService, $state, $rootScope) { state: 'home.entityViews', icon: 'view_quilt' }, - { - name: 'edge.edges', - type: 'link', - state: 'home.edges', - icon: 'router' - }, { name: 'dashboard.dashboards', type: 'link', @@ -386,16 +388,6 @@ function Menu(userService, $state, $rootScope) { } ] }, - { - name: 'edge.management', - places: [ - { - name: 'edge.edges', - icon: 'router', - state: 'home.edges' - } - ] - }, { name: 'dashboard.view-dashboards', places: [ @@ -406,6 +398,11 @@ function Menu(userService, $state, $rootScope) { } ] }]; + + if (userService.isEdgesSupportEnabled()) { + sections.splice(4, 0, edgeMenuSection.side); + homeSections.splice(3, 0, edgeMenuSection.home); + } } } } @@ -423,4 +420,4 @@ function Menu(userService, $state, $rootScope) { return $state.includes(section.state); } -} \ No newline at end of file +} From ee1da2fd6a5004fdafa2bc18f589614580c78f67 Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Mon, 21 Dec 2020 18:14:54 +0200 Subject: [PATCH 02/19] Edge management minor code change --- ui/src/app/api/user.service.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/app/api/user.service.js b/ui/src/app/api/user.service.js index 9d99681b0d..fad837543d 100644 --- a/ui/src/app/api/user.service.js +++ b/ui/src/app/api/user.service.js @@ -698,7 +698,7 @@ function UserService($http, $q, $rootScope, adminService, dashboardService, time var url = '/api/edges/enabled'; $http.get(url).then(function success(response) { edgesSupportEnabled = response.data; - deferred.resolve(response.data); + deferred.resolve(response); }, function fail() { deferred.reject(); }); From da5ac8902d055fc58f4209a14de55fd2d9083d13 Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Mon, 21 Dec 2020 18:20:45 +0200 Subject: [PATCH 03/19] Removed rule chains management for customers --- ui/src/app/services/menu.service.js | 97 +++++++++++++++++------------ 1 file changed, 58 insertions(+), 39 deletions(-) diff --git a/ui/src/app/services/menu.service.js b/ui/src/app/services/menu.service.js index d46c477f4a..620c842421 100644 --- a/ui/src/app/services/menu.service.js +++ b/ui/src/app/services/menu.service.js @@ -58,45 +58,6 @@ function Menu(userService, $state, $rootScope) { if (authority !== user.authority) { sections = []; authority = user.authority; - var edgeMenuSection = { - side: { - name: 'edge.management', - type: 'toggle', - state: 'home.edges', - height: '80px', - icon: 'router', - pages: [ - { - name: 'edge.edges', - type: 'link', - state: 'home.edges', - icon: 'router' - }, - { - name: 'rulechain.edge-rulechains', - type: 'link', - state: 'home.edges.edgeRuleChains', - icon: 'code' - } - ] - }, - home: { - name: 'edge.management', - places: [ - { - name: 'edge.edges', - icon: 'router', - state: 'home.edges' - }, - { - name: 'rulechain.edge-rulechains', - icon: 'code', - state: 'home.edges.edgeRuleChains' - } - ] - - } - } if (authority === 'SYS_ADMIN') { sections = [ { @@ -186,6 +147,45 @@ function Menu(userService, $state, $rootScope) { ] }]; } else if (authority === 'TENANT_ADMIN') { + let edgeMenuSection = { + side: { + name: 'edge.management', + type: 'toggle', + state: 'home.edges', + height: '80px', + icon: 'router', + pages: [ + { + name: 'edge.edges', + type: 'link', + state: 'home.edges', + icon: 'router' + }, + { + name: 'rulechain.edge-rulechains', + type: 'link', + state: 'home.edges.edgeRuleChains', + icon: 'code' + } + ] + }, + home: { + name: 'edge.management', + places: [ + { + name: 'edge.edges', + icon: 'router', + state: 'home.edges' + }, + { + name: 'rulechain.edge-rulechains', + icon: 'code', + state: 'home.edges.edgeRuleChains' + } + ] + + } + } sections = [ { name: 'home.home', @@ -325,6 +325,25 @@ function Menu(userService, $state, $rootScope) { } } else if (authority === 'CUSTOMER_USER') { + let edgeMenuSection = { + side: { + name: 'edge.edges', + type: 'link', + state: 'home.edges', + icon: 'router' + }, + home: { + name: 'edge.edges', + places: [ + { + name: 'edge.edges', + icon: 'router', + state: 'home.edges' + } + ] + + } + } sections = [ { name: 'home.home', From 479c318925fc537fbb02d8c1622dae81bed2aa1a Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Tue, 22 Dec 2020 05:11:31 +0200 Subject: [PATCH 04/19] Edge menu hide --- ui/src/app/api/user.service.js | 3 +- ui/src/app/services/menu.service.js | 206 ++++++++++++++-------------- 2 files changed, 107 insertions(+), 102 deletions(-) diff --git a/ui/src/app/api/user.service.js b/ui/src/app/api/user.service.js index fad837543d..cdf18c27ed 100644 --- a/ui/src/app/api/user.service.js +++ b/ui/src/app/api/user.service.js @@ -67,8 +67,7 @@ function UserService($http, $q, $rootScope, adminService, dashboardService, time isUserTokenAccessEnabled: isUserTokenAccessEnabled, loginAsUser: loginAsUser, setUserCredentialsEnabled: setUserCredentialsEnabled, - isEdgesSupportEnabled: isEdgesSupportEnabled, - loadIsEdgesSupportEnabled: loadIsEdgesSupportEnabled + isEdgesSupportEnabled: isEdgesSupportEnabled } reloadUser(); diff --git a/ui/src/app/services/menu.service.js b/ui/src/app/services/menu.service.js index 620c842421..f3bfbea470 100644 --- a/ui/src/app/services/menu.service.js +++ b/ui/src/app/services/menu.service.js @@ -147,45 +147,6 @@ function Menu(userService, $state, $rootScope) { ] }]; } else if (authority === 'TENANT_ADMIN') { - let edgeMenuSection = { - side: { - name: 'edge.management', - type: 'toggle', - state: 'home.edges', - height: '80px', - icon: 'router', - pages: [ - { - name: 'edge.edges', - type: 'link', - state: 'home.edges', - icon: 'router' - }, - { - name: 'rulechain.edge-rulechains', - type: 'link', - state: 'home.edges.edgeRuleChains', - icon: 'code' - } - ] - }, - home: { - name: 'edge.management', - places: [ - { - name: 'edge.edges', - icon: 'router', - state: 'home.edges' - }, - { - name: 'rulechain.edge-rulechains', - icon: 'code', - state: 'home.edges.edgeRuleChains' - } - ] - - } - } sections = [ { name: 'home.home', @@ -222,7 +183,33 @@ function Menu(userService, $state, $rootScope) { type: 'link', state: 'home.entityViews', icon: 'view_quilt' - }, + }]; + if (userService.isEdgesSupportEnabled()) { + sections.push( + { + name: 'edge.management', + type: 'toggle', + state: 'home.edges', + height: '80px', + icon: 'router', + pages: [ + { + name: 'edge.edges', + type: 'link', + state: 'home.edges', + icon: 'router' + }, + { + name: 'rulechain.edge-rulechains', + type: 'link', + state: 'home.edges.edgeRuleChains', + icon: 'code' + } + ] + } + ); + } + sections.push( { name: 'widget.widget-library', type: 'link', @@ -230,17 +217,18 @@ function Menu(userService, $state, $rootScope) { icon: 'now_widgets' }, { - name: 'dashboard.dashboards', - type: 'link', - state: 'home.dashboards', - icon: 'dashboards' - }, + name: 'dashboard.dashboards', + type: 'link', + state: 'home.dashboards', + icon: 'dashboards' + }, { - name: 'audit-log.audit-logs', - type: 'link', - state: 'home.auditLogs', - icon: 'track_changes' - }]; + name: 'audit-log.audit-logs', + type: 'link', + state: 'home.auditLogs', + icon: 'track_changes' + } + ); homeSections = [{ @@ -292,58 +280,52 @@ function Menu(userService, $state, $rootScope) { state: 'home.entityViews' } ] - }, - { - name: 'dashboard.management', - places: [ - { - name: 'widget.widget-library', - icon: 'now_widgets', - state: 'home.widgets-bundles' - }, - { - name: 'dashboard.dashboards', - icon: 'dashboard', - state: 'home.dashboards' - } - ] - }, - { - name: 'audit-log.audit', - places: [ - { - name: 'audit-log.audit-logs', - icon: 'track_changes', - state: 'home.auditLogs' - } - ] }]; - if (userService.isEdgesSupportEnabled()) { - sections.splice(6, 0, edgeMenuSection.side); - homeSections.splice(5, 0, edgeMenuSection.home); - } - - } else if (authority === 'CUSTOMER_USER') { - let edgeMenuSection = { - side: { - name: 'edge.edges', - type: 'link', - state: 'home.edges', - icon: 'router' - }, - home: { - name: 'edge.edges', + homeSections.push({ + name: 'edge.management', places: [ { name: 'edge.edges', icon: 'router', state: 'home.edges' + }, + { + name: 'rulechain.edge-rulechains', + icon: 'code', + state: 'home.edges.edgeRuleChains' } ] - } + }); } + homeSections.push( + { + name: 'dashboard.management', + places: [ + { + name: 'widget.widget-library', + icon: 'now_widgets', + state: 'home.widgets-bundles' + }, + { + name: 'dashboard.dashboards', + icon: 'dashboard', + state: 'home.dashboards' + } + ] + }, + { + name: 'audit-log.audit', + places: [ + { + name: 'audit-log.audit-logs', + icon: 'track_changes', + state: 'home.auditLogs' + } + ] + }); + } else if (authority === 'CUSTOMER_USER') { sections = [ { name: 'home.home', @@ -368,13 +350,25 @@ function Menu(userService, $state, $rootScope) { type: 'link', state: 'home.entityViews', icon: 'view_quilt' - }, + }]; + if (userService.isEdgesSupportEnabled()) { + sections.push( + { + name: 'edge.edges', + type: 'link', + state: 'home.edges', + icon: 'router' + } + ); + } + sections.push( { name: 'dashboard.dashboards', type: 'link', state: 'home.dashboards', icon: 'dashboard' - }]; + } + ); homeSections = [{ @@ -406,7 +400,23 @@ function Menu(userService, $state, $rootScope) { state: 'home.entityViews' } ] - }, + }]; + if (userService.isEdgesSupportEnabled()) { + homeSections.push( + { + name: 'edge.edges', + places: [ + { + name: 'edge.edges', + icon: 'router', + state: 'home.edges' + } + ] + + } + ); + } + homeSections.push( { name: 'dashboard.view-dashboards', places: [ @@ -416,12 +426,8 @@ function Menu(userService, $state, $rootScope) { state: 'home.dashboards' } ] - }]; - - if (userService.isEdgesSupportEnabled()) { - sections.splice(4, 0, edgeMenuSection.side); - homeSections.splice(3, 0, edgeMenuSection.home); - } + } + ); } } } From f0d21d94a3ae4faeba790ec8eca7610f9dedd761 Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Tue, 22 Dec 2020 05:16:03 +0200 Subject: [PATCH 05/19] Code beatify --- ui/src/app/services/menu.service.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/ui/src/app/services/menu.service.js b/ui/src/app/services/menu.service.js index f3bfbea470..4d2c74da63 100644 --- a/ui/src/app/services/menu.service.js +++ b/ui/src/app/services/menu.service.js @@ -217,16 +217,16 @@ function Menu(userService, $state, $rootScope) { icon: 'now_widgets' }, { - name: 'dashboard.dashboards', - type: 'link', - state: 'home.dashboards', - icon: 'dashboards' - }, + name: 'dashboard.dashboards', + type: 'link', + state: 'home.dashboards', + icon: 'dashboards' + }, { - name: 'audit-log.audit-logs', - type: 'link', - state: 'home.auditLogs', - icon: 'track_changes' + name: 'audit-log.audit-logs', + type: 'link', + state: 'home.auditLogs', + icon: 'track_changes' } ); @@ -412,7 +412,6 @@ function Menu(userService, $state, $rootScope) { state: 'home.edges' } ] - } ); } From 6c33cb351ab1dbec57b64f22c790cbb6b56410c3 Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Tue, 22 Dec 2020 15:26:47 +0200 Subject: [PATCH 06/19] Edge fieldset reorder and rename Manage... buttons --- ui/src/app/edge/edge-fieldset.tpl.html | 58 ++++++++++++++------------ 1 file changed, 31 insertions(+), 27 deletions(-) diff --git a/ui/src/app/edge/edge-fieldset.tpl.html b/ui/src/app/edge/edge-fieldset.tpl.html index 2f2195ec39..e96d12f391 100644 --- a/ui/src/app/edge/edge-fieldset.tpl.html +++ b/ui/src/app/edge/edge-fieldset.tpl.html @@ -15,34 +15,38 @@ limitations under the License. --> -{{ 'edge.assign-to-customer' | translate }} -{{ isPublic ? 'edge.make-private' : 'edge.unassign-from-customer' | translate }} -{{ 'edge.make-public' | translate }} -{{ 'edge.manage-edge-assets' | translate }} -{{ 'edge.manage-edge-devices' | translate }} -{{ 'edge.manage-edge-entity-views' | translate }} -{{ 'edge.manage-edge-dashboards' | translate }} -{{ 'edge.manage-edge-rulechains' | translate }} -{{ 'edge.delete' | translate }} +
+ {{ 'edge.assign-to-customer' | translate }} + {{ isPublic ? 'edge.make-private' : 'edge.unassign-from-customer' | translate }} + {{ 'edge.make-public' | translate }} + {{ 'edge.delete' | translate }} +
+
+ {{ 'edge.assets' | translate }} + {{ 'edge.devices' | translate }} + {{ 'edge.entity-views' | translate }} + {{ 'edge.dashboards' | translate }} + {{ 'edge.rulechains' | translate }} +
Date: Tue, 22 Dec 2020 15:55:21 +0200 Subject: [PATCH 07/19] Edge rule chains rename to Rule chain templates --- ui/src/app/customer/customer.controller.js | 2 +- ui/src/app/edge/edge-fieldset.tpl.html | 2 +- ui/src/app/edge/edge.routes.js | 10 +++++----- ui/src/app/locale/locale.constant-de_DE.json | 6 ++---- ui/src/app/locale/locale.constant-en_US.json | 8 +++----- ui/src/app/locale/locale.constant-es_ES.json | 4 +--- ui/src/app/locale/locale.constant-fr_FR.json | 4 +--- ui/src/app/rulechain/rulechain.routes.js | 8 ++++---- ui/src/app/services/menu.service.js | 14 +++++++------- 9 files changed, 25 insertions(+), 33 deletions(-) diff --git a/ui/src/app/customer/customer.controller.js b/ui/src/app/customer/customer.controller.js index c61962f9f3..2d1d2202a8 100644 --- a/ui/src/app/customer/customer.controller.js +++ b/ui/src/app/customer/customer.controller.js @@ -81,7 +81,7 @@ export default function CustomerController(customerService, $state, $stateParams onAction: function ($event, item) { openCustomerEdges($event, item); }, - name: function() { return $translate.instant('edge.edges') }, + name: function() { return $translate.instant('edge.edge-instances') }, details: function(customer) { if (customer && customer.additionalInfo && customer.additionalInfo.isPublic) { return $translate.instant('customer.manage-public-edges') diff --git a/ui/src/app/edge/edge-fieldset.tpl.html b/ui/src/app/edge/edge-fieldset.tpl.html index e96d12f391..05b4742f82 100644 --- a/ui/src/app/edge/edge-fieldset.tpl.html +++ b/ui/src/app/edge/edge-fieldset.tpl.html @@ -44,7 +44,7 @@ class="md-raised md-primary">{{ 'edge.dashboards' | translate }} {{ 'edge.rulechains' | translate }} + class="md-raised md-primary">{{ 'edge.rulechain-templates' | translate }}
diff --git a/ui/src/app/edge/edge.routes.js b/ui/src/app/edge/edge.routes.js index ccfb3a7b14..e4b0d72727 100644 --- a/ui/src/app/edge/edge.routes.js +++ b/ui/src/app/edge/edge.routes.js @@ -46,10 +46,10 @@ export default function EdgeRoutes($stateProvider, types) { searchEnabled: true, searchByEntitySubtype: true, searchEntityType: types.entityType.edge, - pageTitle: 'edge.edges' + pageTitle: 'edge.edge-instances' }, ncyBreadcrumb: { - label: '{"icon": "router", "label": "edge.edges"}' + label: '{"icon": "router", "label": "edge.edge-instances"}' } }).state('home.edges.entityViews', { url: '/:edgeId/entityViews', @@ -194,11 +194,11 @@ export default function EdgeRoutes($stateProvider, types) { }, data: { searchEnabled: true, - pageTitle: 'edge.rulechains', + pageTitle: 'edge.rulechain-templates', ruleChainsType: 'edge' }, ncyBreadcrumb: { - label: '{"icon": "code", "label": "rulechain.edge-rulechains"}' + label: '{"icon": "code", "label": "edge.rulechain-templates"}' } }).state('home.edges.ruleChains.ruleChain', { url: '/:ruleChainId', @@ -232,7 +232,7 @@ export default function EdgeRoutes($stateProvider, types) { data: { import: false, searchEnabled: false, - pageTitle: 'edge.rulechain' + pageTitle: 'edge.rulechain-templates' }, ncyBreadcrumb: { label: '{"icon": "code", "label": "{{ vm.ruleChain.name }}", "translate": "false"}' diff --git a/ui/src/app/locale/locale.constant-de_DE.json b/ui/src/app/locale/locale.constant-de_DE.json index 81558e7ab2..e209d61c85 100644 --- a/ui/src/app/locale/locale.constant-de_DE.json +++ b/ui/src/app/locale/locale.constant-de_DE.json @@ -431,7 +431,7 @@ "customer-required": "Kunde ist erforderlich", "select-default-customer": "Wählen Sie den Standardkunden aus.", "default-customer": "Standardkunde", - "edges": "Kunden Rand", + "edge-instances": "Kunden Rand", "default-customer-required": "Ein Standardkunde ist erforderlich, um das Dashboard auf Mandantenebene zu testen." }, "datetime": { @@ -730,7 +730,7 @@ }, "edge": { "edge": "Rand", - "edges": "Rand", + "edge-instances": "Rand", "management": "Rand verwalten", "no-edges-matching": "Keine passenden Rand '{{entity}}' gefunden.", "add": "Rand hinzufügen", @@ -1355,8 +1355,6 @@ "rulechain": { "rulechain": "Regelkette", "rulechains": "Regelketten", - "core-rulechains": "Kernregelketten", - "edge-rulechains": "Randregelketten", "root": "Wurzel", "delete": "Regelkette löschen", "name": "Name", diff --git a/ui/src/app/locale/locale.constant-en_US.json b/ui/src/app/locale/locale.constant-en_US.json index 5e02bc95b5..3bafe1813d 100644 --- a/ui/src/app/locale/locale.constant-en_US.json +++ b/ui/src/app/locale/locale.constant-en_US.json @@ -764,7 +764,7 @@ }, "edge": { "edge": "Edge", - "edges": "Edges", + "edge-instances": "Edge instances", "edge-file": "Edge file", "management": "Edge management", "no-edges-matching": "No edges matching '{{entity}}' were found.", @@ -828,8 +828,8 @@ "unassign-from-edge": "Unassign from edge", "dashboards": "Edge Dashboards", "manage-edge-rulechains": "Manage edge rule chains", - "rulechains": "Edge Rule Chains", - "rulechain": "Edge Rule Chain", + "rulechain-templates": "Rule chain templates", + "rulechain-template": "Rule chain template", "edge-key": "Edge key", "copy-edge-key": "Copy edge key", "edge-key-copied-message": "Edge key has been copied to clipboard", @@ -1549,8 +1549,6 @@ "rulechain": { "rulechain": "Rule chain", "rulechains": "Rule chains", - "core-rulechains": "Core Rule chains", - "edge-rulechains": "Edge Rule chains", "default-root": "Default root", "root": "Root", "delete": "Delete rule chain", diff --git a/ui/src/app/locale/locale.constant-es_ES.json b/ui/src/app/locale/locale.constant-es_ES.json index 060c762fec..59b354c191 100644 --- a/ui/src/app/locale/locale.constant-es_ES.json +++ b/ui/src/app/locale/locale.constant-es_ES.json @@ -743,7 +743,7 @@ }, "edge": { "edge": "Borde", - "edges": "Bordes", + "edge-instances": "Bordes", "management": "Gestión de bordes", "no-edges-matching": "No se encontraron bordes que coincidan con '{{entity}}'", "add": "Agregar borde", @@ -1423,8 +1423,6 @@ "rulechain": { "rulechain": "Cadena de reglas", "rulechains": "Cadenas de reglas", - "core-rulechains": "Cadenas de reglas centrales", - "edge-rulechains": "Cadenas de reglas de borde", "root": "Raíz", "delete": "Eliminar cadena de reglas", "name": "Nombre", diff --git a/ui/src/app/locale/locale.constant-fr_FR.json b/ui/src/app/locale/locale.constant-fr_FR.json index fcd2bc4d22..d6775567fb 100644 --- a/ui/src/app/locale/locale.constant-fr_FR.json +++ b/ui/src/app/locale/locale.constant-fr_FR.json @@ -748,7 +748,7 @@ }, "edge": { "edge": "Bordure", - "edges": "Bordures", + "edge-instances": "Bordures", "management": "Gestion des bordures", "no-edges-matching": "Aucun bordure correspondant à {{entity}} n'a été trouvé.", "add": "Ajouter un bordure", @@ -1429,8 +1429,6 @@ "rulechain-required": "Chaîne de règles requise", "rulechains": "Chaînes de règles", "select-rulechain": "Sélectionner la chaîne de règles", - "core-rulechains": "Chaînes de règles fondamentales", - "edge-rulechains": "Chaînes de règles de la bordure", "set-root": "Rend la chaîne de règles racine (root) ", "set-root-rulechain-text": "Après la confirmation, la chaîne de règles deviendra racine (root) et gérera tous les messages de transport entrants.", "set-root-rulechain-title": "Voulez-vous vraiment que la chaîne de règles '{{ruleChainName}} soit racine (root) ?", diff --git a/ui/src/app/rulechain/rulechain.routes.js b/ui/src/app/rulechain/rulechain.routes.js index a1d5da43e2..359579c9c8 100644 --- a/ui/src/app/rulechain/rulechain.routes.js +++ b/ui/src/app/rulechain/rulechain.routes.js @@ -139,11 +139,11 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider }, data: { searchEnabled: true, - pageTitle: 'rulechain.edge-rulechains', + pageTitle: 'edge.rulechain-templates', ruleChainsType: 'edges' }, ncyBreadcrumb: { - label: '{"icon": "code", "label": "rulechain.edge-rulechains"}' + label: '{"icon": "code", "label": "edge.rulechain-templates"}' } }).state('home.edges.edgeRuleChains.ruleChain', { url: '/:ruleChainId', @@ -177,7 +177,7 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider data: { import: false, searchEnabled: false, - pageTitle: 'edge.rulechain' + pageTitle: 'edge.rulechain-template' }, ncyBreadcrumb: { label: '{"icon": "code", "label": "{{ vm.ruleChain.name }}", "translate": "false"}' @@ -218,7 +218,7 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider data: { import: true, searchEnabled: true, - pageTitle: 'edge.rulechain' + pageTitle: 'edge.rulechain-template' }, ncyBreadcrumb: { label: '{"icon": "code", "label": "{{ (\'rulechain.import\' | translate) + \': \'+ vm.ruleChain.name }}", "translate": "false"}' diff --git a/ui/src/app/services/menu.service.js b/ui/src/app/services/menu.service.js index 4d2c74da63..6b0337d0ab 100644 --- a/ui/src/app/services/menu.service.js +++ b/ui/src/app/services/menu.service.js @@ -194,13 +194,13 @@ function Menu(userService, $state, $rootScope) { icon: 'router', pages: [ { - name: 'edge.edges', + name: 'edge.edge-instances', type: 'link', state: 'home.edges', icon: 'router' }, { - name: 'rulechain.edge-rulechains', + name: 'edge.rulechain-templates', type: 'link', state: 'home.edges.edgeRuleChains', icon: 'code' @@ -286,12 +286,12 @@ function Menu(userService, $state, $rootScope) { name: 'edge.management', places: [ { - name: 'edge.edges', + name: 'edge.edge-instances', icon: 'router', state: 'home.edges' }, { - name: 'rulechain.edge-rulechains', + name: 'edge.rulechain-templates', icon: 'code', state: 'home.edges.edgeRuleChains' } @@ -354,7 +354,7 @@ function Menu(userService, $state, $rootScope) { if (userService.isEdgesSupportEnabled()) { sections.push( { - name: 'edge.edges', + name: 'edge.edge-instances', type: 'link', state: 'home.edges', icon: 'router' @@ -404,10 +404,10 @@ function Menu(userService, $state, $rootScope) { if (userService.isEdgesSupportEnabled()) { homeSections.push( { - name: 'edge.edges', + name: 'edge.edge-instances', places: [ { - name: 'edge.edges', + name: 'edge.edge-instances', icon: 'router', state: 'home.edges' } From 314f5a7c00be846bf98e8b4da61f292d8e3bc87a Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Tue, 22 Dec 2020 20:54:46 +0200 Subject: [PATCH 08/19] Set default type for new edges, Customer edges renamed to Customer edge instances --- ui/src/app/edge/edge-fieldset.tpl.html | 19 ++++++++++--------- ui/src/app/edge/edge.directive.js | 1 + ui/src/app/locale/locale.constant-en_US.json | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/ui/src/app/edge/edge-fieldset.tpl.html b/ui/src/app/edge/edge-fieldset.tpl.html index 05b4742f82..42eee537b0 100644 --- a/ui/src/app/edge/edge-fieldset.tpl.html +++ b/ui/src/app/edge/edge-fieldset.tpl.html @@ -102,14 +102,6 @@ ng-model="edge.type" entity-type="types.entityType.edge"> - - - - - - - - @@ -126,7 +118,6 @@
- @@ -156,4 +147,14 @@
+
+ + + + + + + + +
diff --git a/ui/src/app/edge/edge.directive.js b/ui/src/app/edge/edge.directive.js index bdd3b44b67..a1efa67197 100644 --- a/ui/src/app/edge/edge.directive.js +++ b/ui/src/app/edge/edge.directive.js @@ -36,6 +36,7 @@ export default function EdgeDirective($compile, $templateCache, $translate, $mdD scope.edge.routingKey = utils.guid(''); scope.edge.secret = generateSecret(20); scope.edge.cloudEndpoint = utils.baseUrl(); + scope.edge.type = 'default'; } if (scope.edge.customerId && scope.edge.customerId.id !== types.id.nullUid) { scope.isAssignedToCustomer = true; diff --git a/ui/src/app/locale/locale.constant-en_US.json b/ui/src/app/locale/locale.constant-en_US.json index 3bafe1813d..343ead0099 100644 --- a/ui/src/app/locale/locale.constant-en_US.json +++ b/ui/src/app/locale/locale.constant-en_US.json @@ -457,7 +457,7 @@ "select-default-customer": "Select default customer", "default-customer": "Default customer", "default-customer-required": "Default customer is required in order to debug dashboard on Tenant level", - "edges": "Customer Edges" + "edges": "Customer edge instances" }, "datetime": { "date-from": "Date from", From 6ce3a7577f1e5e161286e9c3c4c9e66b03cf323d Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Tue, 22 Dec 2020 22:01:22 +0200 Subject: [PATCH 09/19] Edge license key tooltip. Code icon changed to settings_ethernet --- ui/src/app/edge/edge-fieldset.tpl.html | 17 +++++++++++++---- ui/src/app/edge/edge.controller.js | 2 +- ui/src/app/edge/edge.directive.js | 2 +- ui/src/app/edge/edge.routes.js | 4 ++-- ui/src/app/locale/locale.constant-en_US.json | 3 ++- ui/src/app/rulechain/rulechain.routes.js | 6 +++--- ui/src/app/services/menu.service.js | 4 ++-- 7 files changed, 24 insertions(+), 14 deletions(-) diff --git a/ui/src/app/edge/edge-fieldset.tpl.html b/ui/src/app/edge/edge-fieldset.tpl.html index 42eee537b0..01728b0b9a 100644 --- a/ui/src/app/edge/edge-fieldset.tpl.html +++ b/ui/src/app/edge/edge-fieldset.tpl.html @@ -100,15 +100,24 @@ tb-required="true" the-form="theForm" ng-model="edge.type" - entity-type="types.entityType.edge"> + entity-type="types.entityType.edge" + ng-value="defaultType"> - +
+
edge.edge-license-key-required
+ + + {{ 'edge.license-key-tooltip' | translate }} + + + +
@@ -147,7 +156,7 @@
-
+
@@ -156,5 +165,5 @@ -
+ diff --git a/ui/src/app/edge/edge.controller.js b/ui/src/app/edge/edge.controller.js index 0c9d42c584..6239789edc 100644 --- a/ui/src/app/edge/edge.controller.js +++ b/ui/src/app/edge/edge.controller.js @@ -283,7 +283,7 @@ export function EdgeController($rootScope, userService, edgeService, customerSer details: function() { return $translate.instant('edge.manage-edge-rulechains'); }, - icon: "code" + icon: "settings_ethernet" } ); diff --git a/ui/src/app/edge/edge.directive.js b/ui/src/app/edge/edge.directive.js index a1efa67197..6a56cbcd87 100644 --- a/ui/src/app/edge/edge.directive.js +++ b/ui/src/app/edge/edge.directive.js @@ -29,6 +29,7 @@ export default function EdgeDirective($compile, $templateCache, $translate, $mdD scope.isAssignedToCustomer = false; scope.isPublic = false; scope.assignedCustomer = null; + scope.defaultType = 'default'; scope.$watch('edge', function(newVal) { if (newVal) { @@ -36,7 +37,6 @@ export default function EdgeDirective($compile, $templateCache, $translate, $mdD scope.edge.routingKey = utils.guid(''); scope.edge.secret = generateSecret(20); scope.edge.cloudEndpoint = utils.baseUrl(); - scope.edge.type = 'default'; } if (scope.edge.customerId && scope.edge.customerId.id !== types.id.nullUid) { scope.isAssignedToCustomer = true; diff --git a/ui/src/app/edge/edge.routes.js b/ui/src/app/edge/edge.routes.js index e4b0d72727..bed701009a 100644 --- a/ui/src/app/edge/edge.routes.js +++ b/ui/src/app/edge/edge.routes.js @@ -198,7 +198,7 @@ export default function EdgeRoutes($stateProvider, types) { ruleChainsType: 'edge' }, ncyBreadcrumb: { - label: '{"icon": "code", "label": "edge.rulechain-templates"}' + label: '{"icon": "settings_ethernet", "label": "edge.rulechain-templates"}' } }).state('home.edges.ruleChains.ruleChain', { url: '/:ruleChainId', @@ -235,7 +235,7 @@ export default function EdgeRoutes($stateProvider, types) { pageTitle: 'edge.rulechain-templates' }, ncyBreadcrumb: { - label: '{"icon": "code", "label": "{{ vm.ruleChain.name }}", "translate": "false"}' + label: '{"icon": "settings_ethernet", "label": "{{ vm.ruleChain.name }}", "translate": "false"}' } }); } diff --git a/ui/src/app/locale/locale.constant-en_US.json b/ui/src/app/locale/locale.constant-en_US.json index 343ead0099..1849b6625a 100644 --- a/ui/src/app/locale/locale.constant-en_US.json +++ b/ui/src/app/locale/locale.constant-en_US.json @@ -852,7 +852,8 @@ "enter-edge-type": "Enter edge type", "no-edge-types-matching": "No edge types matching '{{entitySubtype}}' were found.", "edge-type-list-empty": "No edge types selected.", - "edge-types": "Edge types" + "edge-types": "Edge types", + "license-key-tooltip": "To get license key please visit www.thingsboard.io/edge" }, "error": { "unable-to-connect": "Unable to connect to the server! Please check your internet connection.", diff --git a/ui/src/app/rulechain/rulechain.routes.js b/ui/src/app/rulechain/rulechain.routes.js index 359579c9c8..9bdb5c2981 100644 --- a/ui/src/app/rulechain/rulechain.routes.js +++ b/ui/src/app/rulechain/rulechain.routes.js @@ -143,7 +143,7 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider ruleChainsType: 'edges' }, ncyBreadcrumb: { - label: '{"icon": "code", "label": "edge.rulechain-templates"}' + label: '{"icon": "settings_ethernet", "label": "edge.rulechain-templates"}' } }).state('home.edges.edgeRuleChains.ruleChain', { url: '/:ruleChainId', @@ -180,7 +180,7 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider pageTitle: 'edge.rulechain-template' }, ncyBreadcrumb: { - label: '{"icon": "code", "label": "{{ vm.ruleChain.name }}", "translate": "false"}' + label: '{"icon": "settings_ethernet", "label": "{{ vm.ruleChain.name }}", "translate": "false"}' } }).state('home.edges.edgeRuleChains.importRuleChain', { url: '/edges/ruleChains/import', @@ -221,7 +221,7 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider pageTitle: 'edge.rulechain-template' }, ncyBreadcrumb: { - label: '{"icon": "code", "label": "{{ (\'rulechain.import\' | translate) + \': \'+ vm.ruleChain.name }}", "translate": "false"}' + label: '{"icon": "settings_ethernet", "label": "{{ (\'rulechain.import\' | translate) + \': \'+ vm.ruleChain.name }}", "translate": "false"}' } }); } diff --git a/ui/src/app/services/menu.service.js b/ui/src/app/services/menu.service.js index 6b0337d0ab..2d01daccdf 100644 --- a/ui/src/app/services/menu.service.js +++ b/ui/src/app/services/menu.service.js @@ -203,7 +203,7 @@ function Menu(userService, $state, $rootScope) { name: 'edge.rulechain-templates', type: 'link', state: 'home.edges.edgeRuleChains', - icon: 'code' + icon: 'settings_ethernet' } ] } @@ -292,7 +292,7 @@ function Menu(userService, $state, $rootScope) { }, { name: 'edge.rulechain-templates', - icon: 'code', + icon: 'settings_ethernet', state: 'home.edges.edgeRuleChains' } ] From a083719de40e63eeab734253312ad0a29b0e021a Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Wed, 23 Dec 2020 06:37:04 +0200 Subject: [PATCH 10/19] Rename edge Default rule chain to Auto-assign --- ui/src/app/locale/locale.constant-en_US.json | 14 +++++----- ui/src/app/rulechain/rulechain-card.tpl.html | 2 +- .../app/rulechain/rulechain-fieldset.tpl.html | 6 ++--- ui/src/app/rulechain/rulechain.directive.js | 4 +-- ui/src/app/rulechain/rulechains.controller.js | 26 +++++++++---------- ui/src/app/rulechain/rulechains.tpl.html | 4 +-- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/ui/src/app/locale/locale.constant-en_US.json b/ui/src/app/locale/locale.constant-en_US.json index 1849b6625a..d6774ea114 100644 --- a/ui/src/app/locale/locale.constant-en_US.json +++ b/ui/src/app/locale/locale.constant-en_US.json @@ -1587,7 +1587,7 @@ "assign-rulechains": "Assign rulechains", "assign-new-rulechain": "Assign new rulechain", "delete-rulechains": "Delete rulechains", - "default": "Default", + "auto-assign-to-edge": "Auto-assign to edge(s)", "unassign-rulechain": "Unassign rulechain", "unassign-rulechains": "Unassign rulechains", "unassign-rulechain-title": "Are you sure you want to unassign the rulechain '{{ruleChainTitle}}'?", @@ -1601,12 +1601,12 @@ "set-default-root-edge-rulechain-title": "Are you sure you want to make the rule chain '{{ruleChainName}}' default edge root?", "set-default-root-edge-rulechain-text": "After the confirmation the rule chain will become default edge root and will handle all incoming transport messages.", "invalid-rulechain-type-error": "Unable to import rule chain: Invalid rule chain type. Expected type is {{expectedRuleChainType}}.", - "set-default-edge": "Make rule chain default", - "set-default-edge-title": "Are you sure you want to make the edge rule chain '{{ruleChainName}}' default?", - "set-default-edge-text": "After the confirmation the edge rule chain will be added to default list and assigned to newly created edge(s).", - "remove-default-edge": "Remove rule chain from defaults", - "remove-default-edge-title": "Are you sure you want to remove the edge rule chain '{{ruleChainName}}' from default list?", - "remove-default-edge-text": "After the confirmation the edge rule chain will not be assigned for a newly created edges." + "set-auto-assign-to-edge": "Auto-assign rule chain to edge(s) on creation", + "set-auto-assign-to-edge-title": "Are you sure you want to auto-assign the edge rule chain '{{ruleChainName}}' to edge(s) on creation?", + "set-auto-assign-to-edge-text": "After the confirmation the edge rule chain will be automatically assigned to edge(s) on creation.", + "remove-auto-assign-to-edge": "Do not assign rule chain to edge(s) on creation", + "remove-auto-assign-to-edge-title": "Are you sure you do not want to auto-assign the edge rule chain '{{ruleChainName}}' to edge(s) on creation?", + "remove-auto-assign-to-edge-text": "After the confirmation the edge rule chain won't be automatically assigned to edge(s) on creation." }, "rulenode": { "details": "Details", diff --git a/ui/src/app/rulechain/rulechain-card.tpl.html b/ui/src/app/rulechain/rulechain-card.tpl.html index e4df4c9471..95e7b4fd2b 100644 --- a/ui/src/app/rulechain/rulechain-card.tpl.html +++ b/ui/src/app/rulechain/rulechain-card.tpl.html @@ -20,4 +20,4 @@
rulechain.default-root
-
rulechain.default
+
rulechain.auto-assign-to-edge
diff --git a/ui/src/app/rulechain/rulechain-fieldset.tpl.html b/ui/src/app/rulechain/rulechain-fieldset.tpl.html index 5d3bf08739..223806386f 100644 --- a/ui/src/app/rulechain/rulechain-fieldset.tpl.html +++ b/ui/src/app/rulechain/rulechain-fieldset.tpl.html @@ -26,12 +26,12 @@ {{ 'rulechain.set-default-root-edge' | translate }} -{{ 'rulechain.set-default-edge' | translate }} + class="md-raised md-primary">{{ 'rulechain.set-auto-assign-to-edge' | translate }} {{ 'rulechain.remove-default-edge' | translate }} + class="md-raised md-primary">{{ 'rulechain.remove-auto-assign-to-edge' | translate }} From 59018f12847c1d3e5add639b15bff4ecc7cc6e45 Mon Sep 17 00:00:00 2001 From: deaflynx Date: Wed, 23 Dec 2020 10:24:19 +0200 Subject: [PATCH 11/19] Set 'default' as default edge type, added hints to cloudEndpoint, licenseKey --- ui/src/app/edge/edge-fieldset.tpl.html | 15 ++++----------- ui/src/app/edge/edge.directive.js | 2 +- ui/src/app/locale/locale.constant-en_US.json | 3 ++- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/ui/src/app/edge/edge-fieldset.tpl.html b/ui/src/app/edge/edge-fieldset.tpl.html index 01728b0b9a..aee00875b9 100644 --- a/ui/src/app/edge/edge-fieldset.tpl.html +++ b/ui/src/app/edge/edge-fieldset.tpl.html @@ -100,24 +100,17 @@ tb-required="true" the-form="theForm" ng-model="edge.type" - entity-type="types.entityType.edge" - ng-value="defaultType"> + entity-type="types.entityType.edge"> -
- +
edge.license-key-hint
+
edge.edge-license-key-required
- - - {{ 'edge.license-key-tooltip' | translate }} - - - -
+
edge.cloud-endpoint-hint
diff --git a/ui/src/app/edge/edge.directive.js b/ui/src/app/edge/edge.directive.js index 6a56cbcd87..a1efa67197 100644 --- a/ui/src/app/edge/edge.directive.js +++ b/ui/src/app/edge/edge.directive.js @@ -29,7 +29,6 @@ export default function EdgeDirective($compile, $templateCache, $translate, $mdD scope.isAssignedToCustomer = false; scope.isPublic = false; scope.assignedCustomer = null; - scope.defaultType = 'default'; scope.$watch('edge', function(newVal) { if (newVal) { @@ -37,6 +36,7 @@ export default function EdgeDirective($compile, $templateCache, $translate, $mdD scope.edge.routingKey = utils.guid(''); scope.edge.secret = generateSecret(20); scope.edge.cloudEndpoint = utils.baseUrl(); + scope.edge.type = 'default'; } if (scope.edge.customerId && scope.edge.customerId.id !== types.id.nullUid) { scope.isAssignedToCustomer = true; diff --git a/ui/src/app/locale/locale.constant-en_US.json b/ui/src/app/locale/locale.constant-en_US.json index d6774ea114..77bd29dcb6 100644 --- a/ui/src/app/locale/locale.constant-en_US.json +++ b/ui/src/app/locale/locale.constant-en_US.json @@ -853,7 +853,8 @@ "no-edge-types-matching": "No edge types matching '{{entitySubtype}}' were found.", "edge-type-list-empty": "No edge types selected.", "edge-types": "Edge types", - "license-key-tooltip": "To get license key please visit www.thingsboard.io/edge" + "license-key-hint": "To obtain your license please navigate to the pricing page and select the best license option for your case.", + "cloud-endpoint-hint": "Edge requires HTTP(s) access to Cloud (ThingsBoard CE/PE) to verify the license key. Please specify Cloud URL that Edge is able to connect to." }, "error": { "unable-to-connect": "Unable to connect to the server! Please check your internet connection.", From 908a89bfc5dd5581fa17e3258faae6a67746cf79 Mon Sep 17 00:00:00 2001 From: deaflynx Date: Wed, 23 Dec 2020 12:58:11 +0200 Subject: [PATCH 12/19] Remove edge type from relations in case edge is disabled --- ui/src/app/api/entity.service.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ui/src/app/api/entity.service.js b/ui/src/app/api/entity.service.js index df684c334e..153fe11b50 100644 --- a/ui/src/app/api/entity.service.js +++ b/ui/src/app/api/entity.service.js @@ -910,6 +910,9 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device } } } + if (userService.isEdgesSupportEnabled()) { + delete entityTypes.edge; + } return entityTypes; } From 318019d10c1a4948a6dd4e5b32470b9ded9ad1d5 Mon Sep 17 00:00:00 2001 From: deaflynx Date: Wed, 23 Dec 2020 12:58:29 +0200 Subject: [PATCH 13/19] Remove edge type from relations in case edge is disabled --- ui/src/app/api/entity.service.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/app/api/entity.service.js b/ui/src/app/api/entity.service.js index 153fe11b50..56e4378eba 100644 --- a/ui/src/app/api/entity.service.js +++ b/ui/src/app/api/entity.service.js @@ -910,7 +910,7 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device } } } - if (userService.isEdgesSupportEnabled()) { + if (!userService.isEdgesSupportEnabled()) { delete entityTypes.edge; } return entityTypes; From 5aa8ad1755145da0636ae7cd91e3a200dbd2d350 Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Thu, 24 Dec 2020 09:16:54 +0200 Subject: [PATCH 14/19] Hide edge type in alias types --- ui/src/app/entity/entity-filter.directive.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/src/app/entity/entity-filter.directive.js b/ui/src/app/entity/entity-filter.directive.js index 629433545d..c79739cdd4 100644 --- a/ui/src/app/entity/entity-filter.directive.js +++ b/ui/src/app/entity/entity-filter.directive.js @@ -22,7 +22,7 @@ import entityFilterTemplate from './entity-filter.tpl.html'; import './entity-filter.scss'; /*@ngInject*/ -export default function EntityFilterDirective($compile, $templateCache, $q, $document, $mdDialog, types, entityService) { +export default function EntityFilterDirective($compile, $templateCache, $q, $document, $mdDialog, types, entityService, userService) { var linker = function (scope, element, attrs, ngModelCtrl) { @@ -31,6 +31,9 @@ export default function EntityFilterDirective($compile, $templateCache, $q, $doc scope.ngModelCtrl = ngModelCtrl; scope.types = types; + if (userService.isEdgesSupportEnabled()) { + scope.allowedEntityTypes = Object.values(types.entityType).filter(entityType => entityType !== types.entityType.edge); + } scope.aliasFilterTypes = entityService.getAliasFilterTypesByEntityTypes(scope.allowedEntityTypes); scope.$watch('filter.type', function (newType, prevType) { From f71aec543afc6e55028c9a1bc6bd8670796ec746 Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Thu, 24 Dec 2020 09:17:03 +0200 Subject: [PATCH 15/19] Hide edge type in alias types --- ui/src/app/entity/entity-filter.directive.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/src/app/entity/entity-filter.directive.js b/ui/src/app/entity/entity-filter.directive.js index c79739cdd4..e29fbf4a78 100644 --- a/ui/src/app/entity/entity-filter.directive.js +++ b/ui/src/app/entity/entity-filter.directive.js @@ -31,7 +31,7 @@ export default function EntityFilterDirective($compile, $templateCache, $q, $doc scope.ngModelCtrl = ngModelCtrl; scope.types = types; - if (userService.isEdgesSupportEnabled()) { + if (!userService.isEdgesSupportEnabled()) { scope.allowedEntityTypes = Object.values(types.entityType).filter(entityType => entityType !== types.entityType.edge); } scope.aliasFilterTypes = entityService.getAliasFilterTypesByEntityTypes(scope.allowedEntityTypes); From 790da527f4caec5396b9c358daa8d70582442b27 Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Thu, 24 Dec 2020 13:24:45 +0200 Subject: [PATCH 16/19] Edge events with translations --- ui/src/app/common/types.constant.js | 123 +++++++++++++++++- .../app/event/event-row-edge-event.tpl.html | 4 +- ui/src/app/event/event-table.directive.js | 18 ++- ui/src/app/locale/locale.constant-en_US.json | 12 +- 4 files changed, 151 insertions(+), 6 deletions(-) diff --git a/ui/src/app/common/types.constant.js b/ui/src/app/common/types.constant.js index a9a833bd7e..e43dd9aa8a 100644 --- a/ui/src/app/common/types.constant.js +++ b/ui/src/app/common/types.constant.js @@ -1076,6 +1076,127 @@ export default angular.module('thingsboard.types', []) }, translate: { customTranslationsPrefix: "custom." - } + }, + edgeEventActionType: { + "ADDED": { + name: "audit-log.type-added" + }, + "DELETED": { + name: "audit-log.type-deleted" + }, + "UPDATED": { + name: "audit-log.type-updated" + }, + "ATTRIBUTES_UPDATED": { + name: "audit-log.type-attributes-updated" + }, + "ATTRIBUTES_DELETED": { + name: "audit-log.type-attributes-deleted" + }, + "RPC_CALL": { + name: "audit-log.type-rpc-call" + }, + "CREDENTIALS_UPDATED": { + name: "audit-log.type-credentials-updated" + }, + "RELATION_ADD_OR_UPDATE": { + name: "audit-log.type-relation-add-or-update" + }, + "RELATION_DELETED": { + name: "audit-log.type-relation-delete" + }, + "ALARM_ACK": { + name: "audit-log.type-alarm-ack" + }, + "ALARM_CLEAR": { + name: "audit-log.type-alarm-clear" + }, + "CREDENTIALS_REQUEST": { + name: "edge.credentials-request" + }, + "ATTRIBUTES_REQUEST": { + name: "edge.attributes-request" + }, + "TIMESERIES_UPDATED": { + name: "edge.timeseries-updated" + }, + "RELATION_REQUEST": { + name: "edge.relation-request" + }, + "RULE_CHAIN_METADATA_REQUEST": { + name: "edge.rule-chain-metadata-request" + }, + "GROUP_ENTITIES_REQUEST": { + name: "edge.group_entities_request" + }, + "GROUP_PERMISSIONS_REQUEST": { + name: "edge.group-permissions-request" + }, + "ASSIGNED_TO_EDGE": { + name: "audit-log.type-assigned-to-edge" + }, + "UNASSIGNED_FROM_EDGE": { + name: "audit-log.type-unassigned-from-edge" + } + }, + edgeEventTypeTranslations:{ + "DASHBOARD": { + name: "entity.type-dashboard" + }, + "ASSET": { + name: "entity.type-asset" + }, + "DEVICE": { + name: "entity.type-device" + }, + "ENTITY_VIEW": { + name: "entity.type-entity_view" + }, + "ALARM": { + name: "entity.type-alarm" + }, + "RULE_CHAIN": { + name: "entity.type-rulechain" + }, + "RULE_CHAIN_META_DATA": { + name: "entity.type-rule-chain-metadata" + }, + "EDGE": { + name: "entity.type-edge" + }, + "USER": { + name: "entity.type-user" + }, + "CUSTOMER": { + name: "entity.type-customer" + }, + "RELATION": { + name: "entity.type-relation" + }, + "ENTITY_GROUP": { + name: "entity.type-entity-group" + }, + "SCHEDULER_EVENT": { + name: "entity.type-scheduler-event" + }, + "WHITE_LABELING": { + name: "white-labeling.white-labeling" + }, + "LOGIN_WHITE_LABELING": { + name: "white-labeling.login-white-labeling" + }, + "CUSTOM_TRANSLATION": { + name: "custom-translation.custom-translation", + }, + "WIDGETS_BUNDLE": { + name: "widget.widget-bundle" + }, + "WIDGET_TYPE": { + name: "widget.type" + }, + "ADMIN_SETTINGS": { + name: "permission.resource.display-type.ADMIN_SETTINGS" + } + }, } ).name; diff --git a/ui/src/app/event/event-row-edge-event.tpl.html b/ui/src/app/event/event-row-edge-event.tpl.html index 01b6c6e261..c88d98855a 100644 --- a/ui/src/app/event/event-row-edge-event.tpl.html +++ b/ui/src/app/event/event-row-edge-event.tpl.html @@ -16,8 +16,8 @@ -->
{{ event.createdTime | date : 'yyyy-MM-dd HH:mm:ss' }}
-
{{ event.type }}
-
{{ event.action }}
+
{{ event.edgeEventTypeText }}
+
{{ event.edgeEventActionText }}
{{ event.entityId }}
{{ updateStatus(event.createdTime) }}
diff --git a/ui/src/app/event/event-table.directive.js b/ui/src/app/event/event-table.directive.js index 746f82c405..ba41da8c34 100644 --- a/ui/src/app/event/event-table.directive.js +++ b/ui/src/app/event/event-table.directive.js @@ -22,7 +22,7 @@ import eventTableTemplate from './event-table.tpl.html'; /* eslint-enable import/no-unresolved, import/default */ /*@ngInject*/ -export default function EventTableDirective($compile, $templateCache, $rootScope, types, +export default function EventTableDirective($compile, $templateCache, $rootScope, $translate, types, eventService, edgeService, attributeService) { var linker = function (scope, element, attrs) { @@ -118,7 +118,11 @@ export default function EventTableDirective($compile, $templateCache, $rootScope scope.events.pending = true; promise.then( function success(events) { - scope.events.data = scope.events.data.concat(events.data); + if (scope.eventType === types.eventType.edgeEvent.value) { + scope.events.data = scope.events.data.concat(prepareEdgeEventData(events.data)); + } else { + scope.events.data = scope.events.data.concat(events.data); + } scope.events.nextPageLink = events.nextPageLink; scope.events.hasNext = events.hasNext; if (scope.events.hasNext) { @@ -266,6 +270,16 @@ export default function EventTableDirective($compile, $templateCache, $rootScope $compile(element.contents())(scope); } + + function prepareEdgeEventData(data) { + data.forEach( + edgeEvent => { + edgeEvent.edgeEventActionText = $translate.instant(types.edgeEventActionType[edgeEvent.action].name); + edgeEvent.edgeEventTypeText = $translate.instant(types.edgeEventTypeTranslations[edgeEvent.edgeId.entityType].name); + } + ); + return data; + } return { restrict: "E", diff --git a/ui/src/app/locale/locale.constant-en_US.json b/ui/src/app/locale/locale.constant-en_US.json index 77bd29dcb6..1469f23de4 100644 --- a/ui/src/app/locale/locale.constant-en_US.json +++ b/ui/src/app/locale/locale.constant-en_US.json @@ -854,7 +854,17 @@ "edge-type-list-empty": "No edge types selected.", "edge-types": "Edge types", "license-key-hint": "To obtain your license please navigate to the pricing page and select the best license option for your case.", - "cloud-endpoint-hint": "Edge requires HTTP(s) access to Cloud (ThingsBoard CE/PE) to verify the license key. Please specify Cloud URL that Edge is able to connect to." + "cloud-endpoint-hint": "Edge requires HTTP(s) access to Cloud (ThingsBoard CE/PE) to verify the license key. Please specify Cloud URL that Edge is able to connect to.", + + "set-edge-template-root-rulechain": "Make rule chain edge template root", + "set-edge-template-root-rulechain-title": "Are you sure you want to make the rule chain '{{ruleChainName}}' edge template root?", + "set-edge-template-root-rulechain-text": "After the confirmation the rule chain will become edge template root and will be root rule chain for a newly created edges.", + "set-auto-assign-to-edge": "Assign rule chain to edge(s) on creation", + "set-auto-assign-to-edge-title": "Are you sure you want to assign the edge rule chain '{{ruleChainName}}' to edge(s) on creation?", + "set-auto-assign-to-edge-text": "After the confirmation the edge rule chain will be automatically assigned to edge(s) on creation.", + "unset-auto-assign-to-edge": "Unset assign rule chain to edge(s) on creation", + "unset-auto-assign-to-edge-title": "Are you sure you want to unset assign the edge rule chain '{{ruleChainName}}' to edge(s) on creation?", + "unset-auto-assign-to-edge-text": "After the confirmation the edge rule chain will no longer be automatically assigned to edge(s) on creation." }, "error": { "unable-to-connect": "Unable to connect to the server! Please check your internet connection.", From 633de57330605ba60d6600e37ebbfc265de2a9ad Mon Sep 17 00:00:00 2001 From: Artem Babak Date: Thu, 24 Dec 2020 15:38:02 +0200 Subject: [PATCH 17/19] EdgeEvents columns width --- ui/src/app/event/event-header-edge-event.tpl.html | 6 +++--- ui/src/app/event/event-row-edge-event.tpl.html | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ui/src/app/event/event-header-edge-event.tpl.html b/ui/src/app/event/event-header-edge-event.tpl.html index e84922f6a5..3de281ddc7 100644 --- a/ui/src/app/event/event-header-edge-event.tpl.html +++ b/ui/src/app/event/event-header-edge-event.tpl.html @@ -16,8 +16,8 @@ -->
event.event-time
-
event.event-type
-
edge.event-action
-
edge.entity-id
+
event.event-type
+
edge.event-action
+
edge.entity-id
edge.status
edge.entity-info
diff --git a/ui/src/app/event/event-row-edge-event.tpl.html b/ui/src/app/event/event-row-edge-event.tpl.html index c88d98855a..a842b5d787 100644 --- a/ui/src/app/event/event-row-edge-event.tpl.html +++ b/ui/src/app/event/event-row-edge-event.tpl.html @@ -16,9 +16,9 @@ -->
{{ event.createdTime | date : 'yyyy-MM-dd HH:mm:ss' }}
-
{{ event.edgeEventTypeText }}
-
{{ event.edgeEventActionText }}
-
{{ event.entityId }}
+
{{ event.edgeEventTypeText }}
+
{{ event.edgeEventActionText }}
+
{{ event.entityId }}
{{ updateStatus(event.createdTime) }}
Date: Thu, 24 Dec 2020 17:43:11 +0200 Subject: [PATCH 18/19] Rule chains default to auto-assign style refactor --- ui/src/app/locale/locale.constant-de_DE.json | 20 ++++---- ui/src/app/locale/locale.constant-en_US.json | 29 +++++------ ui/src/app/locale/locale.constant-es_ES.json | 20 ++++---- ui/src/app/locale/locale.constant-fr_FR.json | 20 ++++---- ui/src/app/rulechain/rulechain-card.tpl.html | 4 +- .../app/rulechain/rulechain-fieldset.tpl.html | 49 +++++++++---------- ui/src/app/rulechain/rulechain.directive.js | 2 +- ui/src/app/rulechain/rulechains.controller.js | 34 ++++++------- ui/src/app/rulechain/rulechains.tpl.html | 4 +- 9 files changed, 87 insertions(+), 95 deletions(-) diff --git a/ui/src/app/locale/locale.constant-de_DE.json b/ui/src/app/locale/locale.constant-de_DE.json index e209d61c85..6c69c25910 100644 --- a/ui/src/app/locale/locale.constant-de_DE.json +++ b/ui/src/app/locale/locale.constant-de_DE.json @@ -1391,7 +1391,6 @@ "assign-rulechains": "Regelketten zuweisen", "assign-new-rulechain": "Neues Regelkette zuweisen", "delete-rulechains": "Regelketten löschen", - "default": "Standard", "unassign-rulechain": "Nicht zugeordnete Regelkette", "unassign-rulechains": "Nicht zugeordnete Regelketten", "unassign-rulechain-title": "Möchten Sie die Zuordnung die Regelkette '{{ruleChainTitle}}' wirklich aufheben?", @@ -1401,16 +1400,17 @@ "unassign-rulechains-from-edge-text": "Nach der Bestätigung wird die Zuordnung aller ausgewählten Regelketten aufgehoben und sie sind für den Rand nicht mehr zugänglich.", "assign-rulechain-to-edge": "Regelkette(n) dem Rand zuordnen", "assign-rulechain-to-edge-text": "Bitte wählen Sie die Regelketten aus, die Sie dem Rand zuordnen möchten", - "set-default-root-edge": "Machen Sie Randregelkette zur Wurzel Standard", - "set-default-root-edge-rulechain-title": "Sind Sie sicher, dass Sie die Randregelkette '{{ruleChainName}}' zur Wurzel machen Standard?", - "set-default-root-edge-rulechain-text": "Nach der Bestätigung wird die Randregelkette zur Wurzel Standard und behandelt alle eingehenden Transportnachrichten.", + "set-edge-template-root-rulechain": "Regelkette als Rand der Kantenvorlage erstellen", + "set-edge-template-root-rulechain-title": "Möchten Sie die Kantenvorlage der Regelkette '{{ruleChainName}}' wirklich als Root festlegen?", + "set-edge-template-root-rulechain-text": "Nach der Bestätigung wird die Regelkette zum Stamm der Kantenvorlage und zur Stammregelkette für neu erstellte Kanten.", "invalid-rulechain-type-error": "Regelkette konnte nicht importiert werden: Ungültige Regelkettentyp. Erwarteter Typ ist {{expectedRuleChainType}}.", - "set-default-edge": "Machen Sie Regelkette Standard", - "set-default-edge-title": "Sind Sie sicher, dass Sie die Randregelkette '{{ruleChainName}}' machen Standard?", - "set-default-edge-text": "Nach der Bestätigung wird die Randregelkette für neu erstellte Rand vergeben.", - "remove-default-edge": "Randregelkette Standard entfernen", - "remove-default-edge-title": "Sind Sie sicher, dass Sie die Randregelkette '{{ruleChainName}}' aus der Standardliste entfernen?", - "remove-default-edge-text": "Nach der Bestätigung wird die Randregelkette nicht für neu erstellte Rand vergeben." + "set-auto-assign-to-edge": "Weisen Sie den Kanten bei der Erstellung eine Regelkette zu", + "set-auto-assign-to-edge-title": "Sind Sie sicher, dass Sie die Kantenregelkette '{{ruleChainName}}' bei der Erstellung den Kanten zuweisen möchten? ", + "set-auto-assign-to-edge-text": "Nach der Bestätigung wird die Kantenregelkette bei der Erstellung automatisch den Kanten zugewiesen.", + "unset-auto-assign-to-edge": "Weisen Sie Kanten bei der Erstellung keine Regelkette zu", + "unset-auto-assign-to-edge-title": "Sind Sie sicher, dass Sie die Kantenregelkette '{{ruleChainName}}' bei der Erstellung nicht den Kanten zuweisen möchten?", + "unset-auto-assign-to-edge-text": "Nach der Bestätigung wird die Kantenregelkette bei der Erstellung nicht mehr automatisch den Kanten zugewiesen.", + "edge-template-root": "Vorlagenstamm" }, "rulenode": { "details": "Details", diff --git a/ui/src/app/locale/locale.constant-en_US.json b/ui/src/app/locale/locale.constant-en_US.json index 1469f23de4..e04d152b43 100644 --- a/ui/src/app/locale/locale.constant-en_US.json +++ b/ui/src/app/locale/locale.constant-en_US.json @@ -854,17 +854,7 @@ "edge-type-list-empty": "No edge types selected.", "edge-types": "Edge types", "license-key-hint": "To obtain your license please navigate to the pricing page and select the best license option for your case.", - "cloud-endpoint-hint": "Edge requires HTTP(s) access to Cloud (ThingsBoard CE/PE) to verify the license key. Please specify Cloud URL that Edge is able to connect to.", - - "set-edge-template-root-rulechain": "Make rule chain edge template root", - "set-edge-template-root-rulechain-title": "Are you sure you want to make the rule chain '{{ruleChainName}}' edge template root?", - "set-edge-template-root-rulechain-text": "After the confirmation the rule chain will become edge template root and will be root rule chain for a newly created edges.", - "set-auto-assign-to-edge": "Assign rule chain to edge(s) on creation", - "set-auto-assign-to-edge-title": "Are you sure you want to assign the edge rule chain '{{ruleChainName}}' to edge(s) on creation?", - "set-auto-assign-to-edge-text": "After the confirmation the edge rule chain will be automatically assigned to edge(s) on creation.", - "unset-auto-assign-to-edge": "Unset assign rule chain to edge(s) on creation", - "unset-auto-assign-to-edge-title": "Are you sure you want to unset assign the edge rule chain '{{ruleChainName}}' to edge(s) on creation?", - "unset-auto-assign-to-edge-text": "After the confirmation the edge rule chain will no longer be automatically assigned to edge(s) on creation." + "cloud-endpoint-hint": "Edge requires HTTP(s) access to Cloud (ThingsBoard CE/PE) to verify the license key. Please specify Cloud URL that Edge is able to connect to." }, "error": { "unable-to-connect": "Unable to connect to the server! Please check your internet connection.", @@ -1561,7 +1551,6 @@ "rulechain": { "rulechain": "Rule chain", "rulechains": "Rule chains", - "default-root": "Default root", "root": "Root", "delete": "Delete rule chain", "name": "Name", @@ -1598,7 +1587,7 @@ "assign-rulechains": "Assign rulechains", "assign-new-rulechain": "Assign new rulechain", "delete-rulechains": "Delete rulechains", - "auto-assign-to-edge": "Auto-assign to edge(s)", + "set-auto-assign-to-edge-card": "Assign to edge(s) on creation", "unassign-rulechain": "Unassign rulechain", "unassign-rulechains": "Unassign rulechains", "unassign-rulechain-title": "Are you sure you want to unassign the rulechain '{{ruleChainTitle}}'?", @@ -1611,13 +1600,17 @@ "set-default-root-edge": "Make rule chain default root", "set-default-root-edge-rulechain-title": "Are you sure you want to make the rule chain '{{ruleChainName}}' default edge root?", "set-default-root-edge-rulechain-text": "After the confirmation the rule chain will become default edge root and will handle all incoming transport messages.", + "set-edge-template-root-rulechain": "Make rule chain as edge template root", + "set-edge-template-root-rulechain-title": "Are you sure you want to make the rule chain '{{ruleChainName}}' edge template root?", + "set-edge-template-root-rulechain-text": "After the confirmation the rule chain will become edge template root and will be root rule chain for a newly created edges.", "invalid-rulechain-type-error": "Unable to import rule chain: Invalid rule chain type. Expected type is {{expectedRuleChainType}}.", - "set-auto-assign-to-edge": "Auto-assign rule chain to edge(s) on creation", - "set-auto-assign-to-edge-title": "Are you sure you want to auto-assign the edge rule chain '{{ruleChainName}}' to edge(s) on creation?", + "set-auto-assign-to-edge": "Assign rule chain to edge(s) on creation", + "set-auto-assign-to-edge-title": "Are you sure you want to assign the edge rule chain '{{ruleChainName}}' to edge(s) on creation?", "set-auto-assign-to-edge-text": "After the confirmation the edge rule chain will be automatically assigned to edge(s) on creation.", - "remove-auto-assign-to-edge": "Do not assign rule chain to edge(s) on creation", - "remove-auto-assign-to-edge-title": "Are you sure you do not want to auto-assign the edge rule chain '{{ruleChainName}}' to edge(s) on creation?", - "remove-auto-assign-to-edge-text": "After the confirmation the edge rule chain won't be automatically assigned to edge(s) on creation." + "unset-auto-assign-to-edge": "Do not assign rule chain to edge(s) on creation", + "unset-auto-assign-to-edge-title": "Are you sure you do not want to assign the edge rule chain '{{ruleChainName}}' to edge(s) on creation?", + "unset-auto-assign-to-edge-text": "After the confirmation the edge rule chain will no longer be automatically assigned to edge(s) on creation.", + "edge-template-root": "Template Root" }, "rulenode": { "details": "Details", diff --git a/ui/src/app/locale/locale.constant-es_ES.json b/ui/src/app/locale/locale.constant-es_ES.json index 59b354c191..301e292de2 100644 --- a/ui/src/app/locale/locale.constant-es_ES.json +++ b/ui/src/app/locale/locale.constant-es_ES.json @@ -1459,7 +1459,6 @@ "assign-rulechains": "Asignar cadenas de reglas", "assign-new-rulechain": "Asignar nueva cadena de reglas", "delete-rulechains": "Eliminar cadenas de reglas", - "default": "Predeterminado", "unassign-rulechain": "Anular asignación de cadena de reglas", "unassign-rulechains": "Anular asignación de cadenas de reglas", "unassign-rulechain-title": "¿Está seguro de que desea desasignar la cadena de reglas '{{ruleChainTitle}}'?", @@ -1469,16 +1468,17 @@ "unassign-rulechains-from-edge-text": "Después de la confirmación, todas las cadenas de reglas seleccionadas quedarán sin asignar y el borde no podrá acceder a ellas", "assign-rulechain-to-edge": "Asignar cadena (s) de reglas a borde", "assign-rulechain-to-edge-text": "Seleccione las cadenas de reglas para asignar al borde", - "set-default-root-edge": "Hacer que la cadena de reglas sea la raíz predeterminada", - "set-default-root-edge-rulechain-title": "¿Está seguro de que desea hacer que la cadena de reglas '{{ruleChainName}}' sea la raíz de borde predeterminada?", - "set-default-root-edge-rulechain-text": "Después de la confirmación, la cadena de reglas se convertirá en raíz raíz predeterminada y manejará todos los mensajes de transporte entrantes", + "set-edge-template-root-rulechain": "Hacer una cadena de reglas como raíz de la plantilla de borde", + "set-edge-template-root-rulechain-title": "¿Está seguro de que desea que la cadena de reglas '{{ruleChainName}}' sea la raíz de la plantilla de borde?", + "set-edge-template-root-rulechain-text": "Después de la confirmación, la cadena de reglas se convertirá en la raíz de la plantilla de borde y será la cadena de reglas raíz para los bordes recién creados.", "invalid-rulechain-type-error": "No se puede importar la cadena de reglas: Tipo de cadena de reglas no válido. El tipo esperado es {{expectedRuleChainType}}", - "set-default-edge": "Hacer que la cadena de reglas de borde sea predeterminada", - "set-default-edge-title": "¿Está seguro de que desea que la cadena de reglas de borde '{{ruleChainName}}' sea predeterminada?", - "set-default-edge-text": "Después de la confirmación, la cadena de reglas de borde se agregará a la lista predeterminada y se asignará a los bordes recién creados", - "remove-default-edge": "Eliminar la cadena de regla de borde de los valores predeterminados", - "remove-default-edge-title": "¿Está seguro de que desea eliminar la cadena de reglas de borde '{{ruleChainName}}' de la lista predeterminada?", - "remove-default-edge-text": "Después de la confirmación, la cadena de reglas de borde no se asignará a los bordes recién creados" + "set-auto-assign-to-edge": "Asignar cadena de reglas a los bordes en la creación", + "set-auto-assign-to-edge-title": "¿Está seguro de que desea asignar la cadena de reglas de borde '{{ruleChainName}}' a los bordes en la creación?", + "set-auto-assign-to-edge-text": "Después de la confirmación, la cadena de reglas de borde se asignará automáticamente a los bordes en la creación.", + "unset-auto-assign-to-edge": "No asigne una cadena de reglas a los bordes en la creación", + "unset-auto-assign-to-edge-title": "¿Está seguro de que no desea asignar la cadena de reglas de borde '{{ruleChainName}}' a los bordes en la creación?", + "unset-auto-assign-to-edge-text": "Después de la confirmación, la cadena de reglas de borde ya no se asignará automáticamente a los bordes en la creación.", + "edge-template-root": "Raíz de plantilla" }, "rulenode": { "details": "Detalles", diff --git a/ui/src/app/locale/locale.constant-fr_FR.json b/ui/src/app/locale/locale.constant-fr_FR.json index d6775567fb..a4b92cae37 100644 --- a/ui/src/app/locale/locale.constant-fr_FR.json +++ b/ui/src/app/locale/locale.constant-fr_FR.json @@ -1436,7 +1436,6 @@ "assign-rulechains": "Attribuer aux chaînes de règles", "assign-new-rulechain": "Attribuer une nouvele chaînes de règles", "delete-rulechains": "Supprimer une chaînes de règles", - "default": "Défaut", "unassign-rulechain": "Retirer chaîne de règles", "unassign-rulechains": "Retirer chaînes de règles", "unassign-rulechain-title": "AÊtes-vous sûr de vouloir retirer l'attribution de chaînes de règles '{{ruleChainTitle}}'?", @@ -1446,16 +1445,17 @@ "unassign-rulechains-from-edge-text": "Après la confirmation, tous les chaînes de règles sélectionnés ne seront pas attribués et ne seront pas accessibles a la bordure.", "assign-rulechain-to-edge": "Attribuer les chaînes de règles a la bordure", "assign-rulechain-to-edge-text": "Veuillez sélectionner la bordure pour attribuer le ou les chaînes de règles", - "set-default-root-edge": "Définir la racine par défaut de la chaîne de règles", - "set-default-root-edge-rulechain-title": "AVoulez-vous vraiment créer de chaînes de règles par défaut '{{ruleChainName}}'?", - "set-default-root-edge-rulechain-text": "Après la confirmation, la chaîne de règles deviendra la racine de la bordure par défaut et gérera tous les messages de transport entrants.", + "set-edge-template-root-rulechain": "Faire de la chaîne de règles la racine du modèle d'arête", + "set-edge-template-root-rulechain-title": "Voulez-vous vraiment définir la racine du modèle d'arête de la chaîne de règles '{{ruleChainName}}'?", + "set-edge-template-root-rulechain-text": "Après la confirmation, la chaîne de règles deviendra la racine du modèle d'arête et sera la chaîne de règles racine pour les arêtes nouvellement créées.", "invalid-rulechain-type-error": "Impossible d'importer la chaîne de règles: type de chaîne de règles non valide. Le type attendu est {{attenduRuleChainType}}.", - "set-default-edge": "Définir la chaîne de règles de la bordure par défaut", - "set-default-edge-title": "Voulez-vous vraiment définir la chaîne de règles de la bordure '{{ruleChainName}}' par défaut?", - "set-default-edge-text": "Après la confirmation, la chaîne de règles d'arête sera ajoutée à la liste par défaut et affectée aux arêtes nouvellement créées.", - "remove-default-edge": "Supprimer la chaîne de règles de la bordure des valeurs par défaut", - "remove-default-edge-title": "Voulez-vous vraiment supprimer la chaîne de règles de la bordure '{{ruleChainName}}' de la liste par défaut", - "remove-default-edge-text": "Après la confirmation, la chaîne de règles d'arête ne sera pas affectée aux arêtes nouvellement créées." + "set-auto-assign-to-edge": "Attribuer une chaîne de règles aux arêtes lors de la création", + "set-auto-assign-to-edge-title": "Voulez-vous vraiment attribuer la chaîne de règles d'arête '{{ruleChainName}}' à l'arête (s) lors de la création?", + "set-auto-assign-to-edge-text": "Après la confirmation, la chaîne de règles d'arêtes sera automatiquement affectée aux arêtes lors de la création.", + "unset-auto-assign-to-edge": "N'attribuez pas de chaîne de règles aux arêtes lors de la création", + "unset-auto-assign-to-edge-title": "Êtes-vous sûr de ne pas vouloir attribuer la chaîne de règles d'arête '{{ruleChainName}}' à l'arête (s) lors de la création?", + "unset-auto-assign-to-edge-text": "Après la confirmation, la chaîne de règles d'arêtes ne sera plus automatiquement affectée aux arêtes lors de la création.", + "edge-template-root": "Racine du modèle" }, "rulenode": { "add": "Ajouter un noeud de règle", diff --git a/ui/src/app/rulechain/rulechain-card.tpl.html b/ui/src/app/rulechain/rulechain-card.tpl.html index 95e7b4fd2b..974a0af4cf 100644 --- a/ui/src/app/rulechain/rulechain-card.tpl.html +++ b/ui/src/app/rulechain/rulechain-card.tpl.html @@ -18,6 +18,6 @@
rulechain.root
-
rulechain.default-root
+
rulechain.edge-template-root
-
rulechain.auto-assign-to-edge
+
rulechain.set-auto-assign-to-edge-card
diff --git a/ui/src/app/rulechain/rulechain-fieldset.tpl.html b/ui/src/app/rulechain/rulechain-fieldset.tpl.html index 223806386f..6a4841a550 100644 --- a/ui/src/app/rulechain/rulechain-fieldset.tpl.html +++ b/ui/src/app/rulechain/rulechain-fieldset.tpl.html @@ -15,32 +15,31 @@ limitations under the License. --> -{{ 'rulechain.export' | translate }} - -{{ 'rulechain.set-root' | translate }} - -{{ 'rulechain.set-default-root-edge' | translate }} -{{ 'rulechain.set-auto-assign-to-edge' | translate }} -{{ 'rulechain.remove-auto-assign-to-edge' | translate }} - -{{ 'rulechain.set-root' | translate }} - -{{ 'rulechain.delete' | translate }} +
+ {{ 'rulechain.export' | translate }} + {{ 'rulechain.delete' | translate }} +
+
{{ 'rulechain.set-root' | translate }} + {{ 'rulechain.set-edge-template-root-rulechain' | translate }} + {{ 'rulechain.set-auto-assign-to-edge' | translate }} + {{ 'rulechain.unset-auto-assign-to-edge' | translate }} + {{ 'rulechain.set-root' | translate }} +
From ee111c644596ddb2273d2664141183ddb162d0bc Mon Sep 17 00:00:00 2001 From: deaflynx Date: Fri, 25 Dec 2020 11:10:38 +0200 Subject: [PATCH 19/19] Alert message for missingRuleChains --- ui/src/app/api/edge.service.js | 14 +++++++++- ui/src/app/locale/locale.constant-en_US.json | 4 ++- ui/src/app/rulechain/rulechains.controller.js | 28 +++++++++++++++++-- 3 files changed, 42 insertions(+), 4 deletions(-) diff --git a/ui/src/app/api/edge.service.js b/ui/src/app/api/edge.service.js index f5e43f7ef5..debd49069a 100644 --- a/ui/src/app/api/edge.service.js +++ b/ui/src/app/api/edge.service.js @@ -36,7 +36,8 @@ function EdgeService($http, $q, customerService) { makeEdgePublic: makeEdgePublic, setRootRuleChain: setRootRuleChain, getEdgeEvents: getEdgeEvents, - syncEdge: syncEdge + syncEdge: syncEdge, + findMissingToRelatedRuleChains: findMissingToRelatedRuleChains }; return service; @@ -305,4 +306,15 @@ function EdgeService($http, $q, customerService) { }); return deferred.promise; } + + function findMissingToRelatedRuleChains(edgeId) { + var deferred = $q.defer(); + var url = '/api/edge/missingToRelatedRuleChains/' + edgeId; + $http.get(url, null).then(function success(response) { + deferred.resolve(response.data); + }, function fail(response) { + deferred.reject(response.data); + }); + return deferred.promise; + } } diff --git a/ui/src/app/locale/locale.constant-en_US.json b/ui/src/app/locale/locale.constant-en_US.json index e04d152b43..56f45586c3 100644 --- a/ui/src/app/locale/locale.constant-en_US.json +++ b/ui/src/app/locale/locale.constant-en_US.json @@ -854,7 +854,9 @@ "edge-type-list-empty": "No edge types selected.", "edge-types": "Edge types", "license-key-hint": "To obtain your license please navigate to the pricing page and select the best license option for your case.", - "cloud-endpoint-hint": "Edge requires HTTP(s) access to Cloud (ThingsBoard CE/PE) to verify the license key. Please specify Cloud URL that Edge is able to connect to." + "cloud-endpoint-hint": "Edge requires HTTP(s) access to Cloud (ThingsBoard CE/PE) to verify the license key. Please specify Cloud URL that Edge is able to connect to.", + "missing-related-rule-chains-title": "Edge has missing related rule chain(s)", + "missing-related-rule-chains-text": "Assigned to edge rule chain(s) use rule nodes that forward message(s) to rule chain(s) that are not assigned to this edge.

List of missing rule chain(s):
{{missingRuleChains}}" }, "error": { "unable-to-connect": "Unable to connect to the server! Please check your internet connection.", diff --git a/ui/src/app/rulechain/rulechains.controller.js b/ui/src/app/rulechain/rulechains.controller.js index b11008cacc..4ea5d5ffd1 100644 --- a/ui/src/app/rulechain/rulechains.controller.js +++ b/ui/src/app/rulechain/rulechains.controller.js @@ -572,8 +572,32 @@ export default function RuleChainsController(ruleChainService, userService, impo fullscreen: true, targetEvent: $event }).then(function () { - vm.grid.refreshList(); - }, function () { + edgeService.findMissingToRelatedRuleChains(edgeId).then( + function success(missingRuleChains) { + if (missingRuleChains && Object.keys(missingRuleChains).length > 0) { + let formattedMissingRuleChains = []; + for (const missingRuleChain of Object.keys(missingRuleChains)) { + const arrayOfMissingRuleChains = missingRuleChains[missingRuleChain]; + const tmp = "- '" + missingRuleChain + "': '" + arrayOfMissingRuleChains.join("', ") + "'"; + formattedMissingRuleChains.push(tmp); + } + var alert = $mdDialog.alert() + .parent(angular.element($document[0].body)) + .clickOutsideToClose(true) + .title($translate.instant('edge.missing-related-rule-chains-title')) + .htmlContent($translate.instant('edge.missing-related-rule-chains-text', {missingRuleChains: formattedMissingRuleChains.join("
")})) + .ok($translate.instant('action.close')); + alert._options.fullscreen = true; + $mdDialog.show(alert).then( + function () { + vm.grid.refreshList(); + } + ); + } else { + vm.grid.refreshList(); + } + } + ); }); }, function fail() {