pull/105/head
Apex Liu 2017-10-11 13:18:16 +08:00
parent 467a9918eb
commit 178f53a28f
4 changed files with 424 additions and 283 deletions

View File

@ -1 +1 @@
@charset "utf-8";body{font-family:"Microsoft YaHei","微软雅黑",Helvetica,Arial,sans-serif;font-size:13px;background-color:#fff;color:#333}html,body{height:100%}.header{width:100%;height:48px;position:fixed;top:0;line-height:48px;background-color:#3b3b3b;color:#fff;z-index:999}.header .title{font-size:16px}.header .sub-title{margin-left:30px;color:#acacac}.header-fix{height:48px}.footer{width:100%;height:24px;position:fixed;bottom:0;text-align:center;line-height:24px;background-color:#d5d5d5;border-top:1px solid #a2a2a2;z-index:999}.content{margin:20px 0 50px 0}.content .cfg-title{font-size:16px;font-weight:bold}.content .form-group{margin-bottom:5px}.content .col-sm-1,.content .col-sm-2,.content .col-sm-3,.content .col-sm-4,.content .col-sm-5,.content .col-sm-6,.content .col-sm-7{padding-left:3px;padding-right:3px}.content .arg-detail ol,.content .arg-detail ul{margin-bottom:0}.content .arg-detail-common{background-color:#dbffbe;border-radius:5px;padding:15px}.content .input-args{font-family:Consolas,Lucida Console,Monaco,Courier,'Courier New',monospace}.arg-varb{color:#0a6aa1;font-weight:bold;font-family:Consolas,Lucida Console,Monaco,Courier,'Courier New',monospace;display:inline-block;width:164px}#gritter-notice-wrapper{z-index:9999}.gritter-bottom,.gritter-item,.gritter-top{background:rgba(0,0,0,0.8) !important}.gritter-top{border-top-left-radius:3px;border-top-right-radius:3px}.gritter-bottom{border-bottom-left-radius:3px;border-bottom-right-radius:3px}.gritter-close,.gritter-light .gritter-close{left:auto !important;right:5px !important;top:5px !important;width:16px !important;height:16px !important;line-height:16px !important;display:block !important;border-radius:50%}.gritter-close:before,.gritter-light .gritter-close:before{content:'\f00d' !important;font-family:FontAwesome !important;font-size:9px !important;width:16px !important;height:16px !important;line-height:16px !important;color:#fff !important;text-indent:0 !important;position:absolute !important;text-align:center !important;right:0 !important;top:0 !important}.gritter-title{font-size:13px !important;line-height:16px !important;padding-bottom:5px !important;font-weight:400 !important;color:#fff !important;text-shadow:none !important}.gritter-item{color:#aaa !important;font-size:13px !important;padding:2px 15px 5px !important}.gritter-error .gritter-bottom,.gritter-error .gritter-item,.gritter-error .gritter-top{background:rgba(123,32,32,0.9) !important}.gritter-error .gritter-title{color:#fff !important}.gritter-error .gritter-item{color:#ddd !important}.gritter-error .gritter-close{left:auto !important;right:5px !important;top:5px !important;width:16px !important;height:16px !important;line-height:16px !important;display:block !important;border-radius:50%;background:#e33b3b !important}.gritter-success .gritter-bottom,.gritter-success .gritter-item,.gritter-success .gritter-top{background:rgba(1,65,16,0.9) !important}.gritter-success .gritter-title{color:#ddd !important}.gritter-success .gritter-item{color:#ccc !important}.gritter-success .gritter-close{background:#0eb320 !important}#gritter-notice-wrapper{width:320px;max-width:480px}/*# sourceMappingURL=style.css.map */ @charset "utf-8";body{font-family:"Microsoft YaHei","微软雅黑",Helvetica,Arial,sans-serif;font-size:13px;background-color:#fff;color:#333}html,body{height:100%}.header{width:100%;height:48px;position:fixed;top:0;line-height:48px;background-color:#3b3b3b;color:#fff;z-index:999}.header .title{font-size:16px}.header .sub-title{margin-left:30px;color:#acacac}.header-fix{height:48px}.footer{width:100%;height:24px;position:fixed;bottom:0;text-align:center;line-height:24px;background-color:#d5d5d5;border-top:1px solid #a2a2a2;z-index:999}.content{margin:20px 0 50px 0}.content .cfg-title{font-size:16px;font-weight:bold}.content .form-group{margin-bottom:5px}.content .col-sm-1,.content .col-sm-2,.content .col-sm-3,.content .col-sm-4,.content .col-sm-5,.content .col-sm-6,.content .col-sm-7,.content .col-sm-8,.content .col-sm-9,.content .col-sm-10,.content .col-sm-11{padding-left:3px;padding-right:3px}.content .arg-detail ol,.content .arg-detail ul{margin-bottom:0}.content .arg-detail-common{background-color:#dbffbe;border-radius:5px;padding:15px}.content .input-args{font-family:Consolas,Lucida Console,Monaco,Courier,'Courier New',monospace}.arg-varb{color:#0a6aa1;font-weight:bold;font-family:Consolas,Lucida Console,Monaco,Courier,'Courier New',monospace;display:inline-block;width:164px}#gritter-notice-wrapper{z-index:9999}.gritter-bottom,.gritter-item,.gritter-top{background:rgba(0,0,0,0.8) !important}.gritter-top{border-top-left-radius:3px;border-top-right-radius:3px}.gritter-bottom{border-bottom-left-radius:3px;border-bottom-right-radius:3px}.gritter-close,.gritter-light .gritter-close{left:auto !important;right:5px !important;top:5px !important;width:16px !important;height:16px !important;line-height:16px !important;display:block !important;border-radius:50%}.gritter-close:before,.gritter-light .gritter-close:before{content:'\f00d' !important;font-family:FontAwesome !important;font-size:9px !important;width:16px !important;height:16px !important;line-height:16px !important;color:#fff !important;text-indent:0 !important;position:absolute !important;text-align:center !important;right:0 !important;top:0 !important}.gritter-title{font-size:13px !important;line-height:16px !important;padding-bottom:5px !important;font-weight:400 !important;color:#fff !important;text-shadow:none !important}.gritter-item{color:#aaa !important;font-size:13px !important;padding:2px 15px 5px !important}.gritter-error .gritter-bottom,.gritter-error .gritter-item,.gritter-error .gritter-top{background:rgba(123,32,32,0.9) !important}.gritter-error .gritter-title{color:#fff !important}.gritter-error .gritter-item{color:#ddd !important}.gritter-error .gritter-close{left:auto !important;right:5px !important;top:5px !important;width:16px !important;height:16px !important;line-height:16px !important;display:block !important;border-radius:50%;background:#e33b3b !important}.gritter-success .gritter-bottom,.gritter-success .gritter-item,.gritter-success .gritter-top{background:rgba(1,65,16,0.9) !important}.gritter-success .gritter-title{color:#ddd !important}.gritter-success .gritter-item{color:#ccc !important}.gritter-success .gritter-close{background:#0eb320 !important}#gritter-notice-wrapper{width:320px;max-width:480px}/*# sourceMappingURL=style.css.map */

View File

@ -56,35 +56,35 @@
<div class="form-horizontal"> <div class="form-horizontal">
<div class="form-group form-group-sm"> <div class="form-group form-group-sm">
<label for="ssh-client-type" class="col-sm-1 control-label"><strong>客户端:</strong></label> <label for="ssh-type" class="col-sm-2 control-label"><strong>客户端:</strong></label>
<div class="col-sm-2"> <div class="col-sm-4">
<select id="ssh-client-type" class="form-control"></select> <select id="ssh-type" class="form-control"></select>
</div> </div>
</div> </div>
<div class="form-group form-group-sm"> <div class="form-group form-group-sm">
<label for="ssh-exec-path" class="col-sm-1 control-label"><strong>程序路径:</strong></label> <label for="ssh-app" class="col-sm-2 control-label"><strong>程序路径:</strong></label>
<div class="col-sm-6"> <div class="col-sm-9">
<div class="input-group"> <div class="input-group">
<input id="ssh-exec-path" type="text" class="form-control" placeholder="客户端可执行程序文件路径" readonly="readonly"> <input id="ssh-app" type="text" class="form-control input-args" placeholder="客户端可执行程序文件路径" readonly="readonly">
<span class="input-group-btn"><button class="btn btn-sm btn-primary" type="button" id="ssh-select-path">选择...</button></span> <span class="input-group-btn"><button class="btn btn-sm btn-primary" type="button" id="ssh-select-app">选择...</button></span>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group form-group-sm"> <div class="form-group form-group-sm">
<label for="ssh-exec-args" class="col-sm-1 control-label"><strong>命令参数:</strong></label> <label for="ssh-cmdline" class="col-sm-2 control-label"><strong>命令参数:</strong></label>
<div class="col-sm-6"> <div class="col-sm-9">
<input id="ssh-exec-args" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数"/> <input id="ssh-cmdline" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数"/>
</div> </div>
</div> </div>
<div class="form-group form-group-sm"> <!--<div class="form-group form-group-sm">-->
<div class="col-sm-1"></div> <!--<div class="col-sm-2"></div>-->
<div class="col-sm-6"> <!--<div class="col-sm-6">-->
<a id="ssh-btn-save" class="btn btn-primary" href="javascript:;"><i class="fa fa-check fa-fw"></i> 保存设置!</a> <!--<a id="ssh-btn-save" class="btn btn-primary" href="javascript:;"><i class="fa fa-check fa-fw"></i> 保存设置!</a>-->
</div> <!--</div>-->
</div> <!--</div>-->
</div> </div>
@ -94,35 +94,35 @@
<div class="form-horizontal"> <div class="form-horizontal">
<div class="form-group form-group-sm"> <div class="form-group form-group-sm">
<label for="sftp-client-type" class="col-sm-1 control-label"><strong>客户端:</strong></label> <label for="scp-type" class="col-sm-2 control-label"><strong>客户端:</strong></label>
<div class="col-sm-2"> <div class="col-sm-4">
<select id="sftp-client-type" class="form-control"></select> <select id="scp-type" class="form-control"></select>
</div> </div>
</div> </div>
<div class="form-group form-group-sm"> <div class="form-group form-group-sm">
<label for="sftp-exec-path" class="col-sm-1 control-label"><strong>程序路径:</strong></label> <label for="scp-app" class="col-sm-2 control-label"><strong>程序路径:</strong></label>
<div class="col-sm-6"> <div class="col-sm-9">
<div class="input-group"> <div class="input-group">
<input id="sftp-exec-path" type="text" class="form-control" placeholder="客户端可执行程序文件路径" readonly="readonly"> <input id="scp-app" type="text" class="form-control input-args" placeholder="客户端可执行程序文件路径" readonly="readonly">
<span class="input-group-btn"><button class="btn btn-sm btn-primary" type="button" id="sftp-select-path">选择...</button></span> <span class="input-group-btn"><button class="btn btn-sm btn-primary" type="button" id="scp-select-app">选择...</button></span>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group form-group-sm"> <div class="form-group form-group-sm">
<label for="sftp-exec-args" class="col-sm-1 control-label"><strong>命令参数:</strong></label> <label for="scp-cmdline" class="col-sm-2 control-label"><strong>命令参数:</strong></label>
<div class="col-sm-6"> <div class="col-sm-9">
<input id="sftp-exec-args" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数"/> <input id="scp-cmdline" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数"/>
</div> </div>
</div> </div>
<div class="form-group form-group-sm"> <!--<div class="form-group form-group-sm">-->
<div class="col-sm-1"></div> <!--<div class="col-sm-1"></div>-->
<div class="col-sm-6"> <!--<div class="col-sm-6">-->
<a id="sftp-btn-save" class="btn btn-primary" href="javascript:;"><i class="fa fa-check fa-fw"></i> 保存设置!</a> <!--<a id="sftp-btn-save" class="btn btn-primary" href="javascript:;"><i class="fa fa-check fa-fw"></i> 保存设置!</a>-->
</div> <!--</div>-->
</div> <!--</div>-->
</div> </div>
@ -131,38 +131,40 @@
<div class="form-horizontal"> <div class="form-horizontal">
<div class="form-group form-group-sm"> <div class="form-group form-group-sm">
<label for="telnet-client-type" class="col-sm-1 control-label"><strong>客户端:</strong></label> <label for="telnet-type" class="col-sm-2 control-label"><strong>客户端:</strong></label>
<div class="col-sm-2"> <div class="col-sm-4">
<select id="telnet-client-type" class="form-control"></select> <select id="telnet-type" class="form-control"></select>
</div> </div>
</div> </div>
<div class="form-group form-group-sm"> <div class="form-group form-group-sm">
<label for="telnet-exec-path" class="col-sm-1 control-label"><strong>程序路径:</strong></label> <label for="telnet-app" class="col-sm-2 control-label"><strong>程序路径:</strong></label>
<div class="col-sm-6"> <div class="col-sm-9">
<div class="input-group"> <div class="input-group">
<input id="telnet-exec-path" type="text" class="form-control" placeholder="客户端可执行程序文件路径" readonly="readonly"> <input id="telnet-app" type="text" class="form-control input-args" placeholder="客户端可执行程序文件路径" readonly="readonly">
<span class="input-group-btn"><button class="btn btn-sm btn-primary" type="button" id="telnet-select-path">选择...</button></span> <span class="input-group-btn"><button class="btn btn-sm btn-primary" type="button" id="telnet-select-app">选择...</button></span>
</div> </div>
</div> </div>
</div> </div>
<div class="form-group form-group-sm"> <div class="form-group form-group-sm">
<label for="telnet-exec-args" class="col-sm-1 control-label"><strong>命令参数:</strong></label> <label for="telnet-cmdline" class="col-sm-2 control-label"><strong>命令参数:</strong></label>
<div class="col-sm-6"> <div class="col-sm-9">
<input id="telnet-exec-args" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数"/> <input id="telnet-cmdline" type="text" class="form-control input-args" placeholder="客户端启动所需命令行参数"/>
</div> </div>
</div> </div>
</div>
<hr/>
<div class="form-horizontal">
<div class="form-group form-group-sm"> <div class="form-group form-group-sm">
<div class="col-sm-1"></div> <div class="col-sm-2"></div>
<div class="col-sm-6"> <div class="col-sm-6">
<a id="telnet-btn-save" class="btn btn-primary" href="javascript:;"><i class="fa fa-check fa-fw"></i> 保存设置!</a> <a id="btn-save" class="btn btn-primary" href="javascript:;"><i class="fa fa-check fa-fw"></i> 保存设置!</a>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>

View File

@ -4,260 +4,399 @@ var g_url_base = 'http://127.0.0.1:50022';
var g_cfg = null; var g_cfg = null;
var dom = {
ssh_type: $('#ssh-type'),
ssh_app: $('#ssh-app'),
ssh_cmdline: $('#ssh-cmdline'),
ssh_select_app: $('#ssh-select-app'),
scp_type: $('#scp-type'),
scp_app: $('#scp-app'),
scp_cmdline: $('#scp-cmdline'),
scp_select_app: $('#scp-select-app'),
var get_config = function () { telnet_type: $('#telnet-type'),
$.ajax({ telnet_app: $('#telnet-app'),
type: 'GET', telnet_cmdline: $('#telnet-cmdline'),
timeout: 5000, telnet_select_app: $('#telnet-select-app'),
url: g_url_base + '/api/get_config',
jsonp: 'callback', btn_save: $('#btn-save')
dataType: 'json', };
success: function (ret) {
if (ret.code == 0) { function get_config() {
console.log(ret.data); $.ajax({
g_cfg = ret.data; type: 'GET',
//init_config_list(type, ret.config_list); timeout: 5000,
} else { url: g_url_base + '/api/get_config',
alert("获取配置信息失败!"); jsonp: 'callback',
} dataType: 'json',
}, success: function (ret) {
error: function (jqXhr, _error, _e) { if (ret.code == 0) {
console.log('state:', jqXhr.state()); console.log(ret.data);
alert("获取配置信息失败!"); g_cfg = ret.data;
} update_dom();
}); } else {
alert("获取配置信息失败!");
}
},
error: function (jqXhr, _error, _e) {
console.log('state:', jqXhr.state());
alert("获取配置信息失败!");
}
});
} }
var set_current_client_config = function (tpye, name, path, commandline, desc) { function update_dom() {
var data = { if (_.isNull(g_cfg))
type: tpye, return;
name: name,
path: path,
commandline: commandline
};
var args_ = encodeURIComponent(JSON.stringify(data));
$.ajax({ dom.ssh_type.html('');
type: 'GET', if (!_.isUndefined(g_cfg.ssh)) {
timeout: 5000, if (_.isUndefined(g_cfg.ssh.selected)) {
url: 'http://127.0.0.1:50022/ts_set_config/' + args_, g_cfg.ssh.selected = '';
jsonp: 'callback', }
dataType: 'json',
success: function (ret) {
if (ret.code == 0) {
alert("保存成功");
} else {
alert("保存成功" + ret.code);
}
}, if (!_.isUndefined(g_cfg.ssh.available) && g_cfg.ssh.available.length > 0) {
error: function (jqXhr, _error, _e) { var selected = '';
console.log('state:', jqXhr.state()); var app = '';
alert("保存失败"); var cmdline = '';
}
}); var html = [];
for (var i = 0; i < g_cfg.ssh.available.length; i++) {
var item = g_cfg.ssh.available[i];
if (selected === '' || item.name === g_cfg.ssh.selected) {
selected = item.name;
app = item.app;
cmdline = item.cmdline;
}
html.push('<option value="' + item.name + '">' + item.display + '</option>');
}
dom.ssh_type.html(html.join(''));
dom.ssh_type.val(selected);
dom.ssh_app.val(app);
dom.ssh_cmdline.val(cmdline);
}
}
dom.scp_type.html('');
if (!_.isUndefined(g_cfg.scp)) {
if (_.isUndefined(g_cfg.scp.selected)) {
g_cfg.scp.selected = '';
}
if (!_.isUndefined(g_cfg.scp.available) && g_cfg.scp.available.length > 0) {
var selected = '';
var app = '';
var cmdline = '';
var html = [];
for (var i = 0; i < g_cfg.scp.available.length; i++) {
var item = g_cfg.scp.available[i];
if (selected === '' || item.name === g_cfg.scp.selected) {
selected = item.name;
app = item.app;
cmdline = item.cmdline;
}
html.push('<option value="' + item.name + '">' + item.display + '</option>');
}
dom.scp_type.html(html.join(''));
dom.scp_type.val(selected);
dom.scp_app.val(app);
dom.scp_cmdline.val(cmdline);
}
}
dom.telnet_type.html('');
if (!_.isUndefined(g_cfg.telnet)) {
if (_.isUndefined(g_cfg.telnet.selected)) {
g_cfg.telnet.selected = '';
}
if (!_.isUndefined(g_cfg.telnet.available) && g_cfg.telnet.available.length > 0) {
var selected = '';
var app = '';
var cmdline = '';
var html = [];
for (var i = 0; i < g_cfg.telnet.available.length; i++) {
var item = g_cfg.telnet.available[i];
if (selected === '' || item.name === g_cfg.telnet.selected) {
selected = item.name;
app = item.app;
cmdline = item.cmdline;
}
html.push('<option value="' + item.name + '">' + item.display + '</option>');
}
dom.telnet_type.html(html.join(''));
dom.telnet_type.val(selected);
dom.telnet_app.val(app);
dom.telnet_cmdline.val(cmdline);
}
}
} }
var open_exist_file = function (callback) { function on_save() {
var data = { if (g_cfg === null)
action: 1 return;
};
var args_ = encodeURIComponent(JSON.stringify(data));
$.ajax({ var i = 0;
type: 'GET', for (i = 0; i < g_cfg.ssh.available.length; i++) {
timeout: -1, var item = g_cfg.ssh.available[i];
url: 'http://127.0.0.1:50022/ts_file_action/' + args_, if (item.name === g_cfg.ssh.selected) {
jsonp: 'callback', item.app = dom.ssh_app.val();
dataType: 'json', item.cmdline = dom.ssh_cmdline.val();
success: function (ret) { break;
callback(0, ret.path); }
}, }
error: function (jqXhr, _error, _e) { for (i = 0; i < g_cfg.scp.available.length; i++) {
console.log('state:', jqXhr.state()); var item = g_cfg.scp.available[i];
callback(-1, ""); if (item.name === g_cfg.scp.selected) {
} item.app = dom.scp_app.val();
}); item.cmdline = dom.scp_cmdline.val();
break;
}
}
for (i = 0; i < g_cfg.telnet.available.length; i++) {
var item = g_cfg.telnet.available[i];
if (item.name === g_cfg.telnet.selected) {
item.app = dom.telnet_app.val();
item.cmdline = dom.telnet_cmdline.val();
break;
}
}
var args_ = encodeURIComponent(JSON.stringify(g_cfg));
$.ajax({
type: 'GET',
timeout: 5000,
url: g_url_base + '/api/set_config/' + args_,
jsonp: 'callback',
dataType: 'json',
success: function (ret) {
if (ret.code == 0) {
notify_success('设置保存成功!');
} else {
notify_error('设置保存失败!' + ret.code);
}
},
error: function () {
notify_error('网络故障,设置保存失败');
}
});
} }
var init_config_list = function (type, config_list) { var select_local_file = function (callback) {
var data = {
action: 1
};
var args_ = encodeURIComponent(JSON.stringify(data));
var html = ""; $.ajax({
if (type == 1) { type: 'GET',
$("#ssh-client-type").html(html); timeout: -1,
for (var i = 0; i < config_list.length; i++) { url: g_url_base + '/api/file_action/' + args_,
var item = config_list[i]; jsonp: 'callback',
html = '<option id="ssh-' + item.name + '" value="' + item.name + '">' + item.alias_name + '</option>'; dataType: 'json',
$('#ssh-client-type').append(html); success: function (ret) {
if (item.current == 1) { callback(0, ret.path);
$('#ssh-' + item.name).attr('selected', true); },
init_config_param(type, item.build_in, item.path, item.commandline); error: function (jqXhr, _error, _e) {
g_current_ssh = item.name; console.log('state:', jqXhr.state());
} callback(-1, "");
g_ssh_config_dict[item.name] = item; }
} });
} else if(type == 2) {
$('#sftp-client-type').html(html);
for (var i = 0; i < config_list.length; i++) {
var item = config_list[i];
html = '<option id="sftp-' + item.name + '" value="' + item.name + '">' + item.alias_name + '</option>';
$('#sftp-client-type').append(html);
if (item.current == 1) {
$('#sftp-' + item.name).attr('selected', true);
init_config_param(type, item.build_in, item.path, item.commandline);
g_current_sftp = item.name;
}
g_sftp_config_dict[item.name] = item;
}
} else if(type == 3) {
$('#telnet-client-type').html(html);
for (var i = 0; i < config_list.length; i++) {
var item = config_list[i];
html = '<option id="telnet-' + item.name + '" value="' + item.name + '">' + item.alias_name + '</option>';
$("#telnet-client-type").append(html);
if (item.current == 1) {
$('#telnet-' + item.name).attr('selected', true);
init_config_param(type, item.build_in, item.path, item.commandline);
g_current_telnet = item.name;
}
g_telnet_config_dict[item.name] = item;
}
}
} }
var init_config_param = function (type, build_in, path, command_line) {
if (type == 1) { function notify_error(message_, title_) {
if (build_in == 1) { var _title = title_ || '';
$("#ssh-exec-args").attr("readonly", "readonly"); $.gritter.add({
$("#ssh-select-path").attr("disabled", "disabled"); class_name: 'gritter-error',
} else { time: 10000,
$("#ssh-exec-args").removeAttr("readonly"); title: '<i class="fa fa-warning fa-fw"></i> 错误:' + _title,
$("#ssh-select-path").removeAttr("disabled"); text: message_
} });
$("#ssh-exec-path").val(path); console.error('错误', _title, message_);
$("#ssh-exec-args").val(command_line); };
} else if (type == 2) {
if (build_in == 1) { function notify_success(message_, title_) {
$("#sftp-exec-args").attr("readonly", "readonly"); var _title = title_ || null;
$("#sftp-select-path").attr("disabled", "disabled"); if (_title !== null)
} else { _title = '<i class="fa fa-check-square fa-fw"></i> ' + _title;
$("#sftp-exec-args").removeAttr("readonly"); $.gritter.add({
$("#sftp-select-path").removeAttr("disabled"); class_name: 'gritter-success',
} time: 5000,
$("#sftp-exec-path").val(path); title: _title,
$("#sftp-exec-args").val(command_line); text: message_
} else if(type == 3) { });
if (build_in == 1) { };
$("#telnet-exec-args").attr("readonly", "readonly");
$("#telnet-select-path").attr("disabled", "disabled");
} else {
$("#telnet-exec-args").removeAttr("readonly");
$("#telnet-select-path").removeAttr("disabled");
}
$("#telnet-exec-path").val(path);
$("#telnet-exec-args").val(command_line);
}
}
$(document).ready(function () { $(document).ready(function () {
get_config(); get_config();
// get_client_config_list(1);
// get_client_config_list(2);
// get_client_config_list(3);
$("#ssh-client-type").change(function () { dom.ssh_type.change(function () {
var i = 0; g_cfg.ssh.selected = dom.ssh_type.val();
var name = $("#ssh-client-type").val(); for (var i = 0; i < g_cfg.ssh.available.length; i++) {
var item = g_ssh_config_dict[name]; var item = g_cfg.ssh.available[i];
init_config_param(1, item.build_in, item.path, item.commandline); if (item.name === g_cfg.ssh.selected) {
g_current_ssh = item.name; dom.ssh_app.val(item.app);
}); dom.ssh_cmdline.val(item.cmdline);
$("#ssh-select-path").click(function () { return;
open_exist_file(function (code, path) { }
if (code == 0) { }
$("#ssh-exec-path").val(path); notify_error('所选的配置项不存在!');
} else { });
console.log("can not select file."); dom.ssh_select_app.click(function () {
} select_local_file(function (code, path) {
}); if (code == 0) {
}); dom.ssh_app.val(path);
$("#ssh-btn-save").click(function () { } else {
var name = $("#ssh-client-type").val(); console.log("can not select file.");
var path = $("#ssh-exec-path").val(); }
if (path == "") { });
alert("请选择路径"); });
return;
}
var command_line = $("#ssh-exec-args").val();
if (command_line == "") {
alert("请输入命令行");
return;
}
set_current_client_config(1, name, path, command_line);
});
$("#sftp-client-type").change(function () { dom.scp_type.change(function () {
var i = 0; g_cfg.scp.selected = dom.scp_type.val();
var name = $("#sftp-client-type").val(); for (var i = 0; i < g_cfg.scp.available.length; i++) {
var item = g_sftp_config_dict[name]; var item = g_cfg.scp.available[i];
init_config_param(2, item.build_in, item.path, item.commandline); if (item.name === g_cfg.scp.selected) {
g_current_sftp = item.name; dom.scp_app.val(item.app);
}); dom.scp_cmdline.val(item.cmdline);
$("#sftp-select-path").click(function () { return;
open_exist_file(function (code, path) { }
if (code == 0) { }
$("#sftp-exec-path").val(path); notify_error('所选的配置项不存在!');
} else { });
console.log("can not select file."); dom.scp_select_app.click(function () {
} select_local_file(function (code, path) {
}); if (code == 0) {
}); dom.scp_app.val(path);
$("#sftp-btn-save").click(function () { } else {
var name = $("#sftp-client-type").val(); console.log("can not select file.");
var path = $("#sftp-exec-path").val(); }
if (path == "") { });
alert("请选择路径"); });
return;
}
var command_line = $("#sftp-exec-args").val();
if (command_line == "") {
alert("请输入命令行");
return;
}
set_current_client_config(2, name, path, command_line);
});
$("#telnet-client-type").change(function () { dom.telnet_type.change(function () {
var i = 0; g_cfg.telnet.selected = dom.telnet_type.val();
var name = $("#telnet-client-type").val(); for (var i = 0; i < g_cfg.telnet.available.length; i++) {
var item = g_telnet_config_dict[name]; var item = g_cfg.telnet.available[i];
init_config_param(3, item.build_in, item.path, item.commandline); if (item.name === g_cfg.telnet.selected) {
g_current_telnet = item.name; dom.telnet_app.val(item.app);
}); dom.telnet_cmdline.val(item.cmdline);
$("#telnet-select-path").click(function () { return;
open_exist_file(function (code, path) { }
if (code == 0) { }
$("#telnet-exec-path").val(path); notify_error('所选的配置项不存在!');
} else { });
console.log("can not select file."); dom.telnet_select_app.click(function () {
} select_local_file(function (code, path) {
}); if (code == 0) {
}); dom.telnet_app.val(path);
$("#telnet-btn-save").click(function () { } else {
var name = $("#telnet-client-type").val(); console.log("can not select file.");
var path = $("#telnet-exec-path").val(); }
if (path == "") { });
alert("请选择路径"); });
return;
}
var command_line = $("#telnet-exec-args").val(); dom.btn_save.click(function () {
if (command_line == "") { on_save();
alert("请输入命令行"); // var name = $("#ssh-client-type").val();
return; // var path = $("#ssh-exec-path").val();
} // if (path == "") {
set_current_client_config(3, name, path, command_line); // alert("请选择路径");
}); // return;
// }
// var command_line = $("#ssh-exec-args").val();
// if (command_line == "") {
// alert("请输入命令行");
// return;
// }
// set_current_client_config(1, name, path, command_line);
});
// $("#sftp-client-type").change(function () {
// var i = 0;
// var name = $("#sftp-client-type").val();
// var item = g_sftp_config_dict[name];
// init_config_param(2, item.build_in, item.path, item.commandline);
// g_current_sftp = item.name;
// });
// $("#sftp-select-path").click(function () {
// open_exist_file(function (code, path) {
// if (code == 0) {
// $("#sftp-exec-path").val(path);
// } else {
// console.log("can not select file.");
// }
// });
// });
// $("#sftp-btn-save").click(function () {
// var name = $("#sftp-client-type").val();
// var path = $("#sftp-exec-path").val();
// if (path == "") {
// alert("请选择路径");
// return;
// }
// var command_line = $("#sftp-exec-args").val();
// if (command_line == "") {
// alert("请输入命令行");
// return;
// }
// set_current_client_config(2, name, path, command_line);
// });
//
//
// $("#telnet-client-type").change(function () {
// var i = 0;
// var name = $("#telnet-client-type").val();
// var item = g_telnet_config_dict[name];
// init_config_param(3, item.build_in, item.path, item.commandline);
// g_current_telnet = item.name;
// });
// $("#telnet-select-path").click(function () {
// open_exist_file(function (code, path) {
// if (code == 0) {
// $("#telnet-exec-path").val(path);
// } else {
// console.log("can not select file.");
// }
// });
// });
// $("#telnet-btn-save").click(function () {
// var name = $("#telnet-client-type").val();
// var path = $("#telnet-exec-path").val();
// if (path == "") {
// alert("请选择路径");
// return;
// }
// var command_line = $("#telnet-exec-args").val();
// if (command_line == "") {
// alert("请输入命令行");
// return;
// }
// set_current_client_config(3, name, path, command_line);
// });
}); });

View File

@ -74,7 +74,7 @@ html, body {
margin-bottom: 5px; margin-bottom: 5px;
} }
.col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7 { .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11 {
padding-left: 3px; padding-left: 3px;
padding-right: 3px; padding-right: 3px;
} }