Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AIRFLOW-3067] Display www_rbac Flask flash msg properly #3903

Merged
merged 1 commit into from
Sep 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions airflow/www_rbac/static/css/bootstrap-theme.css
Original file line number Diff line number Diff line change
Expand Up @@ -4949,6 +4949,28 @@ a.thumbnail.active {
.alert-danger .alert-link {
color: #843534;
}
.alert-message {
Copy link
Member Author

@XD-DENG XD-DENG Sep 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Copying" alert-info's specs, like color.

background-color: #d9edf7;
border-color: #bce8f1;
color: #31708f;
}
.alert-message hr {
border-top-color: #a6e1ec;
}
.alert-message .alert-link {
color: #245269;
}
.alert-error {
Copy link
Member Author

@XD-DENG XD-DENG Sep 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Copying" alert-danger's specs, like color.

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;
Expand Down
14 changes: 7 additions & 7 deletions airflow/www_rbac/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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():
Expand All @@ -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()
Expand Down Expand Up @@ -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')

Expand Down