Repository: meltano/meltano

Issue:
Uvicorn - Add to Project doesn't work
Confirmed on Windows and Linux

When adding a tap to the project I get a failure

![image](https://user-images.githubusercontent.com/8680264/176037875-9ed067cf-d878-4239-a438-c3c982ae711e.png)

```
2022-06-27T21:30:17.510848Z [error    ] Exception on /api/v1/plugins/install/batch [POST]
Traceback (most recent call last):
  File "/home/visch/.local/pipx/venvs/meltano/lib/python3.8/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/home/visch/.local/pipx/venvs/meltano/lib/python3.8/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/home/visch/.local/pipx/venvs/meltano/lib/python3.8/site-packages/flask_restful/__init__.py", line 271, in error_router
    return original_handler(e)
  File "/home/visch/.local/pipx/venvs/meltano/lib/python3.8/site-packages/flask_restful/__init__.py", line 271, in error_router
    return original_handler(e)
  File "/home/visch/.local/pipx/venvs/meltano/lib/python3.8/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/home/visch/.local/pipx/venvs/meltano/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/home/visch/.local/pipx/venvs/meltano/lib/python3.8/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/home/visch/.local/pipx/venvs/meltano/lib/python3.8/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/home/visch/.local/pipx/venvs/meltano/lib/python3.8/site-packages/meltano/api/security/auth.py", line 125, in decorated
    return f(*args, **kwargs)
  File "/home/visch/.local/pipx/venvs/meltano/lib/python3.8/site-packages/meltano/api/controllers/plugins.py", line 151, in install_batch
    related_plugins = add_service.add_related(plugin)
AttributeError: 'ProjectAddService' object has no attribute 'add_related'
```


Discussion:
@visch - Thanks for raising this. Looks like we removed `add_related()` but missed this ref.

Resolving patch:
diff --git a/src/meltano/api/controllers/plugins.py b/src/meltano/api/controllers/plugins.py
--- a/src/meltano/api/controllers/plugins.py
+++ b/src/meltano/api/controllers/plugins.py
@@ -58,8 +58,8 @@ def _handle(ex):
     return (jsonify({"error": True, "code": str(ex)}), 502)
 
 
-@pluginsBP.route("/all", methods=["GET"])  # noqa: WPS125
-def all():
+@pluginsBP.route("/all", methods=["GET"])
+def all():  # noqa: WPS125
     """Plugins found by the PluginDiscoveryService.
 
     Returns:
@@ -147,12 +147,7 @@ def install_batch():  # noqa: WPS210
     )
 
     add_service = ProjectAddService(project, plugins_service=plugins_service)
-    related_plugins = add_service.add_related(plugin)
-
-    # We will install the plugins in reverse order, since dependencies
-    # are listed after their dependents in `related_plugins`, but should
-    # be installed first.
-    related_plugins.reverse()
+    required_plugins = add_service.add_required(plugin)
 
     # This was added to assist api_worker threads
     try:
@@ -163,14 +158,14 @@ def install_batch():  # noqa: WPS210
 
     install_service = PluginInstallService(project, plugins_service=plugins_service)
     install_results = install_service.install_plugins(
-        related_plugins, reason=PluginInstallReason.ADD
+        required_plugins, reason=PluginInstallReason.ADD
     )
 
     for result in install_results:
         if not result.successful:
             raise PluginInstallError(result.message)
 
-    return jsonify([plugin.canonical() for plugin in related_plugins])
+    return jsonify([plugin.canonical() for plugin in required_plugins])
 
 
 @pluginsBP.route("/install", methods=["POST"])


Test patch: