You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2019/04/08 05:47:16 UTC

[GitHub] [airflow] milton0825 opened a new pull request #5059: [AIRFLOW-161] New redirect route and extra links

milton0825 opened a new pull request #5059: [AIRFLOW-161] New redirect route and extra links
URL: https://github.com/apache/airflow/pull/5059
 
 
   Co-authored-by: Max Payton <mp...@lyft.com>
   
   With this change different operators would be able to customize the
   task instance model view with extra links, those can be used to
   redirect users to systems which are out of Airflow.
   
   Add some context on format of whitelisted domains
   
   Add a new endpoint to views that gets redirect links
   
   In order to be able to display the link on UI, and not have the backend do the external routing, I had to setup the endpoint to
   be a RESTful endpoint that the frontend could ping whenever. I also wanted to handle a handful of error cases, so it returns different errors
   If the URL is not whitelisted, if the URL is not provided, and there is even a way for operator to provide their own custom errors
   
   Add some documenation for how get_redirect_url and the redirect endpoint work
   
   Update the modal box to make a AJAX call for link resolutions
   
   This gives us multiple benefits:
    1. It enables us to disable links when actionable
    2. It enables us to give better feedback to the user on whitelisting and errors without navigating the page
    3. You can see and interact with the link as it points to it's real destitnation, as opposed to the airflow backend doing the routing
      This let's you see where the link will resolve in advance
   
   Update graph.html and tree.html for www_rbac as well
   
   Fix unit tests to handle bytes from requests
   
   The problem is the python3.5 and python3.6 return different data types from network connections (bytes versus unicode), and tests were breaking
   
   Cover case when link URL name has a space
   
   Rename instances of redirect to extra_links
   
   Also, remove the whitelist, as we're no longer doing backend redirects
   
   Rename 'redirect_to' to 'link_name' to make things clearer
   
   Also, fix a small bug in the views method that flashed on screen when the DAG was invalid
   Fix a small bug where the link name itself would replace spaces with underscores
   
   Rename redirect_to to link_name in the quboleOperator
   
   Use the correct endpoint for rbac
   
   Fix call to call_modal so that they all resolve properly.
   
   Essentially second merge pass
   
   Also, there seems to have been an issue with the order of arguments relative to the try_numbers. They were only used sometimes, and in graph.html, they seemed to be used in the wrong order relative to the function definition. So I reordered some arguments
   
   Fix rbac permissions to extra_links command
   
   Fix some UI elements that have changed since I originally made this PR
   
   Also, undefined is subdag doesn't exist, not true
   
   replace only replaces first instance, replace all instances
   Also, use the underscore tooltip instead of the original link name. I'm not sure how this was not caught sooner by me :/
   
   Also, add a comment about subdags to the tree documentation, I don't think it calculates subdag identities correctly.
   
   Add mypy annotation
   
   Fix url_for link
   
   This broke after one of the rebases without my notice
   
   Make sure you have checked _all_ steps below.
   
   ### Jira
   
   - [ ] My PR addresses the following [Airflow Jira](https://issues.apache.org/jira/browse/AIRFLOW/) issues and references them in the PR title. For example, "\[AIRFLOW-XXX\] My Airflow PR"
     - https://issues.apache.org/jira/browse/AIRFLOW-XXX
     - In case you are fixing a typo in the documentation you can prepend your commit with \[AIRFLOW-XXX\], code changes always need a Jira issue.
     - In case you are proposing a fundamental code change, you need to create an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)).
     - In case you are adding a dependency, check if the license complies with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).
   
   ### Description
   
   - [ ] Here are some details about my PR, including screenshots of any UI changes:
   
   ### Tests
   
   - [ ] My PR adds the following unit tests __OR__ does not need testing for this extremely good reason:
   
   ### Commits
   
   - [ ] My commits all reference Jira issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)":
     1. Subject is separated from body by a blank line
     1. Subject is limited to 50 characters (not including Jira issue reference)
     1. Subject does not end with a period
     1. Subject uses the imperative mood ("add", not "adding")
     1. Body wraps at 72 characters
     1. Body explains "what" and "why", not "how"
   
   ### Documentation
   
   - [ ] In case of new functionality, my PR adds documentation that describes how to use it.
     - All the public functions and the classes in the PR contain docstrings that explain what it does
     - If you implement backwards incompatible changes, please leave a note in the [Updating.md](https://github.com/apache/airflow/blob/master/UPDATING.md) so we can assign it to a appropriate release
   
   ### Code Quality
   
   - [ ] Passes `flake8`
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services