thingsboard-aplcache

Remove Rules and Plugins UI

5/15/2018 1:14:50 PM

Changes

ui/src/app/api/plugin.service.js 218(+0 -218)

ui/src/app/api/rule.service.js 186(+0 -186)

ui/src/app/component/component.directive.js 75(+0 -75)

ui/src/app/component/component.tpl.html 58(+0 -58)

ui/src/app/component/component-dialog.controller.js 105(+0 -105)

ui/src/app/component/component-dialog.service.js 60(+0 -60)

ui/src/app/component/component-dialog.tpl.html 79(+0 -79)

ui/src/app/component/index.js 28(+0 -28)

ui/src/app/components/plugin-select.directive.js 115(+0 -115)

ui/src/app/components/plugin-select.scss 37(+0 -37)

ui/src/app/components/plugin-select.tpl.html 44(+0 -44)

ui/src/app/plugin/add-plugin.tpl.html 48(+0 -48)

ui/src/app/plugin/index.js 36(+0 -36)

ui/src/app/plugin/plugin.controller.js 218(+0 -218)

ui/src/app/plugin/plugin.directive.js 94(+0 -94)

ui/src/app/plugin/plugin.routes.js 46(+0 -46)

ui/src/app/plugin/plugin.scss 18(+0 -18)

ui/src/app/plugin/plugin-card.tpl.html 19(+0 -19)

ui/src/app/plugin/plugin-fieldset.tpl.html 90(+0 -90)

ui/src/app/plugin/plugins.tpl.html 77(+0 -77)

ui/src/app/rule/add-rule.tpl.html 48(+0 -48)

ui/src/app/rule/index.js 40(+0 -40)

ui/src/app/rule/rule.controller.js 210(+0 -210)

ui/src/app/rule/rule.directive.js 191(+0 -191)

ui/src/app/rule/rule.routes.js 46(+0 -46)

ui/src/app/rule/rule.scss 55(+0 -55)

ui/src/app/rule/rule-card.tpl.html 19(+0 -19)

ui/src/app/rule/rule-fieldset.tpl.html 219(+0 -219)

ui/src/app/rule/rules.tpl.html 77(+0 -77)

Details

diff --git a/ui/src/app/api/entity.service.js b/ui/src/app/api/entity.service.js
index ba1265f..762bf1a 100644
--- a/ui/src/app/api/entity.service.js
+++ b/ui/src/app/api/entity.service.js
@@ -21,8 +21,7 @@ export default angular.module('thingsboard.api.entity', [thingsboardTypes])
 
 /*@ngInject*/
 function EntityService($http, $q, $filter, $translate, $log, userService, deviceService,
-                       assetService, tenantService, customerService,
-                       ruleService, pluginService, ruleChainService, dashboardService, entityRelationService, attributeService, types, utils) {
+                       assetService, tenantService, customerService, ruleChainService, dashboardService, entityRelationService, attributeService, types, utils) {
     var service = {
         getEntity: getEntity,
         getEntities: getEntities,
@@ -61,12 +60,6 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device
             case types.entityType.customer:
                 promise = customerService.getCustomer(entityId, config);
                 break;
-            case types.entityType.rule:
-                promise = ruleService.getRule(entityId, config);
-                break;
-            case types.entityType.plugin:
-                promise = pluginService.getPlugin(entityId, config);
-                break;
             case types.entityType.dashboard:
                 promise = dashboardService.getDashboardInfo(entityId, config);
                 break;
@@ -146,14 +139,6 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device
                 promise = getEntitiesByIdsPromise(
                     (id) => customerService.getCustomer(id, config), entityIds);
                 break;
-            case types.entityType.rule:
-                promise = getEntitiesByIdsPromise(
-                    (id) => ruleService.getRule(id, config), entityIds);
-                break;
-            case types.entityType.plugin:
-                promise = getEntitiesByIdsPromise(
-                    (id) => pluginService.getPlugin(id, config), entityIds);
-                break;
             case types.entityType.dashboard:
                 promise = getEntitiesByIdsPromise(
                     (id) => dashboardService.getDashboardInfo(id, config), entityIds);
@@ -268,12 +253,6 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device
                     promise = customerService.getCustomers(pageLink, config);
                 }
                 break;
-            case types.entityType.rule:
-                promise = ruleService.getAllRules(pageLink, config);
-                break;
-            case types.entityType.plugin:
-                promise = pluginService.getAllPlugins(pageLink, config);
-                break;
             case types.entityType.rulechain:
                 promise = ruleChainService.getRuleChains(pageLink, config);
                 break;
@@ -742,16 +721,12 @@ function EntityService($http, $q, $filter, $translate, $log, userService, device
         switch(authority) {
             case 'SYS_ADMIN':
                 entityTypes.tenant = types.entityType.tenant;
-                entityTypes.rule = types.entityType.rule;
-                entityTypes.plugin = types.entityType.plugin;
                 break;
             case 'TENANT_ADMIN':
                 entityTypes.device = types.entityType.device;
                 entityTypes.asset = types.entityType.asset;
                 entityTypes.tenant = types.entityType.tenant;
                 entityTypes.customer = types.entityType.customer;
-                entityTypes.rule = types.entityType.rule;
-                entityTypes.plugin = types.entityType.plugin;
                 entityTypes.dashboard = types.entityType.dashboard;
                 if (useAliasEntityTypes) {
                     entityTypes.current_customer = types.aliasEntityType.current_customer;
diff --git a/ui/src/app/app.js b/ui/src/app/app.js
index 3131013..88e1448 100644
--- a/ui/src/app/app.js
+++ b/ui/src/app/app.js
@@ -74,6 +74,7 @@ import thingsboardApiAttribute from './api/attribute.service';
 import thingsboardApiEntity from './api/entity.service';
 import thingsboardApiAlarm from './api/alarm.service';
 import thingsboardApiAuditLog from './api/audit-log.service';
+import thingsboardApiComponentDescriptor from './api/component-descriptor.service';
 import thingsboardApiRuleChain from './api/rule-chain.service';
 
 import 'typeface-roboto';
@@ -139,6 +140,7 @@ angular.module('thingsboard', [
     thingsboardApiEntity,
     thingsboardApiAlarm,
     thingsboardApiAuditLog,
+    thingsboardApiComponentDescriptor,
     thingsboardApiRuleChain,
     uiRouter])
     .config(AppConfig)
diff --git a/ui/src/app/common/types.constant.js b/ui/src/app/common/types.constant.js
index 5c30563..8d88cb9 100644
--- a/ui/src/app/common/types.constant.js
+++ b/ui/src/app/common/types.constant.js
@@ -297,16 +297,15 @@ export default angular.module('thingsboard.types', [])
                 }
             },
             componentType: {
+                enrichment: "ENRICHMENT",
                 filter: "FILTER",
-                processor: "PROCESSOR",
+                transformation: "TRANSFORMATION",
                 action: "ACTION",
-                plugin: "PLUGIN"
+                external: "EXTERNAL"
             },
             entityType: {
                 device: "DEVICE",
                 asset: "ASSET",
-                rule: "RULE",
-                plugin: "PLUGIN",
                 tenant: "TENANT",
                 customer: "CUSTOMER",
                 user: "USER",
@@ -331,18 +330,6 @@ export default angular.module('thingsboard.types', [])
                     list: 'entity.list-of-assets',
                     nameStartsWith: 'entity.asset-name-starts-with'
                 },
-                "RULE": {
-                    type: 'entity.type-rule',
-                    typePlural: 'entity.type-rules',
-                    list: 'entity.list-of-rules',
-                    nameStartsWith: 'entity.rule-name-starts-with'
-                },
-                "PLUGIN": {
-                    type: 'entity.type-plugin',
-                    typePlural: 'entity.type-plugins',
-                    list: 'entity.list-of-plugins',
-                    nameStartsWith: 'entity.plugin-name-starts-with'
-                },
                 "TENANT": {
                     type: 'entity.type-tenant',
                     typePlural: 'entity.type-tenants',
diff --git a/ui/src/app/entity/entity-autocomplete.directive.js b/ui/src/app/entity/entity-autocomplete.directive.js
index 2dfc3be..e46c614 100644
--- a/ui/src/app/entity/entity-autocomplete.directive.js
+++ b/ui/src/app/entity/entity-autocomplete.directive.js
@@ -131,18 +131,6 @@ export default function EntityAutocomplete($compile, $templateCache, $q, $filter
                     scope.noEntitiesMatchingText = 'device.no-devices-matching';
                     scope.entityRequiredText = 'device.device-required';
                     break;
-                case types.entityType.rule:
-                    scope.selectEntityText = 'rule.select-rule';
-                    scope.entityText = 'rule.rule';
-                    scope.noEntitiesMatchingText = 'rule.no-rules-matching';
-                    scope.entityRequiredText = 'rule.rule-required';
-                    break;
-                case types.entityType.plugin:
-                    scope.selectEntityText = 'plugin.select-plugin';
-                    scope.entityText = 'plugin.plugin';
-                    scope.noEntitiesMatchingText = 'plugin.no-plugins-matching';
-                    scope.entityRequiredText = 'plugin.plugin-required';
-                    break;
                 case types.entityType.rulechain:
                     scope.selectEntityText = 'rulechain.select-rulechain';
                     scope.entityText = 'rulechain.rulechain';
diff --git a/ui/src/app/import-export/import-export.service.js b/ui/src/app/import-export/import-export.service.js
index f04b036..d64441f 100644
--- a/ui/src/app/import-export/import-export.service.js
+++ b/ui/src/app/import-export/import-export.service.js
@@ -25,8 +25,7 @@ import entityAliasesTemplate from '../entity/alias/entity-aliases.tpl.html';
 
 /*@ngInject*/
 export default function ImportExport($log, $translate, $q, $mdDialog, $document, $http, itembuffer, utils, types,
-                                     dashboardUtils, entityService, dashboardService, pluginService, ruleService,
-                                     ruleChainService, widgetService, toast, attributeService) {
+                                     dashboardUtils, entityService, dashboardService, ruleChainService, widgetService, toast, attributeService) {
 
 
     var service = {
@@ -34,10 +33,6 @@ export default function ImportExport($log, $translate, $q, $mdDialog, $document,
         importDashboard: importDashboard,
         exportWidget: exportWidget,
         importWidget: importWidget,
-        exportPlugin: exportPlugin,
-        importPlugin: importPlugin,
-        exportRule: exportRule,
-        importRule: importRule,
         exportRuleChain: exportRuleChain,
         importRuleChain: importRuleChain,
         exportWidgetType: exportWidgetType,
@@ -221,62 +216,6 @@ export default function ImportExport($log, $translate, $q, $mdDialog, $document,
         return true;
     }
 
-    // Rule functions
-
-    function exportRule(ruleId) {
-        ruleService.getRule(ruleId).then(
-            function success(rule) {
-                var name = rule.name;
-                name = name.toLowerCase().replace(/\W/g,"_");
-                exportToPc(prepareExport(rule), name + '.json');
-            },
-            function fail(rejection) {
-                var message = rejection;
-                if (!message) {
-                    message = $translate.instant('error.unknown-error');
-                }
-                toast.showError($translate.instant('rule.export-failed-error', {error: message}));
-            }
-        );
-    }
-
-    function importRule($event) {
-        var deferred = $q.defer();
-        openImportDialog($event, 'rule.import', 'rule.rule-file').then(
-            function success(rule) {
-                if (!validateImportedRule(rule)) {
-                    toast.showError($translate.instant('rule.invalid-rule-file-error'));
-                    deferred.reject();
-                } else {
-                    rule.state = 'SUSPENDED';
-                    ruleService.saveRule(rule).then(
-                        function success() {
-                            deferred.resolve();
-                        },
-                        function fail() {
-                            deferred.reject();
-                        }
-                    );
-                }
-            },
-            function fail() {
-                deferred.reject();
-            }
-        );
-        return deferred.promise;
-    }
-
-    function validateImportedRule(rule) {
-        if (angular.isUndefined(rule.name)
-            || angular.isUndefined(rule.pluginToken)
-            || angular.isUndefined(rule.filters)
-            || angular.isUndefined(rule.action))
-        {
-            return false;
-        }
-        return true;
-    }
-
     // Rule chain functions
 
     function exportRuleChain(ruleChainId) {
@@ -361,65 +300,6 @@ export default function ImportExport($log, $translate, $q, $mdDialog, $document,
         return true;
     }
 
-    // Plugin functions
-
-    function exportPlugin(pluginId) {
-        pluginService.getPlugin(pluginId).then(
-            function success(plugin) {
-                if (!plugin.configuration || plugin.configuration === null) {
-                    plugin.configuration = {};
-                }
-                var name = plugin.name;
-                name = name.toLowerCase().replace(/\W/g,"_");
-                exportToPc(prepareExport(plugin), name + '.json');
-            },
-            function fail(rejection) {
-                var message = rejection;
-                if (!message) {
-                    message = $translate.instant('error.unknown-error');
-                }
-                toast.showError($translate.instant('plugin.export-failed-error', {error: message}));
-            }
-        );
-    }
-
-    function importPlugin($event) {
-        var deferred = $q.defer();
-        openImportDialog($event, 'plugin.import', 'plugin.plugin-file').then(
-            function success(plugin) {
-                if (!validateImportedPlugin(plugin)) {
-                    toast.showError($translate.instant('plugin.invalid-plugin-file-error'));
-                    deferred.reject();
-                } else {
-                    plugin.state = 'SUSPENDED';
-                    pluginService.savePlugin(plugin).then(
-                        function success() {
-                            deferred.resolve();
-                        },
-                        function fail() {
-                            deferred.reject();
-                        }
-                    );
-                }
-            },
-            function fail() {
-                deferred.reject();
-            }
-        );
-        return deferred.promise;
-    }
-
-    function validateImportedPlugin(plugin) {
-        if (angular.isUndefined(plugin.name)
-            || angular.isUndefined(plugin.clazz)
-            || angular.isUndefined(plugin.apiToken)
-            || angular.isUndefined(plugin.configuration))
-        {
-            return false;
-        }
-        return true;
-    }
-
     // Widget functions
 
     function exportWidget(dashboard, sourceState, sourceLayout, widget) {
diff --git a/ui/src/app/layout/index.js b/ui/src/app/layout/index.js
index 6ec7ef7..8f2958d 100644
--- a/ui/src/app/layout/index.js
+++ b/ui/src/app/layout/index.js
@@ -50,8 +50,6 @@ import thingsboardAsset from '../asset';
 import thingsboardDevice from '../device';
 import thingsboardWidgetLibrary from '../widget';
 import thingsboardDashboard from '../dashboard';
-import thingsboardPlugin from '../plugin';
-import thingsboardRule from '../rule';
 import thingsboardRuleChain from '../rulechain';
 
 import thingsboardJsonForm from '../jsonform';
@@ -83,8 +81,6 @@ export default angular.module('thingsboard.home', [
     thingsboardDevice,
     thingsboardWidgetLibrary,
     thingsboardDashboard,
-    thingsboardPlugin,
-    thingsboardRule,
     thingsboardRuleChain,
     thingsboardJsonForm,
     thingsboardApiDevice,
diff --git a/ui/src/app/services/menu.service.js b/ui/src/app/services/menu.service.js
index 5d97ea6..1c33d1f 100644
--- a/ui/src/app/services/menu.service.js
+++ b/ui/src/app/services/menu.service.js
@@ -67,24 +67,6 @@ function Menu(userService, $state, $rootScope) {
                             icon: 'home'
                         },
                         {
-                            name: 'plugin.plugins',
-                            type: 'link',
-                            state: 'home.plugins',
-                            icon: 'extension'
-                        },
-                        {
-                            name: 'rule.rules',
-                            type: 'link',
-                            state: 'home.rules',
-                            icon: 'settings_ethernet'
-                        },
-                        {
-                            name: 'rulechain.rulechains',
-                            type: 'link',
-                            state: 'home.ruleChains',
-                            icon: 'settings_ethernet'
-                        },
-                        {
                             name: 'tenant.tenants',
                             type: 'link',
                             state: 'home.tenants',
@@ -119,31 +101,6 @@ function Menu(userService, $state, $rootScope) {
                         }];
                     homeSections =
                         [{
-                            name: 'rule-plugin.management',
-                            places: [
-                                {
-                                    name: 'plugin.plugins',
-                                    icon: 'extension',
-                                    state: 'home.plugins'
-                                },
-                                {
-                                    name: 'rule.rules',
-                                    icon: 'settings_ethernet',
-                                    state: 'home.rules'
-                                }
-                            ]
-                        },
-                        {
-                            name: 'rulechain.management',
-                            places: [
-                                {
-                                    name: 'rulechain.rulechains',
-                                    icon: 'settings_ethernet',
-                                    state: 'home.ruleChains'
-                                }
-                            ]
-                        },
-                        {
                             name: 'tenant.management',
                             places: [
                                 {
@@ -187,18 +144,6 @@ function Menu(userService, $state, $rootScope) {
                             icon: 'home'
                         },
                         {
-                            name: 'plugin.plugins',
-                            type: 'link',
-                            state: 'home.plugins',
-                            icon: 'extension'
-                        },
-                        {
-                            name: 'rule.rules',
-                            type: 'link',
-                            state: 'home.rules',
-                            icon: 'settings_ethernet'
-                        },
-                        {
                             name: 'rulechain.rulechains',
                             type: 'link',
                             state: 'home.ruleChains',
@@ -243,21 +188,6 @@ function Menu(userService, $state, $rootScope) {
 
                     homeSections =
                         [{
-                            name: 'rule-plugin.management',
-                            places: [
-                                {
-                                    name: 'plugin.plugins',
-                                    icon: 'extension',
-                                    state: 'home.plugins'
-                                },
-                                {
-                                    name: 'rule.rules',
-                                    icon: 'settings_ethernet',
-                                    state: 'home.rules'
-                                }
-                            ]
-                        },
-                        {
                             name: 'rulechain.management',
                             places: [
                                 {