Advertisement
Guest User

Untitled

a guest
Sep 11th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. render() {
  2.     const globalAppStyles = {
  3.       color: GlobalStyles.FONT_COLOR,
  4.       gridTemplateRows: `${this.TOP_AND_BOTTOM_BAR_HEIGHT}px 1fr ${this.TOP_AND_BOTTOM_BAR_HEIGHT}px`
  5.     };
  6.  
  7.     const scrollBarTrackHeightInPixels = this.determineScrollBarTrackHeightInPixels();
  8.    
  9.     const scrollBarHeadHeightInPercent = Math.min(this.determineScrollHeadHeightInPercent(), 1);
  10.     const scrollBarHeadHeightInPixels = scrollBarHeadHeightInPercent * scrollBarTrackHeightInPixels;
  11.    
  12.     const numOfRowsThatFitInTable = this.determineNumOfRowsThatFitInTable();
  13.     const scrollDistanceInPercent = this.state.tableOffset === 0 ? 0 : this.state.tableOffset / (this.state.filteredJobList.length - numOfRowsThatFitInTable);
  14.     let scrollOffsetInPixels = scrollDistanceInPercent * this.determineMaxScrollBarHeadOffset();
  15.  
  16.  
  17.     // used in the top and bottom bars for positioning buttons and dropdowns
  18.     const TOP_BOTTOM_BAR_COLUMN_PADDING = 10;
  19.     const clickableElementStyles = {
  20.       width: `calc(100% - ${TOP_BOTTOM_BAR_COLUMN_PADDING * 2}px)`,
  21.       marginLeft: TOP_BOTTOM_BAR_COLUMN_PADDING + "px",
  22.       marginTop: TOP_BOTTOM_BAR_COLUMN_PADDING + "px",
  23.       height: this.TOP_AND_BOTTOM_BAR_HEIGHT - (TOP_BOTTOM_BAR_COLUMN_PADDING * 2) + "px"
  24.     };
  25.  
  26.     const contextMenu = this.state.contextMenu.visible ?
  27.       <ContextMenu
  28.         AE={this.AE}
  29.         position={this.state.contextMenu.position}
  30.         jobSelection={this.state.jobSelection.map((jobIndex) => this.state.filteredJobList[jobIndex])}
  31.         fetchJobXMLStringsHandler={this.fetchJobXMLStringsHandler}
  32.         jobActionHandler={this.jobActionHandler}
  33.         restartHandler={this.restartHandler}
  34.         cancelHandler={this.cancelHandler}
  35.         bumpHandler={this.bumpHandler}
  36.         continueHandler={this.continueHandler} />
  37.       : null
  38.  
  39.     const duplicateJobWindows = this.state.contextMenu.duplicatedJobDetails.map((jobDetails) => {
  40.       return (
  41.         <DuplicateWindow
  42.           xmlString={jobDetails.xmlString}
  43.           jobID={jobDetails.jobID}
  44.           title={jobDetails.title}
  45.           closeWindowHandler={this.removeJobFromDuplicatedJobArray}
  46.           submitHandler={this.submitDuplicatedJob} />
  47.       );
  48.     });
  49.  
  50.     return (
  51.       <div
  52.         className={Classes.Nightwing} style={globalAppStyles}
  53.         onMouseMove={(event) => this.scrollDragMoveHandler(event.clientY)}>
  54.         {contextMenu}
  55.         {duplicateJobWindows}
  56.         <GridRow row="1">
  57.           <FilterBar
  58.             clickableElementStyles={clickableElementStyles}
  59.             height={this.TOP_AND_BOTTOM_BAR_HEIGHT}
  60.             filters={this.state.filters}
  61.             contentIDListOpen={this.state.contentIDListOpen}
  62.             contentIDListVisiblityUpdate={this.contentIDListVisiblityUpdate}
  63.             contentIDListValue={this.state.contentIDListValue}
  64.             contentIDListValueUpdateHandler={this.contentIDListValueUpdate}
  65.             filterUpdateHandler={this.filterUpdateHandler}
  66.             timeFilterUpdateHandler={this.timeFilterUpdateHandler}
  67.             filteredListUpdateHandler={this.filteredListUpdateHandler} />
  68.         </GridRow>
  69.         <GridRow row="2">
  70.           <Table
  71.             jobsToDraw={this.state.filteredJobList.slice(this.state.tableOffset, this.state.tableOffset + numOfRowsThatFitInTable)}
  72.             tableOffset={this.state.tableOffset}
  73.             tableRowClickToSelectHandler={this.tableRowClickToSelectHandler}
  74.             tableCellDoubleClicked={this.state.tableCellDoubleClicked}
  75.             tableCellDoubleClickToSelectHandler={this.tableCellDoubleClickToSelectHandler}
  76.             tableCellDoubleClickToSelectRemoveHandler={this.tableCellDoubleClickToSelectRemoveHandler}
  77.             tableOffsetUpdateHandler={this.tableOffsetUpdate}
  78.             scrollDragStartHandler={this.scrollDragStartHandler}
  79.             scrollBarState={this.state.scrollBar}
  80.             rowHeight={this.TABLE_ROW_HEIGHT}
  81.             scrollBarTrackHeight={scrollBarTrackHeightInPixels}
  82.             scrollBarHeadHeight={scrollBarHeadHeightInPixels}
  83.             scrollOffset={scrollOffsetInPixels}
  84.             jobSelection={this.state.jobSelection}
  85.             contextMenu={this.state.contextMenu}
  86.             tableRightClickDisplayContextMenu={this.tableRightClickDisplayContextMenu}
  87.             tableClickHideContextMenu={this.hideContextMenu}
  88.             sortProperty={this.state.sortProperty}
  89.             sortDirection={this.state.sortDirection}
  90.             updateSortHandler={this.updateSortHandler}>
  91.             {this.state.isLoading ? <LoadingBar loadingPercent={this.state.loadingPercent} /> : null}
  92.           </Table>
  93.         </GridRow>
  94.         <GridRow row="3">
  95.           <InfoBar
  96.               clickableElementStyles={clickableElementStyles}
  97.               height={this.TOP_AND_BOTTOM_BAR_HEIGHT}
  98.               selectedCount={this.state.jobSelection.length}
  99.               resultCount={this.state.filteredJobList.length}
  100.               failureCount={this.countJobsByStatus("filteredJobList").failed || 0}
  101.               missingCount={23} />
  102.         </GridRow>
  103.       </div>
  104.     );
  105.   }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement