milton0825 commented on a change in pull request #5059: [AIRFLOW-161] New redirect route and extra links URL: https://github.com/apache/airflow/pull/5059#discussion_r274599898
########## File path: airflow/models/baseoperator.py ########## @@ -941,3 +945,34 @@ def xcom_pull( task_ids=task_ids, dag_id=dag_id, include_prior_dates=include_prior_dates) + + @property + def extra_links(self): + # type: () -> Iterable[str] + return list(self.operator_extra_link_dict.keys()) + + def get_extra_links(self, dttm, link_name): + """ + For an operator, gets the URL that the external links specified in + `extra_links` should point to. + :raise ValueError: The error message of a ValueError will be passed on through to + the fronted to show up as a tooltip on the disabled link + :param dttm: The datetime parsed execution date for the URL being searched for + :param link_name: The name of the link we're looking for the URL for. Should be + one of the options specified in `extra_links` + :return: A URL + """ + if link_name in self.operator_extra_link_dict: + return self.operator_extra_link_dict[link_name].get_link(self, dttm) + + +class BaseOperatorLink: Review comment: De-coupled how we define the link from the `BaseOperator` so that we can support global extra links (links shared by all operators) in the future easier. ---------------------------------------------------------------- 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: us...@infra.apache.org With regards, Apache Git Services