- Timestamp:
- 02/24/15 16:58:55 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
SRUAggregator/trunk/src/main/resources/assets/js/main.jsx
r5976 r6043 3 3 "use strict"; 4 4 5 var VERSION = "VERSION 2.0.0.α2 0";5 var VERSION = "VERSION 2.0.0.α21"; 6 6 var URLROOT = "/Aggregator-testing"; 7 7 … … 13 13 var Main = React.createClass({ 14 14 componentWillMount: function() { 15 routeFromLocation (this);15 routeFromLocation.bind(this); 16 16 }, 17 17 … … 102 102 } 103 103 this.setState({navbarPageFn: pageFn}); 104 console.log("new page: " + document.location + ", name: " + pageFnName);104 // console.log("new page: " + document.location + ", name: " + pageFnName); 105 105 } 106 106 }, … … 193 193 success: function(json, textStatus, jqXHR) { 194 194 this.setState({stats: json}); 195 console.log("stats:", json);195 // console.log("stats:", json); 196 196 }.bind(this), 197 197 }); … … 294 294 295 295 renderInstitution: function(isScan, inst) { 296 return <div style={{margin Bottom:30}} key={inst[0]}>296 return <div style={{marginTop:30}} key={inst[0]}> 297 297 <h4>{inst[0]}</h4> 298 298 <div style={{marginLeft:20}}> {_.pairs(inst[1]).map(this.renderEndpoint.bind(this, isScan)) }</div> … … 302 302 renderStatistics: function(stats) { 303 303 return <div className="container statistics" style={{marginTop:20}}> 304 <ul className='list-inline list-unstyled'> 305 { stats.maxConcurrentScanRequestsPerEndpoint ? 306 <li>max concurrent scan requests per endpoint:{" "} 307 <kbd>{stats.maxConcurrentScanRequestsPerEndpoint}</kbd>, 308 </li> : false 304 <div> 305 <div>Start date: {new Date(stats.date).toLocaleString()}</div> 306 { stats.isScan ? 307 <div>Max concurrent scan requests per endpoint:{" "} 308 <kbd>{stats.maxConcurrentScanRequestsPerEndpoint}</kbd> 309 </div> 310 : 311 <div>Max concurrent search requests per endpoint:{" "} 312 <kbd>{stats.maxConcurrentSearchRequestsPerEndpoint}</kbd> 313 </div> 309 314 } 310 { stats.maxConcurrentSearchRequestsPerEndpoint ? 311 <li>max concurrent search requests per endpoint:{" "} 312 <kbd>{stats.maxConcurrentSearchRequestsPerEndpoint}</kbd>, 313 </li> : false 314 } 315 <li>timeout:{" "}<kbd>{stats.timeout} seconds</kbd></li> 316 </ul> 315 <div>Timeout: {" "}<kbd>{stats.timeout} seconds</kbd></div> 316 </div> 317 317 <div> { _.pairs(stats.institutions).map(this.renderInstitution.bind(this, stats.isScan)) } </div> 318 318 </div> … … 508 508 } 509 509 510 var routeFromLocation = function(com) { 510 var routeFromLocation = function() { 511 // console.log("routeFromLocation: " + document.location); 512 if (!this) throw "routeFromLocation must be bound to main"; 511 513 var path = window.location.pathname.split('/'); 512 514 if (path.length === 3) { 513 515 var p = path[2]; 514 516 if (p === 'help') { 515 com.toHelp(false);517 this.toHelp(false); 516 518 } else if (p === 'about') { 517 com.toAbout(false);519 this.toAbout(false); 518 520 } else if (p === 'stats') { 519 com.toStatistics(false);521 this.toStatistics(false); 520 522 } else { 521 com.toAggregator(false);523 this.toAggregator(false); 522 524 } 523 525 } else { 524 com.toAggregator(false);526 this.toAggregator(false); 525 527 } 526 528 }; … … 529 531 React.render(<Footer />, document.getElementById('footer') ); 530 532 531 window.onpopstate = function(event) { 532 console.log("popped location: " + document.location + ", state: " + JSON.stringify(event.state)); 533 routeFromLocation(main); 534 }; 535 536 window.main = main; 533 window.onpopstate = routeFromLocation.bind(main); 534 535 routeFromLocation.bind(main)(); 537 536 538 537 })(); … … 544 543 545 544 546 547 548 549 550 551 552 553 554 555 556 557
Note: See TracChangeset
for help on using the changeset viewer.