mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Make default option be selected option in edit
This commit is contained in:
parent
1b2fef06fb
commit
9ecf912a98
@ -1009,6 +1009,7 @@ class PanelHandler(BaseHandler):
|
||||
# We'll just default to basic for new schedules
|
||||
page_data["schedule"]["difficulty"] = "basic"
|
||||
page_data["schedule"]["interval_type"] = "days"
|
||||
page_data["parent"] = None
|
||||
|
||||
if not EnumPermissionsServer.SCHEDULE in page_data["user_permissions"]:
|
||||
if not superuser:
|
||||
@ -1091,8 +1092,12 @@ class PanelHandler(BaseHandler):
|
||||
page_data["schedule"]["interval_type"] = schedule.interval_type
|
||||
if schedule.interval_type == "reaction":
|
||||
difficulty = "reaction"
|
||||
page_data["parent"] = self.controller.management.get_scheduled_task(
|
||||
schedule.parent
|
||||
)
|
||||
elif schedule.cron_string == "":
|
||||
difficulty = "basic"
|
||||
page_data["parent"] = None
|
||||
else:
|
||||
difficulty = "advanced"
|
||||
page_data["schedule"]["difficulty"] = difficulty
|
||||
|
@ -145,17 +145,35 @@
|
||||
data['lang']) }}</small> </label>
|
||||
<select id="parent" name="parent" class="form-control form-control-lg select-css"
|
||||
value="{{ data['schedule']['action'] }}">
|
||||
{% for schedule in data['schedules'] %}
|
||||
{% if schedule.schedule_id != data['schedule']['schedule_id'] %}
|
||||
{% if schedule.interval != '' %}
|
||||
<option id="{{schedule.schedule_id}}" value="{{schedule.schedule_id}}">
|
||||
{{schedule.name}} | {{schedule.command}} | {{schedule.interval}} {{
|
||||
schedule.interval_type}}</option>
|
||||
{% if data['parent'] %}
|
||||
<option id="{{data['parent']['schedule_id']}}" value="{{data['parent']['schedule_id']}}">
|
||||
{{data['parent']['name']}} | {{data['parent']['command']}} | {{data['parent']['interval']}}
|
||||
</option>
|
||||
{% for schedule in data['schedules'] %}
|
||||
{% if schedule.schedule_id != data['schedule']['schedule_id'] and schedule.schedule_id != data['parent']['schedule_id'] %}
|
||||
{% if schedule.interval != '' %}
|
||||
<option id="{{schedule.schedule_id}}" value="{{schedule.schedule_id}}">
|
||||
{{schedule.name}} | {{schedule.command}} | {{schedule.interval}} {{
|
||||
schedule.interval_type}}</option>
|
||||
{% else %}
|
||||
<option id="{{schedule.schedule_id}}" value="{{schedule.schedule_id}}">
|
||||
{{schedule.name}} | {{schedule.command}} | {{schedule.cron_string}}</option>
|
||||
{% end %}
|
||||
{% end %}
|
||||
{% end %}
|
||||
{% else %}
|
||||
<option id="{{schedule.schedule_id}}" value="{{schedule.schedule_id}}">
|
||||
{{schedule.name}} | {{schedule.command}} | {{schedule.cron_string}}</option>
|
||||
{% end %}
|
||||
{% end %}
|
||||
{% for schedule in data['schedules'] %}
|
||||
{% if schedule.schedule_id != data['schedule']['schedule_id'] and schedule.schedule_id %}
|
||||
{% if schedule.interval != '' %}
|
||||
<option id="{{schedule.schedule_id}}" value="{{schedule.schedule_id}}">
|
||||
{{schedule.name}} | {{schedule.command}} | {{schedule.interval}} {{
|
||||
schedule.interval_type}}</option>
|
||||
{% else %}
|
||||
<option id="{{schedule.schedule_id}}" value="{{schedule.schedule_id}}">
|
||||
{{schedule.name}} | {{schedule.command}} | {{schedule.cron_string}}</option>
|
||||
{% end %}
|
||||
{% end %}
|
||||
{% end %}
|
||||
{% end %}
|
||||
</select>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user