diff --git a/ui/src/app/api/component-descriptor.service.js b/ui/src/app/api/component-descriptor.service.js index 1069eef33d..b4cacf4991 100644 --- a/ui/src/app/api/component-descriptor.service.js +++ b/ui/src/app/api/component-descriptor.service.js @@ -28,31 +28,31 @@ function ComponentDescriptorService($http, $q) { return service; - function getComponentDescriptorsByTypes(componentTypes, type) { + function getComponentDescriptorsByTypes(componentTypes, ruleChainType) { var deferred = $q.defer(); var result = []; - if (!componentsByType[type]) { - componentsByType[type] = {}; + if (!componentsByType[ruleChainType]) { + componentsByType[ruleChainType] = {}; } for (var i=componentTypes.length-1;i>=0;i--) { var componentType = componentTypes[i]; - if (componentsByType[type][componentType]) { - result = result.concat(componentsByType[type][componentType]); + if (componentsByType[ruleChainType][componentType]) { + result = result.concat(componentsByType[ruleChainType][componentType]); componentTypes.splice(i, 1); } } if (!componentTypes.length) { deferred.resolve(result); } else { - var url = '/api/components?componentTypes=' + componentTypes.join(',') + '&ruleChainType=' + type; + var url = '/api/components?componentTypes=' + componentTypes.join(',') + '&ruleChainType=' + ruleChainType; $http.get(url, null).then(function success(response) { var components = response.data; for (var i = 0; i < components.length; i++) { var component = components[i]; - var componentsList = componentsByType[type][component.type]; + var componentsList = componentsByType[ruleChainType][component.type]; if (!componentsList) { componentsList = []; - componentsByType[type][component.type] = componentsList; + componentsByType[ruleChainType][component.type] = componentsList; } componentsList.push(component); componentsByClazz[component.clazz] = component; diff --git a/ui/src/app/asset/asset-fieldset.tpl.html b/ui/src/app/asset/asset-fieldset.tpl.html index cc08b40f0a..d4eecf9627 100644 --- a/ui/src/app/asset/asset-fieldset.tpl.html +++ b/ui/src/app/asset/asset-fieldset.tpl.html @@ -27,6 +27,9 @@ {{ 'asset.delete' | translate }} +{{ 'edge.unassign-from-edge' | translate }}
diff --git a/ui/src/app/dashboard/dashboard-fieldset.tpl.html b/ui/src/app/dashboard/dashboard-fieldset.tpl.html index bf3283b857..d3eb314917 100644 --- a/ui/src/app/dashboard/dashboard-fieldset.tpl.html +++ b/ui/src/app/dashboard/dashboard-fieldset.tpl.html @@ -16,7 +16,7 @@ --> {{ 'dashboard.export' | translate }} {{ 'dashboard.delete' | translate }} +{{ 'edge.unassign-from-edge' | translate }} diff --git a/ui/src/app/dashboard/dashboard.directive.js b/ui/src/app/dashboard/dashboard.directive.js index 37e3485d31..2d5b942410 100644 --- a/ui/src/app/dashboard/dashboard.directive.js +++ b/ui/src/app/dashboard/dashboard.directive.js @@ -48,12 +48,14 @@ export default function DashboardDirective($compile, $templateCache, $translate, dashboard: '=', isEdit: '=', customerId: '=', + edgeId: '=', dashboardScope: '=', theForm: '=', onMakePublic: '&', onMakePrivate: '&', onManageAssignedCustomers: '&', onUnassignFromCustomer: '&', + onUnassignFromEdge: '&', onExportDashboard: '&', onDeleteDashboard: '&' } diff --git a/ui/src/app/dashboard/dashboards.controller.js b/ui/src/app/dashboard/dashboards.controller.js index 964f440afe..f5fc50d538 100644 --- a/ui/src/app/dashboard/dashboards.controller.js +++ b/ui/src/app/dashboard/dashboards.controller.js @@ -129,6 +129,7 @@ export function DashboardsController(userService, dashboardService, customerServ vm.manageAssignedCustomers = manageAssignedCustomers; vm.unassignFromCustomer = unassignFromCustomer; vm.exportDashboard = exportDashboard; + vm.unassignFromEdge = unassignFromEdge; initController(); @@ -156,6 +157,10 @@ export function DashboardsController(userService, dashboardService, customerServ ); } + if (edgeId) { + vm.edgeId = edgeId; + } + if (vm.dashboardsScope === 'tenant') { fetchDashboardsFunction = function (pageLink) { return dashboardService.getTenantDashboards(pageLink); diff --git a/ui/src/app/dashboard/dashboards.tpl.html b/ui/src/app/dashboard/dashboards.tpl.html index 2fb4e35e72..02f6ef8101 100644 --- a/ui/src/app/dashboard/dashboards.tpl.html +++ b/ui/src/app/dashboard/dashboards.tpl.html @@ -26,12 +26,14 @@ is-edit="vm.grid.detailsConfig.isDetailsEditMode" dashboard-scope="vm.dashboardsScope" customer-id="vm.customerId" + edge-id="vm.edgeId" the-form="vm.grid.detailsForm" on-make-public="vm.makePublic(event, vm.grid.detailsConfig.currentItem)" on-make-private="vm.makePrivate(event, vm.grid.detailsConfig.currentItem)" on-manage-assigned-customers="vm.manageAssignedCustomers(event, vm.grid.detailsConfig.currentItem)" on-unassign-from-customer="vm.unassignFromCustomer(event, vm.grid.detailsConfig.currentItem, vm.customerId)" - on-export-dashboard="vm.exportDashboard(event, vm.grid.detailsConfig.currentItem)" + on-unassign-from-edge="vm.unassignFromEdge(event, vm.grid.detailsConfig.currentItem, vm.edgeId)" + on-export-dashboard="vm.exportDashboard(event, vm.grid.detailsConfig.currentItem)" on-delete-dashboard="vm.grid.deleteItem(event, vm.grid.detailsConfig.currentItem)"> diff --git a/ui/src/app/device/device-fieldset.tpl.html b/ui/src/app/device/device-fieldset.tpl.html index 76b85a60e4..1755e62646 100644 --- a/ui/src/app/device/device-fieldset.tpl.html +++ b/ui/src/app/device/device-fieldset.tpl.html @@ -24,6 +24,9 @@ {{ isPublic ? 'device.make-private' : 'device.unassign-from-customer' | translate }} +{{ 'edge.unassign-from-edge' | translate }} {{ (deviceScope === 'customer_user' ? 'device.view-credentials' : 'device.manage-credentials') | translate }} diff --git a/ui/src/app/device/device.controller.js b/ui/src/app/device/device.controller.js index dc71090d76..e15dd14678 100644 --- a/ui/src/app/device/device.controller.js +++ b/ui/src/app/device/device.controller.js @@ -131,6 +131,7 @@ export function DeviceController($rootScope, userService, deviceService, custome vm.makePublic = makePublic; vm.unassignFromCustomer = unassignFromCustomer; vm.manageCredentials = manageCredentials; + vm.unassignFromEdge = unassignFromEdge; initController(); diff --git a/ui/src/app/device/device.directive.js b/ui/src/app/device/device.directive.js index 03874e5ca5..45a849c4fd 100644 --- a/ui/src/app/device/device.directive.js +++ b/ui/src/app/device/device.directive.js @@ -82,7 +82,8 @@ export default function DeviceDirective($compile, $templateCache, toast, $transl onMakePublic: '&', onUnassignFromCustomer: '&', onManageCredentials: '&', - onDeleteDevice: '&' + onDeleteDevice: '&', + onUnassignFromEdge: '&', } }; } diff --git a/ui/src/app/device/devices.tpl.html b/ui/src/app/device/devices.tpl.html index 14b4f90df3..0f403ba1be 100644 --- a/ui/src/app/device/devices.tpl.html +++ b/ui/src/app/device/devices.tpl.html @@ -29,6 +29,7 @@ on-assign-to-customer="vm.assignToCustomer(event, [ vm.grid.detailsConfig.currentItem.id.id ])" on-make-public="vm.makePublic(event, vm.grid.detailsConfig.currentItem)" on-unassign-from-customer="vm.unassignFromCustomer(event, vm.grid.detailsConfig.currentItem, isPublic)" + on-unassign-from-edge="vm.unassignFromEdge(event, vm.grid.detailsConfig.currentItem)" on-manage-credentials="vm.manageCredentials(event, vm.grid.detailsConfig.currentItem)" on-delete-device="vm.grid.deleteItem(event, vm.grid.detailsConfig.currentItem)"> diff --git a/ui/src/app/edge/edge.controller.js b/ui/src/app/edge/edge.controller.js index 94f076c1af..76b78960a1 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: "settings_ethernet" + icon: "code" } ); diff --git a/ui/src/app/edge/edge.routes.js b/ui/src/app/edge/edge.routes.js index 43bfe9850a..ccfb3a7b14 100644 --- a/ui/src/app/edge/edge.routes.js +++ b/ui/src/app/edge/edge.routes.js @@ -49,7 +49,7 @@ export default function EdgeRoutes($stateProvider, types) { pageTitle: 'edge.edges' }, ncyBreadcrumb: { - label: '{"icon": "transform", "label": "edge.edges"}' + label: '{"icon": "router", "label": "edge.edges"}' } }).state('home.edges.entityViews', { url: '/:edgeId/entityViews', diff --git a/ui/src/app/entity-view/entity-view-fieldset.tpl.html b/ui/src/app/entity-view/entity-view-fieldset.tpl.html index 6e6f5dc2cb..4beac8a231 100644 --- a/ui/src/app/entity-view/entity-view-fieldset.tpl.html +++ b/ui/src/app/entity-view/entity-view-fieldset.tpl.html @@ -27,6 +27,9 @@ {{ 'entity-view.delete' | translate }} +{{ 'edge.unassign-from-edge' | translate }}
diff --git a/ui/src/app/locale/locale.constant-en_US.json b/ui/src/app/locale/locale.constant-en_US.json index ef6449d167..febe3ea80a 100644 --- a/ui/src/app/locale/locale.constant-en_US.json +++ b/ui/src/app/locale/locale.constant-en_US.json @@ -844,7 +844,8 @@ "set-root-rule-chain-to-edges-text": "Set root rule chain for { count, plural, 1 {1 edge} other {# edges} }", "status": "Received by edge", "deployed": "Deployed", - "pending": "Pending" + "pending": "Pending", + "unassign-edges-action-title": "Unassign { count, plural, 1 {1 edge} other {# edges} } from customer" }, "error": { "unable-to-connect": "Unable to connect to the server! Please check your internet connection.", @@ -1539,6 +1540,7 @@ "rulechains": "Rule chains", "core-rulechains": "Core Rule chains", "edge-rulechains": "Edge Rule chains", + "default-root": "Default root", "root": "Root", "delete": "Delete rule chain", "name": "Name", @@ -1589,10 +1591,10 @@ "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 edge rule chain default", + "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 edge rule chain from defaults", + "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." }, diff --git a/ui/src/app/rulechain/rulechain-card.tpl.html b/ui/src/app/rulechain/rulechain-card.tpl.html index 330786e8ea..e4df4c9471 100644 --- a/ui/src/app/rulechain/rulechain-card.tpl.html +++ b/ui/src/app/rulechain/rulechain-card.tpl.html @@ -16,7 +16,8 @@ -->
rulechain.root
+ (vm.parentCtl.ruleChainsScope === 'edge' && vm.parentCtl.isRootRuleChain(item))" translate>rulechain.root
+ +
rulechain.default-root
rulechain.default
diff --git a/ui/src/app/rulechain/rulechain-fieldset.tpl.html b/ui/src/app/rulechain/rulechain-fieldset.tpl.html index 4afd6ee96e..5d3bf08739 100644 --- a/ui/src/app/rulechain/rulechain-fieldset.tpl.html +++ b/ui/src/app/rulechain/rulechain-fieldset.tpl.html @@ -18,11 +18,27 @@ {{ 'rulechain.export' | translate }} + {{ 'rulechain.set-root' | translate }} + +{{ 'rulechain.set-default-root-edge' | translate }} +{{ 'rulechain.set-default-edge' | translate }} +{{ 'rulechain.remove-default-edge' | translate }} + +{{ 'rulechain.set-root' | translate }} + {{ 'rulechain.delete' | translate }}
diff --git a/ui/src/app/rulechain/rulechain.directive.js b/ui/src/app/rulechain/rulechain.directive.js index 105c888063..750c96d05c 100644 --- a/ui/src/app/rulechain/rulechain.directive.js +++ b/ui/src/app/rulechain/rulechain.directive.js @@ -40,6 +40,10 @@ export default function RuleChainDirective($compile, $templateCache, $mdDialog, isEdit: '=', isReadOnly: '=', theForm: '=', + ruleChainsScope: '=', + edge: '=', + onSetDefaultEdgeRuleChain: '&', + onRemoveDefaultEdgeRuleChain: '&', onSetRootRuleChain: '&', onExportRuleChain: '&', onDeleteRuleChain: '&' diff --git a/ui/src/app/rulechain/rulechains.controller.js b/ui/src/app/rulechain/rulechains.controller.js index 97a2c2de29..6e3908b0a7 100644 --- a/ui/src/app/rulechain/rulechains.controller.js +++ b/ui/src/app/rulechain/rulechains.controller.js @@ -97,6 +97,8 @@ export default function RuleChainsController(ruleChainService, userService, impo vm.exportRuleChain = exportRuleChain; vm.setRootRuleChain = setRootRuleChain; + vm.setDefaultEdgeRuleChain = setDefaultEdgeRuleChain; + vm.removeDefaultEdgeRuleChain = removeDefaultEdgeRuleChain; initController(); diff --git a/ui/src/app/rulechain/rulechains.tpl.html b/ui/src/app/rulechain/rulechains.tpl.html index 9880ac0213..0e03a4d8fe 100644 --- a/ui/src/app/rulechain/rulechains.tpl.html +++ b/ui/src/app/rulechain/rulechains.tpl.html @@ -26,6 +26,10 @@ is-edit="vm.grid.detailsConfig.isDetailsEditMode" is-read-only="vm.grid.isDetailsReadOnly(vm.grid.operatingItem())" the-form="vm.grid.detailsForm" + rule-chains-scope="vm.ruleChainsScope" + edge="vm.edge" + on-set-default-edge-rule-chain="vm.setDefaultEdgeRuleChain(event, vm.grid.detailsConfig.currentItem)" + on-remove-default-edge-rule-chain="vm.removeDefaultEdgeRuleChain(event, vm.grid.detailsConfig.currentItem)" on-set-root-rule-chain="vm.setRootRuleChain(event, vm.grid.detailsConfig.currentItem)" on-export-rule-chain="vm.exportRuleChain(event, vm.grid.detailsConfig.currentItem)" on-delete-rule-chain="vm.grid.deleteItem(event, vm.grid.detailsConfig.currentItem)">