Edge code cleaning. Not stable Default edges
This commit is contained in:
parent
cc7bd63b62
commit
0f24bd2912
@ -67,29 +67,6 @@ export default function AssetRoutes($stateProvider, types) {
|
|||||||
ncyBreadcrumb: {
|
ncyBreadcrumb: {
|
||||||
label: '{"icon": "domain", "label": "{{ vm.customerAssetsTitle }}", "translate": "false"}'
|
label: '{"icon": "domain", "label": "{{ vm.customerAssetsTitle }}", "translate": "false"}'
|
||||||
}
|
}
|
||||||
})
|
|
||||||
.state('home.edges.assets', {
|
|
||||||
url: '/:edgeId/assets',
|
|
||||||
params: {'topIndex': 0},
|
|
||||||
module: 'private',
|
|
||||||
auth: ['TENANT_ADMIN'],
|
|
||||||
views: {
|
|
||||||
"content@home": {
|
|
||||||
templateUrl: assetsTemplate,
|
|
||||||
controllerAs: 'vm',
|
|
||||||
controller: 'AssetController'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
assetsType: 'edge',
|
|
||||||
searchEnabled: true,
|
|
||||||
searchByEntitySubtype: true,
|
|
||||||
searchEntityType: types.entityType.asset,
|
|
||||||
pageTitle: 'edge.assets'
|
|
||||||
},
|
|
||||||
ncyBreadcrumb: {
|
|
||||||
label: '{"icon": "domain", "label": "edge.assets"}'
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -124,47 +124,4 @@ export default function DashboardRoutes($stateProvider) {
|
|||||||
label: '{"icon": "dashboard", "label": "customer.dashboard"}'
|
label: '{"icon": "dashboard", "label": "customer.dashboard"}'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('home.edges.dashboards', {
|
|
||||||
url: '/:edgeId/dashboards',
|
|
||||||
params: {'topIndex': 0},
|
|
||||||
module: 'private',
|
|
||||||
auth: ['TENANT_ADMIN'],
|
|
||||||
views: {
|
|
||||||
"content@home": {
|
|
||||||
templateUrl: dashboardsTemplate,
|
|
||||||
controllerAs: 'vm',
|
|
||||||
controller: 'DashboardsController'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
dashboardsType: 'edge',
|
|
||||||
searchEnabled: true,
|
|
||||||
pageTitle: 'edge.dashboards'
|
|
||||||
},
|
|
||||||
ncyBreadcrumb: {
|
|
||||||
label: '{"icon": "dashboard", "label": "edge.dashboards"}'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.state('home.edges.dashboards.dashboard', {
|
|
||||||
url: '/:dashboardId?state',
|
|
||||||
reloadOnSearch: false,
|
|
||||||
module: 'private',
|
|
||||||
auth: ['TENANT_ADMIN', 'CUSTOMER_USER'],
|
|
||||||
views: {
|
|
||||||
"content@home": {
|
|
||||||
templateUrl: dashboardTemplate,
|
|
||||||
controller: 'DashboardController',
|
|
||||||
controllerAs: 'vm'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
widgetEditMode: false,
|
|
||||||
searchEnabled: false,
|
|
||||||
pageTitle: 'dashboard.dashboard',
|
|
||||||
dashboardsType: 'edge',
|
|
||||||
},
|
|
||||||
ncyBreadcrumb: {
|
|
||||||
label: '{"icon": "dashboard", "label": "{{ vm.dashboard.title }}", "translate": "false"}'
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -219,20 +219,6 @@ export function DeviceController($rootScope, userService, deviceService, custome
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
deviceActionsList.push(
|
|
||||||
{
|
|
||||||
onAction: function ($event, item) {
|
|
||||||
unassignFromEdge($event, item, false);
|
|
||||||
},
|
|
||||||
name: function() { return $translate.instant('action.unassign') },
|
|
||||||
details: function() { return $translate.instant('device.unassign-from-edge') },
|
|
||||||
icon: "portable_wifi_off",
|
|
||||||
isEnabled: function(device) {
|
|
||||||
return device && device.edgeId && device.edgeId.id !== types.id.nullUid;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
deviceActionsList.push(
|
deviceActionsList.push(
|
||||||
{
|
{
|
||||||
onAction: function ($event, item) {
|
onAction: function ($event, item) {
|
||||||
|
|||||||
@ -67,29 +67,6 @@ export default function DeviceRoutes($stateProvider, types) {
|
|||||||
ncyBreadcrumb: {
|
ncyBreadcrumb: {
|
||||||
label: '{"icon": "devices_other", "label": "{{ vm.customerDevicesTitle }}", "translate": "false"}'
|
label: '{"icon": "devices_other", "label": "{{ vm.customerDevicesTitle }}", "translate": "false"}'
|
||||||
}
|
}
|
||||||
})
|
|
||||||
.state('home.edges.devices', {
|
|
||||||
url: '/:edgeId/devices',
|
|
||||||
params: {'topIndex': 0},
|
|
||||||
module: 'private',
|
|
||||||
auth: ['TENANT_ADMIN'],
|
|
||||||
views: {
|
|
||||||
"content@home": {
|
|
||||||
templateUrl: devicesTemplate,
|
|
||||||
controllerAs: 'vm',
|
|
||||||
controller: 'DeviceController'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
devicesType: 'edge',
|
|
||||||
searchEnabled: true,
|
|
||||||
searchByEntitySubtype: true,
|
|
||||||
searchEntityType: types.entityType.device,
|
|
||||||
pageTitle: 'edge.devices'
|
|
||||||
},
|
|
||||||
ncyBreadcrumb: {
|
|
||||||
label: '{"icon": "devices_other", "label": "edge.devices"}'
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -577,7 +577,6 @@ export function EdgeController($rootScope, userService, edgeService, customerSer
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function assignEdgesToCustomer($event, items) {
|
function assignEdgesToCustomer($event, items) {
|
||||||
var edgeIds = [];
|
var edgeIds = [];
|
||||||
for (var id in items.selections) {
|
for (var id in items.selections) {
|
||||||
@ -667,7 +666,6 @@ export function EdgeController($rootScope, userService, edgeService, customerSer
|
|||||||
$state.go('home.edges.ruleChains', {edgeId: edge.id.id});
|
$state.go('home.edges.ruleChains', {edgeId: edge.id.id});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function openEdgeAssets($event, edge) {
|
function openEdgeAssets($event, edge) {
|
||||||
if ($event) {
|
if ($event) {
|
||||||
$event.stopPropagation();
|
$event.stopPropagation();
|
||||||
|
|||||||
@ -16,6 +16,11 @@
|
|||||||
/* eslint-disable import/no-unresolved, import/default */
|
/* eslint-disable import/no-unresolved, import/default */
|
||||||
|
|
||||||
import edgesTemplate from './edges.tpl.html';
|
import edgesTemplate from './edges.tpl.html';
|
||||||
|
import entityViewsTemplate from "../entity-view/entity-views.tpl.html";
|
||||||
|
import devicesTemplate from "../device/devices.tpl.html";
|
||||||
|
import assetsTemplate from "../asset/assets.tpl.html";
|
||||||
|
import dashboardsTemplate from "../dashboard/dashboards.tpl.html";
|
||||||
|
import dashboardTemplate from "../dashboard/dashboard.tpl.html";
|
||||||
|
|
||||||
/* eslint-enable import/no-unresolved, import/default */
|
/* eslint-enable import/no-unresolved, import/default */
|
||||||
|
|
||||||
@ -45,27 +50,116 @@ export default function EdgeRoutes($stateProvider, types) {
|
|||||||
label: '{"icon": "transform", "label": "edge.edges"}'
|
label: '{"icon": "transform", "label": "edge.edges"}'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('home.customers.edges', {
|
.state('home.edges.entityViews', {
|
||||||
url: '/:customerId/edges',
|
url: '/:edgeId/entityViews',
|
||||||
params: {'topIndex': 0},
|
params: {'topIndex': 0},
|
||||||
module: 'private',
|
module: 'private',
|
||||||
auth: ['TENANT_ADMIN'],
|
auth: ['TENANT_ADMIN'],
|
||||||
views: {
|
views: {
|
||||||
"content@home": {
|
"content@home": {
|
||||||
templateUrl: edgesTemplate,
|
templateUrl: entityViewsTemplate,
|
||||||
controllerAs: 'vm',
|
controllerAs: 'vm',
|
||||||
controller: 'EdgeController'
|
controller: 'EntityViewController'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data: {
|
data: {
|
||||||
edgesType: 'customer',
|
entityViewsType: 'edge',
|
||||||
searchEnabled: true,
|
searchEnabled: true,
|
||||||
searchByEntitySubtype: true,
|
searchByEntitySubtype: true,
|
||||||
searchEntityType: types.entityType.edge,
|
searchEntityType: types.entityType.entityView,
|
||||||
pageTitle: 'customer.edges'
|
pageTitle: 'edge.entity-views'
|
||||||
},
|
},
|
||||||
ncyBreadcrumb: {
|
ncyBreadcrumb: {
|
||||||
label: '{"icon": "transform", "label": "{{ vm.customerEdgesTitle }}", "translate": "false"}'
|
label: '{"icon": "view_quilt", "label": "edge.entity-views"}'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.state('home.edges.devices', {
|
||||||
|
url: '/:edgeId/devices',
|
||||||
|
params: {'topIndex': 0},
|
||||||
|
module: 'private',
|
||||||
|
auth: ['TENANT_ADMIN'],
|
||||||
|
views: {
|
||||||
|
"content@home": {
|
||||||
|
templateUrl: devicesTemplate,
|
||||||
|
controllerAs: 'vm',
|
||||||
|
controller: 'DeviceController'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
devicesType: 'edge',
|
||||||
|
searchEnabled: true,
|
||||||
|
searchByEntitySubtype: true,
|
||||||
|
searchEntityType: types.entityType.device,
|
||||||
|
pageTitle: 'edge.devices'
|
||||||
|
},
|
||||||
|
ncyBreadcrumb: {
|
||||||
|
label: '{"icon": "devices_other", "label": "edge.devices"}'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.state('home.edges.assets', {
|
||||||
|
url: '/:edgeId/assets',
|
||||||
|
params: {'topIndex': 0},
|
||||||
|
module: 'private',
|
||||||
|
auth: ['TENANT_ADMIN'],
|
||||||
|
views: {
|
||||||
|
"content@home": {
|
||||||
|
templateUrl: assetsTemplate,
|
||||||
|
controllerAs: 'vm',
|
||||||
|
controller: 'AssetController'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
assetsType: 'edge',
|
||||||
|
searchEnabled: true,
|
||||||
|
searchByEntitySubtype: true,
|
||||||
|
searchEntityType: types.entityType.asset,
|
||||||
|
pageTitle: 'edge.assets'
|
||||||
|
},
|
||||||
|
ncyBreadcrumb: {
|
||||||
|
label: '{"icon": "domain", "label": "edge.assets"}'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.state('home.edges.dashboards', {
|
||||||
|
url: '/:edgeId/dashboards',
|
||||||
|
params: {'topIndex': 0},
|
||||||
|
module: 'private',
|
||||||
|
auth: ['TENANT_ADMIN'],
|
||||||
|
views: {
|
||||||
|
"content@home": {
|
||||||
|
templateUrl: dashboardsTemplate,
|
||||||
|
controllerAs: 'vm',
|
||||||
|
controller: 'DashboardsController'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
dashboardsType: 'edge',
|
||||||
|
searchEnabled: true,
|
||||||
|
pageTitle: 'edge.dashboards'
|
||||||
|
},
|
||||||
|
ncyBreadcrumb: {
|
||||||
|
label: '{"icon": "dashboard", "label": "edge.dashboards"}'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.state('home.edges.dashboards.dashboard', {
|
||||||
|
url: '/:dashboardId?state',
|
||||||
|
reloadOnSearch: false,
|
||||||
|
module: 'private',
|
||||||
|
auth: ['TENANT_ADMIN', 'CUSTOMER_USER'],
|
||||||
|
views: {
|
||||||
|
"content@home": {
|
||||||
|
templateUrl: dashboardTemplate,
|
||||||
|
controller: 'DashboardController',
|
||||||
|
controllerAs: 'vm'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
widgetEditMode: false,
|
||||||
|
searchEnabled: false,
|
||||||
|
pageTitle: 'dashboard.dashboard',
|
||||||
|
dashboardsType: 'edge',
|
||||||
|
},
|
||||||
|
ncyBreadcrumb: {
|
||||||
|
label: '{"icon": "dashboard", "label": "{{ vm.dashboard.title }}", "translate": "false"}'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -294,6 +294,19 @@ export function EntityViewController($rootScope, userService, entityViewService,
|
|||||||
return {"edgeId": edgeId, "topIndex": vm.topIndex};
|
return {"edgeId": edgeId, "topIndex": vm.topIndex};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
entityViewActionsList.push({
|
||||||
|
onAction: function ($event, item) {
|
||||||
|
unassignFromEdge($event, item, false);
|
||||||
|
},
|
||||||
|
name: function() { return $translate.instant('action.unassign') },
|
||||||
|
details: function() { return $translate.instant('entity-view.unassign-from-edge') },
|
||||||
|
icon: "assignment_return",
|
||||||
|
isEnabled: function(entityView) {
|
||||||
|
return entityView && entityView.edgeId && entityView.edgeId.id !== types.id.nullUid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
entityViewGroupActionsList.push(
|
entityViewGroupActionsList.push(
|
||||||
{
|
{
|
||||||
onAction: function ($event, items) {
|
onAction: function ($event, items) {
|
||||||
@ -583,4 +596,25 @@ export function EntityViewController($rootScope, userService, entityViewService,
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function unassignFromEdge($event, entityView) {
|
||||||
|
if ($event) {
|
||||||
|
$event.stopPropagation();
|
||||||
|
}
|
||||||
|
var title = $translate.instant('entity-view.unassign-entity-view-from-edge-title', {entityViewName: entityView.name});
|
||||||
|
var content = $translate.instant('entity-view.unassign-entity-view-from-edge-text');
|
||||||
|
var label = $translate.instant('entity-view.unassign-entity-view');
|
||||||
|
var confirm = $mdDialog.confirm()
|
||||||
|
.targetEvent($event)
|
||||||
|
.title(title)
|
||||||
|
.htmlContent(content)
|
||||||
|
.ariaLabel(label)
|
||||||
|
.cancel($translate.instant('action.no'))
|
||||||
|
.ok($translate.instant('action.yes'));
|
||||||
|
$mdDialog.show(confirm).then(function () {
|
||||||
|
entityViewService.unassignEntityViewFromEdge(entityView.id.id).then(function success() {
|
||||||
|
vm.grid.refreshList();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,29 +67,5 @@ export default function EntityViewRoutes($stateProvider, types) {
|
|||||||
ncyBreadcrumb: {
|
ncyBreadcrumb: {
|
||||||
label: '{"icon": "view_quilt", "label": "{{ vm.customerEntityViewsTitle }}", "translate": "false"}'
|
label: '{"icon": "view_quilt", "label": "{{ vm.customerEntityViewsTitle }}", "translate": "false"}'
|
||||||
}
|
}
|
||||||
})
|
|
||||||
.state('home.edges.entityViews', {
|
|
||||||
url: '/:edgeId/entityViews',
|
|
||||||
params: {'topIndex': 0},
|
|
||||||
module: 'private',
|
|
||||||
auth: ['TENANT_ADMIN'],
|
|
||||||
views: {
|
|
||||||
"content@home": {
|
|
||||||
templateUrl: entityViewsTemplate,
|
|
||||||
controllerAs: 'vm',
|
|
||||||
controller: 'EntityViewController'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data: {
|
|
||||||
entityViewsType: 'edge',
|
|
||||||
searchEnabled: true,
|
|
||||||
searchByEntitySubtype: true,
|
|
||||||
searchEntityType: types.entityType.entityView,
|
|
||||||
pageTitle: 'edge.entity-views'
|
|
||||||
},
|
|
||||||
ncyBreadcrumb: {
|
|
||||||
label: '{"icon": "view_quilt", "label": "edge.entity-views"}'
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,25 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright © 2016-2020 The Thingsboard Authors
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
.tb-rule-chain-assigned-edges {
|
|
||||||
display: block;
|
|
||||||
display: -webkit-box; /* stylelint-disable-line value-no-vendor-prefix */
|
|
||||||
height: 34px;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
-webkit-line-clamp: 2;
|
|
||||||
-webkit-box-orient: vertical; /* stylelint-disable-line property-no-vendor-prefix */
|
|
||||||
}
|
|
||||||
@ -17,9 +17,6 @@
|
|||||||
-->
|
-->
|
||||||
<div ng-if="(vm.parentCtl.ruleChainsScope === 'tenant' && item && item.root) ||
|
<div ng-if="(vm.parentCtl.ruleChainsScope === 'tenant' && item && item.root) ||
|
||||||
(vm.parentCtl.ruleChainsScope === 'edge' && vm.parentCtl.isRootRuleChain(item)) ||
|
(vm.parentCtl.ruleChainsScope === 'edge' && vm.parentCtl.isRootRuleChain(item)) ||
|
||||||
(vm.parentCtl.ruleChainsScope === 'edges' && vm.parentCtl.isRootRuleChain(item))"
|
(vm.parentCtl.ruleChainsScope === 'edges' && vm.parentCtl.isRootRuleChain(item))" translate>rulechain.root </div>
|
||||||
translate>rulechain.root
|
|
||||||
</div>
|
<div ng-if="(vm.parentCtl.ruleChainsScope === 'edge' && vm.parentCtl.isDefaultEdgeRuleChain(item))" translate>rulechain.default </div>
|
||||||
<div ng-if="(vm.parentCtl.ruleChainsScope === 'edge' && vm.parentCtl.isDefaultEdgeRuleChain(item))"
|
|
||||||
translate>rulechain.default
|
|
||||||
</div>
|
|
||||||
|
|||||||
@ -21,8 +21,6 @@ import addRuleChainsToEdgeTemplate from "./add-rulechains-to-edge.tpl.html";
|
|||||||
|
|
||||||
/* eslint-enable import/no-unresolved, import/default */
|
/* eslint-enable import/no-unresolved, import/default */
|
||||||
|
|
||||||
import './rulechain-card.scss';
|
|
||||||
|
|
||||||
/*@ngInject*/
|
/*@ngInject*/
|
||||||
export default function RuleChainsController(ruleChainService, userService, edgeService, importExport, $state,
|
export default function RuleChainsController(ruleChainService, userService, edgeService, importExport, $state,
|
||||||
$stateParams, $filter, $translate, $mdDialog, $document, $q, types) {
|
$stateParams, $filter, $translate, $mdDialog, $document, $q, types) {
|
||||||
@ -342,6 +340,7 @@ export default function RuleChainsController(ruleChainService, userService, edge
|
|||||||
var deferred = $q.defer();
|
var deferred = $q.defer();
|
||||||
ruleChainService.getDefaultEdgeRuleChains(null).then(
|
ruleChainService.getDefaultEdgeRuleChains(null).then(
|
||||||
function success(response) {
|
function success(response) {
|
||||||
|
defaultEdgeRuleChainIds = [];
|
||||||
response.map(function (ruleChain) {
|
response.map(function (ruleChain) {
|
||||||
defaultEdgeRuleChainIds.push(ruleChain.id.id)
|
defaultEdgeRuleChainIds.push(ruleChain.id.id)
|
||||||
});
|
});
|
||||||
@ -368,7 +367,7 @@ export default function RuleChainsController(ruleChainService, userService, edge
|
|||||||
|
|
||||||
function fetchEdgeRuleChains(edgeId, pageLink) {
|
function fetchEdgeRuleChains(edgeId, pageLink) {
|
||||||
var deferred = $q.defer();
|
var deferred = $q.defer();
|
||||||
ruleChainService.getRuleChains(pageLink, null, types.edgeRuleChainType).then(
|
ruleChainService.getEdgeRuleChains(edgeId, pageLink, null).then(
|
||||||
function success(ruleChains) {
|
function success(ruleChains) {
|
||||||
getDefaultEdges(ruleChains).then(
|
getDefaultEdges(ruleChains).then(
|
||||||
function success(response) {
|
function success(response) {
|
||||||
@ -377,7 +376,6 @@ export default function RuleChainsController(ruleChainService, userService, edge
|
|||||||
deferred.reject();
|
deferred.reject();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
// deferred.resolve(response);
|
|
||||||
}, function fail() {
|
}, function fail() {
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user