From d9030abed508d88e768f885f98d05ba8bba57c3f Mon Sep 17 00:00:00 2001 From: Ryan Rathsam Date: Fri, 15 Jan 2021 10:59:57 -0500 Subject: [PATCH] Updates to allow `getActionsForPipelines` to be used as a TreeGrid source - Updated the url for the TreeGrid to point at `/etl/pipelines/actions` - Upated the `getActionsforPipelines` method chain so that it produces output suitable for use in an ExtJS TreeGrid. - The change @ #201 was needed due to `get_object_vars` returning a keyed array ` => `. - #289: This function preps the output for use use in an EXtJS TreeGrid. - #453: This was simplify / declutter the display of the action name from it's fully qualified form `xdmod.pipeline.action` to `action` as the nodes immediately preceeding the action node will already be displaying the full pipeline name. --- classes/Rest/Controllers/ETLControllerProvider.php | 11 ++++++----- .../js/etl_viewer/ETLViewerTreePanel.js | 2 +- .../js/etl_viewer/ETLViewerTreeTab.js | 3 +-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/classes/Rest/Controllers/ETLControllerProvider.php b/classes/Rest/Controllers/ETLControllerProvider.php index 7b3de83b9a..255731f466 100644 --- a/classes/Rest/Controllers/ETLControllerProvider.php +++ b/classes/Rest/Controllers/ETLControllerProvider.php @@ -41,6 +41,8 @@ public function setupRoutes(Application $app, ControllerCollection $controller) $class = get_class($this); $controller->get("$root/pipelines/actions", "$class::getActionsForPipelines"); + $controller->post("$root/pipelines/actions", "$class::getActionsForPipelines"); + $controller->get("$root/pipelines/{pipeline}/actions", "$class::getActionsForPipeline"); $controller->get("$root/pipelines/{pipeline}/endpoints", "$class::getEndpointsForPipeline"); @@ -51,8 +53,6 @@ public function setupRoutes(Application $app, ControllerCollection $controller) $controller->post("$root/files", "$class::getFileNames"); $controller->get("$root/endpoints", "$class::getDataEndpoints"); - - } /** @@ -201,7 +201,7 @@ protected function convertForTreeGrid($source) if ($isArray) { $keys = array_keys($source); } elseif ($isObject) { - $keys = get_object_vars($source); + $keys = array_keys(get_object_vars($source)); } foreach ($keys as $key) { @@ -289,7 +289,7 @@ public function getActionsForPipelines(Request $request, Application $app) #echo "\t Skipping $pipelineName\n"; } } - return $app->json($results); + return $app->json($this->convertForTreeGrid($results)); } public function getActionsForPipeline(Request $request, Application $app, $pipeline) @@ -453,7 +453,8 @@ function ($carry, $item) { $endpoints[$destination['key']] = $destination; } - $results[$pipelineName][] = array( + $name = substr($actionName, strlen($pipelineName) + 1); + $results[$name] = array( 'name' => $actionName, 'class' => $configClass, 'source' => $source, diff --git a/html/internal_dashboard/js/etl_viewer/ETLViewerTreePanel.js b/html/internal_dashboard/js/etl_viewer/ETLViewerTreePanel.js index f5dc05a10a..fb6914026f 100644 --- a/html/internal_dashboard/js/etl_viewer/ETLViewerTreePanel.js +++ b/html/internal_dashboard/js/etl_viewer/ETLViewerTreePanel.js @@ -8,7 +8,7 @@ XDMoD.Admin.ETL.ETLViewerTreePanel = Ext.extend(XDMoD.Admin.ETL.ETLViewerTree, { url: null, initComponent: function () { - this.url = XDMoD.REST.url + '/etl/pipelines'; + this.url = XDMoD.REST.url + '/etl/pipelines/actions'; this.loaded = false; XDMoD.Admin.ETL.ETLViewerTreePanel.superclass.initComponent.call(this, arguments); diff --git a/html/internal_dashboard/js/etl_viewer/ETLViewerTreeTab.js b/html/internal_dashboard/js/etl_viewer/ETLViewerTreeTab.js index e6f173c5ec..10d90642e1 100644 --- a/html/internal_dashboard/js/etl_viewer/ETLViewerTreeTab.js +++ b/html/internal_dashboard/js/etl_viewer/ETLViewerTreeTab.js @@ -65,9 +65,8 @@ XDMoD.Admin.ETL.ETLViewerTreeTab = Ext.extend(Ext.Panel, { updateHistory: true, title: 'ETL Pipeline Viewer', autoScroll: true, - columnResize: true, enableDD: true, - dataUrl: XDMoD.REST.url + '/etl/pipelines', + dataUrl: XDMoD.REST.url + '/etl/pipelines/actions', columns: [ { header: 'Name',