You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by mc...@apache.org on 2015/01/26 15:18:30 UTC

incubator-nifi git commit: NIFI-250: - Starting to load the controller services and prepare for adding them.

Repository: incubator-nifi
Updated Branches:
  refs/heads/NIFI-250 35616e9ad -> 0c021c782


NIFI-250:
- Starting to load the controller services and prepare for adding them.

Project: http://git-wip-us.apache.org/repos/asf/incubator-nifi/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-nifi/commit/0c021c78
Tree: http://git-wip-us.apache.org/repos/asf/incubator-nifi/tree/0c021c78
Diff: http://git-wip-us.apache.org/repos/asf/incubator-nifi/diff/0c021c78

Branch: refs/heads/NIFI-250
Commit: 0c021c782589b4fe439dcb0f81d229fde6cd9327
Parents: 35616e9
Author: Matt Gilman <ma...@gmail.com>
Authored: Mon Jan 26 09:18:06 2015 -0500
Committer: Matt Gilman <ma...@gmail.com>
Committed: Mon Jan 26 09:18:06 2015 -0500

----------------------------------------------------------------------
 .../webapp/js/nf/canvas/nf-canvas-header.js     |  4 +-
 .../src/main/webapp/js/nf/canvas/nf-settings.js | 99 +++++++++++++++++++-
 2 files changed, 97 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/0c021c78/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-header.js
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-header.js b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-header.js
index 03715e8..c7d0a1d 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-header.js
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-canvas-header.js
@@ -60,7 +60,9 @@ nf.CanvasHeader = (function () {
             // mouse over for the flow settings link
             if (nf.Common.isDFM()) {
                 nf.Common.addHoverEffect('#flow-settings-link', 'flow-settings-link', 'flow-settings-link-hover').click(function () {
-                    nf.Settings.showSettings();
+                    nf.Settings.showSettings().done(function () {
+                        nf.Settings.resetTableSize();
+                    });
                 });
             } else {
                 $('#flow-settings-link').addClass('flow-settings-link-disabled');

http://git-wip-us.apache.org/repos/asf/incubator-nifi/blob/0c021c78/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
----------------------------------------------------------------------
diff --git a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
index e2d59e6..ee8b409 100644
--- a/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
+++ b/nifi/nifi-nar-bundles/nifi-framework-bundle/nifi-framework/nifi-web/nifi-web-ui/src/main/webapp/js/nf/canvas/nf-settings.js
@@ -25,7 +25,9 @@ nf.Settings = (function () {
             controllerConfig: '../nifi-api/controller/config',
             controllerArchive: '../nifi-api/controller/archive',
             controllerServiceTypes: '../nifi-api/controller/controller-service-types',
-            reportingTaskTypes: '../nifi-api/controller/reporting-task-types'
+            controllerServices: '../nifi-api/controller/controller-services',
+            reportingTaskTypes: '../nifi-api/controller/reporting-task-types',
+            reportingTasks: '../nifi-api/controller/reporting-tasks'
         }
     };
 
@@ -565,7 +567,15 @@ nf.Settings = (function () {
                 buttonText: 'Add',
                 handler: {
                     click: function () {
+                        // add the new controller service
+                        var selectedServiceName = $('#controller-service-name-field').val();
+                        var selectedServiceType = $('#selected-controller-service-type').text();
                         
+                        $.ajax({
+                            
+                        }).done(function () {
+                            
+                        });
                     }
                 }
             }, {
@@ -606,11 +616,75 @@ nf.Settings = (function () {
         };
         
         // define the column model for the controller services table
-        var controllerServicesColumnModel = [
+        var controllerServicesColumns = [
             {id: 'moreDetails', field: 'moreDetails', name: '&nbsp;', resizable: false, formatter: moreControllerServiceDetails, sortable: true, width: 50, maxWidth: 50},
-            {id: 'id', field: 'id', name: 'Identifier', sortable: true, resizable: true},
+            {id: 'name', field: 'name', name: 'Name', sortable: true, resizable: true},
             {id: 'type', field: 'type', name: 'Type', sortable: true, resizable: true}
         ];
+        var controllerServicesOptions = {
+            forceFitColumns: true,
+            enableTextSelectionOnCells: true,
+            enableCellNavigation: true,
+            enableColumnReorder: false,
+            autoEdit: false,
+            multiSelect: false
+        };
+
+        // initialize the dataview
+        var controllerServicesData = new Slick.Data.DataView({
+            inlineFilters: false
+        });
+        controllerServicesData.setItems([]);
+//        controllerServicesData.setFilterArgs({
+//            searchString: getControllerServiceTypeFilterText(),
+//            property: $('#controller-service-type-filter-options').combo('getSelectedOption').value
+//        });
+        controllerServicesData.setFilter(filterControllerServiceTypes);
+        
+        // initialize the grid
+        var controllerServicesGrid = new Slick.Grid('#controller-services-table', controllerServicesData, controllerServicesColumns, controllerServicesOptions);
+        controllerServicesGrid.setSelectionModel(new Slick.RowSelectionModel());
+        controllerServicesGrid.registerPlugin(new Slick.AutoTooltips());
+        controllerServicesGrid.setSortColumn('name', true);
+
+        // wire up the dataview to the grid
+        controllerServicesData.onRowCountChanged.subscribe(function (e, args) {
+            controllerServicesGrid.updateRowCount();
+            controllerServicesGrid.render();
+
+            // update the total number of displayed processors
+//            $('#displayed-controller-service-types').text(getVisibleControllerServiceCount());
+        });
+        controllerServicesData.onRowsChanged.subscribe(function (e, args) {
+            controllerServicesGrid.invalidateRows(args.rows);
+            controllerServicesGrid.render();
+        });
+        controllerServicesData.syncGridSelection(controllerServicesGrid, true);
+
+        // hold onto an instance of the grid
+        $('#controller-services-table').data('gridInstance', controllerServicesGrid);
+    };
+    
+    /**
+     * Loads the controller services.
+     */
+    var loadControllerServices = function () {
+        return $.ajax({
+            type: 'GET',
+            url: config.urls.controllerServices,
+            dataType: 'json'
+        }).done(function (response) {
+            var controllerServices = response.controllerServices;
+            if (nf.Common.isDefinedAndNotNull(controllerServices)) {
+                var controllerServicesGrid = $('#controller-services-table').data('gridInstance');
+                var controllerServicesData = controllerServicesGrid.getData();
+
+                // update the processors
+                controllerServicesData.setItems(controllerServices);
+                controllerServicesData.reSort();
+                controllerServicesGrid.invalidate();
+            }
+        });
     };
     
     /**
@@ -640,10 +714,17 @@ nf.Settings = (function () {
         // define the column model for the reporting tasks table
         var reportingTasksColumnModel = [
             {id: 'moreDetails', field: 'moreDetails', name: '&nbsp;', resizable: false, formatter: moreReportingTaskDetails, sortable: true, width: 50, maxWidth: 50},
-            {id: 'id', field: 'id', name: 'Identifier', sortable: true, resizable: true},
+            {id: 'name', field: 'name', name: 'Name', sortable: true, resizable: true},
             {id: 'type', field: 'type', name: 'Type', sortable: true, resizable: true}
         ];
     };
+    
+    /**
+     * Loads the reporting tasks.
+     */
+    var loadReportingTasks = function () {
+        
+    };
 
     return {
         /**
@@ -736,7 +817,7 @@ nf.Settings = (function () {
          * Shows the settings dialog.
          */
         showSettings: function () {
-            $.ajax({
+            var settings = $.ajax({
                 type: 'GET',
                 url: config.urls.controllerConfig,
                 dataType: 'json'
@@ -759,6 +840,14 @@ nf.Settings = (function () {
                     $('#settings-save').mouseout();
                 });
             }).fail(nf.Common.handleAjaxError);
+            
+            // load the controller services
+            var controllerServices = loadControllerServices();
+            
+            // load the reporting tasks
+            var reportingTasks = loadReportingTasks();
+            
+            return $.when(settings, controllerServices, reportingTasks);
         }
     };
 }());
\ No newline at end of file