eDatagridOptions(this.getActionDefinitions(), this.onSelectionChange.bind(this), this.trafficDirectionEnabled); if (this.editMode) { this.loading = true; var portIds = this.model.ports.map(function (portData) { return portData.id; }); this.portsListService.getData(this.dvsUrn, portIds) .then(function (data) { _this.datagridOptions.data = _this.model.ports.map(function (data) { var listItemData = new DvsSpanSessionPortListItemData(); listItemData.portId = data.id; listItemData.trafficDirection = data.trafficDirection; return listItemData; }); _this.onDataRetrieved(data); }); } else if (this.model.cachedData) { setTimeout(function () { _this.datagridOptions.data = _this.model.cachedData; }, 0); } }; DvsSpanSessionPortsListComponentController.prototype.getActionDefinitions = function () { var _this = this; var actionDefinitions = []; actionDefinitions.push({ id: DvsSpanSessionPortsListComponentController.ADD_ACTION, enabled: true, iconClass: "network-lib-ui-icon-portAdd", tooltipText: this.i18nService.getString("DvsUi", "sessionDvPortSourceList.addPortByPortSelector"), onClick: function () { var portsToIgnore = []; if (_this.model.ports) { portsToIgnore = _.map(_this.model.ports, function (port) { return port.id; }); } _this.portBrowserDialogService.show(_this.dvsUrn, portsToIgnore, function (portIds) { if (!portIds || portIds.length === 0) { return; } _this.loading = true; _this.portsListService.getData(_this.dvsUrn, portIds) .then(function (data) { _this.onDataRetrieved(data); }); }); } }); actionDefinitions.push({ id: DvsSpanSessionPortsListComponentController.REMOVE_ACTION, enabled: true, iconClass: "vx-icon-removeIcon", tooltipText: this.i18nService.getString("DvsUi", "sessionDvPortSourceList.remove"), onClick: function () { var selectedPortIds = _.map(_this.datagridOptions.selectedItems, function (item) { return item.portId; }); _this.model.ports = _.filter(_this.model.ports, function (port) { return selectedPortIds.indexOf(port.id) < 0; }); _this.datagridOptions.data = _.filter(_this.datagridOptions.data, function (item) { return selectedPortIds.indexOf(item.portId) < 0; }); _this.model.cachedData = _this.datagridOptions.data; } }); if (this.trafficDirectionEnabled) { actionDefinitions.push(this.vuiConstants.actions.SEPARATOR); actionDefinitions.push({ id: DvsSpanSessionPortsListComponentController.INGRESS_ACTION, enabled: true, iconClass: "network-lib-ui-icon-ingressTraffic", tooltipText: this.i18nService.getString("DvsUi", "sessionDvPortSourceList.ingress"), onClick: function () { _this.onTrafficDirectionChange(dvs_ui.DvsSpanSessionConstants.TRAFFIC_DIRECTION.INGRESS); } }); actionDefinitions.push({ id: DvsSpanSessionPortsListComponentController.EGRESS_ACTION, enabled: true, iconClass: "network-lib-ui-icon-egressTraffic", tooltipText: this.i18nService.getString("DvsUi", "sessionDvPortSourceList.egress"), onClick: function () { _this.onTrafficDirectionChange(dvs_ui.DvsSpanSessionConstants.TRAFFIC_DIRECTION.EGRESS); } }); actionDefinitions.push({ id: DvsSpanSessionPortsListComponentController.BOTH_ACTION, enabled: true, iconClass: "network-lib-ui-icon-ingressEgressTraffic", tooltipText: this.i18nService.getString("DvsUi", "sessionDvPortSourceList.both"), onClick: function () { _this.onTrafficDirectionChange(dvs_ui.DvsSpanSessionConstants.TRAFFIC_DIRECTION.BOTH); } }); } return actionDefinitions; }; DvsSpanSessionPortsListComponentController.prototype.onDataRetrieved = function (data) { var _this = this; var existingKeys = []; var newData = []; this.datagridOptions.data.forEach(function (item) { newData.push(item); existingKeys.push(item.portId); }); data.items.forEach(function (item) { if (existingKeys.indexOf(item.portId) < 0) { item.trafficDirection = dvs_ui.DvsSpanSessionConstants.TRAFFIC_DIRECTION.BOTH; newData.push(item); _this.model.ports.push(new dvs_ui.PortData(item.portId, item.trafficDirection)); } else { newData.forEach(function (existingItem) { if (existingItem.portId === item.portId) { existingItem.host = item.host; existingItem.connectee = item.connectee; existingItem.connecteeType = item.connecteeType; } }); } }); this.datagridOptions.data = newData; this.model.cachedData = newData; this.loading = false; }; DvsSpanSessionPortsListComponentController.prototype.onSelectionChange = function (items) { if (this._ignoreNextItemSelection) { this._ignoreNextItemSelection = false; return; } var hasSelectedItems = items && items.length > 0; if (hasSelectedItems) { this._selectedPortsIds = _.map(items, function (item) { return item.portId; }); } else { this._selectedPortsIds = []; } for (var _i = 0, _a = this.datagridOptions.actionBarOptions.actions; _i < _a.length; _i++) { var actionDef = _a[_i]; if (actionDef.id === DvsSpanSessionPortsListComponentController.REMOVE_ACTION || actionDef.id === DvsSpanSessionPortsListComponentController.BOTH_ACTION || actionDef.id === DvsSpanSessionPortsListComponentController.EGRESS_ACTION || actionDef.id === DvsSpanSessionPortsListComponentController.INGRESS_ACTION) { actionDef.enabled = hasSelectedItems; } } }; DvsSpanSessionPortsListComponentController.prototype.onTrafficDirectionChange = function (direction) { this._ignoreNextItemSelection = true; var selectedPortIds = _.map(this.datagridOptions.selectedItems, function (item) { return item.portId; }); this.model.ports.forEach(function (port) { if (selectedPortIds.indexOf(port.id) > -1) { 000;" class="fblack" onclick="changesize(14)">[中] [小] | [打印] | [关闭]

相关文章

财税要闻
境外税讯
双微

本社风貌 | 联系我们 | 友情链接 | 法律声明 | 诚聘英才
电子邮箱:tax@ctax.org.cn | 联系电话:010-63422191 | 传真:86-010-63584617
中国税务网编辑部投稿邮箱:shuixun@ctax.org.cn | 中国税务网编辑部电话:010-63886789
《中国税务》投稿邮箱:zsbjb@ctax.org.cn |《税务研究》投稿邮箱:swyj@ctax.org.cn |《国际税收》投稿邮箱:gjss@ctax.org.cn
地址:北京市丰台区广安路9号国投财富广场1号楼10层 邮政编码:100055
主办:中国税务杂志社 HTTP://www.ctax.org.cn

版权所有 未经许可不得复制或建立镜像

互联网新闻信息服务许可证 国新网 1012012003 | 电信与信息服务业务经营许可证:京ICP证040820号 | 备案:京公网安备 11010602130045号