Huge change, removed Status class and all "alert" messages are now shown as BS toast() and are via the DB and handled async in the F/E in jscript via Ajax. Fixed BUG-113 where toasts() were repeating. Removed many of the explicit alert messages (other than errors) and hooked {New|Finish}Job to consistently send messages to the F/E. Other messages (F/E without a job, like save settings) now use this model as well. Finally converted most of the older POST responses to formal json
This commit is contained in:
@@ -3,7 +3,6 @@ from flask_wtf import FlaskForm
|
||||
from flask import request, render_template, redirect, url_for
|
||||
from sqlalchemy import Sequence
|
||||
from sqlalchemy.exc import SQLAlchemyError
|
||||
from status import st, Status
|
||||
from flask_login import login_required, current_user
|
||||
from main import db, app, ma
|
||||
|
||||
@@ -98,10 +97,10 @@ def settings():
|
||||
|
||||
if request.method == 'POST' and form.validate():
|
||||
try:
|
||||
|
||||
from job import SetFELog
|
||||
s = Settings.query.one()
|
||||
if 'submit' in request.form:
|
||||
st.SetMessage("Successfully Updated Settings" )
|
||||
SetFELog("Successfully Updated Settings" )
|
||||
s.import_path = request.form['import_path']
|
||||
s.storage_path = request.form['storage_path']
|
||||
s.recycle_bin_path = request.form['recycle_bin_path']
|
||||
@@ -122,7 +121,7 @@ def settings():
|
||||
db.session.commit()
|
||||
return redirect( url_for( 'settings' ) )
|
||||
except SQLAlchemyError as e:
|
||||
st.SetMessage( f"<b>Failed to modify Setting:</b> {e.orig}", "danger" )
|
||||
SetFELog( f"<b>Failed to modify Setting:</b> {e.orig}", "danger" )
|
||||
return render_template("settings.html", form=form, page_title=page_title, HELP=HELP)
|
||||
else:
|
||||
form = SettingsForm( obj=Settings.query.first() )
|
||||
|
||||
Reference in New Issue
Block a user