How to use showHTMLReport method in Playwright Internal

Best JavaScript code snippet using playwright-internal

DICT_NET_BRAND.jsx

Source:DICT_NET_BRAND.jsx Github

copy

Full Screen

1import {BootstrapTable, TableHeaderColumn} from 'react-bootstrap-table'2import React from "react";3import * as axios from "axios";4import {Field, reduxForm} from "redux-form";5const OptionItemDICT_INSTITUTION = (props) => {6 //console.log( props )7 return(8 <option value={props.optionItem.institution_id} >{props.optionItem.institution_name}</option>9 // <Dropdown.Item onClick={() => this.selectRoleID} value={props.optionItem.role_id} >{props.optionItem.role_name}</Dropdown.Item>10 )11}12const OptionItemDICT_BRANCH = (props) => {13 //console.log( props )14 return(15 <option value={props.optionItem.branch_id} >{props.optionItem.branch_name}</option>16 // <Dropdown.Item onClick={() => this.selectRoleID} value={props.optionItem.role_id} >{props.optionItem.role_name}</Dropdown.Item>17 )18}19const OptionItemDICT_NET_CLIENT_STATUS= (props) => {20 //console.log( props )21 return(22 <option value={props.optionItem.status_code} >{props.optionItem.status_name}</option>23 // <Dropdown.Item onClick={() => this.selectRoleID} value={props.optionItem.role_id} >{props.optionItem.role_name}</Dropdown.Item>24 )25}26const OptionItemDICT_NETWORK_MANAGERS = (props) => {27 //console.log( props )28 return(29 <option30 selected={props.optionItem.manager_id == props.manager_id ? 'selected' : ''}31 value={props.optionItem.manager_id}32 >{props.optionItem.manager_name}</option>33 // <Dropdown.Item onClick={() => this.selectRoleID} value={props.optionItem.role_id} >{props.optionItem.role_name}</Dropdown.Item>34 )35}36const OptionItemDICT_REPORT_PERIOD_TYPE = (props) => {37 // console.log( props );38 // console.log( props.optionItem.report_period_type_id );39 // console.log( props.report_period_type_id );40 //console.log( props.optionItem.report_period_type_id == props.report_period_type_id );41 return(42 <option43 selected={props.optionItem.report_period_type_id == props.report_period_type_id ? 'selected' : ''}44 value={props.optionItem.report_period_type_id}45 >{props.optionItem.report_period_type_name}</option>46 )47}48const OptionItemDICT_REPORT_CHANNEL_TYPE = (props) => {49 //console.log( props )50 return(51 <option52 selected={props.optionItem.report_channel_type_id == props.channel_type_id ? 'selected' : ''}53 value={props.optionItem.report_channel_type_id}54 >{props.optionItem.report_channel_type_name}</option>55 )56}57class DICT_NET_BRAND extends React.Component {58 constructor(props) {59 super(props);60 this.state = {61 DICT_INSTITUTION: null,62 isShowSelectDICT_INSTITUTION: false,63 DICT_NETWORK_MANAGERS: null,64 isShowSelectDICT_NETWORK_MANAGERS: false,65 isDisableInput: true,66 brand_name: null,67 brand_id: null,68 contact_person: "",69 contact_phone: "",70 contact_position: "",71 contact_email: "",72 brand_status_code: null,73 brand_region: null,74 manager_name: null,75 moreTwoLevel: false,76 showTwoLevel: false,77 isDisableButton: false,78 selectRow: null,79 DICT_BRANCH: null,80 isDisableTVBV: true,81 isShowSelectTVBV: false,82 TSPReportSettingsSearchObj:{83 },84 settings: null,85 tsp_list: null,86 isShowTsp: false,87 currentTsp: null,88 isShowTypeAcquiring: false,89 //type_acquiring: 1, 1-фізичний 2-інтернет90 isShowReport: false,91 DICT_REPORT_FORMAT: null,92 isShowREPORT_FORMAT: false,93 DICT_REPORT_PERIOD_TYPE: null,94 isShowDICT_REPORT_PERIOD_TYPE: false,95 DICT_REPORT_CHANNEL_TYPE: null,96 isShowDICT_REPORT_CHANNEL_TYPE: false,97 isShowTableTSPReportSettingsSTD: false,98 TSPReportSettingsSTD: null,99 DICT_NET_CLIENT_STATUS: null,100 isShowDICT_NET_CLIENT_STATUS: false,101 isShowPopupError: false,102 isShowPopupErrorSave: false,103 currentAcquiring_type_id: null,104 type_acquiring: 1,105 tsp_id: null,106 report_format_id: null,107 report_period_type_id: null,108 channel_type_id: null,109 file_name_mask: null,110 physical_acquiring_type_id: 1,111 physical_channel_address: "",112 physical_channel_type_id: 1,113 physical_extended_report: false,114 physical_file_name_mask: "",115 physical_installment_report: false,116 physical_report_format_id: 1,117 physical_report_period_type_id: 1,118 physical_standard_report: true,119 internet_acquiring_type_id: 2,120 internet_channel_address: "",121 internet_channel_type_id: 1,122 internet_extended_report: false,123 internet_file_name_mask: "",124 internet_installment_report: false,125 internet_report_format_id: 1,126 internet_report_period_type_id: 1,127 internet_standard_report: true,128 isShowOrder_numberError: false,129 isShowBootstrapTable: true130 }131 //console.log(this.data.sort());132 }133 componentDidMount() {134 //console.log('test');135 }136 selectDICT_INSTITUTION = (e) => {137 console.log(e.target.value);138 let param = e.target.value;139 console.log(param);140 let apiName = e.currentTarget.getAttribute("apiName");141 console.log(apiName);142 let inputValue = e.target.value;143 console.log(inputValue);144 let inputDataObj = this.state.TSPReportSettingsSearchObj;145 inputDataObj.[apiName] = inputValue;146 console.log(inputDataObj);147 this.setState({148 isShowSelectTVBV: false,149 TSPReportSettingsSearchObj: inputDataObj150 });151 console.log(this.state);152 console.log(this.state.TSPReportSettingsSearchObj);153 this.requestDICT_BRANCH(this.props.store.userState.token, param);154 }155 async requestDICT_INSTITUTION ( token ) {156 this.props.store.changeLoading(true);157 console.log( token );158 const baseUrl = `/api/Dictionary/DICT_INSTITUTION`;159 await axios.get(160 baseUrl,161 {162 headers: {"Token" : `${ token }`}163 }164 )165 .then((response) => {166 console.log(response.data);167 //console.log(response.data.Table);168 //this.props.store.showTable(true);169 // this.props.store.addTableData(true, response.data.Table);170 this.setState({171 DICT_INSTITUTION: response.data.Table.TableRows,172 isShowSelectDICT_INSTITUTION: true173 });174 this.props.store.changeLoading(false);175 //this.props.store.showTable(true);176 })177 .catch((error) => {178 console.log(error.response);179 console.log(error.response.data);180 //console.log('error_catch');181 });182 }183 async requestGetNewBrandId ( token ) {184 this.props.store.changeLoading(true);185 console.log( token );186 const baseUrl = `/api/Dictionary/GetNewBrandId`;187 await axios.get(188 baseUrl,189 {190 headers: {"Token" : `${ token }`}191 }192 )193 .then((response) => {194 console.log(response.data);195 //console.log(response.data.Table);196 //this.props.store.showTable(true);197 // this.props.store.addTableData(true, response.data.Table);198 this.requestDICT_NET_CLIENT_STATUS( this.props.store.userState.token );199 this.requestDICT_NETWORK_MANAGERS( this.props.store.userState.token );200 this.requestDICT_INSTITUTION( this.props.store.userState.token );201 this.setState({202 brand_id: response.data.brand_id,203 isDisableInput: false204 });205 this.props.store.changeLoading(false);206 //this.props.store.showTable(true);207 })208 .catch((error) => {209 console.log(error.response);210 console.log(error.response.data);211 //console.log('error_catch');212 });213 }214 async requestDICT_NETWORK_MANAGERS ( token ) {215 this.props.store.changeLoading(true);216 console.log( token );217 const baseUrl = `/api/Dictionary/DICT_NETWORK_MANAGERS`;218 await axios.get(219 baseUrl,220 {221 headers: {"Token" : `${ token }`}222 }223 )224 .then((response) => {225 console.log(response.data);226 //console.log(response.data.Table);227 //this.props.store.showTable(true);228 // this.props.store.addTableData(true, response.data.Table);229 this.setState({230 DICT_NETWORK_MANAGERS: response.data.Table.TableRows,231 isShowSelectDICT_NETWORK_MANAGERS: true232 });233 this.props.store.changeLoading(false);234 //this.props.store.showTable(true);235 })236 .catch((error) => {237 console.log(error.response);238 console.log(error.response.data);239 //console.log('error_catch');240 });241 }242 async requestDICT_BRANCH ( token, param ) {243 this.props.store.changeLoading(true);244 console.log( token );245 const baseUrl = `/api/Dictionary/DICT_BRANCH/?param1=${param}`;246 let paramBody = {247 "param1": param248 }249 await axios.get(250 baseUrl,251 {252 headers: {"Token" : `${ token }`}253 }254 )255 .then((response) => {256 console.log(response.data);257 console.log(response.data.Table);258 //this.props.store.showTable(true);259 // this.props.store.addTableData(true, response.data.Table);260 this.setState({261 DICT_BRANCH: response.data.Table.TableRows,262 isShowSelectTVBV: true,263 isDisableTVBV: false264 });265 this.props.store.changeLoading(false);266 //this.props.store.showTable(true);267 })268 .catch((error) => {269 console.log(error.response);270 console.log(error.response.data);271 //console.log('error_catch');272 });273 }274 async requestDICT_REPORT_FORMAT (token) {275 this.props.store.changeLoading(true);276 console.log( token );277 const baseUrl = `/api/Dictionary/DICT_REPORT_FORMAT`;278 await axios.get(279 baseUrl,280 {281 headers: {"Token" : `${ token }`}282 }283 )284 .then((response) => {285 console.log(response.data);286 this.setState({287 DICT_REPORT_FORMAT: response.data.Table.TableRows,288 isShowREPORT_FORMAT: true289 });290 this.props.store.changeLoading(false);291 })292 .catch((error) => {293 console.log(error.response);294 console.log(error.response.data);295 //console.log('error_catch');296 });297 }298 async requestDICT_REPORT_PERIOD_TYPE (token) {299 this.props.store.changeLoading(true);300 console.log( token );301 const baseUrl = `/api/Dictionary/DICT_REPORT_PERIOD_TYPE`;302 await axios.get(303 baseUrl,304 {305 headers: {"Token" : `${ token }`}306 }307 )308 .then((response) => {309 console.log(response.data);310 this.setState({311 DICT_REPORT_PERIOD_TYPE: response.data.Table.TableRows,312 isShowDICT_REPORT_PERIOD_TYPE: true313 });314 this.props.store.changeLoading(false);315 })316 .catch((error) => {317 console.log(error.response);318 console.log(error.response.data);319 //console.log('error_catch');320 });321 }322 async requestDICT_REPORT_CHANNEL_TYPE (token) {323 this.props.store.changeLoading(true);324 console.log( token );325 const baseUrl = `/api/Dictionary/DICT_REPORT_CHANNEL_TYPE`;326 await axios.get(327 baseUrl,328 {329 headers: {"Token" : `${ token }`}330 }331 )332 .then((response) => {333 console.log(response.data);334 this.setState({335 DICT_REPORT_CHANNEL_TYPE: response.data.Table.TableRows,336 isShowDICT_REPORT_CHANNEL_TYPE: true337 });338 this.props.store.changeLoading(false);339 })340 .catch((error) => {341 console.log(error.response);342 console.log(error.response.data);343 //console.log('error_catch');344 });345 }346 async requestDICT_NET_CLIENT_STATUS (token) {347 this.props.store.changeLoading(true);348 console.log( token );349 const baseUrl = `/api/Dictionary/DICT_NET_CLIENT_STATUS`;350 await axios.get(351 baseUrl,352 {353 headers: {"Token" : `${ token }`}354 }355 )356 .then((response) => {357 console.log(response.data);358 this.setState({359 DICT_NET_CLIENT_STATUS: response.data.Table.TableRows,360 isShowDICT_NET_CLIENT_STATUS: true361 });362 this.props.store.changeLoading(false);363 })364 .catch((error) => {365 console.log(error.response);366 console.log(error.response.data);367 //console.log('error_catch');368 });369 }370 async requestTSPReportSettings (token, userBody) {371 this.props.store.changeLoading(true);372 console.log( token );373 const baseUrl = `/api/TSPReportSettings`;374 await axios.post(375 baseUrl,376 userBody,377 {378 headers: {379 "Token" : `${ token }`,380 'Content-Type': 'application/json'381 }382 }383 )384 .then((response) => {385 console.log(response.data);386 //console.log(response.data.users);387 //console.log(response.data.Table);388 //this.props.store.showTable(true);389 // this.props.store.addTableData(true, response.data.users);390 if(response.data.record_count >= 1){391 this.setState({392 settings: response.data.settings,393 tsp_list: response.data.tsp_list,394 //tsp_id: response.data.tsp_list[0].tsp_id,395 isShowTsp: true396 });397 }else if(response.data.record_count < 1){398 this.setState({399 isShowPopupError: true400 });401 }402 this.props.store.changeLoading(false);403 //this.props.store.showTable(true);404 })405 .catch((error) => {406 console.log(error.response);407 // console.log(error.response.data);408 //console.log('error_catch');409 });410 }411 async requestTSPReportSettings_test (token) {412 this.props.store.changeLoading(true);413 console.log( token );414 const baseUrl = `/api/TSPReportSettings`;415 let userBody = {416 date_from: "2018081",417 date_to: "2021081",418 institution_id: "824",419 tsp_name: "Тзов"420 }421 await axios.post(422 baseUrl,423 userBody,424 {425 headers: {426 "Token" : `${ token }`,427 'Content-Type': 'application/json'428 }429 }430 )431 .then((response) => {432 console.log(response.data);433 //console.log(response.data.users);434 //console.log(response.data.Table);435 //this.props.store.showTable(true);436 // this.props.store.addTableData(true, response.data.users);437 if(response.data.record_count >= 1){438 this.setState({439 settings: response.data.settings,440 tsp_list: response.data.tsp_list,441 //tsp_id: response.data.tsp_list[0].tsp_id,442 isShowTsp: true443 });444 }else if(response.data.record_count < 1){445 this.setState({446 isShowPopupError: true447 });448 }449 this.props.store.changeLoading(false);450 //this.props.store.showTable(true);451 })452 .catch((error) => {453 console.log(error.response);454 // console.log(error.response.data);455 //console.log('error_catch');456 });457 }458 async requestDICT_NET_BRAND (token, body) {459 this.props.store.changeLoading(true);460 console.log( token );461 const baseUrl = `/api/Dictionary/DICT_NET_BRAND`;462 console.log( body );463 await axios.post(464 baseUrl,465 body,466 {467 headers: {468 "Token" : `${ token }`,469 'Content-Type': 'application/json'470 }471 }472 )473 .then((response) => {474 console.log(response.data);475 //console.log(response.data.users);476 //console.log(response.data.Table);477 //this.props.store.showTable(true);478 // this.props.store.addTableData(true, response.data.users);479 // this.setState({480 // TSPReportSettingsSTD: response.data.standard_settings,481 // isShowTableTSPReportSettingsSTD: true482 // });483 this.props.store.changeLoading(false);484 //this.props.store.showTable(true);485 })486 .catch((error) => {487 // console.log(error.response);488 // console.log(error.response.data);489 //console.log('error_catch');490 });491 }492 async requestTSPReportSettingsSTD_SAVE (token, dody) {493 this.props.store.changeLoading(true);494 console.log( token );495 const baseUrl = `/api/TSPReportSettings`;496 console.log( dody );497 await axios.put(498 baseUrl,499 dody,500 {501 headers: {502 "Token" : `${ token }`,503 'Content-Type': 'application/json'504 }505 }506 )507 .then((response) => {508 console.log(response.data);509 //console.log(response.data.users);510 //console.log(response.data.Table);511 //this.props.store.showTable(true);512 // this.props.store.addTableData(true, response.data.users);513 // this.setState({514 // TSPReportSettingsSTD: response.data.standard_settings,515 // isShowTableTSPReportSettingsSTD: true516 // });517 this.setState({518 isShowTsp: false,519 isShowTypeAcquiring: false520 });521 this.search();522 this.props.store.changeLoading(false);523 //this.props.store.showTable(true);524 })525 .catch((error) => {526 console.log(error.response);527 // console.log(error.response.data);528 //console.log('error_catch');529 this.setState({530 isShowPopupErrorSave: true531 });532 this.props.store.changeLoading(false);533 });534 }535 formatDate = (date) => {536 let day = date.getDate();537 let month = ("0" + (date.getMonth() + 1)).slice(-2)538 let year = date.getFullYear();539 return year + month + day;540 }541 save = () => {542 let body = {543 brand_name: this.state.brand_name,544 brand_id: this.state.brand_id,545 contact_person: this.state.contact_person,546 contact_phone: this.state.contact_phone,547 contact_position: this.state.contact_position,548 contact_email: this.state.contact_email,549 brand_status_code: this.state.brand_status_code,550 brand_region: this.state.brand_region,551 manager_name: this.state.manager_name,552 }553 console.log(body);554 this.requestDICT_NET_BRAND(this.props.store.userState.token, body);555 }556 openStandardReport = () => {557 // this.setState({558 // isShowTableTSPReportSettingsSTD: true559 // });560 this.requestTSPReportSettingsSTD(this.props.store.userState.token);561 }562 closePopupTable = () => {563 this.setState({564 isShowTableTSPReportSettingsSTD: false565 });566 }567 changeSelect = (e) => {568 let name_input = e.currentTarget.getAttribute("name");569 let inputValue = e.target.value;570 console.log(name_input);571 console.log(inputValue);572 if(name_input == 'physical_acquiring_type_id')this.setState({physical_acquiring_type_id: Number(inputValue)});573 if(name_input == 'physical_channel_type_id')this.setState({physical_channel_type_id: Number(inputValue)});574 if(name_input == 'physical_report_format_id')this.setState({physical_report_format_id: Number(inputValue)});575 if(name_input == 'physical_report_period_type_id')this.setState({physical_report_period_type_id: Number(inputValue)});576 if(name_input == 'internet_acquiring_type_id')this.setState({internet_acquiring_type_id: Number(inputValue)});577 if(name_input == 'internet_channel_type_id')this.setState({internet_channel_type_id: Number(inputValue)});578 if(name_input == 'internet_report_format_id')this.setState({internet_report_format_id: Number(inputValue)});579 if(name_input == 'internet_report_period_type_id')this.setState({internet_report_period_type_id: Number(inputValue)});580 }581 changeReport_format_id = (e) => {582 let inputValue = e.target.value;583 console.log(inputValue);584 this.setState({585 report_format_id: Number(inputValue)586 });587 }588 changeReport_period_type_id = (e) => {589 let name_input = e.currentTarget.getAttribute("name");590 let inputValue = e.target.value;591 console.log(name_input);592 console.log(inputValue);593 this.setState({594 name_input: Number(inputValue)595 });596 }597 changeChannel_type_id = (e) => {598 let inputValue = e.target.value;599 console.log(inputValue);600 this.setState({601 channel_type_id: Number(inputValue)602 });603 }604 saveReport = () => {605 let dody = {606 tsp_list: [607 {608 tsp_id: this.state.currentTsp //tsp_id609 }610 ],611 main_settings: [612 {613 acquiring_type_id: 1,//type_acquiring614 // "standard_report": true,615 // "extended_report": true,616 // "installment_report": true,617 report_format_id: this.state.physical_report_format_id, //report_format_id618 // "report_format_name": "string",619 report_period_type_id: this.state.physical_report_period_type_id, //report_period_type_id620 // "report_period_type_name": "string",621 channel_type_id: this.state.physical_channel_type_id, //channel_type_id622 // "channel_type_name": "string",623 file_name_mask: this.state.physical_file_name_mask, //file_name_mask624 // "file_path": "string"625 channel_address: this.state.physical_channel_address, //file_name_mask626 },627 {628 acquiring_type_id: 1,//type_acquiring629 // "standard_report": true,630 // "extended_report": true,631 // "installment_report": true,632 report_format_id: this.state.internet_report_format_id, //report_format_id633 // "report_format_name": "string",634 report_period_type_id: this.state.internet_report_period_type_id, //report_period_type_id635 // "report_period_type_name": "string",636 channel_type_id: this.state.internet_channel_type_id, //channel_type_id637 // "channel_type_name": "string",638 file_name_mask: this.state.internet_file_name_mask, //file_name_mask639 // "file_path": "string"640 channel_address: this.state.internet_channel_address, //file_name_mask641 }642 ],643 };644 if( this.state.TSPReportSettingsSTD != null){645 dody.std_settings = this.state.TSPReportSettingsSTD;646 }647 console.log( dody );648 //this.requestTSPReportSettingsSTD_SAVE(this.props.store.userState.token, dody);649 }650 closePopupError = () => {651 this.setState({652 isShowPopupError: false653 });654 }655 closePopupErrorSave = () => {656 this.setState({657 isShowPopupErrorSave: false658 });659 }660 closePopupOrder_numberError = () => {661 this.setState({662 isShowOrder_numberError: false,663 isShowBootstrapTable: true664 });665 }666 activeOperation = (operationArr, operation) => {667 let res;668 operationArr.map(( item , index) => {669 if(item.operation == operation){670 console.log(item.name);671 res = item.name;672 }673 })674 return res;675 }676 nameNetWork = (e) => {677 let val = e.target.value;678 console.log( val );679 console.log( val != "" );680 if(val != ""){681 this.requestGetNewBrandId(this.props.store.userState.token, val);682 this.setState({ brand_name: val });683 }else{684 this.setState({ isDisableInput: true });685 }686 }687 hendleNnameNetWork = (e) => {688 if (e.keyCode === 13) {689 //console.log('enter');690 this.nameNetWork(e);691 }692 }693 changeInput = (e) => {694 let apiName = e.currentTarget.getAttribute("api_name");695 console.log(apiName);696 let inputValue = e.target.value;697 console.log(inputValue);698 if( apiName == 'contact_person'){699 this.setState({700 contact_person: inputValue701 });702 }else if( apiName == 'contact_phone'){703 this.setState({704 contact_phone: inputValue705 });706 }else if( apiName == 'contact_position'){707 this.setState({708 contact_position: inputValue709 });710 }else if( apiName == 'contact_email'){711 this.setState({712 contact_email: inputValue713 });714 }else if( apiName == 'brand_status_code'){715 this.setState({716 brand_status_code: inputValue717 });718 }else if( apiName == 'brand_region'){719 this.setState({720 brand_region: inputValue721 });722 } else if( apiName == 'manager_name'){723 this.setState({724 manager_name: inputValue,725 //manager_id: inputValue,726 });727 }728 }729 more = () => {730 this.setState({731 moreTwoLevel: true732 });733 }734 showTwoLevelYes = () => {735 this.setState({736 showTwoLevel: true737 });738 }739 showTwoLevelNo = () => {740 this.setState({741 showTwoLevel: false,742 moreTwoLevel: false743 });744 }745 render() {746 console.log(this.state);747 console.log('test2');748 return (749 <div className="coverTable DICT_NET_BRAND">750 <div className="headerTable">751 <div className="titleTable">{this.activeOperation(this.props.store.userState.OPERATIONS, this.props.store.location.pathname.substr(11))}</div>752 <div className="optionBlock"></div>753 </div>754 <div className="addblock">755 <div className="coverInputs">756 <label htmlFor="name_netWork">Найменування мережі</label>757 <input onBlur={this.nameNetWork} onKeyDown={this.hendleNnameNetWork} api_name="brand_name" id="name_netWork" type="text" className="form-control"/>758 <label htmlFor="status">Статус</label>759 <select disabled={this.state.isDisableInput ? 'disabled' : ''} id="dropdown-basic-button" onChange={this.changeInput} api_name="brand_status_code" className="form-select" title="ТВБВ">760 <option>-</option>761 {762 this.state.isShowDICT_NET_CLIENT_STATUS763 ? this.state.DICT_NET_CLIENT_STATUS.map((item, index) => {764 return < OptionItemDICT_NET_CLIENT_STATUS key={index} optionItem={item}/>765 })766 : <></>767 }768 </select>769 <label htmlFor="DICT_NETWORK_MANAGERS">Менеджер мережі</label>770 <select disabled={this.state.isDisableInput ? 'disabled' : ''} id="dropdown-basic-button" onChange={this.changeInput} api_name="manager_name" className="form-select" title="ТВБВ">771 <option>-</option>772 {773 this.state.isShowSelectDICT_NETWORK_MANAGERS774 ? this.state.DICT_NETWORK_MANAGERS.map((item, index) => {775 return < OptionItemDICT_NETWORK_MANAGERS key={index} optionItem={item}/>776 })777 : <></>778 }779 </select>780 </div>781 <div className="coverInputs">782 <label htmlFor="brand_id">ID мережі</label>783 <input disabled={this.state.isDisableTVBV ? 'disabled' : ''} value={this.state.brand_id} api_name="brand_id" id="brand_id" type="text" className="form-control"/>784 <label htmlFor="brand_region">Регіональні управління</label>785 <select disabled={this.state.isDisableInput ? 'disabled' : ''} onChange={this.changeInput} api_name="brand_region" id="brand_region" className="form-select"786 title="Регіональні управління">787 <option>-</option>788 {789 this.state.isShowSelectDICT_INSTITUTION790 ?791 this.state.DICT_INSTITUTION.map((item, index) => {792 return < OptionItemDICT_INSTITUTION key={index} optionItem={item}/>793 })794 : <>795 </>796 }797 </select>798 </div>799 <div className="coverInputs">800 <span>Контактна особа</span>801 <div className="innerBlock">802 <div className="coverInput">803 <label htmlFor="date_from">ПІБ</label>804 <input disabled={this.state.isDisableInput ? 'disabled' : ''} onChange={this.changeInput} api_name="contact_person" className="customInput form-control" id="date_from" type="text"/>805 </div>806 <div className="coverInput">807 <label htmlFor="date_to">Посада</label>808 <input disabled={this.state.isDisableInput ? 'disabled' : ''} onChange={this.changeInput} api_name="contact_position" className="customInput form-control" id="date_to" type="text"/>809 </div>810 <div className="coverInput">811 <label htmlFor="date_to">Телефон</label>812 <input disabled={this.state.isDisableInput ? 'disabled' : ''} onChange={this.changeInput} api_name="contact_phone" className="customInput form-control" id="date_to" type="text"/>813 </div>814 <div className="coverInput">815 <label htmlFor="date_to">Email</label>816 <input disabled={this.state.isDisableInput ? 'disabled' : ''} onChange={this.changeInput} api_name="contact_email" className="customInput form-control" id="date_to" type="text"/>817 </div>818 </div>819 </div>820 </div>821 <div className="addBlockRadio">822 <div className="title">2-й рівень</div>823 <div className="coverRadioBtn" >824 <label htmlFor="yes">Так</label>825 <input name="is_two_level" onClick={this.showTwoLevelYes} disabled={this.state.isDisableInput ? 'disabled' : ''} type="radio" id="yes"/>826 <label htmlFor="no">Ні</label>827 <input name="is_two_level" onClick={this.showTwoLevelNo} disabled={this.state.isDisableInput ? 'disabled' : ''} type="radio" id="no"/>828 </div>829 </div>830 <div className="coverTwoLevel">831 {832 this.state.showTwoLevel833 ? <>834 <div className="twoLevel">835 <div className="innerBlock">836 <label htmlFor="edrpou">ЄДРПОУ</label>837 <input api_name="brand_id" id="edrpou" type="text" className="form-control"/>838 <label htmlFor="brand_id">Назва 2-го рівня</label>839 <input api_name="brand_id" id="brand_id" type="text" className="form-control"/>840 <label htmlFor="brand_id">Менеджер</label>841 <select disabled={this.state.isDisableInput ? 'disabled' : ''} id="dropdown-basic-button" onChange={this.changeInput} api_name="manager_name" className="form-select" title="ТВБВ">842 <option>-</option>843 {844 this.state.isShowSelectDICT_NETWORK_MANAGERS845 ? this.state.DICT_NETWORK_MANAGERS.map((item, index) => {846 return < OptionItemDICT_NETWORK_MANAGERS key={index} optionItem={item}/>847 })848 : <></>849 }850 </select>851 </div>852 <div className="innerBlock">853 <label htmlFor="brand_id">ID 2-го рівня</label>854 <input api_name="brand_id" id="brand_id" type="text" className="form-control"/>855 <label htmlFor="brand_id">ID РУ</label>856 <input api_name="brand_id" id="brand_id" type="text" className="form-control"/>857 </div>858 </div>859 {860 this.state.moreTwoLevel861 ? <div className="twoLevel">862 <div className="innerBlock">863 <label htmlFor="edrpou">ЄДРПОУ</label>864 <input api_name="brand_id" id="edrpou" type="text" className="form-control"/>865 <label htmlFor="brand_id">Назва 2-го рівня</label>866 <input api_name="brand_id" id="brand_id" type="text" className="form-control"/>867 <label htmlFor="brand_id">Менеджер</label>868 <select disabled={this.state.isDisableInput ? 'disabled' : ''} id="dropdown-basic-button" onChange={this.changeInput} api_name="manager_name" className="form-select" title="ТВБВ">869 <option>-</option>870 {871 this.state.isShowSelectDICT_NETWORK_MANAGERS872 ? this.state.DICT_NETWORK_MANAGERS.map((item, index) => {873 return < OptionItemDICT_NETWORK_MANAGERS key={index} optionItem={item}/>874 })875 : <></>876 }877 </select>878 </div>879 <div className="innerBlock">880 <label htmlFor="brand_id">ID 2-го рівня</label>881 <input api_name="brand_id" id="brand_id" type="text" className="form-control"/>882 <label htmlFor="brand_id">ID РУ</label>883 <input api_name="brand_id" id="brand_id" type="text" className="form-control"/>884 </div>885 </div>886 : <></>887 }888 <button className="btn btn-secondary" onClick={this.more}>Ще</button>889 </>890 : <></>891 }892 </div>893 <div className="coverBtn">894 <button className="btn btn-success" onClick={this.save}>Зберегти</button>895 </div>896 {/*<div className="coverResult">*/}897 {/* <div className="resultSearch border">*/}898 {/* {*/}899 {/* this.state.isShowTsp*/}900 {/* ? <>*/}901 {/* <div className="title">Результат пошуку</div>*/}902 {/* <ul className="blockTsp_list">*/}903 {/* {*/}904 {/* this.Tsp_list(this.state.tsp_list)*/}905 {/* }*/}906 {/* </ul>*/}907 {/* </>*/}908 {/* :<>Не вибрано даних пошуку</>*/}909 {/* }*/}910 {/* </div>*/}911 {/* <div className="typeAcquiring">*/}912 {/* {*/}913 {/* this.state.isShowTypeAcquiring*/}914 {/* ? <>*/}915 {/* /!*<div className="coverBtn border">*!/*/}916 {/* /!* <div className="title">Вид екварингу</div>*!/*/}917 {/* /!* <button*!/*/}918 {/* /!* className="btn btn-secondary"*!/*/}919 {/* /!* disabled={this.state.type_acquiring == 1 ? 'disabled' : ''}*!/*/}920 {/* /!* onClick={this.changeTypeAcquiringPhysical}*!/*/}921 {/* /!* type_acquiring={1}>Фізичний</button>*!/*/}922 {/* /!* <button*!/*/}923 {/* /!* className="btn btn-secondary"*!/*/}924 {/* /!* disabled={this.state.type_acquiring == 2 ? 'disabled' : ''}*!/*/}925 {/* /!* onClick={this.changeTypeAcquiringInternet}*!/*/}926 {/* /!* type_acquiring={2}>Інтернет</button>*!/*/}927 {/* /!*</div>*!/*/}928 {/* /!*{this.showReport(this.state.currentTsp)}*!/*/}929 {/* {this.showHtmlReport()}*/}930 {/* </>*/}931 {/* : <></>*/}932 {/* }*/}933 {/* </div>*/}934 {/*</div>*/}935 {936 this.state.isShowPopupError937 ? <>938 <div className="coverPopupError">939 <div className="innerBlock">940 <div className="title alert alert-primary">Немає результату по даному пошуку</div>941 <div className="msg">Спробуйте ввести інші дані для пошуку</div>942 <button className="btn btn-secondary" onClick={this.closePopupError}>Закрити</button>943 </div>944 </div>945 </>946 : <>947 </>948 }949 {950 this.state.isShowPopupErrorSave951 ? <>952 <div className="coverPopupError">953 <div className="innerBlock">954 <div className="title alert alert-primary">Упс1 Сталася помилка</div>955 <div className="msg">:(</div>956 <button className="btn btn-secondary" onClick={this.closePopupErrorSave}>Закрити</button>957 </div>958 </div>959 </>960 : <>961 </>962 }963 {964 this.state.isShowOrder_numberError965 ? <>966 <div className="coverOrder_numberError">967 <div className="innerBlock">968 <div className="title alert alert-primary">Такий порядковий номер вже вибрано</div>969 <div className="msg">Введіть інший порядковий номер поля</div>970 <button className="btn btn-secondary" onClick={this.closePopupOrder_numberError}>Закрити</button>971 </div>972 </div>973 </>974 : <>975 </>976 }977 </div>978 );979 }980}...

Full Screen

Full Screen

display.js

Source:display.js Github

copy

Full Screen

1// App is the main Vue object controlling everything2let app;3let tabId = '';4let frameId = '';5const urlParameter = utils.getParameter(document.location.href, 'url');6const context = {7 url: urlParameter,8 domain: utils.parseDomainFromUrl(urlParameter)9};10// Event dispatcher for Vue11const eventBus = new Vue();12/* Vue Components */13Vue.component('modal', {14 template: '#modal-template',15 props: ['show', 'title', 'text', 'size'],16 computed: {17 isWide() {18 return this.size === 'wide';19 },20 isSmall() {21 return this.size === 'small';22 }23 },24 methods: {25 close() {26 this.$emit('close');27 },28 afterLeave(element) {29 if (!app.keepShowing) {30 app.backStack = [];31 hideDisplayFrame();32 }33 app.keepShowing = false;34 },35 escapeKey(event) {36 if (this.show && (event.key === 'Escape' || event.key === 'Esc')) {37 this.close();38 }39 }40 },41 mounted() {42 document.addEventListener('keydown', this.escapeKey);43 },44 beforeDestroy() {45 document.removeEventListener('keydown', this.escapeKey);46 }47});48Vue.component('nav-modal', {49 template: '#nav-modal-template',50 props: ['show', 'title', 'text', 'stack'],51 computed: {52 isBackShowing() {53 return this.stack && this.stack.length > 1;54 }55 },56 methods: {57 close() {58 this.$emit('close');59 },60 back() {61 this.$emit('back');62 app.keepShowing = true;63 app.backStack.pop();64 const showPrevious = app.backStack[app.backStack.length - 1];65 showPrevious();66 }67 }68});69Vue.component('dialog-modal', {70 template: '#dialog-modal-template',71 props: ['show', 'title', 'text'],72 methods: {73 close() {74 this.$emit('close');75 },76 buttonClick(id) {77 this.port.postMessage({action: 'dialogSelected', id});78 this.close();79 }80 },81 data() {82 return {83 port: null,84 buttons: [85 {text: I18n.t('common_ok'), id: 'okay'},86 {text: I18n.t('common_cancel'), id: 'cancel'}87 ]88 };89 },90 created() {91 const self = this;92 eventBus.$on('showDialogModal', data => {93 app.isDialogModalShown = true;94 app.dialogModalTitle = data.title;95 app.dialogModalText = data.text;96 self.buttons = data.buttons;97 self.port = data.port;98 });99 },100 beforeDestroy() {101 eventBus.$off('showDialogModal');102 }103});104Vue.component('ajax-dialog-modal', {105 template: '#ajax-dialog-modal-template',106 props: ['show', 'title', 'text'],107 methods: {108 close() {109 this.$emit('close');110 },111 buttonClick(id) {112 this.port.postMessage({action: 'dialogSelected', id, browserId: this.browser});113 this.close();114 }115 },116 data() {117 return {118 port: null,119 browser: 'firefox-headless',120 status: '',121 buttons: [122 {text: I18n.t('common_ok'), id: 'okay'},123 {text: I18n.t('common_cancel'), id: 'cancel'}124 ]125 };126 },127 created() {128 const self = this;129 eventBus.$on('showAjaxDialogModal', data => {130 app.isAjaxDialogModalShown = true;131 app.dialogModalTitle = data.title;132 app.dialogModalText = data.text;133 self.buttons = data.buttons;134 self.port = data.port;135 self.status = data.status;136 });137 },138 beforeDestroy() {139 eventBus.$off('showAjaxDialogModal');140 }141});142Vue.component('select-tool-modal', {143 template: '#select-tool-modal-template',144 props: ['show', 'title'],145 methods: {146 close() {147 this.$emit('close');148 }149 },150 data() {151 return {152 port: null,153 tools: []154 };155 },156 created() {157 const self = this;158 eventBus.$on('showSelectToolModal', data => {159 app.isSelectToolModalShown = true;160 self.tools = data.tools;161 self.port = data.port;162 });163 },164 beforeDestroy() {165 eventBus.$off('showSelectToolModal');166 }167});168Vue.component('tool-li', {169 template: '#tool-li-template',170 props: ['image', 'label', 'toolname', 'port'],171 methods: {172 close() {173 this.$emit('close');174 },175 toolSelect() {176 this.port.postMessage({action: 'toolSelected', toolname: this.toolname});177 this.close();178 }179 }180});181Vue.component('all-alerts-modal', {182 template: '#all-alerts-modal-template',183 props: ['show', 'title'],184 methods: {185 close() {186 this.$emit('close');187 }188 },189 data() {190 return {191 port: null,192 alerts: {},193 activeTab: I18n.t('alerts_risk_high')194 };195 },196 created() {197 const self = this;198 eventBus.$on('showAllAlertsModal', data => {199 app.isAllAlertsModalShown = true;200 app.allAlertsModalTitle = data.title;201 self.alerts = data.alerts;202 self.port = data.port;203 self.activeTab = data.risk;204 });205 },206 beforeDestroy() {207 eventBus.$off('showAllAlertsModal');208 }209});210Vue.component('alert-list-modal', {211 template: '#alert-list-modal-template',212 props: ['show', 'title'],213 methods: {214 close() {215 this.$emit('close');216 }217 },218 data() {219 return {220 port: null,221 alerts: {}222 };223 },224 created() {225 const self = this;226 eventBus.$on('showAlertListModal', data => {227 app.isAlertListModalShown = true;228 app.alertListModalTitle = data.title;229 self.alerts = data.alerts;230 self.port = data.port;231 });232 },233 beforeDestroy() {234 eventBus.$off('showAlertListModal');235 }236});237Vue.component('alert-accordion', {238 template: '#alert-accordion-template',239 props: ['title', 'alerts', 'port'],240 methods: {241 close() {242 this.$emit('close');243 },244 urlCount(alert) {245 return alert.length;246 },247 alertSelect(alert) {248 // Set keepShowing so that we don't hide the display frame249 app.keepShowing = true;250 app.isAlertListModalShown = false;251 app.isAllAlertsModalShown = false;252 navigator.serviceWorker.controller.postMessage({tabId, frameId, action: 'commonAlerts.showAlert', alertId: alert.id});253 }254 }255});256Vue.component('alert-details-modal', {257 template: '#alert-details-modal-template',258 props: ['show', 'title', 'stack'],259 methods: {260 close() {261 this.$emit('close');262 },263 messageSelected(id) {264 app.keepShowing = true;265 app.isAlertDetailsModalShown = false;266 navigator.serviceWorker.controller.postMessage({tabId, frameId, action: 'showHttpMessageDetails', tool: 'history', id});267 },268 back() {269 app.isAlertDetailsModalShown = false;270 }271 },272 data() {273 return {274 port: null,275 details: {}276 };277 },278 created() {279 const self = this;280 eventBus.$on('showAlertDetailsModal', data => {281 app.isAlertDetailsModalShown = true;282 app.alertDetailsModalTitle = data.title;283 self.details = data.details;284 self.port = data.port;285 });286 },287 beforeDestroy() {288 eventBus.$off('showAlertDetailsModal');289 }290});291Vue.component('simple-menu-modal', {292 template: '#simple-menu-modal-template',293 props: ['show', 'title'],294 methods: {295 close() {296 this.$emit('close');297 },298 itemSelect(itemId) {299 this.port.postMessage({action: 'itemSelected', id: itemId});300 this.close();301 }302 },303 data() {304 return {305 port: null,306 items: {}307 };308 },309 created() {310 const self = this;311 eventBus.$on('showSimpleMenuModal', data => {312 app.isSimpleMenuModalShown = true;313 app.simpleMenuModalTitle = data.title;314 self.items = data.items;315 self.port = data.port;316 });317 },318 beforeDestroy() {319 eventBus.$off('showSimpleMenuModal');320 }321});322Vue.component('adv-menu-modal', {323 template: '#adv-menu-modal-template',324 props: ['show', 'title'],325 methods: {326 close() {327 this.$emit('close');328 },329 itemSelect(itemId) {330 this.port.postMessage({action: 'itemSelected', id: itemId});331 app.isAdvMenuModalShown = false;332 this.close();333 }334 },335 data() {336 return {337 port: null,338 items: {}339 };340 },341 created() {342 const self = this;343 eventBus.$on('showAdvMenuModal', data => {344 app.isAdvMenuModalShown = true;345 app.iconMenuModalTitle = data.title;346 self.items = data.items;347 self.port = data.port;348 });349 },350 beforeDestroy() {351 eventBus.$off('showAdvMenuModal');352 }353});354Vue.component('http-message-modal', {355 template: '#http-message-modal-template',356 props: ['show', 'title', 'request', 'response', 'is-response-disabled', 'active-tab', 'stack'],357 methods: {358 close() {359 this.$emit('close');360 },361 back() {362 app.isHistoryMessageModalShown = false;363 }364 },365 computed: {366 currentMessage() {367 let method = '';368 let header = '';369 let body = '';370 if (!this.response.isReadonly) {371 header = this.response.header;372 body = this.response.body;373 } else {374 method = this.request.method;375 header = this.request.header;376 body = this.request.body;377 }378 return {method, header, body};379 }380 }381});382Vue.component('break-message-modal', {383 template: '#break-message-modal-template',384 props: ['show', 'title'],385 methods: {386 close() {387 this.step();388 this.$emit('close');389 },390 step() {391 const message = this.$refs.messageModal.currentMessage;392 this.$emit('close');393 this.port.postMessage({buttonSelected: 'step', tabId, method: message.method, header: message.header, body: message.body});394 },395 continueOn() {396 const message = this.$refs.messageModal.currentMessage;397 this.port.postMessage({buttonSelected: 'continue', tabId, method: message.method, header: message.header, body: message.body});398 this.$emit('close');399 },400 drop() {401 this.port.postMessage({buttonSelected: 'drop', frameId});402 this.$emit('close');403 }404 },405 data() {406 return {407 port: null,408 request: {},409 response: {},410 isDropDisabled: false,411 isResponseDisabled: false,412 activeTab: I18n.t('common_request')413 };414 },415 created() {416 const self = this;417 eventBus.$on('showBreakMessageModal', data => {418 self.request = data.request;419 self.response = data.response;420 self.port = data.port;421 self.isResponseDisabled = data.isResponseDisabled;422 self.activeTab = data.activeTab;423 self.request.isReadonly = !data.isResponseDisabled;424 self.response.isReadonly = data.isResponseDisabled;425 // Only show the Drop option for things that don't look like a requests for a web page as this can break the HUD UI426 if (data.isResponseDisabled) {427 // Its a request428 const headerLc = data.request.header.toLowerCase();429 self.isDropDisabled = headerLc.match('accept:.*text/html');430 // Explicitly XHRs should be fine431 if (headerLc.match('x-requested-with.*xmlhttprequest')) {432 self.isDropDisabled = false;433 }434 } else {435 // Its a response436 const headerLc = data.response.header.toLowerCase();437 self.isDropDisabled = headerLc.match('content-type:.*text/html');438 }439 app.isBreakMessageModalShown = true;440 app.BreakMessageModalTitle = data.title;441 });442 eventBus.$on('closeAllModals', () => {443 this.$emit('close');444 });445 },446 beforeDestroy() {447 eventBus.$off('showBreakMessageModal');448 eventBus.$off('closeAllModals');449 }450});451Vue.component('history-message-modal', {452 template: '#history-message-modal-template',453 props: ['show', 'title', 'stack'],454 methods: {455 close() {456 this.$emit('close');457 },458 replay() {459 const message = this.request;460 this.port.postMessage({buttonSelected: 'replay', method: message.method, header: message.header, body: message.body});461 this.$emit('close');462 },463 replayInBrowser() {464 const self = this;465 const message = this.request;466 const channel = new MessageChannel();467 channel.port1.start();468 channel.port2.start();469 channel.port1.addEventListener('message', event => {470 if (event.data.requestUrl) {471 window.top.location.href = event.data.requestUrl;472 } else {473 self.errors = I18n.t('error_invalid_html_header');474 }475 });476 navigator.serviceWorker.controller.postMessage({477 action: 'zapApiCall', component: 'hud', type: 'action',478 name: 'recordRequest',479 params: {header: message.header, body: message.body}480 }, [channel.port2]);481 },482 ascanRequest() {483 const request = this.request;484 this.$emit('close');485 navigator.serviceWorker.controller.postMessage(486 {487 tabId, frameId, action: 'ascanRequest', tool: 'active-scan',488 uri: request.uri, method: request.method, body: request.body489 });490 }491 },492 data() {493 return {494 port: null,495 request: {},496 response: {},497 isAscanDisabled: true,498 isResponseDisabled: false,499 activeTab: 'Request',500 errors: ''501 };502 },503 created() {504 const self = this;505 eventBus.$on('showHistoryMessageModal', data => {506 self.request = data.request;507 self.response = data.response;508 self.port = data.port;509 self.isResponseDisabled = data.isResponseDisabled;510 self.isAscanDisabled = data.isAscanDisabled;511 self.activeTab = data.activeTab;512 self.request.isReadonly = false;513 self.response.isReadonly = true;514 app.isHistoryMessageModalShown = true;515 app.HistoryMessageModalTitle = data.title;516 });517 },518 beforeDestroy() {519 eventBus.$off('showHistoryMessageModal');520 }521});522Vue.component('ws-message-modal', {523 template: '#ws-message-modal-template',524 props: ['show', 'title', 'time', 'direction', 'opcode', 'payload'],525 methods: {526 close() {527 this.$emit('close');528 }529 },530 computed: {531 currentMessage() {532 const payload = this.payload;533 return {payload};534 }535 }536});537Vue.component('websocket-message-modal', {538 template: '#websocket-message-modal-template',539 props: ['show', 'title'],540 methods: {541 close() {542 this.$emit('close');543 },544 replay() {545 this.port.postMessage({buttonSelected: 'replay', channelId: this.channelId, outgoing: this.outgoing, message: this.$refs.messageModal.currentMessage.payload});546 this.$emit('close');547 }548 },549 data() {550 return {551 port: null,552 time: null,553 direction: null,554 outgoing: null,555 opcode: null,556 channelId: null,557 payload: null,558 isReplayDisabled: false559 };560 },561 created() {562 const self = this;563 eventBus.$on('showWebSocketMessageModal', data => {564 const date = new Date(Number(data.msg.timestamp));565 self.time = date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds() + '.' + date.getMilliseconds();566 self.payload = data.msg.payload;567 self.channelId = data.msg.channelId;568 self.outgoing = data.msg.outgoing;569 // The outgoing field is actually a string not a boolean570 if (data.msg.outgoing === 'true') {571 self.direction = I18n.t('websockets_direction_outgoing');572 } else {573 self.direction = I18n.t('websockets_direction_incoming');574 }575 self.opcode = data.msg.opcodeString;576 self.isReplayDisabled = data.msg.opcodeString !== 'TEXT';577 self.port = data.port;578 app.isWebsocketMessageModalShown = true;579 app.websocketMessageModalTitle = data.title;580 });581 },582 beforeDestroy() {583 eventBus.$off('showWebSocketMessageModal');584 }585});586Vue.component('break-websocket-message-modal', {587 template: '#break-websocket-message-modal-template',588 props: ['show', 'title'],589 methods: {590 close() {591 this.step();592 this.$emit('close');593 },594 step() {595 const message = this.$refs.messageModal.currentMessage;596 this.$emit('close');597 this.port.postMessage({buttonSelected: 'step', tabId, payload: message.payload, outgoing: this.outgoing});598 },599 continueOn() {600 const message = this.$refs.messageModal.currentMessage;601 this.$emit('close');602 this.port.postMessage({buttonSelected: 'continue', tabId, payload: message.payload, outgoing: this.outgoing});603 },604 drop() {605 this.port.postMessage({buttonSelected: 'drop', frameId});606 this.$emit('close');607 }608 },609 data() {610 return {611 port: null,612 time: null,613 direction: null,614 outgoing: null,615 opcode: null,616 channelId: null,617 payload: null618 };619 },620 created() {621 const self = this;622 eventBus.$on('showBreakWebSocketMessageModal', data => {623 const date = new Date(Number(data.msg.timestamp));624 self.time = date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds() + '.' + date.getMilliseconds();625 self.payload = data.msg.payload;626 self.channelId = data.msg.channelId;627 self.outgoing = data.msg.outgoing;628 // The outgoing field is actually a string not a boolean629 if (data.msg.outgoing === 'true') {630 self.direction = I18n.t('websockets_direction_outgoing');631 } else {632 self.direction = I18n.t('websockets_direction_incoming');633 }634 self.opcode = data.msg.opcodeString;635 self.port = data.port;636 app.isBreakWebSocketMessageModalShown = true;637 app.BreakWebSocketMessageModalTitle = data.title;638 });639 eventBus.$on('closeAllModals', () => {640 this.$emit('close');641 });642 }643});644Vue.component('site-tree-node', {645 template: '#site-tree-node-template',646 props: {647 model: Object648 },649 methods: {650 toggle() {651 if (!this.model.isLeaf) {652 this.open = !this.open;653 if (this.open) {654 this.showChildren();655 } else {656 // We always want to query ZAP when expanding a node657 Vue.set(this.model, 'children', []);658 }659 }660 },661 showHttpMessageDetails() {662 app.keepShowing = true;663 app.isSiteTreeModalShown = false;664 navigator.serviceWorker.controller.postMessage({tabId, frameId, action: 'showHttpMessageDetails', tool: 'history', id: this.model.hrefId});665 },666 showChildren() {667 this.addChild(I18n.t('sites_children_loading'), false);668 const treeNode = this;669 const channel = new MessageChannel();670 channel.port1.start();671 channel.port2.start();672 channel.port1.addEventListener('message', event => {673 // Remove the ..loading.. child674 Vue.set(treeNode.model, 'children', []);675 for (let i = 0; i < event.data.childNodes.length; i++) {676 const child = event.data.childNodes[i];677 treeNode.addChild(child.name, child.method, child.isLeaf, child.hrefId);678 }679 });680 navigator.serviceWorker.controller.postMessage({681 action: 'zapApiCall', component: 'core', type: 'view',682 name: 'childNodes', params: {url: this.model.url}683 }, [channel.port2]);684 },685 addChild(name, method, isLeaf, hrefId) {686 if (name.slice(-1) === '/') {687 name = name.slice(0, -1);688 }689 if ((name.match(/\//g) || []).length > 2) {690 // If there are more than 2 slashes just show last url element691 // The first 2 slashes will be http(s)://...692 name = name.substring(name.lastIndexOf('/') + 1);693 }694 if (isLeaf) {695 name = method + ': ' + name;696 }697 this.model.children.push({698 name,699 isLeaf,700 hrefId,701 method,702 children: [],703 url: this.model.url === '' ? name : this.model.url + '/' + name704 });705 }706 },707 data() {708 return {709 name: I18n.t('sites_tool'),710 open: false711 };712 }713});714Vue.component('site-tree-modal', {715 template: '#site-tree-modal-template',716 props: {717 title: '',718 show: ''719 },720 methods: {721 close() {722 this.$emit('close');723 }724 },725 data() {726 return {727 port: null,728 name: I18n.t('sites_tool'),729 open: false,730 model: {731 name: I18n.t('sites_title'),732 isLeaf: false,733 hrefId: 0,734 url: '',735 method: '',736 children: []737 }738 };739 },740 created() {741 const self = this;742 eventBus.$on('showSiteTreeModal', data => {743 self.port = data.port;744 app.isSiteTreeModalShown = true;745 app.siteTreeModalTitle = data.title;746 });747 },748 beforeDestroy() {749 eventBus.$off('showSiteTreeModal');750 }751});752Vue.component('tabs', {753 template: '#tabs-template',754 props: ['activetab'],755 data() {756 return {757 tabs: []758 };759 },760 methods: {761 selectTab(selectedTab) {762 this.tabs.forEach(tab => {763 tab.isActive = (tab.href === selectedTab.href);764 });765 },766 changeTab(tabName) {767 const tabHref = '#' + tabName.toLowerCase().replace(/ /g, '-');768 this.tabs.forEach(tab => {769 tab.isActive = (tab.href === tabHref);770 });771 }772 },773 watch: {774 activetab(tabName) {775 this.changeTab(tabName);776 }777 },778 created() {779 this.tabs = this.$children;780 }781});782Vue.component('tab', {783 template: '#tab-template',784 props: {785 name: {required: true},786 selected: {default: false},787 disabled: {default: false}788 },789 data() {790 return {791 isActive: false,792 isDisabled: false793 };794 },795 computed: {796 href() {797 return '#' + this.name.toLowerCase().replace(/ /g, '-');798 }799 },800 mounted() {801 this.isActive = this.selected;802 this.isDisabled = this.disabled;803 }804});805document.addEventListener('DOMContentLoaded', () => {806 const parameters = new URL(document.location).searchParams;807 frameId = parameters.get('frameId');808 tabId = parameters.get('tabId');809 /* Vue app */810 app = new Vue({811 i18n: I18n.i18n,812 el: '#app',813 data: {814 isDialogModalShown: false,815 isAjaxDialogModalShown: false,816 dialogModalTitle: '',817 dialogModalText: 'text',818 isSelectToolModalShown: false,819 isAlertListModalShown: false,820 alertListModalTitle: I18n.t('alerts_title'),821 isAllAlertsModalShown: false,822 allAlertsModalTitle: I18n.t('alerts_all_title'),823 isAlertDetailsModalShown: false,824 alertDetailsModalTitle: I18n.t('alerts_details_title'),825 isSimpleMenuModalShown: false,826 simpleMenuModalTitle: I18n.t('common_menu_title'),827 isAdvMenuModalShown: false,828 advMenuModalTitle: I18n.t('common_menu_title'),829 isBreakMessageModalShown: false,830 breakMessageModalTitle: I18n.t('break_http_message_title'),831 isHistoryMessageModalShown: false,832 historyMessageModalTitle: I18n.t('history_http_message_title'),833 isWebsocketMessageModalShown: false,834 websocketMessageModalTitle: I18n.t('websockets_message_title'),835 isBreakWebSocketMessageModalShown: false,836 breakWebSocketMessageModalTitle: I18n.t('break_intercept_ws_title'),837 isSiteTreeModalShown: false,838 siteTreeModalTitle: I18n.t('sites_tool'),839 keepShowing: false,840 backStack: []841 }842 });843});844navigator.serviceWorker.addEventListener('message', event => {845 const action = event.data.action;846 const config = event.data.config;847 const port = event.ports[0];848 let show;849 switch (action) {850 case 'showDialog': {851 show = () => eventBus.$emit('showDialogModal', {852 title: config.title,853 text: config.text,854 buttons: config.buttons,855 port856 });857 app.backStack.push(show);858 show();859 showDisplayFrame();860 break;861 }862 case 'showAjaxDialog': {863 show = () => eventBus.$emit('showAjaxDialogModal', {864 title: config.title,865 text: config.text,866 buttons: config.buttons,867 status: config.status,868 port869 });870 app.backStack.push(show);871 show();872 showDisplayFrame();873 break;874 }875 case 'showAddToolList': {876 show = () => eventBus.$emit('showSelectToolModal', {877 tools: config.tools,878 port879 });880 app.backStack.push(show);881 show();882 showDisplayFrame();883 break;884 }885 case 'showAlerts': {886 show = () => eventBus.$emit('showAlertListModal', {887 title: config.title,888 alerts: config.alerts,889 port890 });891 app.backStack.push(show);892 show();893 showDisplayFrame();894 break;895 }896 case 'showAllAlerts': {897 show = () => eventBus.$emit('showAllAlertsModal', {898 title: config.title,899 alerts: config.alerts,900 port,901 risk: config.risk902 });903 app.backStack.push(show);904 show();905 showDisplayFrame();906 break;907 }908 case 'showAlertDetails': {909 show = () => eventBus.$emit('showAlertDetailsModal', {910 title: config.title,911 details: config.details,912 port913 });914 app.backStack.push(show);915 show();916 showDisplayFrame();917 break;918 }919 case 'showButtonOptions': {920 show = () => eventBus.$emit('showSimpleMenuModal', {921 title: config.toolLabel,922 items: config.options,923 port924 });925 app.backStack.push(show);926 show();927 showDisplayFrame();928 break;929 }930 case 'showHudSettings': {931 show = () => eventBus.$emit('showAdvMenuModal', {932 title: I18n.t('settings_title'),933 items: config.settings,934 port935 });936 app.backStack.push(show);937 show();938 showDisplayFrame();939 break;940 }941 case 'showBreakMessage': {942 show = () => eventBus.$emit('showBreakMessageModal', {943 title: I18n.t('break_intercept_http_title'),944 request: config.request,945 response: config.response,946 isResponseDisabled: config.isResponseDisabled,947 activeTab: config.activeTab,948 port949 });950 app.backStack.push(show);951 show();952 showDisplayFrame();953 break;954 }955 case 'showHistoryMessage': {956 show = () => eventBus.$emit('showHistoryMessageModal', {957 title: I18n.t('history_http_message_title'),958 request: config.request,959 response: config.response,960 isResponseDisabled: config.isResponseDisabled,961 isAscanDisabled: config.isAscanDisabled,962 activeTab: config.activeTab,963 port964 });965 app.backStack.push(show);966 show();967 showDisplayFrame();968 break;969 }970 case 'showWebSocketMessage': {971 show = () => eventBus.$emit('showWebSocketMessageModal', {972 title: I18n.t('websockets_message_title'),973 msg: config,974 port975 });976 app.backStack.push(show);977 show();978 showDisplayFrame();979 break;980 }981 case 'showBreakWebSocketMessage': {982 show = () => eventBus.$emit('showBreakWebSocketMessageModal', {983 title: I18n.t('break_intercept_ws_title'),984 msg: config,985 port986 });987 app.backStack.push(show);988 show();989 showDisplayFrame();990 break;991 }992 case 'showSiteTree': {993 show = () => eventBus.$emit('showSiteTreeModal', {994 title: I18n.t('sites_tool'),995 port996 });997 app.backStack.push(show);998 show();999 showDisplayFrame();1000 break;1001 }1002 case 'showHtmlReport': {1003 const channel = new MessageChannel();1004 channel.port1.start();1005 channel.port2.start();1006 channel.port1.addEventListener('message', event => {1007 // Open window and inject the HTML report1008 // FIXME: remove after #6201009 // eslint-disable-next-line no-unsanitized/property1010 window.open('').document.body.innerHTML = event.data.response;1011 });1012 navigator.serviceWorker.controller.postMessage({1013 action: 'zapApiCall', component: 'core', type: 'other',1014 name: 'htmlreport'1015 }, [channel.port2]);1016 break;1017 }1018 case 'closeModals': {1019 if (config && config.notTabId !== tabId) {1020 eventBus.$emit('closeAllModals', {1021 port1022 });1023 }1024 break;1025 }1026 default: {1027 break;1028 }1029 }1030});1031/* The injected script makes the main frame visible */1032function showDisplayFrame() {1033 return utils.messageWindow(parent, {action: 'showMainDisplay'}, context.url);1034}1035/* The injected script makes the main frame invisible */1036function hideDisplayFrame() {1037 parent.postMessage({action: 'hideMainDisplay'}, context.url);...

Full Screen

Full Screen

app.js

Source:app.js Github

copy

Full Screen

1(function autoLoader(require, win, doc) {2 'use strict';3 require([4 'scripts/Helper', 'scripts/Actor', 'scripts/ProofCorrectorApp',5 'scripts/ProofEditorApp', 'scripts/ProofValidatorApp',6 'scripts/QueryReplierApp', 'scripts/ConfigReader', 'scripts/EventBus',7 'scripts/ErrorHandler', 'scripts/RequestBuilder',8 'scripts/PerformanceLog', 'scripts/SessionReport', 'scripts/HtmlReport',9 'scripts/DialogPopupPanel', 'scripts/Logger', 'scripts/HeaderMenuItems',10 'scripts/ViewPageProof', 'scripts/BrowserCompatibility', 'scripts/ActionLogger',11 'scripts/AlertDialog', 'templates/SupportLinks', 'scripts/PopOver',12 'customer/Config', 'scripts/FeatureToggle', 'scripts/browser-compatability',13 'scripts/polyfills/polyfills', 'scripts/polyfills/classList',14 'scripts/polyfills/dataset', 'scripts/polyfills/assign', 'scripts/polyfills/dialog',15 'scripts/polyfills/beacon'16 ],17 function appLoader(18 Helper, Actor, ProofCorrectorApp, ProofEditorApp, ProofValidatorApp,19 QueryReplierApp, Config, EventBus, ErrorHandler, RequestBuilder, PerformanceLog,20 SessionReport, HtmlReport, DialogPopupPanel, Logger, HeaderMenuItems, ViewPageProof,21 BrowserCompatibility, ActionLogger, AlertDialog, SupportLinkTemplate, PopOver,22 CustomerConfig, FeatureToggle23 ) {24 var performanceLog, token, currentActorType, headerMenuItems, readonly,25 localeData, browserCompatibility, browserVersion, supportedBrowser,26 actionLogger, alertDialog, metaData, popOverInst, clearFrame, loaderPrecentage,27 CustomerConfig, FeatureToggle, ConfirmDialog, DataChangeAttributeHandler28 ) {29 var performanceLog, token, currentActorType, headerMenuItems, readonly,30 localeData, browserCompatibility, browserVersion, supportedBrowser,31 actionLogger, alertDialog, confirmDialog, metaData, popOverInst,32 clearFrame, loaderPrecentage, changeAttributeHandler,33 loaderBlock = doc.querySelector('.overlay'),34 parentContainer = doc.querySelector('.container'),35 articleContainer = doc.querySelector('.editor'),36 supplementaryContainer = doc.querySelector('.supplementary'),37 flashMessageContainer = doc.querySelector('.flash-message-container'),38 flashMessageContainerClose = doc.querySelector('.flash-message-container .close'),39 flashMessageContainerContent = doc.querySelector('.flash-message-container .content'),40 helpLinkElement = doc.querySelector('.action-buttons a.help-link'),41 bootstrapLoaderElement = doc.querySelector('.progress-container progress'),42 errorHandler = new ErrorHandler(win, doc), viewPageProof,43 loaderWidth = 0;44 function hideFlashMessage() {45 var classList = flashMessageContainer.classList;46 classList.remove('show');47 classList.remove('green');48 }49 function showFlashMessage(content, options) {50 var defaultOptions = {51 'closeButton': true,52 'success': false,53 'error': true,54 'autoClose': true55 };56 options = options || {};57 options = Object.assign({}, defaultOptions, options);58 if (Helper.isUndefined(content) === true ||59 Helper.isNull(content) === true ||60 Helper.isEmptyString(content) === true) {61 return;62 }63 if (options.success === true) {64 flashMessageContainer.classList.add('green');65 }66 if (options.closeButton === false) {67 flashMessageContainerClose.classList.add('hide');68 }69 if (options.closeButton === false && options.autoClose === true) {70 setTimeout(function timeOutFn() {71 hideFlashMessage();72 }, 4000);73 }74 flashMessageContainerContent.innerHTML = content;75 flashMessageContainer.classList.add('show');76 }77 function hideLoader() {78 loaderBlock.removeAttribute('style');79 loaderBlock.style.display = 'none';80 }81 function showLoader(zIndex) {82 var loderStyle = loaderBlock.style;83 if (Helper.isNumber(zIndex)) {84 loderStyle.zIndex = zIndex;85 }86 loderStyle.display = 'block';87 }88 function removeEditorBootstrapLoader() {89 var loader = doc.querySelector('.progress-overlay');90 if (Helper.isNull(loader) === true) {91 return;92 }93 loader.parentNode.removeChild(loader);94 }95 function frame() {96 if (loaderWidth >= loaderPrecentage) {97 if (loaderPrecentage === 100) {98 removeEditorBootstrapLoader();99 }100 clearInterval(clearFrame);101 }102 else {103 loaderWidth += 1;104 bootstrapLoaderElement.value = loaderWidth;105 }106 }107 function setBootstrapLoader(percentage) {108 loaderPrecentage = percentage;109 clearFrame = setInterval(frame, 250);110 }111 function invalidArticle() {112 parentContainer.style.display = 'none';113 showFlashMessage(Config.getLocaleByKey('article.not.found'), true);114 hideLoader();115 removeEditorBootstrapLoader();116 }117 function loadConfiguration() {118 var configReader = new Config(win);119 configReader.load();120 }121 function bindLogger() {122 var logger = new Logger(win, doc);123 logger.configure(124 Config.get('Log').Level,125 Config.get('Log').PersistOnServer,126 Config.getRoute('logEndPoint')127 );128 }129 function bindErrorEvent() {130 win.addEventListener('error', function error(errorData) {131 errorHandler.handleErrors(errorData);132 });133 }134 function generateSessionReport(conformation) {135 var sessionReport, alertMessage;136 if (conformation === true) {137 EventBus.publish('Loader:show', 9999);138 alertMessage = Config.getLocaleByKey('article.session.report');139 alert(alertMessage);140 }141 sessionReport = new SessionReport(win, doc, token, currentActorType);142 sessionReport.generateReport();143 }144 function bindSessionReport() {145 var sessionReportBtn = doc.querySelector('.sessionBtn');146 sessionReportBtn.classList.remove('hide');147 sessionReportBtn.addEventListener('click', function click() {148 generateSessionReport(true);149 }, false);150 }151 function bindHtmlReport() {152 var htmlReport,153 htmlReportBtn = doc.querySelector('.htmlReportBtn');154 htmlReportBtn.classList.remove('hide');155 htmlReportBtn.addEventListener('click', function htmlReportClick() {156 htmlReport = new HtmlReport(win, doc, token);157 htmlReport.render(metaData.data);158 });159 }160 function bindViewPageProof() {161 viewPageProof = new ViewPageProof(162 win, doc, token, {163 'downloadPageProofEndPoint': Config.getRoute(164 'downloadPageProofEndPoint'165 )166 }167 );168 }169 function applyLocale(template, locale) {170 return Helper.replaceLocaleString(template, locale);171 }172 function bindKeepAliveProcess() {173 var request,174 requestBuilder = new RequestBuilder();175 requestBuilder.setUrl(Config.getRoute('keepAliveEndPoint'));176 requestBuilder.setMethod('GET');177 requestBuilder.setSuccessCallback(function onSuccessCallback() {178 console.log('Keep alive saved');179 });180 requestBuilder.setTimeoutCallback(function onTimeoutCallback(response) {181 console.log('Timeout ', response);182 });183 requestBuilder.setFailureCallback(function onFailureCallback(response) {184 console.log('Keep alive failed ', response);185 });186 request = requestBuilder.build();187 request.withCredentials(true);188 request.send();189 }190 function bindExpireIdleSessionProcess() {191 var sessionLandingPageLink, request, currentlocaleVal,192 requestBuilder = new RequestBuilder(),193 sessionBaseLink = Config.getRoute('SessionLandingPageLink');194 sessionLandingPageLink = sessionBaseLink.replace('{{token}}', token);195 sessionLandingPageLink = sessionLandingPageLink.replace('{{actor}}', currentActorType.toUpperCase());196 if (Config.get('locale') === true) {197 currentlocaleVal = Config.get('currentLocale');198 sessionLandingPageLink = sessionLandingPageLink.replace('{{locale}}', currentlocaleVal);199 }200 requestBuilder.setUrl(Config.getRoute('expireIdleSessionEndPoint') + '/' + token);201 requestBuilder.setMethod('GET');202 requestBuilder.setSuccessCallback(function onSuccessCallback(response) {203 metaData = JSON.parse(response);204 if (metaData.data === true) {205 window.location.replace(sessionLandingPageLink);206 }207 else if (metaData.data === Config.getLocaleByKey('session.expired.message')) {208 console.log(metaData.data);209 }210 else {211 console.log('Session Keep Active');212 }213 });214 requestBuilder.setTimeoutCallback(function onTimeoutCallback(response) {215 console.log('Timeout ', response);216 });217 requestBuilder.setFailureCallback(function onFailureCallback(response) {218 console.log('Idle Session Expiration failed ', response);219 });220 request = requestBuilder.build();221 request.withCredentials(true);222 request.send();223 }224 function clearSessionOnClose() {225 var request,226 requestBuilder = new RequestBuilder(),227 url = Config.getRoute('clearSessionEndPoint'),228 formData = new FormData();229 formData.append('token', token);230 requestBuilder.setUrl(url);231 requestBuilder.setMethod('POST');232 requestBuilder.setData(formData);233 request = requestBuilder.build();234 request.withCredentials(true);235 request.send();236 }237 function pageCloseHandler() {238 actionLogger.save({'action': 'Browser-reloaded'});239 actionLogger.pushToServer();240 if (Helper.isObject(win.opener) === true) {241 win.opener.location.reload();242 }243 }244 function isXmlEditorEnabled() {245 var Plugins = Config.get('Plugins'),246 aC = new Actor(),247 actor = aC.getValidActor(currentActorType);248 if (actor !== 'proofValidator') {249 return false;250 }251 if (252 Helper.objectHasKey(Plugins, 'XmlEditor') === true &&253 Helper.objectHasKey(Plugins.XmlEditor, 'enable') === true254 ) {255 return Plugins.XmlEditor.enable;256 }257 return false;258 }259 function renderHeaderButtons() {260 if (261 FeatureToggle.isFeatureEnabled('ShowDownloadProof') === true ||262 Config.get('showPaginateProofOverride') === true263 ) {264 headerMenuItems.showDownloadProof();265 }266 if (267 FeatureToggle.isFeatureEnabled('ShowPaginateProof') === true ||268 Config.get('showPaginateProofOverride') === true269 ) {270 headerMenuItems.showPaginateProof();271 }272 if (273 FeatureToggle.isFeatureEnabled('ShowViewProof') === true ||274 Config.get('showViewProofOverride') === true275 ) {276 headerMenuItems.showViewProof();277 }278 if (isXmlEditorEnabled() === true) {279 headerMenuItems.showXmlEditor();280 }281 }282 function getHelpLink(token, actor) {283 var helpLink, currentLocale, localePrefix;284 currentLocale = Config.get('currentLocale');285 localePrefix = currentLocale.substring(0, 2);286 helpLink = Config.getRoute('helpLink');287 helpLink = helpLink.replace('{{token}}', token);288 helpLink = helpLink.replace('{{actor}}', actor);289 helpLink = helpLink.replace('{{locale}}', localePrefix);290 return helpLink;291 }292 function getSupportLink() {293 var supportLink;294 supportLink = metaData.data.supportLink;295 return supportLink;296 }297 function createPopOverFragment() {298 var supportLinkTemplate, temp, domFragment, genAuthorLink,299 helpLink, navigateHelpLink, supportLink;300 supportLinkTemplate = applyLocale(SupportLinkTemplate, localeData);301 temp = document.createElement('span');302 temp.innerHTML = supportLinkTemplate;303 domFragment = temp.firstChild;304 genAuthorLink = domFragment.querySelector('a.gen-author');305 helpLink = domFragment.querySelector('a.online-proof');306 supportLink = getSupportLink();307 genAuthorLink.setAttribute('href', supportLink);308 navigateHelpLink = getHelpLink(token, currentActorType);309 helpLink.setAttribute('href', navigateHelpLink);310 return domFragment;311 }312 function initiatePopOver() {313 var fragment = createPopOverFragment();314 popOverInst = new PopOver(window, document);315 popOverInst.render(fragment, helpLinkElement);316 }317 function renderHelpLink(actor) {318 var navigateHelpLink;319 if (320 actor === 'proofValidator' ||321 actor === 'queryReplier' ||322 FeatureToggle.isFeatureEnabled('ShowSupportLink') === false323 ) {324 navigateHelpLink = getHelpLink(token, currentActorType);325 helpLinkElement.setAttribute('href', navigateHelpLink);326 }327 else {328 initiatePopOver();329 }330 }331 function browserVerification() {332 var isSupport, message,333 supportedBrowsers = Config.get('browserCompatible');334 browserCompatibility = new BrowserCompatibility(win, EventBus);335 isSupport = browserCompatibility.verifyBrowser();336 browserVersion = browserCompatibility.getBrowserInfo();337 if (isSupport === false) {338 message = Config.getLocaleByKey('browser.support.message');339 message = message.replace('{{FIREFOX}}', supportedBrowsers.Firefox);340 message = message.replace('{{IE}}', supportedBrowsers.InternetExplorer);341 message = message.replace('{{CHROME}}', supportedBrowsers.Chrome);342 EventBus.publish('Loader:hide');343 showFlashMessage(message, true);344 parentContainer.style.display = 'none';345 throw new Error('unsupport.browser');346 }347 }348 function initiateRevision() {349 var saveBtn = doc.querySelector('div.action-buttons .saveBtn');350 saveBtn.dataset.revisionId = 1;351 }352 function metaFailureCallback() {353 console.log('Meta Download Failure');354 invalidArticle();355 }356 function bindSessionManagement() {357 var idleSessionExpireTime = Config.get('idleSessionExpirationTime'),358 enableInvalidateSession = FeatureToggle.isFeatureEnabled('ValidateUserSession');359 if ((enableInvalidateSession === false) &&360 (metaData.data.readOnly === false)) {361 setInterval(function keepAlive() {362 bindKeepAliveProcess();363 }, idleSessionExpireTime);364 }365 else if (enableInvalidateSession === true &&366 metaData.data.readOnly === false) {367 setInterval(function expireIdleSession() {368 bindExpireIdleSessionProcess();369 }, idleSessionExpireTime);370 }371 }372 function loadPaginationScript() {373 var scriptRef, sourceFilePath,374 modeButtonBlock = doc.querySelector('.container .mode-buttons'),375 proofModeButtons = modeButtonBlock.querySelector('.proofBtn'),376 paginationEnabled = FeatureToggle.isFeatureEnabled('ShowPaginateProof');377 if (Config.get('Environment') === 'prod' && paginationEnabled === true) {378 sourceFilePath = '/' + Config.get('sourceFilePath');379 scriptRef = doc.createElement('script');380 scriptRef.setAttribute('type', 'text/javascript');381 scriptRef.setAttribute('src', sourceFilePath);382 scriptRef.onerror = function scriptErrFn() {383 proofModeButtons.classList.remove('show');384 proofModeButtons.classList.add('hide');385 };386 doc.head.appendChild(scriptRef);387 }388 }389 function downloadMetaData(url, metaSuccessCallback, metaFailureCallback) {390 var actor, featureToggle,391 startTime, startDate, request,392 aC = new Actor(),393 requestBuilder = new RequestBuilder();394 startTime = new Date().getTime();395 startDate = new Date().toString();396 requestBuilder.setUrl(url);397 requestBuilder.setMethod('GET');398 requestBuilder.setSuccessCallback(function(response) {399 initiateRevision();400 setBootstrapLoader(90);401 metaData = JSON.parse(response);402 actor = aC.getValidActor(currentActorType);403 featureToggle = new FeatureToggle(metaData.data.features);404 bindSessionManagement();405 if (FeatureToggle.isFeatureEnabled('ShowHtmlReport') === true) {406 bindHtmlReport(metaData.data);407 }408 else if(FeatureToggle.isFeatureEnabled('ShowSessionReport') === true) {409 bindSessionReport();410 }411 bindViewPageProof();412 performanceLog.pushLoadTimeline(413 'Load', startTime, startDate, 'InterfaceLoad'414 );415 articleContainer.classList.add(actor);416 supplementaryContainer.classList.add(actor);417 renderHelpLink(actor);418 renderHeaderButtons(metaData.data);419 metaSuccessCallback.call(this, response);420 });421 requestBuilder.setFailureCallback(metaFailureCallback);422 requestBuilder.setTimeoutCallback(function() {423 console.log('Timeout!');424 });425 request = requestBuilder.build();426 request.withCredentials(true);427 request.send();428 }429 function handleActorRedirection(currentActor, token, isOpenReadOnly) {430 var proofCorrector, proofValidator, proofEditor,431 queryReplier, successCallback,432 aC = new Actor(),433 endPoint = Config.getRoute('loadEndPoint'),434 actor = aC.getValidActor(currentActor),435 metaURL = endPoint;436 if (isOpenReadOnly === true) {437 metaURL += '/readonly';438 }439 if (actor === 'proofCorrector') {440 proofCorrector = new ProofCorrectorApp(token, currentActor);441 proofCorrector.bootstrap();442 successCallback = proofCorrector.metaSuccessCallback;443 }444 else if (actor === 'proofEditor') {445 proofEditor = new ProofEditorApp(token, currentActor);446 proofEditor.bootstrap();447 successCallback = proofEditor.metaSuccessCallback;448 }449 else if (actor === 'proofValidator') {450 proofValidator = new ProofValidatorApp(token, currentActor);451 proofValidator.bootstrap();452 successCallback = proofValidator.metaSuccessCallback;453 }454 else if (actor === 'queryReplier') {455 queryReplier = new QueryReplierApp(token, currentActor);456 queryReplier.bootstrap();457 successCallback = queryReplier.metaSuccessCallback;458 }459 else {460 invalidArticle();461 return;462 }463 downloadMetaData(metaURL, successCallback, metaFailureCallback);464 }465 function bindFlashMessage() {466 flashMessageContainerClose.addEventListener('click',467 function closeFn() {468 hideFlashMessage();469 }, false);470 }471 function reloadBrowser() {472 win.location.reload();473 }474 function bootstrap() {475 var winEventListner, winEventLoader, body,476 isReadOnly = false, aC, actor;477 localeData = Config.getLocale();478 currentActorType = Helper.getUrlParams('type');479 token = Helper.getUrlParams('token');480 readonly = Helper.getUrlParams('readonly');481 EventBus.subscribe('Loader:show', showLoader);482 EventBus.subscribe('Loader:hide', hideLoader);483 EventBus.subscribe('FlashMessage:show', showFlashMessage);484 EventBus.subscribe('FlashMessage:hide', hideFlashMessage);485 EventBus.subscribe('Browser:reload', reloadBrowser);486 EventBus.subscribe('BootstrapLoader:remove', removeEditorBootstrapLoader);487 EventBus.subscribe('BootstrapLoader:setPercentage', setBootstrapLoader);488 supportedBrowser = Config.get('browserCompatible');489 browserVerification();490 if (491 Helper.isEmptyString(token) === true ||492 Helper.isUndefined(token) === true493 ) {494 invalidArticle();495 return;496 }497 if (498 Helper.isEmptyString(readonly) === false &&499 readonly === 'true'500 ) {501 isReadOnly = true;502 }503 if (504 Helper.isEmptyString(currentActorType) === true ||505 Helper.isUndefined(currentActorType) === true506 ) {507 currentActorType = 'au';508 }509 currentActorType = currentActorType.toLowerCase();510 performanceLog = new PerformanceLog(token, currentActorType);511 headerMenuItems = new HeaderMenuItems(doc);512 handleActorRedirection(currentActorType, token, isReadOnly);513 aC = new Actor();514 actor = aC.getValidActor(currentActorType);515 win.browserDetails = browserDetect(516 typeof navigator !== 'undefined' ? navigator.userAgent : ''517 );518 if (519 win.browserDetails.msie === true &&520 win.browserDetails.version >= 11521 ) {522 winEventListner = win.attachEvent || win.addEventListener;523 winEventLoader = win.attachEvent ? 'onbeforeunload' : 'beforeunload';524 winEventListner(winEventLoader, function closeHandler(e) {525 pageCloseHandler();526 });527 }528 else {529 win.onunload = pageCloseHandler;530 }531 if (Config.get('Environment') === 'prod') {532 body = doc.querySelector('body');533 body.setAttribute('oncontextmenu', 'return false');534 }535 actionLogger = new ActionLogger(win, EventBus, token, currentActorType);536 alertDialog = new AlertDialog(537 win, doc, EventBus, token, currentActorType538 );539 }540 setBootstrapLoader(30);541 loadConfiguration();542 EventBus.subscribe('Configuration:Loaded', function configureLoad() {543 setBootstrapLoader(60);544 bindLogger();545 bindErrorEvent();546 bindFlashMessage();547 bootstrap();548 });549 EventBus.subscribe('Download:ViewPageProof', function viewPage() {550 viewPageProof.generateReport(currentActorType);551 });552 EventBus.subscribe('Download:SessionReport', generateSessionReport);553 });...

Full Screen

Full Screen

PayrollRemittanceAgencyEventWizardStepReview.js

Source:PayrollRemittanceAgencyEventWizardStepReview.js Github

copy

Full Screen

...175 $this.getWizardObject().getReport('pdf_form_government');176 });177 break;178 case 'taxReportsIcon_new_window':179 this.getWizardObject().showHTMLReport('T4Summary', true);180 break;181 case 'taxReportsIcon':182 this.getWizardObject().showHTMLReport('T4Summary');183 break;184 case 'T4FormSetup':185 this.getWizardObject().minimize();186 IndexViewController.openReport(LocalCacheData.current_open_primary_controller, 'T4SummaryReport', null, 'FormSetup');187 break;188 }189 break;190 case 'T4A':191 switch (icon) {192 case 'GovernmentT4A':193 Global.loadScript('views/reports/t4a_summary/T4ASummaryReportViewController', function () {194 $this.getWizardObject().getReport('pdf_form_government');195 });196 break;197 case 'taxReportsIcon_new_window':198 this.getWizardObject().showHTMLReport('T4ASummary', true);199 break;200 case 'taxReportsIcon':201 this.getWizardObject().showHTMLReport('T4ASummary');202 break;203 case 'T4AFormSetup':204 this.getWizardObject().minimize();205 IndexViewController.openReport(LocalCacheData.current_open_primary_controller, 'T4ASummaryReport', null, 'FormSetup');206 break;207 }208 break;209 //US210 case 'FW2':211 switch (icon) {212 case 'GovernmentW2':213 Global.loadScript('views/reports/formw2/FormW2ReportViewController', function () {214 $this.getWizardObject().getReport('pdf_form_government');215 });216 break;217 case 'taxReportsIcon_new_window':218 this.getWizardObject().showHTMLReport('FormW2Report', true);219 break;220 case 'taxReportsIcon':221 this.getWizardObject().showHTMLReport('FormW2Report');222 break;223 case 'W2FormSetup':224 this.getWizardObject().minimize();225 IndexViewController.openReport(LocalCacheData.current_open_primary_controller, 'FormW2Report', null, 'FormSetup');226 break;227 }228 break;229 case 'F1099MISC':230 switch (icon) {231 case 'Government1099Misc':232 Global.loadScript('views/reports/form1099/Form1099MiscReportViewController', function () {233 $this.getWizardObject().getReport('pdf_form_government');234 });235 break;236 case 'taxReportsIcon_new_window':237 this.getWizardObject().showHTMLReport('Form1099MiscReport', true);238 break;239 case 'taxReportsIcon':240 this.getWizardObject().showHTMLReport('Form1099MiscReport');241 break;242 case '1099MiscFormSetup':243 this.getWizardObject().minimize();244 IndexViewController.openReport(LocalCacheData.current_open_primary_controller, 'Form1099MiscReport', null, 'FormSetup');245 break;246 }247 break;248 case 'F940':249 switch (icon) {250 case 'Government940':251 Global.loadScript('views/reports/form940/Form940ReportViewController', function () {252 $this.getWizardObject().getReport('pdf_form');253 });254 break;255 case 'taxReportsIcon_new_window':256 this.getWizardObject().showHTMLReport('Form940', true);257 break;258 case 'taxReportsIcon':259 this.getWizardObject().showHTMLReport('Form940');260 break;261 case '940FormSetup':262 this.getWizardObject().minimize();263 IndexViewController.openReport(LocalCacheData.current_open_primary_controller, 'Form940Report', null, 'FormSetup');264 break;265 }266 break;267 case 'F941':268 switch (icon) {269 case 'Government941':270 Global.loadScript('views/reports/form941/Form941ReportViewController', function () {271 $this.getWizardObject().getReport('pdf_form');272 });273 break;274 case 'taxReportsIcon_new_window':275 this.getWizardObject().showHTMLReport('Form941', true);276 break;277 case 'taxReportsIcon':278 this.getWizardObject().showHTMLReport('Form941');279 break;280 case '941FormSetup':281 this.getWizardObject().minimize();282 IndexViewController.openReport(LocalCacheData.current_open_primary_controller, 'Form941Report', null, 'FormSetup');283 break;284 }285 break;286 case 'PBJ':287 switch (icon) {288 case 'taxReportsIcon_new_window':289 this.getWizardObject().showHTMLReport('PayrollExportReport', true);290 break;291 case 'taxReportsIcon':292 this.getWizardObject().showHTMLReport('PayrollExportReport');293 break;294 case 'PBJExportSetup':295 this.getWizardObject().minimize();296 IndexViewController.openReport(LocalCacheData.current_open_primary_controller, 'PayrollExportReport', null, 'ExportSetup');297 break;298 }299 break;300 case 'ROE':301 switch (icon) {302 case 'taxReportsIcon':303 $this.getWizardObject().getReport('pdf_form');304 break;305 }306 break;307 case 'NEWHIRE':308 switch (icon) {309 case 'taxReportsIcon':310 this.getWizardObject().showHTMLReport('UserSummaryReport');311 break;312 case 'taxReportsIcon_new_window':313 this.getWizardObject().showHTMLReport('UserSummaryReport', true);314 break;315 }316 break;317 default:318 switch (icon) {319 case 'taxReportsIcon_new_window':320 this.getWizardObject().showHTMLReport('TaxSummary', true);321 break;322 case 'taxReportsIcon':323 this.getWizardObject().showHTMLReport('TaxSummary');324 break;325 case 'TaxSummaryFormSetup':326 this.getWizardObject().minimize();327 IndexViewController.openReport(LocalCacheData.current_open_primary_controller, 'TaxSummaryReport');328 break;329 }330 }331 },332 initRightClickMenuForTaxReportViewButton: function( ) {333 var $this = this;334 var selector = '#taxReportsIcon';335 if ( $( selector ).length == 0 ) {336 return;337 }...

Full Screen

Full Screen

PayrollRemittanceAgencyEventWizardStepSubmit.js

Source:PayrollRemittanceAgencyEventWizardStepSubmit.js Github

copy

Full Screen

...278 break;279 case 'NEWHIRE':280 switch (icon) {281 case 'taxReportsIcon_new_window':282 this.getWizardObject().showHTMLReport('TaxSummary', true);283 break;284 case 'taxReportsIcon':285 this.getWizardObject().showHTMLReport('TaxSummary');286 break;287 case 'efileDownload':288 $this.getWizardObject().getReport('csv'); //Use CSV until we get full eFile support.289 break;290 case 'eFileIcon':291 //show report.292 this.urlClick('file');293 break;294 }295 break;296 default:297 switch (icon) {298 case 'taxReportsIcon_new_window':299 this.getWizardObject().showHTMLReport('TaxSummary', true);300 break;301 case 'taxReportsIcon':302 this.getWizardObject().showHTMLReport('TaxSummary');303 break;304 case 'efileDownload':305 Global.loadScript('views/reports/tax_summary/TaxSummaryReportViewController', function () {306 $this.getWizardObject().getReport('efile');307 });308 break;309 case 'eFileIcon':310 //show report.311 this.urlClick('file');312 break;313 case ContextMenuIconName.payment_method:314 //show report.315 this.urlClick('payment');316 break;...

Full Screen

Full Screen

PayrollRemittanceAgencyEventWizard.js

Source:PayrollRemittanceAgencyEventWizard.js Github

copy

Full Screen

1PayrollRemittanceAgencyEventWizard = Wizard.extend({2 current_step: false,3 wizard_name: $.i18n._('Tax Wizard'),4 selected_remittance_agency_event: null,5 selected_remittance_agency_event_id: null,6 payroll_remittance_agency_event_block:null,7 wizard_id: 'PayrollRemittanceAgencyEventWizard',8 _step_map: {9 'home': {script_path:'views/payroll/remittance_wizard/PayrollRemittanceAgencyEventWizardStepHome.js', object_name:'PayrollRemittanceAgencyEventWizardStepHome'},10 'review': {script_path:'views/payroll/remittance_wizard/PayrollRemittanceAgencyEventWizardStepReview.js', object_name:'PayrollRemittanceAgencyEventWizardStepReview'},11 'submit': {script_path:'views/payroll/remittance_wizard/PayrollRemittanceAgencyEventWizardStepSubmit.js', object_name:'PayrollRemittanceAgencyEventWizardStepSubmit'},12 'publish': {script_path:'views/payroll/remittance_wizard/PayrollRemittanceAgencyEventWizardStepPublish.js', object_name:'PayrollRemittanceAgencyEventWizardStepPublish'},13 },14 init: function (){15 var $this = this;16 },17 render: function(){18 //do render stuff19 },20 /**21 * builds the event data block used on several steps in this wizard.22 * @param container_id23 * @param data24 */25 buildEventDataBlock: function(container_id, data){26 $('#'+container_id).remove(); //never allow this to duplicate on the wizard.27 var div = $("<div id='" +container_id+ "' class='payroll_remittance_agency_event_wizard_event_details'><table></table></div>");28 var step_obj = this.getStepObject( this.getCurrentStepName() );29 step_obj.append( div );30 var even = false;31 var td_label, td_value;32 if ( this.payroll_remittance_agency_event_block == null ) {33 var column_one_keys = [34 {key: 'legal_entity_legal_name', title: $.i18n._('Legal Entity') },35 {key: 'payroll_remittance_agency_name', title: $.i18n._('Agency') },36 {key: 'type', title: $.i18n._('Event') },37 ];38 var column_two_keys = [39 {key: 'frequency', title: $.i18n._('Frequency') },40 {key: 'time_period', title: $.i18n._('Time Period') },41 {key: 'due_date', title: $.i18n._('Due Date') },42 ];43 var upper_bound = ( column_one_keys.length > column_two_keys.length ) ? column_one_keys.length : column_two_keys.length;44 for ( var i = 0; i < upper_bound; i++ ) {45 var tr = $('<tr/>');46 if ( column_one_keys.length > i ) {47 var label = $('<td class="label col1" />');48 label.html( column_one_keys[i].title +':' );49 var value = $('<td class="value" />');50 value.html( data[ column_one_keys[i].key ] );51 tr.append( label );52 tr.append( value );53 } else {54 tr.append( $('<td/>') );55 tr.append( $('<td/>') );56 }57 if ( column_two_keys.length > i ) {58 var label = $('<td class="label col2" />');59 label.html( column_two_keys[i].title +':' );60 var value = $('<td class="value" />');61 if ( column_two_keys[i].key == 'time_period' ){62 value.html( data.start_date +' - '+ data.end_date );63 } else {64 value.html( data[ column_two_keys[i].key ] );65 }66 tr.append( label );67 tr.append( value );68 } else {69 tr.append( $('<td/>') );70 tr.append( $('<td/>') );71 }72 $('#' + container_id + ' table').append(tr);73 }74 this.payroll_remittance_agency_event_block = $('#' + container_id + ' table').html();75 } else {76 $('#' + container_id + ' table').html( this.payroll_remittance_agency_event_block );77 }78 },79 /**80 * both args required.81 * @param id82 * @param callback83 */84 getPayrollRemittanceAgencyEventById: function( id, columns, callback ){85 //Stright to the callback if nothing has changed. if ( this.selected_remittance_agency_event.id != id) {86 if (typeof callback == 'function' && this.selected_remittance_agency_event && this.selected_remittance_agency_event.id == id) {87 callback( this.selected_remittance_agency_event );88 } else {89 var filter = {90 filter_data: {91 id: this.selected_remittance_agency_event_id92 },93 };94 if( columns == null || typeof columns == 'undefined' ){95 filter.filter_columns = {96 'legal_entity_legal_name': true,97 'payroll_remittance_agency_name': true,98 'user_report_data_id': true,99 'status': true,100 'type': true,101 'type_id': true,102 'frequency': true,103 'start_date': true,104 'end_date': true,105 'due_date': true106 }107 } else {108 filter.columns = columns;109 }110 var $this = this;111 var api_payroll_remittance_agency_event = new (APIFactory.getAPIClass('APIPayrollRemittanceAgencyEvent'))();112 api_payroll_remittance_agency_event.getPayrollRemittanceAgencyEvent(filter, {113 onResult: function (result) {114 var result = result.getResult()[0];115 if (typeof callback == 'function') {116 callback(result);117 }118 }119 });120 }121 },122 /**123 * Allows us to open reports to give us access to their context menu code from within wizards.124 *125 * @param report_type126 * @param report_obj127 * @param callback128 */129 getReport: function( render_type, post_data ) {130 if( !post_data ) {131 post_data = {132 0: this.selected_remittance_agency_event_id,133 1: render_type,134 };135 }136 Global.APIFileDownload( 'APIPayrollRemittanceAgencyEvent','getReportData', post_data );137 },138 /**139 * Displays html report. Does not close wizard, but leaves it up in the background.140 * @param report_name141 * @param post_data142 */143 showHTMLReport: function ( report_name, new_window ) {144 ProgressBar.showOverlay();145 var api = new (APIFactory.getAPIClass( 'APIPayrollRemittanceAgencyEvent' ))();146 api['getReportData']( this.selected_remittance_agency_event_id, 'html', {147 onResult: function (res) {148 var result = res.getResult();149 if (result) {150 if ( new_window ) {151 var w = window.open();152 w.document.writeln( result.api_retval );153 w.document.close();154 } else if ( result ) {155 IndexViewController.openWizard( 'ReportViewWizard', result.api_retval );156 }157 }158 ProgressBar.closeOverlay();159 }160 });161 },162 /**163 * @param e164 */165 onDone: function (e) {166 if ( e === true || $(e.target).hasClass('disable-image') == false ) {167 var $this = this;168 this.getPayrollRemittanceAgencyEventById( this.selected_remittance_agency_event_id, {}, function(result){169 if ( result ) {170 result.enable_recalculate_dates = 1;171 result.last_due_date = result.due_date;172 var api_payroll_remittance_agency_event = new (APIFactory.getAPIClass('APIPayrollRemittanceAgencyEvent'))();173 api_payroll_remittance_agency_event.setPayrollRemittanceAgencyEvent(result, false, true, {174 onResult: function (result) {175 $this.cleanUp();176 },177 });178 }179 });180 }181 },...

Full Screen

Full Screen

protractor.conf.js

Source:protractor.conf.js Github

copy

Full Screen

1// Protractor configuration file, see link for more information https://github.com/angular/protractor/blob/master/lib/config.ts2const { SpecReporter } = require('jasmine-spec-reporter');3var HtmlScreenshotReporter = require('protractor-jasmine2-screenshot-reporter');4var globalConfigs = require('./e2e/tix.global-config.json');5const showSpecReport = globalConfigs.showSpecReport;6const showHtmlReport = globalConfigs.showHtmlReport;7var htmlScreenshotReporter = new HtmlScreenshotReporter({8 reportTitle: "Tradeix e2e Last Automation Log",9 dest: 'src/app/test-report/screenshots',10 filename: 'test.component.html',11 captureOnlyFailedSpecs: true,12 reportOnlyFailedSpecs: false13});14var specReporter = new SpecReporter({15 spec: {16 displayStacktrace: true17 }18});19let allSpecs = [globalConfigs.specs.login].concat(globalConfigs.specs[globalConfigs.loginUserType], [globalConfigs.specs.logout]);20exports.config = {21 allScriptsTimeout: 60000,22 specs: allSpecs,23 seleniumAddress: 'http://localhost:4444/wd/hub',24 capabilities: {25 browserName: 'chrome',26 os: 'Windows',27 },28 directConnect: true,29 baseUrl: 'http://localhost:4200/',30 framework: 'jasmine2',31 jasmineNodeOpts: {32 showColors: true,33 defaultTimeoutInterval: 60000,34 print: function () {}35 },36 onPrepare() {37 browser.driver.manage().window().maximize();38 require('ts-node').register({39 project: 'e2e/tsconfig.e2e.json'40 });41 if(showSpecReport) {42 jasmine.getEnv().addReporter(specReporter);43 }44 if(showHtmlReport) {45 jasmine.getEnv().addReporter(htmlScreenshotReporter);46 }47 },48 beforeLaunch: () => {49 return new Promise((resolve) => {50 if (showHtmlReport) {51 htmlScreenshotReporter.beforeLaunch(resolve);52 }53 });54 },55 afterLaunch: (exitCode) => {56 return new Promise((resolve) => {57 if (showHtmlReport) {58 htmlScreenshotReporter.afterLaunch(resolve.bind(this, exitCode));59 }60 });61 }...

Full Screen

Full Screen

htmlReport.js

Source:htmlReport.js Github

copy

Full Screen

1/*2 * HTML Report tool3 *4 * When selected displays the standard HTML report in a new window / tab5 */6const HtmlReport = (function () {7 // Constants8 // todo: could probably switch this to a config file?9 const NAME = 'htmlReport';10 const LABEL = I18n.t('html_report_tool');11 const ICON = 'report.png';12 // Todo: change this to a util function that reads in a config file (json/xml)13 function initializeStorage() {14 const tool = {};15 tool.name = NAME;16 tool.label = LABEL;17 tool.data = '';18 tool.icon = ICON;19 tool.panel = '';20 tool.position = 0;21 utils.writeTool(tool);22 }23 function showOptions(tabId) {24 const config = {};25 config.tool = NAME;26 config.toolLabel = LABEL;27 config.options = {remove: I18n.t('common_remove')};28 utils.messageFrame(tabId, 'display', {action: 'showButtonOptions', config})29 .then(response => {30 // Handle button choice31 if (response.id === 'remove') {32 utils.removeToolFromPanel(tabId, NAME);33 }34 })35 .catch(utils.errorHandler);36 }37 function showHtmlReport(tabId) {38 utils.messageFrame(tabId, 'display', {action: 'showHtmlReport'})39 .catch(utils.errorHandler);40 }41 self.addEventListener('activate', event => {42 initializeStorage();43 });44 self.addEventListener('message', event => {45 const message = event.data;46 // Broadcasts47 switch (message.action) {48 case 'initializeTools':49 initializeStorage();50 break;51 default:52 break;53 }54 // Directed55 if (message.tool === NAME) {56 switch (message.action) {57 case 'buttonClicked':58 showHtmlReport(message.tabId);59 break;60 case 'buttonMenuClicked':61 showOptions(message.tabId);62 break;63 default:64 break;65 }66 }67 });68 return {69 name: NAME,70 initialize: initializeStorage71 };72})();...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1const { showHTMLReport } = require('@playwright/test/lib/htmlReporter');2showHTMLReport();3const { showHTMLReport } = require('@playwright/test/lib/htmlReporter');4showHTMLReport();5const { showHTMLReport } = require('@playwright/test/lib/htmlReporter');6showHTMLReport();7const { showHTMLReport } = require('@playwright/test/lib/htmlReporter');8showHTMLReport();9const { showHTMLReport } = require('@playwright/test/lib/htmlReporter');10showHTMLReport();11const { showHTMLReport } = require('@playwright/test/lib/htmlReporter');12showHTMLReport();13const { showHTMLReport } = require('@playwright/test/lib/htmlReporter');14showHTMLReport();15const { showHTMLReport } = require('@playwright/test/lib/htmlReporter');16showHTMLReport();17const { showHTMLReport } = require('@playwright/test/lib/htmlReporter');18showHTMLReport();19const { showHTMLReport } = require('@playwright/test/lib/htmlReporter');20showHTMLReport();21const { showHTMLReport } = require('@playwright/test/lib/htmlReporter');22showHTMLReport();23const { showHTMLReport } = require('@playwright/test/lib/htmlReporter');24showHTMLReport();25const { showHTMLReport } = require('@playwright/test/lib/htmlReporter');26showHTMLReport();

Full Screen

Playwright tutorial

LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.

Chapters:

  1. What is Playwright : Playwright is comparatively new but has gained good popularity. Get to know some history of the Playwright with some interesting facts connected with it.
  2. How To Install Playwright : Learn in detail about what basic configuration and dependencies are required for installing Playwright and run a test. Get a step-by-step direction for installing the Playwright automation framework.
  3. Playwright Futuristic Features: Launched in 2020, Playwright gained huge popularity quickly because of some obliging features such as Playwright Test Generator and Inspector, Playwright Reporter, Playwright auto-waiting mechanism and etc. Read up on those features to master Playwright testing.
  4. What is Component Testing: Component testing in Playwright is a unique feature that allows a tester to test a single component of a web application without integrating them with other elements. Learn how to perform Component testing on the Playwright automation framework.
  5. Inputs And Buttons In Playwright: Every website has Input boxes and buttons; learn about testing inputs and buttons with different scenarios and examples.
  6. Functions and Selectors in Playwright: Learn how to launch the Chromium browser with Playwright. Also, gain a better understanding of some important functions like “BrowserContext,” which allows you to run multiple browser sessions, and “newPage” which interacts with a page.
  7. Handling Alerts and Dropdowns in Playwright : Playwright interact with different types of alerts and pop-ups, such as simple, confirmation, and prompt, and different types of dropdowns, such as single selector and multi-selector get your hands-on with handling alerts and dropdown in Playright testing.
  8. Playwright vs Puppeteer: Get to know about the difference between two testing frameworks and how they are different than one another, which browsers they support, and what features they provide.
  9. Run Playwright Tests on LambdaTest: Playwright testing with LambdaTest leverages test performance to the utmost. You can run multiple Playwright tests in Parallel with the LammbdaTest test cloud. Get a step-by-step guide to run your Playwright test on the LambdaTest platform.
  10. Playwright Python Tutorial: Playwright automation framework support all major languages such as Python, JavaScript, TypeScript, .NET and etc. However, there are various advantages to Python end-to-end testing with Playwright because of its versatile utility. Get the hang of Playwright python testing with this chapter.
  11. Playwright End To End Testing Tutorial: Get your hands on with Playwright end-to-end testing and learn to use some exciting features such as TraceViewer, Debugging, Networking, Component testing, Visual testing, and many more.
  12. Playwright Video Tutorial: Watch the video tutorials on Playwright testing from experts and get a consecutive in-depth explanation of Playwright automation testing.

Run Playwright Internal automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful