forms.py #7

  • //
  • guest/
  • perforce_software/
  • utils/
  • log_analyzer/
  • psla/
  • app/
  • forms.py
  • View
  • Commits
  • Open Download .zip Download (1 KB)
from flask_wtf import FlaskForm
from flask_wtf.file import FileField, FileAllowed, FileRequired
from wtforms.validators import DataRequired
from wtforms import SelectField, SubmitField, TextAreaField

class UploadForm(FlaskForm):
    uploadFile = FileField('file', validators=[
        FileRequired(message="You must specify to upload"),
        FileAllowed(['txt', 'gz', 'zip', 'log'], 'Log files only!')
    ])
    submit = SubmitField('Upload')

class AnalyzeLog(FlaskForm):
    logFile = SelectField(u'Log file', validators = [DataRequired()])
    submit = SubmitField('Analyze')

class MySelectField(SelectField):
    def pre_validate(self, form):
        pass

class QueryLog(FlaskForm):
    logFile = SelectField(u'Log file', validators = [DataRequired()])
    queryOptions = MySelectField(u'Canned Queries', coerce=str, validators = [DataRequired()])
    sqlQuery = TextAreaField(u"SQL Query", default="Enter your SQL query here",
                             validators = [DataRequired()])
    submit = SubmitField('RunQuery')

class ChartLog(FlaskForm):
    logFile = SelectField(u'Log file', validators = [DataRequired()])
    chartId = SelectField(u'Chart to display', validators = [DataRequired()])
    submit = SubmitField('Chart')
# Change User Description Committed
#8 25220 Robert Cowham Moved project files to new location: //guest/perforce_software/log-analyzer/psla/...
Required by Swarm project structure for workshop.
#7 24979 Robert Cowham Tidy up charting to add db selection and titles.
Clarify README
#6 24321 Robert Cowham Allow canned queries to be included
#5 23933 Robert Cowham Create new seperate charting page
#4 23846 Robert Cowham Made sql field larger
#3 23845 Robert Cowham Basic query form working
#2 23772 Robert Cowham Allow user to select from all db files
#1 23765 Robert Cowham Moved things down one level to psla dir to make it easier to see what belongs
//guest/perforce_software/utils/log_analyzer/app/forms.py
#2 23705 Robert Cowham Basics working in simplified form
#1 23704 Robert Cowham Save before simplifying