[Feature][S300][task-view-617][webui] add network status
Change-Id: Ic05034d10c08536d53abe75dc969ab33828558ba
diff --git a/lynq/S300/ap/app/zte_webui/js/net.js b/lynq/S300/ap/app/zte_webui/js/net.js
index 22a9d2b..32b29ed 100755
--- a/lynq/S300/ap/app/zte_webui/js/net.js
+++ b/lynq/S300/ap/app/zte_webui/js/net.js
@@ -3,7 +3,7 @@
function (_, $, ko, config, service) {
//system url filter setting VM
-
+
function UrlFilterSettingVM() {
var target = this;
var urlFltInfo = service.getUrlFilterList();
@@ -28,14 +28,14 @@
});
target.clear = clearFunc;
-
+
target.callback = callbackFunc;
//删除规则
-
+
target.deleteRule = deleteRuleFunc;
-
+
//添加规则
-
+
target.addRule = addRuleFunc;
function callbackFunc(elem) {
if (elem.result != "success") {
@@ -47,7 +47,7 @@
$("#urlFilters").translate();
}
}
-
+
//添加规则
function addRuleFunc() {
if (target.rules().length >= config.urlFilterMax) {
@@ -84,17 +84,17 @@
service.deleteSelectedRules(urlFltParams, target.callback);
});
}
-
+
}
-
+
function clearFunc() {
$("#addURLFilter").val("");
}
-
+
//页面初始化
-
+
function initialize() {
-
+
var vm = new UrlFilterSettingVM();
bindContainer(vm);
}
@@ -127,7 +127,7 @@
function (_, $, ko, config, service) {
//system upnp setting VM
-
+
function UpnpSettingVM() {
var target = this;
var upnpInfo = getUpnpSetting();
@@ -149,21 +149,21 @@
}
}
-
-
+
+
//获取upnp 信息
-
+
function getUpnpSetting() {
return service.getUpnpSetting();
}
//初始化UpnpSettingVM model
-
+
function initialize() {
-
+
var vm = new UpnpSettingVM();
bindContainer(vm);
-
+
}
function bindContainer(vm) {
var container = $('#container');
@@ -185,7 +185,7 @@
function (_, $, ko, config, service) {
//system upnp setting VM
-
+
function UpnpSettingVM() {
var target = this;
var upnpInfo = getUpnpSetting();
@@ -207,21 +207,21 @@
}
}
-
-
+
+
//获取upnp 信息
-
+
function getUpnpSetting() {
return service.getUpnpSetting();
}
//初始化UpnpSettingVM model
-
+
function initialize() {
-
+
var vm = new UpnpSettingVM();
bindContainer(vm);
-
+
}
function bindContainer(vm) {
var container = $('#container');
@@ -240,7 +240,7 @@
});
//端口映射
-
+
define("firewall_port_map","underscore jquery knockout set service".split(" "),
function (_, $, ko, config, service) {
@@ -276,7 +276,7 @@
];
//prot_map VM
-
+
function PortMapVM() {
var target = this;
var mapInfo = getPortMap();
@@ -285,11 +285,11 @@
target.rules = ko.observableArray(mapInfo.portMapRules);
target.portMapEnable = ko.observable(mapInfo.portMapEnable);
-
+
target.comment = ko.observable('');
target.selectedMode = ko.observable('TCP&UDP');
target.modes = ko.observableArray(protocolModes);
-
+
target.destPort = ko.observable('');
target.destIpAddress = ko.observable('');
target.sourcePort = ko.observable('');
@@ -305,25 +305,25 @@
});
//设定,新增,删除回调函数
-
+
target.callback = callbackFunc;
-
+
//删除规则
-
+
target.deleteMapRules = deleteMapRulesFunc;
-
+
//检查新增规则是否已经存在
-
+
target.checkExist = checkExistFunc;
-
+
//设定端口映射
-
+
target.enablePortMap = enablePortMapFunc;
//保存规则
-
+
target.save = saveFunc;
-
+
//保存规则
function saveFunc() {
if (target.rules().length >= config.portForwardMax) {
@@ -349,7 +349,7 @@
mapParams.comment = target.comment();
service.setPortMap(mapParams, target.callback);
}
-
+
//检查新增规则是否已经存在
function checkExistFunc() {
var newMapRule = {
@@ -375,7 +375,7 @@
}
return false;
}
-
+
//设定端口映射
function enablePortMapFunc() {
showLoading();
@@ -383,7 +383,7 @@
mapParams.portMapEnable = target.portMapEnable();
service.enablePortMap(mapParams, target.callback);
}
-
+
//删除规则
function deleteMapRulesFunc() {
var ids = target.gridTemplate.selectedIds();
@@ -399,7 +399,7 @@
service.deleteMapRules(mapParams, target.callback);
});
}
-
+
//设定,新增,删除回调函数
function callbackFunc(ret) {
if (ret.result == "success") {
@@ -412,7 +412,7 @@
}
//情况添加规则输入
-
+
function clear() {
target.sourcePort('');
target.destIpAddress('');
@@ -423,7 +423,7 @@
}
//获取port map信息
-
+
function getPortMap() {
return service.getPortMap();
}
@@ -435,7 +435,7 @@
}
//初始化port map view model
-
+
function initialize(viewModel) {
var vm;
if (viewModel) {
@@ -506,7 +506,7 @@
});
//端口转发
-
+
define("firewall_port_forward","underscore jquery knockout set service".split(" "),
function (_, $, ko, config, service) {
@@ -514,7 +514,7 @@
return new Option(ele.name, ele.value);
});
//列表模板的columns项
-
+
var columnsTmpl = [{
columnType: "checkbox",
rowText: "index",
@@ -539,30 +539,30 @@
];
//prot_forward VM
-
+
function PortForwardVM() {
var target = this;
var fwdinfo = getPortForward();
target.portForwardEnable = ko.observable(fwdinfo.portForwardEnable);
target.oriPortForwardEnable = ko.observable(fwdinfo.portForwardEnable);
-
+
target.portEnd = ko.observable('');
target.portStart = ko.observable('');
target.ipAddress = ko.observable('');
-
+
target.comment = ko.observable('');
target.selectedMode = ko.observable('3');
target.modes = ko.observableArray(protocolModes);
target.rules = ko.observableArray(fwdinfo.portForwardRules);
-
+
//设定,新增,删除回调函数
-
+
target.callback = callbackFunc;
-
+
//创建列表模板
-
+
target.gridTemplate = new ko.simpleGrid.viewModel({
data: target.rules(),
idName: "index",
@@ -572,21 +572,21 @@
});
//检查新增规则是否已经存在
-
+
target.checkExist = checkExistFunc;
-
+
//保存规则
-
+
target.save = saveFunc;
-
+
//删除规则
-
+
target.deleteForwardRules = deleteForwardRulesFunc;
-
+
//设定虚拟服务器
-
+
target.enableVirtualServer = enableVirtualServerFunc;
-
+
//设定虚拟服务器
function enableVirtualServerFunc() {
showLoading();
@@ -594,7 +594,7 @@
fwdParams.portForwardEnable = target.portForwardEnable();
service.enableVirtualServer(fwdParams, target.callback);
}
-
+
//删除规则
function deleteForwardRulesFunc() {
var ids = target.gridTemplate.selectedIds();
@@ -610,7 +610,7 @@
service.deleteForwardRules(fwdParams, target.callback);
});
}
-
+
//保存规则
function saveFunc() {
if (target.rules().length >= config.portForwardMax) {
@@ -643,7 +643,7 @@
target.selectedMode('TCP&UDP');
target.comment('');
}
-
+
//设定,新增,删除回调函数
function callbackFunc(ret) {
if (ret.result == "success") {
@@ -681,13 +681,13 @@
}
//获取port forward信息
-
+
function getPortForward() {
return service.getPortForward();
}
//初始化port forward view model
-
+
function initialize(viewModel) {
var vm;
if (viewModel) {
@@ -704,7 +704,7 @@
vm = new PortForwardVM();
bindContainer(vm);
-
+
fixTableHeight();
renderCheckbox();
@@ -755,14 +755,14 @@
}
});
}
-
+
function bindContainer(vm){
var container = $('#container');
ko.cleanNode(container[0]);
ko.applyBindings(vm, container[0]);
}
-
+
return {
init: initialize
@@ -827,17 +827,17 @@
return new Option(elem.name, elem.value);
});
//prot_filter VM
-
+
function PortFilterVM() {
var target = this;
var info = getPortFilter();
-
+
target.oriDefaultPolicy = ko.observable(info.defaultPolicy);
target.defaultPolicy = ko.observable(info.defaultPolicy);
target.oriPortFilterEnable = ko.observable(info.portFilterEnable);
target.portFilterEnable = ko.observable(info.portFilterEnable);
target.rules = ko.observableArray(info.portFilterRules);
-
+
target.ipv6Support = ko.observable(config.IPV6_SUPPORT);
target.comment = ko.observable('');
target.selectedMode = ko.observable('5');
@@ -856,11 +856,11 @@
target.ipType = ko.observable('ipv4');
//设定,新增,删除回调函数
-
+
target.callback = callbackFunc;
-
+
//创建列表模板
-
+
target.gridTemplate = new ko.simpleGrid.viewModel({
data: target.rules(),
idName: "index",
@@ -869,40 +869,40 @@
pageSize: 20
});
//default policy change handler
-
+
target.policyChangeHandler = policyChangeHandlerFunc;
//保存规则
-
+
target.save = saveFunc;
-
+
//设定过滤基本信息
-
+
target.setPortFilterBasic = setPortFilterBasicFunc;
-
+
//清空添加规则输入
-
+
target.clear = clearFunc;
//检查新增规则是否已经存在
-
+
target.checkExist = checkExistFunc;
//ip类型变化事件监听
-
+
target.ipTypeChangeHandler = ipTypeChangeHandlerFunc;
-
+
//协议变化事件监听
-
+
target.protocolChangeHandler = protocolChangeHandlerFunc;
//删除规则
-
+
target.deleteFilterRules = deleteFilterRulesFunc;
//init to call
target.policyChangeHandler();
-
+
//设定,新增,删除回调函数
function callbackFunc(ret) {
if (ret.result != "success") {
@@ -919,7 +919,7 @@
target.portFilterAction(action);
return true;
}
-
+
//保存规则
function saveFunc() {
target.sourceIpAddress(target.sourceIpAddress().replace(/\s+/g, ''));
@@ -975,7 +975,7 @@
fltParams.destIpAddress = target.destIpv6Address();
fltParams.sourceIpAddress = target.sourceIpv6Address();
}
-
+
fltParams.ipType = target.ipType();
fltParams.comment = target.comment();
fltParams.protocol = target.selectedMode();
@@ -987,7 +987,7 @@
service.setPortFilter(fltParams, target.callback);
});
}
-
+
//设定过滤基本信息
function setPortFilterBasicFunc() {
showLoading();
@@ -1011,7 +1011,7 @@
target.macAddress('');
clearValidateMsg();
}
-
+
//检查新增规则是否已经存在
function checkExistFunc() {
target.macAddress(target.macAddress().toUpperCase());
@@ -1047,7 +1047,7 @@
}
return false;
}
-
+
//协议变化事件监听
function protocolChangeHandlerFunc() {
if (target.selectedMode() == PROTOCOLS.ICMP || target.selectedMode() == PROTOCOLS.NONE) {
@@ -1064,7 +1064,7 @@
}
return true;
}
-
+
//删除规则
function deleteFilterRulesFunc() {
var ids = target.gridTemplate.selectedIds();
@@ -1080,23 +1080,23 @@
service.deleteFilterRules(rules, target.callback);
});
}
-
+
}
//获取port filter信息
-
+
function getPortFilter() {
return service.getPortFilter();
}
-
+
//ip类型变化事件监听
function ipTypeChangeHandlerFunc() {
clearValidateMsg();
return true;
}
-
+
//初始化port filter view model
-
+
function initialize(viewModel) {
var vm;
if (viewModel) {
@@ -1221,7 +1221,7 @@
});
//家长控制
-
+
define("firewall_parental_control","underscore jquery knockout set service".split(" "),
function (_, $, ko, config, service) {
@@ -1232,8 +1232,8 @@
MANAGE: 1,
RULE: 2
};
-
-
+
+
function ParentalControlVM() {
var target = this;
var hostNameList = service.getHostNameList({}).devices;
@@ -1247,12 +1247,12 @@
return data.mac;
});
});
-
+
target.currentUserInChildGroup = ko.observable(true);
//获取儿童组设备列表
-
+
target.fetchChildGroupList = fetchChildGroupListFunc;
-
+
target.fetchChildGroupList();
target.manageHandler = manageHandlerFunc;
@@ -1262,15 +1262,15 @@
}
target.attachedDevices = ko.observable([]);
//获取已连接设备列表
-
+
target.fetchAttachedDevices = fetchAttachedDevicesFunc;
-
+
//儿童组设备 标签按钮事件
-
+
target.backToMainHandler = backToMainHandlerFunc;
-
-
+
+
ko.computed(function () {
target.attachedDevices();
target.childGroupList();
@@ -1279,9 +1279,9 @@
notify: 'always',
throttle: 300
});
-
+
//添加至儿童组
-
+
function addChildGroupFun(flag, eleData) {
showLoading();
service.addChildGroup(eleData, function (data) {
@@ -1299,41 +1299,41 @@
errorOverlay();
});
}
-
+
//移除按钮事件
-
+
target.removeChildGroupHandler = removeChildGroupHandlerFunc;
-
-
+
+
//添加按钮事件
-
+
target.addChildGroupHandler = addChildGroupHandlerFunc;
-
+
target.dealElement = dealElementFunc;
-
-
-
+
+
+
//取消编辑主机名按钮事件
-
+
target.cancelEditHostNameHandler = cancelEditHostNameHandlerFunc;
-
+
//主机名编辑保存按钮事件
-
+
target.saveHostNameHandler = saveHostNameHandlerFunc;
-
+
//主机名编辑按钮事件
-
+
target.editHostNameHandler = editHostNameHandlerFunc;
-
-
+
+
target.selectedIds = ko.observableArray([]);
target.siteList = ko.observable([]);
/////////////////////////////////////////////////////////////////
target.disableAdd = ko.computed(function () {
return target.siteList().length == maxItem;
});
-
+
ko.computed(function () {
target.siteList();
target.selectedIds();
@@ -1342,21 +1342,21 @@
}, 100);
$("#pc_site_white_list_form").translate();
});
-
+
//网站白名单添加按钮事件
-
+
target.openAddSitePopoverHandler = openAddSitePopoverHandlerFunc;
-
+
//网站白名单列表选择框点击事件
-
+
target.checkboxClickHandler = checkboxClickHandlerFunc;
-
+
//获取网站白名单列表
-
+
target.fetchSiteWhiteList = fetchSiteWhiteListFunc;
-
+
//网站白名单删除函数
-
+
function removeSiteWhiteItem(ids) {
showConfirm('confirm_data_delete', function () {
showLoading();
@@ -1374,42 +1374,42 @@
});
}
//网站白名单删除所有按钮事件
-
+
target.removeAllWhiteSite = removeAllWhiteSiteFunc;
-
+
//网站白名单删除按钮事件
-
+
target.removeSelectedWhiteSite = removeSelectedWhiteSiteFunc;
-
+
//网站白名单移除按钮事件
-
+
target.removeWhiteSite = removeWhiteSiteFunc;
-
-
-
+
+
+
//网站白名单添加框保存按钮事件
-
+
target.saveSiteWhite = saveSiteWhiteFunc;
-
+
//////////////////////////////////////////////////////////////////
target.notSave = ko.observable(false);
//获取时间限制信息
-
+
target.fetchTimeLimited = fetchTimeLimitedFunc;
-
-
+
+
//上网时间设置时间表格事件绑定
-
+
target.bindEvent = bindEventFunc;
-
+
//上网时间设置保存按钮事件
-
+
target.saveTimeLimitedHandler = saveTimeLimitedHandlerFunc;
-
+
//////////////////////////////////////////////////////////////////
var isBinded = false;
//上网规则标签点击事件
-
+
target.openRulePage = openRulePageFunc;
function openRulePageFunc() {
if (target.currentPage() == PAGES.RULE) {
@@ -1430,7 +1430,7 @@
hideLoading();
});
}
-
+
//获取儿童组设备列表
function fetchChildGroupListFunc(cb) {
service.childGroupList({}, function (data) {
@@ -1446,7 +1446,7 @@
}
});
}
-
+
//获取已连接设备列表
function fetchAttachedDevicesFunc(cb) {
target.attachedDevices([]);
@@ -1470,7 +1470,7 @@
currDevices = devs;
}
});
-
+
//wifi 已连接设备
service.getCurrentlyAttachedDevicesInfo({}, function (data) {
counter++;
@@ -1494,7 +1494,7 @@
function backToMainHandlerFunc() {
target.currentPage(PAGES.MAIN);
}
-
+
//移除按钮事件
function removeChildGroupHandlerFunc(ele) {
showLoading();
@@ -1508,7 +1508,7 @@
errorOverlay();
});
}
-
+
//添加按钮事件
function addChildGroupHandlerFunc(data) {
var uMacAddr = service.getCurretnMAC();
@@ -1520,12 +1520,12 @@
})
}
}
-
+
//取消编辑主机名按钮事件
function cancelEditHostNameHandlerFunc(eleData) {
target.dealElement(false, eleData.idx);
}
-
+
//主机名编辑保存按钮事件
function saveHostNameHandlerFunc(ele) {
var $hostInput = $("#hostname_input_" + ele.idx);
@@ -1556,7 +1556,7 @@
errorOverlay();
});
}
-
+
//主机名编辑按钮事件
function editHostNameHandlerFunc(ele) {
$("#hostname_input_" + ele.idx).val(ele.hostname);
@@ -1573,7 +1573,7 @@
validation: addValidation
});
}
-
+
//网站白名单列表选择框点击事件
function checkboxClickHandlerFunc(eleData, evt) {
addTimeout(function () {
@@ -1591,7 +1591,7 @@
_.isFunction(cb) && cb.apply(this);
});
}
-
+
//网站白名单删除所有按钮事件
function removeAllWhiteSiteFunc() {
removeSiteWhiteItem(getAllCheckboxValues());
@@ -1604,7 +1604,7 @@
function removeWhiteSiteFunc(ele, evt) {
removeSiteWhiteItem([ele.id]);
}
-
+
//网站白名单添加框保存按钮事件
function saveSiteWhiteFunc(name, site) {
popover.hide();
@@ -1636,7 +1636,7 @@
});
});
}
-
+
//上网时间设置时间表格事件绑定
function bindEventFunc() {
$("td:not('.col-head')", "#pc_time_limited_tbody").addClass('cursorhand').die().click(function () {
@@ -1660,7 +1660,7 @@
$this.removeClass('time_td_hover');
});
}
-
+
//上网时间设置保存按钮事件
function saveTimeLimitedHandlerFunc() {
showLoading();
@@ -1675,9 +1675,9 @@
errorOverlay();
});
}
-
+
}
-
+
function dealElementFunc(flag, idx) {
if (flag == false) {
$("#edit_btn_" + idx + ",#hostname_txt_" + idx).show();
@@ -1716,16 +1716,16 @@
return selectedValues;
}
//获取列表中被选中项的value值
-
+
function getSelectedValues() {
return getCheckboxValues(true);
}
function getAllCheckboxValues() {
return getCheckboxValues(false);
}
-
+
//增加网站白名单表单提交函数绑定和校验规则设置
-
+
function addValidation() {
$('#whiteSiteAddForm').validate({
submitHandler: function () {
@@ -1739,7 +1739,7 @@
}
});
}
-
+
function getSavedData(timeDatas) {
var ret = '';
for (var ki in timeDatas) {
@@ -1755,7 +1755,7 @@
return ret.substring(0, ret.length - 1);
}
//获取时间表格选中的时间
-
+
function getSelectedTds() {
var defaultValue = {
'0': [],
@@ -1783,7 +1783,7 @@
}
}
//初始化时间表格
-
+
function initTableData() {
$("tr", "#pc_time_limited_tbody").each(function (idx, n) {
var $tr = $(n);
@@ -1808,11 +1808,11 @@
pcVm.notSave(false);
}
-
+
//页面初始化
-
+
function initialize() {
-
+
pcVm = new ParentalControlVM();
bindContainer(pcVm);
}
@@ -1832,7 +1832,7 @@
function ( _, $, ko, config, service) {
//system dmz setting VM
-
+
function DmzSettingVM() {
var target = this;
var dmzInfo = getDmzSetting();
@@ -1842,9 +1842,9 @@
target.clear = clearFunc;
//应用按钮事件
-
+
target.save = saveFunc;
-
+
function saveFunc() {
showLoading();
var params = {};
@@ -1859,24 +1859,24 @@
}
});
}
-
+
}
-
+
function clearFunc() {
initialize();
}
-
-
+
+
//获取dmz 信息
-
+
function getDmzSetting() {
return service.getDmzSetting();
}
//初始化DmzSettingVM model
-
+
function initialize() {
-
+
var dmzVm = new DmzSettingVM();
bindContainer(dmzVm);
}
@@ -2114,7 +2114,7 @@
//选网模块
-
+
define("network_net_select","underscore jquery knockout set service".split(" "),
function (_, $, ko, config, service) {
@@ -2123,7 +2123,7 @@
});
//选网功能view model
-
+
function NetSelectVM() {
var target = this;
@@ -2135,9 +2135,9 @@
target.selectMode = ko.observable();
target.networkText = networkTextFunc;
-
+
target.networkStatusId = networkStatusIdFunc;
-
+
target.networkStatus = networkStatusFunc;
target.subnetworkType = subnetworkTypeFunc;
@@ -2152,17 +2152,17 @@
target.subnetTypeId = subnetTypeIdFunc;
//手动搜网.
-
+
target.search = searchFunc;
//自动选网时设置网络模式.
-
+
target.save = saveFunc;
target.checkEnable = checkEnableFunc;
//注册选择的网络.
-
+
target.register = registerFunc;
//init data
@@ -2175,7 +2175,7 @@
}
target.selectedType(info.net_select);
-
+
//注册选择的网络.
function registerFunc() {
showLoading('registering_net');
@@ -2191,7 +2191,7 @@
}
});
}
-
+
function checkEnableFunc() {
var status = service.getStatusInfo();
if (status.connectStatus == "ppp_connected" || status.connectStatus == "ppp_connecting") {
@@ -2200,7 +2200,7 @@
target.enableFlag(true);
}
}
-
+
//自动选网时设置网络模式.
function saveFunc() {
showLoading();
@@ -2217,7 +2217,7 @@
}
});
}
-
+
//手动搜网.
function searchFunc() {
showLoading('searching_net');
@@ -2237,15 +2237,15 @@
}
});
}
-
+
function subnetTypeIdFunc(data) {
return getSubNetworkTypeTog(data.nRat, data.SubAct);
}
-
+
function networkTypeIdFunc(data) {
return getNetworkType(data.nRat);
}
-
+
function networkValueFunc(data) {
var result = [];
result.push(data.strNumeric); //strNumeric
@@ -2253,31 +2253,31 @@
result.push(data.SubAct);
return result.join(',');
}
-
+
function operatorNameFunc(data) {
return data.strShortName;
}
-
+
function networkTypeFunc(data) {
var result = getNetworkType(data.nRat);
if (result == "auto")
result = $.i18n.prop("auto");
return result;
}
-
+
function subnetworkTypeFunc(data) {
var result = getSubNetworkTypeTog(data.nRat, data.SubAct);
return result;
}
-
+
function networkStatusFunc(data) {
return $.i18n.prop(getNetworkStatusTog(data.nState));
}
-
+
function networkStatusIdFunc(data) {
return getNetworkStatusTog(data.nState);
}
-
+
function networkTextFunc(data) {
return data.strNumeric;
}
@@ -2285,13 +2285,13 @@
}
//获取网络选择信息.
-
+
function getNetSelectInfo() {
return service.getNetSelectInfo();
}
//搜网结果中的状态转换为对应的语言项.
-
+
function getNetworkStatusTog(status) {
if ("3" == status) {
return "forbidden";
@@ -2304,7 +2304,7 @@
}
}
//子网络类型转换.
-
+
function getSubNetworkTypeTog(type, subtype) {
var type_3g = [2, 4, 5, 6, 8];
if ("1" == subtype) {
@@ -2329,7 +2329,7 @@
return subtype;
}
//网络类型转换.
-
+
function getNetworkType(type) {
if ("7" == type) {
return "4G";
@@ -2343,14 +2343,14 @@
}
function bindContainer(vm){
-
+
var container = $('#container');
ko.cleanNode(container[0]);
ko.applyBindings(vm, container[0]);
}
//初始化选网功能view model.
-
+
function initialize() {
var vm = new NetSelectVM();
bindContainer(vm);
@@ -2414,7 +2414,7 @@
//显示工作模式设置窗口
target.showOpModeWindow = showOpModeWindowFunc;
-
+
target.isLoggedIn = ko.observable(false);
target.enableFlag = ko.observable(false);
//解锁
@@ -2422,7 +2422,7 @@
//更新工作模式状态
target.refreshOpmodeInfo = refreshOpmodeInfoFunc;
-
+
//定时检查工作模式状态
if (target.hasRj45) {
target.refreshOpmodeInfo();
@@ -2430,7 +2430,7 @@
target.refreshOpmodeInfo();
}, 1000);
}
-
+
//更新工作模式状态
function refreshOpmodeInfoFunc() {
var obj = service.getStatusInfo();
@@ -2467,7 +2467,7 @@
}
$("#opmode").attr("data-trans", currMode).text($.i18n.prop(currMode));
}
-
+
//解锁
function unlockFunc() {
showLoading();
@@ -2491,7 +2491,7 @@
}
})
}
-
+
//显示工作模式设置窗口
function showOpModeWindowFunc() {
showSettingWindow("change_mode", "opmode_popup", "opmode_popup", 400, 300, function () {});
@@ -2504,28 +2504,28 @@
});
// RJ45联网设置模块
-
+
define("network_dial_set_cpe","underscore jquery knockout set service".split(" "),
function(_, $, ko, config, service) {
var dialActions = _.map(config.dialActions, function(elem){
return new Option(elem.name, elem.value);
});
-
+
var dialModes = _.map(config.pppoeModes, function(elem) {
return new Option(elem.name, elem.value);
});
-
+
var checkStatusTimer = 0;
var checkConCounter = 0;
var timeoutTipShowed = false;
// 联网设置view model.
-
+
function PPPoEViewModel() {
var pppObj = service.getPppoeParams();
var ethParams = pppObj;
var target = this;
-
+
target.staticNoticeShow = ko.observable();
target.dhcpNoticeShow = ko.observable();
target.pppoeNoticeShow = ko.observable();
@@ -2549,7 +2549,7 @@
target.enableFlag = ko.observable();
target.isShowDisbtn = ko.observable();
target.isShowCancelbtn = ko.observable();
-
+
if(pppObj.rj45_state == "dead"){
checkRj45DeadTip();
} else if(pppObj.rj45_state == "connect"){
@@ -2558,40 +2558,40 @@
} else if(pppObj.rj45_state == "working"){
setRj45WorkingTip();
}
-
+
target.user = ko.observable(pppObj.pppoe_username);
target.password = ko.observable(pppObj.pppoe_cc);
target.autoUser = ko.observable(pppObj.pppoe_username);
target.autoPassword = ko.observable(pppObj.pppoe_cc);
target.pppMode = ko.observable(pppObj.ethwan_dialmode);
initContronler();
-
+
//下拉框选择改变下面DIV模块
target.changeModeDiv = changeModeDivFunc;
-
+
target.radioHandler = radioHandlerFunc;
-
+
target.primaryDNS = ko.observable(pppObj.static_wan_primary_dns);
target.secondaryDNS = ko.observable(pppObj.static_wan_secondary_dns);
target.ipAddress = ko.observable(pppObj.static_wan_ipaddr);
target.subnetMask = ko.observable(pppObj.static_wan_netmask);
target.defaultGateway = ko.observable(pppObj.static_wan_gateway);
-
+
addInterval(function(){
ethParams = service.getPppoeParams();
pppObj.rj45_state = ethParams.rj45_state;
initContronler();
}, 1000);
-
+
// 取消连接按钮事件.
-
+
target.cancelConnect = cancelConnectFunc;
-
+
// 应用按钮事件.
-
+
target.save = saveFunc;
-
+
//密码显示事件
target.showPasswordHandler = function () {
var checkbox = $("#showPassword:checked");
@@ -2601,9 +2601,9 @@
target.showPassword(false);
}
};
-
+
// 更新当前界面状态、按钮、提示语等.
-
+
function initContronler() {
checkRj45DeadTip();
if(target.currentMode() == "PPPOE"){
@@ -2662,15 +2662,15 @@
}else {
$("#pppoeApply").attr("disabled", false);
}
-
+
//取消/断开按钮
target.isShowDisbtn(target.pppMode() != "auto_dial" && pppObj.rj45_state == "working");
target.isShowCancelbtn(target.pppMode() != "auto_dial" && pppObj.rj45_state == "connect");
-
+
$("#pppoeApply").translate();
}
// 设置后通过定时检查rj45_state状态,判断连接或断开操作结果.
-
+
function setRj45CheckTimer(action){
checkStatusTimer && window.clearInterval(checkStatusTimer);
if("connect" != action){
@@ -2701,7 +2701,7 @@
}
}
// 设置后通过定时检查rj45_state状态,判断连接操作结果.
-
+
function checkConnectionStatus(){
if(checkConCounter < 1){
checkConCounter++;
@@ -2763,7 +2763,7 @@
}
}
// 设置连接成功时提示语状态.
-
+
function setRj45WorkingTip(){
if(target.currentMode() == ethParams.ethwan_mode){
if(target.currentMode() == "AUTO") {
@@ -2785,9 +2785,9 @@
}
}
}
-
+
// 设置网线断开提示语状态.
-
+
function checkRj45DeadTip(){
if(pppObj.rj45_state != "dead"){
if(target.currentMode() == "AUTO" && target.autoNotice() == "pppoe_msg") {
@@ -2799,7 +2799,7 @@
}else if(target.currentMode() == "DHCP" && target.dhcpNotice() == "pppoe_msg") {
target.dhcpNoticeShow(false);
}
-
+
} else{
target.dhcpNotice("pppoe_msg");
target.dhcpNoticeText($.i18n.prop("pppoe_msg"));
@@ -2821,7 +2821,7 @@
}
}
// 设置后通过定时检查rj45_state状态,判断断开操作结果.
-
+
function checkDisconnectStatus(){
if(checkConCounter < 1){
checkConCounter++;
@@ -2845,7 +2845,7 @@
window.clearInterval(checkStatusTimer);
}
}
-
+
//应用按钮事件.
function saveFunc(){
target.dhcpNoticeShow(false);
@@ -2895,7 +2895,7 @@
requestParams.action_link = "connect";
requestParams.dial_mode = target.pppMode();
showLoading("waiting");
-
+
service.setPppoeDialMode(requestParams, function(data){
if(data.result){
target.currentMode($("#pppoe_mode").val());
@@ -2908,9 +2908,9 @@
errorOverlay("pppoe_message_send_fail");
}
});
-
+
}
-
+
//取消连接按钮事件.
function cancelConnectFunc(){
target.dhcpNoticeShow(false);
@@ -2963,34 +2963,34 @@
errorOverlay("pppoe_message_send_fail");
}
});
-
+
}
-
+
function radioHandlerFunc(){
initContronler();
return true;
}
-
+
function changeModeDivFunc(){
initContronler();
}
-
+
}
function bindContainer(vm){
var container = $('#container');
ko.cleanNode(container[0]);
ko.applyBindings(vm, container[0]);
-
+
}
// 联网设置初始化.
-
+
function initialize() {
var vm = new PPPoEViewModel();
bindContainer(vm);
-
+
$("#pppoeApply").translate();
-
+
$('#pppoeForm').validate({
submitHandler : function() {
vm.save();
@@ -3017,11 +3017,11 @@
}
});
}
-
-
+
+
//from 4.0
// 有效DNS检查.
-
+
function validateDns(dns){
if ( "0.0.0.0" == dns || "255.255.255.255" == dns) {
return false;
@@ -3029,7 +3029,7 @@
return true;
}
// 联网设置初始化.
-
+
function isStaticIPValid(ip, lanip, lanmask){
if(!ip || !lanip || !lanmask){//各参数不能为空
return false;
@@ -3053,7 +3053,7 @@
}
// 有效子网掩码验证.
-
+
function isNetmaskIPValid(ip) {
if (ip == 255 || ip == 254 || ip == 252 || ip == 248
|| ip == 240 || ip == 224 || ip == 192 || ip == 128 || ip == 0)
@@ -3066,7 +3066,7 @@
}
}
// 有效子网掩码检查.
-
+
function validateNetmask(netmask) {
var array = new Array();
array = netmask.split(".");
@@ -3117,21 +3117,21 @@
}
return true;
}
-
+
// subnetmask_check校验规则
-
+
jQuery.validator.addMethod("subnetmask_check", function (value, element, param) {
var result = validateNetmask(value);
return this.optional(element) || result;
});
// dns_check校验规则
-
+
jQuery.validator.addMethod("dns_check", function (value, element, param) {
var result = validateDns(value);
return this.optional(element) || result;
});
// 有效网关检查.
-
+
function validateGateway(wanIp, netmaskIp, gatewayIp) {
if(myConcat(wanIp,netmaskIp) == myConcat(netmaskIp, gatewayIp)) {
return true;
@@ -3140,7 +3140,7 @@
}
}
// IP和子网掩码转换成数组形式并相与,返回相与后的IP.
-
+
function myConcat(ip1,ip2){
var result = [];
var iplArr = ip1.split(".");
@@ -3151,12 +3151,12 @@
return result.join(".");
}
// gateway_check校验规则
-
+
jQuery.validator.addMethod("gateway_check", function (value, element, param) {
var result = validateGateway($('#txtIpAddress').val(), $('#txtSubnetMask').val(), $("#txtDefaultGateway").val());
return this.optional(element) || result;
});
-
+
return {
init: initialize
};
@@ -3176,13 +3176,13 @@
var originalRoaming = dialMode.isAllowedRoaming;
target.setAllowedRoaming = setAllowedRoamingFunc;
-
+
var checkboxFlag = $(".checkboxToggle");
target.checkEnable = checkEnableFunc;
-
+
//修改联网模式
target.save = saveFunc;
-
+
function saveFunc() {
showLoading();
var connMode = target.selectMode();
@@ -3203,7 +3203,7 @@
}
});
}
-
+
function setAllowedRoamingFunc() {
if(!$("#roamBtn").hasClass("disable")){
var checkbox = $("#isAllowedRoaming:checked");
@@ -3214,7 +3214,7 @@
}
}
}
-
+
function checkEnableFunc() {
var status = service.getStatusInfo();
@@ -3234,18 +3234,18 @@
function initialize() {
var vm = new DialVM();
bindContainer(vm);
-
+
vm.checkEnable();
addInterval( vm.checkEnable, 1000);
}
-
+
function bindContainer(vm){
var container = $('#container');
ko.cleanNode(container[0]);
ko.applyBindings(vm, container[0]);
-
+
}
-
+
return {
init: initialize
};
@@ -3255,7 +3255,7 @@
function (_, $, ko, config, service) {
//获取鉴权方式
-
+
function getAuthModes() {
return _.map(config.APN_AUTH_MODES, function (item) {
return new Option(item.name, item.value);
@@ -3277,7 +3277,7 @@
}
//获取apn相关信息
-
+
function getApnSet() {
var apnInfo = service.getApnSettings();
apnInfo.ipv6ApnConfigs = getApnConfigs(apnInfo.ipv6APNs, true);
@@ -3290,7 +3290,7 @@
var autoApnConfigs = {};
//解析自动apn信息
-
+
function getAutoApnsConfig(autoApnV4, autoApnV6) {
var autoApnsV4 = [];
var autoApnsV6 = [];
@@ -3316,7 +3316,7 @@
return dealAutoApnsV4V6(autoApnsV4, autoApnsV6);
}
//解析apn信息
-
+
function getApnConfigs(apnsStr, isIpv6) {
var apnCfgs = [];
var theApnConfigs = {};
@@ -3339,7 +3339,7 @@
}
//解析单条apn信息
-
+
function parseApnItem(apnStr, isIpv6) {
var apnItem = {};
var items = apnStr.split("($)");
@@ -3367,7 +3367,7 @@
return apnItem;
}
//合并V4\V6自动apn信息
-
+
function dealAutoApnsV4V6(v4, v6) {
autoApnConfigs = {};
var autoApns = [];
@@ -3396,7 +3396,7 @@
}
//APNViewModel
-
+
function APNViewModel() {
var target = this;
var apnSettings = getApnSet();
@@ -3409,7 +3409,7 @@
target.autoProfiles = ko.observableArray(getProfileOptions(apnSettings.autoApnConfigs));
target.profiles = ko.observableArray(getProfileOptions(apnSettings.apnConfigs));
target.wanDial = ko.observable(apnSettings.wanDial);
-
+
target.showApnDns = ko.observable(config.SHOW_APN_DNS);
target.index = ko.observable(apnSettings.currIndex);
target.supportIPv6 = ko.observable(config.IPV6_SUPPORT);
@@ -3422,7 +3422,7 @@
target.authModes = ko.observableArray(getAuthModes());
target.username = ko.observable(apnSettings.username);
target.password = ko.observable(apnSettings.password);
-
+
target.pdpTypes = ko.observableArray(getApnPdpTypes());
target.selectedPdpType = ko.observable(apnSettings.pdpType);
target.selectedPdpTypeTmp = ko.observable(apnSettings.pdpType); //the PdpType select's value before chang
@@ -3452,12 +3452,12 @@
$("#apn_ipv4_apn").removeClass("required");
$("#apn_ipv6_apn").removeClass("required");
}
-
+
target.disableProfile = ko.observable(false); //表示处于新增页面
target.addApnHide = ko.observable(true);
target.defaultCfg = ko.observable(true); //当前选中的是默认APN
target.predeterminedCfg = ko.observable(true); //当前选中的是预置的APN
-
+
target.selectedAuthentication = ko.observable(apnSettings.authMode);
target.selectedAuthenticationV6 = ko.observable(apnSettings.authModeV6);
@@ -3469,7 +3469,7 @@
target.transAuthV6 = ko.observable('apn_authentication');
target.transUserNameV6 = ko.observable('apn_user_name');
target.transPasswordV6 = ko.observable('apn_password');
-
+
target.transApn = ko.observable(config.IPV4_AND_V6_SUPPORT ? 'apn_ipv4_apn' : 'apn');
target.transDnsMode = ko.observable(config.IPV4_AND_V6_SUPPORT ? 'apn_dns_mode_ipv4' : 'apn_dns_mode');
target.transDns1 = ko.observable(config.IPV4_AND_V6_SUPPORT ? 'apn_dns1_ipv4' : 'apn_dns1');
@@ -3528,7 +3528,7 @@
target.autoApnChecked = ko.computed(function () {
return target.apnMode() == "auto";
});
-
+
target.hasCapacity = ko.computed(function () {
if (target.profiles().length < config.maxApnNumber) {
return true;
@@ -3540,7 +3540,7 @@
target.showDnsV6 = ko.computed(function () {
return target.dnsModeV6() == "manual";
});
-
+
target.showDns = ko.computed(function () {
return target.dnsMode() == "manual";
});
@@ -3562,7 +3562,7 @@
var data = service.getDeviceInfo();
target.pdpTypeChangeAlert = pdpTypeChangeAlertFunc;
-
+
target.showAutoApnDetail = ko.computed(function () {
if (target.apnMode() != "auto") {
@@ -3581,21 +3581,21 @@
}
};
//auto apn profile change 事件处理
-
+
target.autoProfileChangeHandler = autoProfileChangeHandlerFunc;
-
-
+
+
//profile change 事件处理
-
+
target.profileChangeHandler = profileChangeHandlerFunc;
-
-
+
+
//切换profile时重置下面的显示项
target.setUIData = setUIDataFunc;
-
+
//设置默认apn状态
-
+
function checkDefaultProfileStatus() {
var index = getApnIndex();
//默认apn不允许编辑
@@ -3622,16 +3622,16 @@
//设置为默认apn
-
- target.setDefaultAct = setDefaultActFunc;
-
-
+ target.setDefaultAct = setDefaultActFunc;
+
+
+
//APN mode change 事件处理
-
+
target.apnModeChangeHandler = apnModeChangeHandlerFunc;
-
-
+
+
function doSetDefaultAct() {
var index = 0;
if (target.apnMode() != 'auto') {
@@ -3673,10 +3673,10 @@
}
target.getSelectedManualProfile = getSelectedManualProfileFunc;
-
+
//获取自动apn索引
-
+
function getAutoApnIndex() {
var configs = $("#autoProfile option");
for (var ki = 0; ki < configs.length; ki++) {
@@ -3686,9 +3686,9 @@
}
return configs.length - 1;
}
-
+
//获取apn索引
-
+
function getApnIndex() {
var configs = $("#profile option");
if (configs.length == 0) {
@@ -3704,11 +3704,11 @@
}
//保存APN设置信息
-
+
target.saveAct = saveActFunc;
-
+
//编辑APN信息
-
+
function editApnSetting(preAct) { //默认设置按钮触发为TRUE
showLoading();
var apnIndex = getApnIndex();
@@ -3760,9 +3760,9 @@
errorOverlay();
});
}
-
+
//新增APN信息
-
+
function addNewApnSetting() {
showLoading("waiting");
var optionLen = $("option", "#profile").length;
@@ -3814,19 +3814,19 @@
});
}
-
+
var tempApn = {};
//删除APN
-
+
target.deleteAct = deleteActFunc;
-
+
//取消新增APN
-
+
target.cancelAddAct = cancelAddActFunc;
-
+
//进入新增APN页面
-
+
target.addAct = addActFunc;
//进入新增APN页面
function addActFunc() {
@@ -3845,7 +3845,7 @@
authModeV6: target.selectedAuthenticationV6(),
usernameV6: target.usernameV6(),
passwordV6: target.passwordV6(),
-
+
wanApn: target.apn(),
dnsMode: config.SHOW_APN_DNS ? target.dnsMode() : 'auto',
dns1: config.SHOW_APN_DNS ? target.dns1() : '',
@@ -3866,7 +3866,7 @@
target.selectedAuthenticationV6("none");
target.usernameV6("");
target.passwordV6("");
-
+
target.apn("");
target.dnsMode("auto");
target.dns1("");
@@ -3876,7 +3876,7 @@
target.password("");
}
-
+
//取消新增APN
function cancelAddActFunc() {
clearValidateMsg('#apn_setting_form');
@@ -3894,7 +3894,7 @@
target.selectedAuthenticationV6(tempApn.authModeV6);
target.usernameV6(tempApn.usernameV6);
target.passwordV6(tempApn.passwordV6);
-
+
target.apn(tempApn.wanApn);
target.dnsMode(tempApn.dnsMode);
target.dns1(tempApn.dns1);
@@ -3904,7 +3904,7 @@
target.password(tempApn.password);
}
-
+
//删除APN
function deleteActFunc() {
if (!target.selectedProfile()) {
@@ -3938,7 +3938,7 @@
});
});
}
-
+
//保存APN设置信息
function saveActFunc() {
if (!$('#apn_setting_form').valid()) {
@@ -3972,7 +3972,7 @@
editApnSetting(false);
}
} else {
-
+
if ($("#profile option").length >= config.maxApnNumber) {
showInfo({
msg: "apn_profile_full",
@@ -3989,7 +3989,7 @@
//showConfirm("apn_alert", function () {
addNewApnSetting();
//});
-
+
} else {
showConfirm("apn_diconneted_network_confirm", function () {
showLoading('disconnecting');
@@ -4005,7 +4005,7 @@
}
}
}
-
+
function getSelectedManualProfileFunc() {
var cfg = {};
var profileVal = $("#profile").val();
@@ -4027,7 +4027,7 @@
}
return cfg;
}
-
+
//APN mode change 事件处理
function apnModeChangeHandlerFunc(data, event) {
if (target.apnMode() != 'auto') {
@@ -4039,7 +4039,7 @@
}
return true;
}
-
+
//设置为默认apn
function setDefaultActFunc() {
if (!target.selectedProfile()) {
@@ -4092,7 +4092,7 @@
}
}
}
-
+
//切换profile时重置下面的显示项
function setUIDataFunc(data) {
clearValidateMsg('#apn_setting_form');
@@ -4119,7 +4119,7 @@
target.passwordV6(data.passwordV6);
target.selectedAuthenticationV6(data.authModeV6 || 'none');
}
-
+
//profile change 事件处理
function profileChangeHandlerFunc(data, event) {
target.pdpTypeNote(true);
@@ -4131,7 +4131,7 @@
checkDefaultProfileStatus();
return true;
}
-
+
//auto apn profile change 事件处理
function autoProfileChangeHandlerFunc(data, event) {
if (target.apnMode() != 'auto') {
@@ -4142,7 +4142,7 @@
checkDefaultProfileStatus();
return true;
}
-
+
function pdpTypeChangeAlertFunc() {
if (target.pdpTypeNote()) {
showAlert({
@@ -4173,12 +4173,12 @@
}
target.selectedPdpTypeTmp(target.selectedPdpType());
}
-
+
}
//是否已联网
-
+
function isConnectedNetWork() {
var info = service.getConnectionInfo();
return info.connectStatus == "ppp_connected";
@@ -4195,10 +4195,10 @@
ko.applyBindings(vm, container[0]);
}
//初始化ViewModel
-
+
function initialize(formInit) {
initVar();
-
+
var vm = new APNViewModel();
bindContainer(vm);
@@ -4230,4 +4230,30 @@
return {
init: initialize
};
-});
\ No newline at end of file
+});
+define("network_info","underscore jquery knockout set service".split(" "),
+ function (_, $, ko, config, service) {
+
+ function NetInfoVM() {
+ var target = this;
+ var network_status = service.getNetworkStatus();
+
+ target.pci = ko.observable(network_status.pci);
+ target.sinr = ko.observable(network_status.sinr);
+ target.rsrp = ko.observable(network_status.rsrp);
+ target.rsrq = ko.observable(network_status.rsrq);
+ target.plmn = ko.observable(network_status.plmn);
+ target.cellid = ko.observable(network_status.cellid);
+ }
+
+ function initialize() {
+ var container = $('#container');
+ ko.cleanNode(container[0]);
+ var imVm = new NetInfoVM();
+ ko.applyBindings(imVm, container[0]);
+ }
+
+ return {
+ init: initialize
+ };
+});