System: Routing: Changed disable option to enable#10027
System: Routing: Changed disable option to enable#10027fichtner merged 11 commits intoopnsense:masterfrom
Conversation
35ea233 to
bb11f1d
Compare
3502f90 to
988fc12
Compare
|
I did a quick audit of where else this is used and cleaned this up faa7dab where necessary.. I think folding the compat into get_staticroutes() is a good way forward that minimizes impact :) |
72574a1 to
3d4c41a
Compare
fichtner
left a comment
There was a problem hiding this comment.
this turned out better than I could hope for. very nicely done 👍
| public function togglerouteAction($uuid, $enabled = null) | ||
| { | ||
| $result = array("result" => "failed"); | ||
| if ($this->request->isPost() && $uuid != null) { | ||
| $node = $this->getModel()->getNodeByReference('route.' . $uuid); | ||
| if ($node != null) { | ||
| if ($disabled == '0' || $disabled == '1') { | ||
| $node->disabled = (string)$disabled; | ||
| } elseif ((string)$node->disabled == '1') { | ||
| $node->disabled = '0'; | ||
| if ($enabled == '0' || $enabled == '1') { | ||
| $node->enabled = (string)$enabled; | ||
| } elseif ((string)$node->enabled == '1') { | ||
| $node->enabled = '0'; | ||
| } else { | ||
| $node->disabled = '1'; | ||
| $node->enabled = '1'; | ||
| } | ||
| $result['result'] = (string)$node->disabled == '1' ? 'Disabled' : 'Enabled'; | ||
| $result['result'] = (string)$node->enabled == '1' ? 'Enabled' : 'Disabled'; |
There was a problem hiding this comment.
I think this can use toggleBase() now. In fact, this allows the front-end to use multi-select as well (batched toggle):
({selection: true})
Make sure to set batchDelete: false as well, as the delrouteAction doesn't account for multiple UUIDs.
There was a problem hiding this comment.
Applied in 0f041ae. Thanks for the suggestion 😄
There was a problem hiding this comment.
If toggleBase() is used, this comment can go as well.
Co-authored-by: Franco Fichtner <franco@lastsummer.de>
…led options in get_staticroutes()
daedcf7 to
0f041ae
Compare
|
Merged, thanks! |
Changed the disabled option to enabled in system routes configuration.
Closes: #8780