Merge pull request #46 from deaflynx/feature/edge
CE refactored & reviewed
This commit is contained in:
commit
a1db669a9d
@ -28,31 +28,31 @@ function ComponentDescriptorService($http, $q) {
|
||||
|
||||
return service;
|
||||
|
||||
function getComponentDescriptorsByTypes(componentTypes, ruleChainType) {
|
||||
function getComponentDescriptorsByTypes(componentTypes, type) {
|
||||
var deferred = $q.defer();
|
||||
var result = [];
|
||||
if (!componentsByType[ruleChainType]) {
|
||||
componentsByType[ruleChainType] = {};
|
||||
if (!componentsByType[type]) {
|
||||
componentsByType[type] = {};
|
||||
}
|
||||
for (var i=componentTypes.length-1;i>=0;i--) {
|
||||
var componentType = componentTypes[i];
|
||||
if (componentsByType[ruleChainType][componentType]) {
|
||||
result = result.concat(componentsByType[ruleChainType][componentType]);
|
||||
if (componentsByType[type][componentType]) {
|
||||
result = result.concat(componentsByType[type][componentType]);
|
||||
componentTypes.splice(i, 1);
|
||||
}
|
||||
}
|
||||
if (!componentTypes.length) {
|
||||
deferred.resolve(result);
|
||||
} else {
|
||||
var url = '/api/components?componentTypes=' + componentTypes.join(',') + '&ruleChainType=' + ruleChainType;
|
||||
var url = '/api/components?componentTypes=' + componentTypes.join(',') + '&ruleChainType=' + type;
|
||||
$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[ruleChainType][component.type];
|
||||
var componentsList = componentsByType[type][component.type];
|
||||
if (!componentsList) {
|
||||
componentsList = [];
|
||||
componentsByType[ruleChainType][component.type] = componentsList;
|
||||
componentsByType[type][component.type] = componentsList;
|
||||
}
|
||||
componentsList.push(component);
|
||||
componentsByClazz[component.clazz] = component;
|
||||
|
||||
@ -311,7 +311,7 @@ function RuleChainService($http, $q, $filter, $ocLazyLoad, $translate, types, co
|
||||
}
|
||||
|
||||
function getEdgesRuleChains(pageLink, config) {
|
||||
return getRuleChains(pageLink, config, types.edgeRuleChainType);
|
||||
return getRuleChains(pageLink, config, types.ruleChainType.edge);
|
||||
}
|
||||
|
||||
function getEdgeRuleChains(edgeId, pageLink, config) {
|
||||
|
||||
@ -393,7 +393,15 @@ export default angular.module('thingsboard.types', [])
|
||||
edge: "EDGE",
|
||||
user: "USER",
|
||||
customer: "CUSTOMER",
|
||||
relation: "RELATION"
|
||||
relation: "RELATION",
|
||||
entityGroup: "ENTITY_GROUP",
|
||||
schedulerEvent: "SCHEDULER_EVENT",
|
||||
whiteLabeling: "WHITE_LABELING",
|
||||
loginWhiteLabeling: "LOGIN_WHITE_LABELING",
|
||||
customTranslation: "CUSTOM_TRANSLATION",
|
||||
widgetsBundle: "WIDGETS_BUNDLE",
|
||||
widgetType: "WIDGET_TYPE",
|
||||
adminSettings: "ADMIN_SETTINGS"
|
||||
},
|
||||
edgeEventAction: {
|
||||
updated: "UPDATED",
|
||||
@ -786,8 +794,10 @@ export default angular.module('thingsboard.types', [])
|
||||
clientSide: false
|
||||
}
|
||||
},
|
||||
coreRuleChainType: "CORE",
|
||||
edgeRuleChainType: "EDGE",
|
||||
ruleChainType: {
|
||||
core: "CORE",
|
||||
edge: "EDGE"
|
||||
},
|
||||
ruleNodeTypeComponentTypes: ["FILTER", "ENRICHMENT", "TRANSFORMATION", "ACTION", "EXTERNAL"],
|
||||
ruleChainNodeComponent: {
|
||||
type: 'RULE_CHAIN',
|
||||
|
||||
@ -53,13 +53,7 @@ export default function AddDashboardsToEdgeController(dashboardService, types, $
|
||||
fetchMoreItems_: function () {
|
||||
if (vm.dashboards.hasNext && !vm.dashboards.pending) {
|
||||
vm.dashboards.pending = true;
|
||||
var fetchDashboardsPromise;
|
||||
if (edgeCustomerId === vm.types.id.nullUid) {
|
||||
fetchDashboardsPromise = dashboardService.getTenantDashboards(vm.dashboards.nextPageLink);
|
||||
} else {
|
||||
fetchDashboardsPromise = dashboardService.getCustomerDashboards(edgeCustomerId, vm.dashboards.nextPageLink);
|
||||
}
|
||||
fetchDashboardsPromise.then(
|
||||
dashboardService.getTenantDashboards(vm.dashboards.nextPageLink).then(
|
||||
function success(dashboards) {
|
||||
vm.dashboards.data = vm.dashboards.data.concat(dashboards.data);
|
||||
vm.dashboards.nextPageLink = dashboards.nextPageLink;
|
||||
|
||||
@ -708,14 +708,7 @@ export function DashboardsController(userService, dashboardService, customerServ
|
||||
$event.stopPropagation();
|
||||
}
|
||||
var pageSize = 10;
|
||||
var fetchDashboardsPromise;
|
||||
if (vm.edgeCustomerId.id === vm.types.id.nullUid) {
|
||||
fetchDashboardsPromise = dashboardService.getTenantDashboards({limit: pageSize, textSearch: ''});
|
||||
} else {
|
||||
fetchDashboardsPromise = dashboardService.getCustomerDashboards(vm.edgeCustomerId.id, {limit: pageSize, textSearch: ''});
|
||||
}
|
||||
|
||||
fetchDashboardsPromise.then(
|
||||
dashboardService.getTenantDashboards({limit: pageSize, textSearch: ''}).then(
|
||||
function success(_dashboards) {
|
||||
var dashboards = {
|
||||
pageSize: pageSize,
|
||||
|
||||
@ -21,6 +21,8 @@ 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";
|
||||
import ruleChainsTemplate from "../rulechain/rulechains.tpl.html";
|
||||
import ruleChainTemplate from "../rulechain/rulechain.tpl.html";
|
||||
|
||||
/* eslint-enable import/no-unresolved, import/default */
|
||||
|
||||
@ -49,8 +51,7 @@ export default function EdgeRoutes($stateProvider, types) {
|
||||
ncyBreadcrumb: {
|
||||
label: '{"icon": "transform", "label": "edge.edges"}'
|
||||
}
|
||||
})
|
||||
.state('home.edges.entityViews', {
|
||||
}).state('home.edges.entityViews', {
|
||||
url: '/:edgeId/entityViews',
|
||||
params: {'topIndex': 0},
|
||||
module: 'private',
|
||||
@ -72,8 +73,7 @@ export default function EdgeRoutes($stateProvider, types) {
|
||||
ncyBreadcrumb: {
|
||||
label: '{"icon": "view_quilt", "label": "edge.entity-views"}'
|
||||
}
|
||||
})
|
||||
.state('home.edges.devices', {
|
||||
}).state('home.edges.devices', {
|
||||
url: '/:edgeId/devices',
|
||||
params: {'topIndex': 0},
|
||||
module: 'private',
|
||||
@ -95,8 +95,7 @@ export default function EdgeRoutes($stateProvider, types) {
|
||||
ncyBreadcrumb: {
|
||||
label: '{"icon": "devices_other", "label": "edge.devices"}'
|
||||
}
|
||||
})
|
||||
.state('home.edges.assets', {
|
||||
}).state('home.edges.assets', {
|
||||
url: '/:edgeId/assets',
|
||||
params: {'topIndex': 0},
|
||||
module: 'private',
|
||||
@ -118,8 +117,7 @@ export default function EdgeRoutes($stateProvider, types) {
|
||||
ncyBreadcrumb: {
|
||||
label: '{"icon": "domain", "label": "edge.assets"}'
|
||||
}
|
||||
})
|
||||
.state('home.edges.dashboards', {
|
||||
}).state('home.edges.dashboards', {
|
||||
url: '/:edgeId/dashboards',
|
||||
params: {'topIndex': 0},
|
||||
module: 'private',
|
||||
@ -139,8 +137,7 @@ export default function EdgeRoutes($stateProvider, types) {
|
||||
ncyBreadcrumb: {
|
||||
label: '{"icon": "dashboard", "label": "edge.dashboards"}'
|
||||
}
|
||||
})
|
||||
.state('home.edges.dashboards.dashboard', {
|
||||
}).state('home.edges.dashboards.dashboard', {
|
||||
url: '/:dashboardId?state',
|
||||
reloadOnSearch: false,
|
||||
module: 'private',
|
||||
@ -161,8 +158,7 @@ export default function EdgeRoutes($stateProvider, types) {
|
||||
ncyBreadcrumb: {
|
||||
label: '{"icon": "dashboard", "label": "{{ vm.dashboard.title }}", "translate": "false"}'
|
||||
}
|
||||
})
|
||||
.state('home.customers.edges', {
|
||||
}).state('home.customers.edges', {
|
||||
url: '/:customerId/edges',
|
||||
params: {'topIndex': 0},
|
||||
module: 'private',
|
||||
@ -184,5 +180,62 @@ export default function EdgeRoutes($stateProvider, types) {
|
||||
ncyBreadcrumb: {
|
||||
label: '{"icon": "router", "label": "{{ vm.customerEdgesTitle }}", "translate": "false"}'
|
||||
}
|
||||
}).state('home.edges.ruleChains', {
|
||||
url: '/:edgeId/ruleChains',
|
||||
params: {'topIndex': 0},
|
||||
module: 'private',
|
||||
auth: ['TENANT_ADMIN'],
|
||||
views: {
|
||||
"content@home": {
|
||||
templateUrl: ruleChainsTemplate,
|
||||
controllerAs: 'vm',
|
||||
controller: 'RuleChainsController'
|
||||
}
|
||||
},
|
||||
data: {
|
||||
searchEnabled: true,
|
||||
pageTitle: 'edge.rulechains',
|
||||
ruleChainsType: 'edge'
|
||||
},
|
||||
ncyBreadcrumb: {
|
||||
label: '{"icon": "settings_ethernet", "label": "rulechain.edge-rulechains"}'
|
||||
}
|
||||
}).state('home.edges.ruleChains.ruleChain', {
|
||||
url: '/:ruleChainId',
|
||||
reloadOnSearch: false,
|
||||
module: 'private',
|
||||
auth: ['SYS_ADMIN', 'TENANT_ADMIN'],
|
||||
views: {
|
||||
"content@home": {
|
||||
templateUrl: ruleChainTemplate,
|
||||
controller: 'RuleChainController',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
},
|
||||
resolve: {
|
||||
ruleChain:
|
||||
/*@ngInject*/
|
||||
function($stateParams, ruleChainService) {
|
||||
return ruleChainService.getRuleChain($stateParams.ruleChainId);
|
||||
},
|
||||
ruleChainMetaData:
|
||||
/*@ngInject*/
|
||||
function($stateParams, ruleChainService) {
|
||||
return ruleChainService.getRuleChainMetaData($stateParams.ruleChainId);
|
||||
},
|
||||
ruleNodeComponents:
|
||||
/*@ngInject*/
|
||||
function($stateParams, ruleChainService) {
|
||||
return ruleChainService.getRuleNodeComponents(types.ruleChainType.edge);
|
||||
}
|
||||
},
|
||||
data: {
|
||||
import: false,
|
||||
searchEnabled: false,
|
||||
pageTitle: 'edge.rulechain'
|
||||
},
|
||||
ncyBreadcrumb: {
|
||||
label: '{"icon": "settings_ethernet", "label": "{{ vm.ruleChain.name }}", "translate": "false"}'
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@ -16,12 +16,12 @@
|
||||
|
||||
-->
|
||||
<div class="tb-cell" flex="20">{{ event.createdTime | date : 'yyyy-MM-dd HH:mm:ss' }}</div>
|
||||
<div class="tb-cell" flex="20">{{ event.edgeEventType }}</div>
|
||||
<div class="tb-cell" flex="40">{{ event.edgeEventAction }}</div>
|
||||
<div class="tb-cell" flex="20">{{ event.type }}</div>
|
||||
<div class="tb-cell" flex="40">{{ event.action }}</div>
|
||||
<div class="tb-cell" flex="20">{{ event.entityId }}</div>
|
||||
<div class="tb-cell" flex="15" ng-style="isPending ? {'color': 'rgba(0, 0, 0, .38)'} : {'color': '#000'}">{{ updateStatus(event.createdTime) | translate }}</div>
|
||||
<div class="tb-cell" flex="10">
|
||||
<md-button class="md-icon-button md-primary"
|
||||
<md-button ng-if="checkEdgeEventType(event.type)" class="md-icon-button md-primary"
|
||||
ng-click="showEdgeEntityContent($event, 'edge.entity-info', 'JSON')"
|
||||
aria-label="{{ 'action.view' | translate }}">
|
||||
<md-tooltip md-direction="top">
|
||||
|
||||
@ -106,9 +106,9 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $
|
||||
contentType = null;
|
||||
}
|
||||
var content = '';
|
||||
switch(scope.event.edgeEventType) {
|
||||
switch(scope.event.type) {
|
||||
case types.edgeEventType.relation:
|
||||
content = angular.toJson(scope.event.entityBody);
|
||||
content = angular.toJson(scope.event.body);
|
||||
showDialog();
|
||||
break;
|
||||
case types.edgeEventType.ruleChainMetaData:
|
||||
@ -121,7 +121,7 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $
|
||||
});
|
||||
break;
|
||||
default:
|
||||
content = entityService.getEntity(scope.event.edgeEventType, scope.event.entityId, {ignoreErrors: true}).then(
|
||||
content = entityService.getEntity(scope.event.type, scope.event.entityId, {ignoreErrors: true}).then(
|
||||
function success(info) {
|
||||
showDialog();
|
||||
return angular.toJson(info);
|
||||
@ -150,6 +150,12 @@ export default function EventRowDirective($compile, $templateCache, $mdDialog, $
|
||||
}
|
||||
}
|
||||
|
||||
scope.checkEdgeEventType = function (type) {
|
||||
return !(type === types.edgeEventType.widgetType ||
|
||||
type === types.edgeEventType.adminSettings ||
|
||||
type === types.edgeEventType.widgetsBundle );
|
||||
}
|
||||
|
||||
scope.checkTooltip = function($event) {
|
||||
var el = $event.target;
|
||||
var $el = angular.element(el);
|
||||
|
||||
@ -257,9 +257,6 @@ export default function ImportExport($log, $translate, $q, $mdDialog, $document,
|
||||
ruleChain.firstRuleNodeId = null;
|
||||
}
|
||||
ruleChain.root = false;
|
||||
delete ruleChain.assignedEdgesText;
|
||||
delete ruleChain.assignedEdges;
|
||||
delete ruleChain.assignedEdgesIds;
|
||||
return ruleChain;
|
||||
}
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@
|
||||
"general-settings": "Allgemeine Einstellungen",
|
||||
"outgoing-mail": "E-Mail Versand",
|
||||
"outgoing-mail-settings": "Konfiguration des Postausgangsservers",
|
||||
"system-settings": "Systeminstellungen",
|
||||
"system-settings": "Systemeinstellungen",
|
||||
"test-mail-sent": "Test E-Mail wurde erfolgreich versendet!",
|
||||
"base-url": "Basis-URL",
|
||||
"base-url-required": "Basis-URL ist erforderlich.",
|
||||
|
||||
@ -54,7 +54,7 @@ export default function AddRuleChainsToEdgeController(ruleChainService, $mdDialo
|
||||
vm.ruleChains.pending = true;
|
||||
ruleChainService.getEdgesRuleChains(vm.ruleChains.nextPageLink).then(
|
||||
function success(ruleChains) {
|
||||
vm.ruleChains.data = ruleChains.data;
|
||||
vm.ruleChains.data = vm.ruleChains.data.concat(ruleChains.data);
|
||||
vm.ruleChains.nextPageLink = ruleChains.nextPageLink;
|
||||
vm.ruleChains.hasNext = ruleChains.hasNext;
|
||||
if (vm.ruleChains.hasNext) {
|
||||
|
||||
@ -36,11 +36,6 @@
|
||||
</div>
|
||||
|
||||
<md-content class="md-padding tb-rulechain-fieldset" layout="column">
|
||||
<md-input-container class="md-block"
|
||||
ng-show="!isEdit && ruleChain.assignedEdgesText && ruleChainScope === 'tenant'">
|
||||
<label translate>rulechain.assigned-to-edges</label>
|
||||
<input ng-model="ruleChain.assignedEdgesText" disabled>
|
||||
</md-input-container>
|
||||
<fieldset ng-disabled="$root.loading || !isEdit || isReadOnly">
|
||||
<md-input-container class="md-block">
|
||||
<label translate>rulechain.name</label>
|
||||
|
||||
@ -1180,7 +1180,7 @@ export function RuleChainController($state, $scope, $compile, $q, $mdUtil, $time
|
||||
var saveRuleChainPromise;
|
||||
if (vm.isImport) {
|
||||
if (angular.isUndefined(vm.ruleChain.type)) {
|
||||
vm.ruleChain.type = types.coreRuleChainType;
|
||||
vm.ruleChain.type = types.ruleChainType.core;
|
||||
}
|
||||
saveRuleChainPromise = ruleChainService.saveRuleChain(vm.ruleChain);
|
||||
} else {
|
||||
@ -1269,7 +1269,7 @@ export function RuleChainController($state, $scope, $compile, $q, $mdUtil, $time
|
||||
vm.isDirty = false;
|
||||
vm.isImport = false;
|
||||
$mdUtil.nextTick(() => {
|
||||
if (vm.ruleChain.type === vm.types.coreRuleChainType) {
|
||||
if (vm.ruleChain.type === vm.types.ruleChainType.core) {
|
||||
$state.go('home.ruleChains.core.ruleChain', {ruleChainId: vm.ruleChain.id.id});
|
||||
} else {
|
||||
$state.go('home.ruleChains.edge.ruleChain', {ruleChainId: vm.ruleChain.id.id});
|
||||
@ -1293,7 +1293,7 @@ export function RuleChainController($state, $scope, $compile, $q, $mdUtil, $time
|
||||
ruleNode.configuration = angular.copy(ruleNode.component.configurationDescriptor.nodeDefinition.defaultConfiguration);
|
||||
|
||||
var ruleChainId = vm.ruleChain.id ? vm.ruleChain.id.id : null;
|
||||
var ruleChainType = vm.ruleChain.type ? vm.ruleChain.type : types.coreRuleChainType;
|
||||
var ruleChainType = vm.ruleChain.type ? vm.ruleChain.type : types.ruleChainType.core;
|
||||
|
||||
vm.enableHotKeys = false;
|
||||
|
||||
|
||||
@ -22,8 +22,8 @@ import ruleChainFieldsetTemplate from './rulechain-fieldset.tpl.html';
|
||||
/*@ngInject*/
|
||||
export default function RuleChainDirective($compile, $templateCache, $mdDialog, $document, $q, $translate, types, toast) {
|
||||
var linker = function (scope, element) {
|
||||
|
||||
var template = $templateCache.get(ruleChainFieldsetTemplate);
|
||||
|
||||
element.html(template);
|
||||
|
||||
scope.onRuleChainIdCopied = function() {
|
||||
|
||||
@ -82,7 +82,7 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider
|
||||
ruleNodeComponents:
|
||||
/*@ngInject*/
|
||||
function($stateParams, ruleChainService) {
|
||||
return ruleChainService.getRuleNodeComponents(types.coreRuleChainType);
|
||||
return ruleChainService.getRuleNodeComponents(types.ruleChainType.core);
|
||||
}
|
||||
},
|
||||
data: {
|
||||
@ -180,64 +180,7 @@ export default function RuleChainRoutes($stateProvider, NodeTemplatePathProvider
|
||||
ruleNodeComponents:
|
||||
/*@ngInject*/
|
||||
function($stateParams, ruleChainService) {
|
||||
return ruleChainService.getRuleNodeComponents(types.edgeRuleChainType);
|
||||
}
|
||||
},
|
||||
data: {
|
||||
import: false,
|
||||
searchEnabled: false,
|
||||
pageTitle: 'edge.rulechain'
|
||||
},
|
||||
ncyBreadcrumb: {
|
||||
label: '{"icon": "settings_ethernet", "label": "{{ vm.ruleChain.name }}", "translate": "false"}'
|
||||
}
|
||||
}).state('home.edges.ruleChains', {
|
||||
url: '/:edgeId/ruleChains',
|
||||
params: {'topIndex': 0},
|
||||
module: 'private',
|
||||
auth: ['TENANT_ADMIN'],
|
||||
views: {
|
||||
"content@home": {
|
||||
templateUrl: ruleChainsTemplate,
|
||||
controllerAs: 'vm',
|
||||
controller: 'RuleChainsController'
|
||||
}
|
||||
},
|
||||
data: {
|
||||
searchEnabled: true,
|
||||
pageTitle: 'edge.rulechains',
|
||||
ruleChainsType: 'edge'
|
||||
},
|
||||
ncyBreadcrumb: {
|
||||
label: '{"icon": "settings_ethernet", "label": "rulechain.edge-rulechains"}'
|
||||
}
|
||||
}).state('home.edges.ruleChains.ruleChain', {
|
||||
url: '/:ruleChainId',
|
||||
reloadOnSearch: false,
|
||||
module: 'private',
|
||||
auth: ['SYS_ADMIN', 'TENANT_ADMIN'],
|
||||
views: {
|
||||
"content@home": {
|
||||
templateUrl: ruleChainTemplate,
|
||||
controller: 'RuleChainController',
|
||||
controllerAs: 'vm'
|
||||
}
|
||||
},
|
||||
resolve: {
|
||||
ruleChain:
|
||||
/*@ngInject*/
|
||||
function($stateParams, ruleChainService) {
|
||||
return ruleChainService.getRuleChain($stateParams.ruleChainId);
|
||||
},
|
||||
ruleChainMetaData:
|
||||
/*@ngInject*/
|
||||
function($stateParams, ruleChainService) {
|
||||
return ruleChainService.getRuleChainMetaData($stateParams.ruleChainId);
|
||||
},
|
||||
ruleNodeComponents:
|
||||
/*@ngInject*/
|
||||
function($stateParams, ruleChainService) {
|
||||
return ruleChainService.getRuleNodeComponents(types.edgeRuleChainType);
|
||||
return ruleChainService.getRuleNodeComponents(types.ruleChainType.edge);
|
||||
}
|
||||
},
|
||||
data: {
|
||||
|
||||
@ -22,8 +22,8 @@ import addRuleChainsToEdgeTemplate from "./add-rulechains-to-edge.tpl.html";
|
||||
/* eslint-enable import/no-unresolved, import/default */
|
||||
|
||||
/*@ngInject*/
|
||||
export default function RuleChainsController(ruleChainService, userService, edgeService, importExport, $state,
|
||||
$stateParams, $filter, $translate, $mdDialog, $document, $q, types) {
|
||||
export default function RuleChainsController(ruleChainService, userService, importExport, $state, $stateParams, $filter, $translate, $mdDialog, types,
|
||||
$document, $q, edgeService) {
|
||||
|
||||
var vm = this;
|
||||
var edgeId = $stateParams.edgeId;
|
||||
@ -114,7 +114,7 @@ export default function RuleChainsController(ruleChainService, userService, edge
|
||||
|
||||
if (vm.ruleChainsScope === 'tenant') {
|
||||
fetchRuleChainsFunction = function (pageLink) {
|
||||
return fetchRuleChains(pageLink, types.coreRuleChainType);
|
||||
return fetchRuleChains(pageLink, types.ruleChainType.core);
|
||||
};
|
||||
deleteRuleChainFunction = function (ruleChainId) {
|
||||
return deleteRuleChain(ruleChainId);
|
||||
@ -162,9 +162,9 @@ export default function RuleChainsController(ruleChainService, userService, edge
|
||||
});
|
||||
vm.ruleChainGridConfig.addItemActions.push({
|
||||
onAction: function ($event) {
|
||||
importExport.importRuleChain($event, types.coreRuleChainType).then(
|
||||
importExport.importRuleChain($event, types.ruleChainType.core).then(
|
||||
function(ruleChainImport) {
|
||||
$state.go('home.ruleChains.importRuleChain', {ruleChainImport:ruleChainImport, ruleChainType: types.coreRuleChainType});
|
||||
$state.go('home.ruleChains.importRuleChain', {ruleChainImport:ruleChainImport, ruleChainType: types.ruleChainType.core});
|
||||
}
|
||||
);
|
||||
},
|
||||
@ -175,7 +175,7 @@ export default function RuleChainsController(ruleChainService, userService, edge
|
||||
|
||||
} else if (vm.ruleChainsScope === 'edges') {
|
||||
fetchRuleChainsFunction = function (pageLink) {
|
||||
return fetchRuleChains(pageLink, types.edgeRuleChainType);
|
||||
return fetchRuleChains(pageLink, types.ruleChainType.edge);
|
||||
};
|
||||
deleteRuleChainFunction = function (ruleChainId) {
|
||||
return deleteRuleChain(ruleChainId);
|
||||
@ -201,16 +201,6 @@ export default function RuleChainsController(ruleChainService, userService, edge
|
||||
isEnabled: isDefaultEdgeRuleChain
|
||||
});
|
||||
|
||||
ruleChainActionsList.push({
|
||||
onAction: function ($event, item) {
|
||||
vm.grid.deleteItem($event, item);
|
||||
},
|
||||
name: function() { return $translate.instant('action.delete') },
|
||||
details: function() { return $translate.instant('rulechain.delete') },
|
||||
icon: "delete",
|
||||
isEnabled: isNonRootRuleChain
|
||||
});
|
||||
|
||||
ruleChainActionsList.push({
|
||||
onAction: function ($event, item) {
|
||||
setDefaultRootEdgeRuleChain($event, item);
|
||||
@ -221,6 +211,16 @@ export default function RuleChainsController(ruleChainService, userService, edge
|
||||
isEnabled: isNonRootRuleChain
|
||||
});
|
||||
|
||||
ruleChainActionsList.push({
|
||||
onAction: function ($event, item) {
|
||||
vm.grid.deleteItem($event, item);
|
||||
},
|
||||
name: function() { return $translate.instant('action.delete') },
|
||||
details: function() { return $translate.instant('rulechain.delete') },
|
||||
icon: "delete",
|
||||
isEnabled: isNonRootRuleChain
|
||||
});
|
||||
|
||||
ruleChainGroupActionsList.push(
|
||||
{
|
||||
onAction: function ($event) {
|
||||
@ -243,9 +243,9 @@ export default function RuleChainsController(ruleChainService, userService, edge
|
||||
});
|
||||
vm.ruleChainGridConfig.addItemActions.push({
|
||||
onAction: function ($event) {
|
||||
importExport.importRuleChain($event, types.edgeRuleChainType).then(
|
||||
importExport.importRuleChain($event, types.ruleChainType.edge).then(
|
||||
function(ruleChainImport) {
|
||||
$state.go('home.ruleChains.importRuleChain', {ruleChainImport:ruleChainImport, ruleChainType: types.edgeRuleChainType});
|
||||
$state.go('home.ruleChains.importRuleChain', {ruleChainImport:ruleChainImport, ruleChainType: types.ruleChainType.edge});
|
||||
}
|
||||
);
|
||||
},
|
||||
@ -383,9 +383,9 @@ export default function RuleChainsController(ruleChainService, userService, edge
|
||||
function saveRuleChain(ruleChain) {
|
||||
if (angular.isUndefined(ruleChain.type)) {
|
||||
if (vm.ruleChainsScope === 'edges') {
|
||||
ruleChain.type = types.edgeRuleChainType;
|
||||
ruleChain.type = types.ruleChainType.edge;
|
||||
} else {
|
||||
ruleChain.type = types.coreRuleChainType;
|
||||
ruleChain.type = types.ruleChainType.core;
|
||||
}
|
||||
}
|
||||
return ruleChainService.saveRuleChain(ruleChain);
|
||||
@ -395,13 +395,13 @@ export default function RuleChainsController(ruleChainService, userService, edge
|
||||
if ($event) {
|
||||
$event.stopPropagation();
|
||||
}
|
||||
|
||||
var ruleChainParams = {ruleChainId: ruleChain.id.id};
|
||||
if (vm.ruleChainsScope === 'edge') {
|
||||
$state.go('home.edges.ruleChains.ruleChain', {ruleChainId: ruleChain.id.id, edgeId: vm.edge.id.id});
|
||||
$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', {ruleChainId: ruleChain.id.id});
|
||||
$state.go('home.ruleChains.edge.ruleChain', ruleChainParams);
|
||||
} else {
|
||||
$state.go('home.ruleChains.core.ruleChain', {ruleChainId: ruleChain.id.id});
|
||||
$state.go('home.ruleChains.core.ruleChain', ruleChainParams);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -24,7 +24,6 @@
|
||||
<md-tab label="{{ 'rulechain.details' | translate }}">
|
||||
<tb-rule-chain rule-chain="vm.grid.operatingItem()"
|
||||
is-edit="vm.grid.detailsConfig.isDetailsEditMode"
|
||||
rule-chain-scope="vm.ruleChainsScope"
|
||||
is-read-only="vm.grid.isDetailsReadOnly(vm.grid.operatingItem())"
|
||||
the-form="vm.grid.detailsForm"
|
||||
on-set-root-rule-chain="vm.setRootRuleChain(event, vm.grid.detailsConfig.currentItem)"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user