airflow-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (AIRFLOW-3067) (www_rbac) Flask flash messages are not categoried properly (result in 'incomplete' UI display)
Date Mon, 24 Sep 2018 18:21:00 GMT

    [ https://issues.apache.org/jira/browse/AIRFLOW-3067?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16626209#comment-16626209
] 

ASF GitHub Bot commented on AIRFLOW-3067:
-----------------------------------------

feng-tao closed pull request #3903: [AIRFLOW-3067] Display www_rbac Flask flash msg properly
URL: https://github.com/apache/incubator-airflow/pull/3903
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/airflow/www_rbac/static/css/bootstrap-theme.css b/airflow/www_rbac/static/css/bootstrap-theme.css
index 734f940fee..3adaec1d3b 100644
--- a/airflow/www_rbac/static/css/bootstrap-theme.css
+++ b/airflow/www_rbac/static/css/bootstrap-theme.css
@@ -4949,6 +4949,28 @@ a.thumbnail.active {
 .alert-danger .alert-link {
   color: #843534;
 }
+.alert-message {
+  background-color: #d9edf7;
+  border-color: #bce8f1;
+  color: #31708f;
+}
+.alert-message hr {
+  border-top-color: #a6e1ec;
+}
+.alert-message .alert-link {
+  color: #245269;
+}
+.alert-error {
+  background-color: #f2dede;
+  border-color: #ebccd1;
+  color: #a94442;
+}
+.alert-error hr {
+  border-top-color: #e4b9c0;
+}
+.alert-error .alert-link {
+  color: #843534;
+}
 @-webkit-keyframes progress-bar-stripes {
   from {
     background-position: 40px 0;
diff --git a/airflow/www_rbac/views.py b/airflow/www_rbac/views.py
index 3dc3400968..0fc3d67a80 100644
--- a/airflow/www_rbac/views.py
+++ b/airflow/www_rbac/views.py
@@ -782,11 +782,12 @@ def delete(self):
         try:
             delete_dag.delete_dag(dag_id)
         except DagNotFound:
-            flash("DAG with id {} not found. Cannot delete".format(dag_id))
+            flash("DAG with id {} not found. Cannot delete".format(dag_id), 'error')
             return redirect(request.referrer)
         except DagFileExists:
             flash("Dag id {} is still in DagBag. "
-                  "Remove the DAG file first.".format(dag_id))
+                  "Remove the DAG file first.".format(dag_id),
+                  'error')
             return redirect(request.referrer)
 
         flash("Deleting DAG with id {}. May take a couple minutes to fully"
@@ -2065,7 +2066,7 @@ def varimport(self):
             else:
                 d = json.loads(out)
         except Exception:
-            flash("Missing file or syntax error.")
+            flash("Missing file or syntax error.", 'error')
         else:
             suc_count = fail_count = 0
             for k, v in d.items():
@@ -2076,7 +2077,7 @@ def varimport(self):
                     fail_count += 1
                 else:
                     suc_count += 1
-            flash("{} variable(s) successfully updated.".format(suc_count), 'info')
+            flash("{} variable(s) successfully updated.".format(suc_count))
             if fail_count:
                 flash("{} variables(s) failed to be updated.".format(fail_count), 'error')
             self.update_redirect()
@@ -2166,10 +2167,9 @@ def action_set_running(self, drs, session=None):
                 dr.state = State.RUNNING
             models.DagStat.update(dirty_ids, session=session)
             session.commit()
-            flash(
-                "{count} dag runs were set to running".format(**locals()))
+            flash("{count} dag runs were set to running".format(**locals()))
         except Exception as ex:
-            flash(str(ex))
+            flash(str(ex), 'error')
             flash('Failed to set state', 'error')
         return redirect(self.route_base + '/list')
 


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


> (www_rbac) Flask flash messages are not categoried properly (result in 'incomplete' UI
display)
> -----------------------------------------------------------------------------------------------
>
>                 Key: AIRFLOW-3067
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-3067
>             Project: Apache Airflow
>          Issue Type: Improvement
>          Components: webapp
>    Affects Versions: 1.10.0
>            Reporter: Xiaodong DENG
>            Assignee: Xiaodong DENG
>            Priority: Minor
>             Fix For: 1.10.1
>
>         Attachments: 1.png, 2.png
>
>
> The Flask flash messages are not categorized properly (ref: [http://flask.pocoo.org/docs/1.0/patterns/flashing/#flashing-with-categories).]
Then the default category would be 'message'. Flask AppBuilder would assign CSS class `alert-[category]`
to that message when displaying it (ref: [https://github.com/dpgaspar/Flask-AppBuilder/blob/master/flask_appbuilder/templates/appbuilder/flash.html]
). But 'alert-message' is not specified in *bootstrap-theme.css*. This makes the the flash
messages in the _*www_rbac*_ UI come with no background color (please check the screenshots
attached. We don't see this issue in _*www*_ UI as all flash messages without categories are
classed into 'info').
> Solution:
>  * Add proper category when we invoke *flash()*.
>  * We can't use category 'error'. In bootstrap-theme.css, we don't have `alert-error`
(we have `alert-danger` instead).



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message