xref: /aosp_15_r20/external/ot-br-posix/src/openwrt/view/admin_thread/thread_add.htm (revision 4a64e381480ef79f0532b2421e44e6ee336b8e0d)
1<%-
2	local ubus = require "ubus"
3	local sys = require "luci.sys"
4	local utl = require "luci.util"
5
6
7	function connect_ubus(methods)
8		local result
9		local conn = ubus.connect()
10
11		if not conn then
12			error("Failed to connect to ubusd")
13		end
14
15		result = conn:call("otbr", methods, {})
16
17		return result
18	end
19
20	function threadget(action)
21		local result = connect_ubus(action)
22
23		return result
24	end
25-%>
26<%+header%>
27
28<h2><%:Add Joiner in Network: %><%=threadget("networkname").NetworkName%></h2>
29<br />
30
31<br/><br/>
32
33<form class="inline" action="<%=url('admin/network/thread_add_joiner')%>" method="post" id="addForm" name="addForm" onsubmit="return validateForm()">
34<div style="width:90%;margin-left:5%;">
35	<div class="cbi-value">
36		<label class="cbi-value-title" style="margin-right:5%;">New Joiner Credential</label>
37		<div class="cbi-value-title">
38			<input type="text" name="pskd" value="J01NME" style="width:40%;"/>
39		</div>
40		<div style="margin-left:25%;margin-top:1%;">
41			<span><img src="<%=resource .. "/cbi/help.gif"%>"/><%:The Joiner Credential is a device-specific string of all uppercase alphanumeric characters(0-9 and A-Y, excluding I, O, Q and Z for readability), with a length between 6 and 32 characters.%></span>
42		</div>
43	</div>
44	<div class="cbi-value">
45		<label class="cbi-value-title" style="margin-right:5%;">Restrict to a Specific Joiner</label>
46		<div class="cbi-value-title">
47			<input type="text" name="eui64" value="2157d22254527111" style="width:40%;"/>
48		</div>
49		<div style="margin-left:25%;margin-top:1%;">
50			<span><img src="<%=resource .. "/cbi/help.gif"%>"/><%:To restrict commissioning to a specific Joiner device, which is the devices factory-assigned IEEE EUI-64, use the eui64 parameter to get the EUI-64. You can input '*' to unrestrict to the specific joiner%></span>
51		</div>
52	</div>
53	<div class="cbi-value">
54		<label class="cbi-value-title" style="margin-right:5%;">Timeout</label>
55		<div class="cbi-value-title">
56			<input type="text" name="timeout" value="120" style="width:40%;"/>
57		</div>
58	</div>
59</div>
60<div class="cbi-page-actions right">
61	<input class="cbi-button cbi-button-neutral" style="float:left;" type="button" onclick="window.location.href='thread_view'" value="<%:Back to View%>" />
62	<input type="hidden" name="token" value="<%=token%>" />
63	<input class="cbi-button cbi-button-add important" type="submit" value="<%:Add%>" />
64</div>
65</form>
66
67<%+footer%>
68<script type="text/javascript" src="/luci-static/resources/handle_error.js"></script>
69<script type="text/javascript">//<![CDATA[
70	handle_error(GetURLParameter('error'));
71	function validateForm()
72	{
73		var eui64 = document.forms["addForm"]["eui64"].value;
74		if(eui64.length != 16 && eui64 != "*")
75		{
76			alert("eui64 length must be 16 bytes or '*'");
77			return false;
78		}
79	}
80//]]></script>
81