gocron/templates/host/host_form.html

150 lines
5.6 KiB
HTML
Raw Normal View History

2017-04-07 01:13:36 +00:00
{{{ template "common/header" . }}}
<div class="ui grid">
<!--the vertical menu-->
{{{ template "host/menu" . }}}
<div class="twelve wide column">
2017-04-07 09:26:46 +00:00
<div class="pageHeader">
<div class="segment">
<h3 class="ui dividing header">
<i class="large add icon"></i>
<div class="content">
2017-04-20 01:36:42 +00:00
{{{.Title}}}
2017-04-07 09:26:46 +00:00
</div>
</h3>
</div>
</div>
2017-04-07 01:13:36 +00:00
<form class="ui form fluid vertical segment">
2017-04-20 01:36:42 +00:00
<input type="hidden" name="id" value="{{{.Host.Id}}}">
<div class="four fields">
2017-04-07 01:13:36 +00:00
<div class="field">
<label>主机名 (域名或IP)</label>
<div class="ui small left icon input">
2017-04-20 01:36:42 +00:00
<input type="text" name="name" value="{{{.Host.Name}}}">
2017-04-07 01:13:36 +00:00
</div>
</div>
<div class="field">
<label>主机别名 (方便记忆和引用)</label>
<div class="ui small left icon input">
2017-04-20 01:36:42 +00:00
<input type="text" name="alias" value="{{{.Host.Alias}}}">
2017-04-07 01:13:36 +00:00
</div>
</div>
</div>
2017-04-20 01:36:42 +00:00
<div class="four fields">
2017-04-07 01:13:36 +00:00
<div class="field">
<label>SSH用户名</label>
<div class="ui small left icon input">
2017-04-20 01:36:42 +00:00
<input type="text" name="username" value="{{{.Host.Username}}}">
2017-04-07 01:13:36 +00:00
</div>
</div>
<div class="field">
2017-04-20 01:36:42 +00:00
<label>SSH端口</label>
2017-04-07 01:13:36 +00:00
<div class="ui small left icon input">
2017-04-20 01:36:42 +00:00
<input type="text" name="port" value="{{{.Host.Port}}}">
</div>
</div>
</div>
<div class="four fields">
<div class="field">
<label>认证方式</label>
<div class="ui dropdown selection">
{{{ if .Host }}}
<input type="hidden" name="auth_type" value="{{{if eq .Host.AuthType 1 }}}1{{{else}}}2{{{end}}}">
{{{else}}}
<input type="hidden" name="auth_type" value="2">
{{{end}}}
<div class="default text">公钥</div>
<i class="dropdown icon"></i>
<div class="menu">
<div class="item" data-value="2">公钥</div>
<div class="item" data-value="1">密码</div>
</div>
2017-04-07 01:13:36 +00:00
</div>
</div>
</div>
<div class="two fields">
<div class="field">
2017-04-20 01:36:42 +00:00
<label>私钥 (~/.ssh/id_rsa)</label>
<div class="ui small left icon input">
<textarea rows="7" name="private_key">{{{.Host.PrivateKey}}}</textarea>
</div>
</div>
</div>
<div class="four fields">
<div class="field">
<label>SSH密码</label>
2017-04-07 01:13:36 +00:00
<div class="ui small left icon input">
2017-04-20 01:36:42 +00:00
<input type="text" placeholder="" name="password" value="{{{.Host.Password}}}">
2017-04-07 01:13:36 +00:00
</div>
</div>
</div>
<div class="two fields">
<div class="field">
<label>备注</label>
<div class="ui small left icon input">
2017-04-20 01:36:42 +00:00
<textarea rows="7" name="remark" >{{{.Host.Remark}}}</textarea>
2017-04-07 01:13:36 +00:00
</div>
</div>
</div>
2017-04-17 10:04:30 +00:00
<div class="ui primary submit button">保存</div>
2017-04-07 01:13:36 +00:00
</form>
</div>
<!--the newDevice form-->
</div>
<script type="text/javascript">
2017-04-07 09:26:46 +00:00
$('.ui.form').form(
{
onSuccess: function(event, fields) {
util.post('/host/store', fields, function(code, message) {
location.href = "/host"
2017-04-07 09:26:46 +00:00
});
2017-04-07 01:13:36 +00:00
2017-04-07 09:26:46 +00:00
return false;
},
fields: {
name: {
identifier : 'name',
rules: [
{
type : 'empty',
prompt : '请输入主机名'
}
]
},
alias: {
identifier : 'alias',
rules: [
{
type : 'empty',
prompt : '请输入主机别名'
}
]
},
username: {
identifier : 'username',
rules: [
{
type : 'empty',
prompt : '请输入SSH用户名'
}
]
},
port: {
identifier : 'port',
rules: [
{
type : 'integer',
prompt : '请输入SSH端口'
}
]
}
},
inline : true
});
2017-04-07 01:13:36 +00:00
</script>
{{{ template "common/footer" . }}}