proxies: add smart proxy support
still to do: * document new configuration options * add smart proxies to groups view * import bandwidth and CPU alarms
This commit is contained in:
parent
9b90101cf4
commit
66af6e6550
15 changed files with 275 additions and 32 deletions
|
@ -21,6 +21,7 @@ class NewOriginForm(FlaskForm): # type: ignore
|
|||
description = StringField('Description', validators=[DataRequired()])
|
||||
group = SelectField('Group', validators=[DataRequired()])
|
||||
auto_rotate = BooleanField("Enable auto-rotation?", default=True)
|
||||
smart_proxy = BooleanField("Requires smart proxy?", default=False)
|
||||
submit = SubmitField('Save Changes')
|
||||
|
||||
|
||||
|
@ -28,6 +29,7 @@ class EditOriginForm(FlaskForm): # type: ignore
|
|||
description = StringField('Description', validators=[DataRequired()])
|
||||
group = SelectField('Group', validators=[DataRequired()])
|
||||
auto_rotate = BooleanField("Enable auto-rotation?")
|
||||
smart_proxy = BooleanField("Requires smart proxy?")
|
||||
submit = SubmitField('Save Changes')
|
||||
|
||||
|
||||
|
@ -42,6 +44,7 @@ def origin_new(group_id: Optional[int] = None) -> ResponseReturnValue:
|
|||
origin.domain_name = form.domain_name.data
|
||||
origin.description = form.description.data
|
||||
origin.auto_rotation = form.auto_rotate.data
|
||||
origin.smart = form.smart_proxy.data
|
||||
origin.created = datetime.utcnow()
|
||||
origin.updated = datetime.utcnow()
|
||||
try:
|
||||
|
@ -69,12 +72,14 @@ def origin_edit(origin_id: int) -> ResponseReturnValue:
|
|||
status=404)
|
||||
form = EditOriginForm(group=origin.group_id,
|
||||
description=origin.description,
|
||||
auto_rotate=origin.auto_rotation)
|
||||
auto_rotate=origin.auto_rotation,
|
||||
smart_proxy=origin.smart)
|
||||
form.group.choices = [(x.id, x.group_name) for x in Group.query.all()]
|
||||
if form.validate_on_submit():
|
||||
origin.group_id = form.group.data
|
||||
origin.description = form.description.data
|
||||
origin.auto_rotation = form.auto_rotate.data
|
||||
origin.smart = form.smart_proxy.data
|
||||
origin.updated = datetime.utcnow()
|
||||
try:
|
||||
db.session.commit()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue