Skip to content

Commit

Permalink
Merge pull request #2772 from ffgraz/warn2
Browse files Browse the repository at this point in the history
gluon-web-model: fix issue with warning blocking save on private-wifi
  • Loading branch information
blocktrron committed Feb 3, 2023
2 parents 57a0e44 + ad8cfe0 commit 1780baf
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<%- if self.title or self.content then -%>
<%- if not self.hide then -%>
<div class="gluon-warning"<%=
attr("id", id) ..
attr("data-index", self.index) ..
attr("data-depends", self:deplist(self.deps))
%>>
<%- if self.content then -%>
<%=self.content%>
<%= self.content %>
<%- else -%>
<b><%=self.title%></b><br>
<%=self.description%>
<b><%= self.title %></b><br>
<%= self.description %>
<%- end -%>
</div>
<%- end -%>
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,23 @@ function Element:__init__(template, kv, ...)
self.error = false
end

function Element:parse(http)
if not self.datatype then
self.state = M.FORM_VALID
return
end

return AbstractValue:parse(http)
end

function Element:validate()
if not self.datatype then
return true
end

AbstractValue:validate()
end

local Section = class(Node)
M.Section = Section

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ local enabled = s:option(Flag, "enabled", translate("Enabled"))
enabled.default = uci:get('wireless', primary_iface) and not uci:get_bool('wireless', primary_iface, "disabled")

local warning = s:element('model/warning', {
content = mesh_on_wan and translate(
content = translate(
'Meshing on WAN interface is enabled. ' ..
'This can lead to problems.'
) or nil,
),
hide = not mesh_on_wan,
}, 'warning')
warning:depends(enabled, true)

Expand Down

0 comments on commit 1780baf

Please sign in to comment.