jedcunningham commented on a change in pull request #15385:
URL: https://github.com/apache/airflow/pull/15385#discussion_r688750350
##########
File path: airflow/www/views.py
##########
@@ -3339,6 +3339,58 @@ def list(self):
)
+class ProviderView(AirflowBaseView):
+ """View to show Airflow Providers"""
+
+ default_view = 'list'
+
+ class_permission_name = permissions.RESOURCE_PROVIDER
+
+ method_permission_name = {
+ 'list': 'read',
+ }
+
+ base_permissions = [
+ permissions.ACTION_CAN_READ,
+ permissions.ACTION_CAN_ACCESS_MENU,
+ ]
+
+ @expose('/provider')
+ @auth.has_access(
+ [
+ (permissions.ACTION_CAN_READ, permissions.RESOURCE_PROVIDER),
+ ]
+ )
+ def list(self):
+ """List providers."""
+ providers_manager = ProvidersManager()
+
+ providers = []
+ for pi in providers_manager.providers.values():
+ provider_info = pi[1]
+ provider_data = {
+ "package_name": provider_info["package-name"],
+ "description":
self._clean_description(provider_info["description"]),
+ "version": pi[0],
+ }
+ providers.append(provider_data)
+
+ title = "Providers"
+ doc_url = get_docs_url("apache-airflow-providers/index.html")
+ return self.render_template(
+ 'airflow/providers.html',
+ providers=providers,
+ title=title,
+ doc_url=doc_url,
+ )
+
+ def _clean_description(self, description):
+ cd = re.sub("[`_]", "", description.strip(" \n.").strip("\""))
+ cd = re.sub("<", "<a href=\"", cd)
+ cd = re.sub(">", "\">[site]</a>", cd)
+ return cd
Review comment:
Fwiw, this might need a little more effort. 1 providers link doesn't
work right with this, and I thought it was the provider itself but after
looking closer I dont think thats the case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]