Ignore:
Timestamp:
02/24/15 16:58:55 (9 years ago)
Author:
emanuel.dima@uni-tuebingen.de
Message:
  1. alpha 21: downloading as text, csv, excel and tcf works
File:
1 edited

Legend:

Unmodified
Added
Removed
  • SRUAggregator/trunk/src/main/resources/assets/js/main.jsx

    r5976 r6043  
    33"use strict";
    44
    5 var VERSION = "VERSION 2.0.0.α20";
     5var VERSION = "VERSION 2.0.0.α21";
    66var URLROOT = "/Aggregator-testing";
    77
     
    1313var Main = React.createClass({
    1414        componentWillMount: function() {
    15                 routeFromLocation(this);
     15                routeFromLocation.bind(this);
    1616        },
    1717
     
    102102                        }
    103103                        this.setState({navbarPageFn: pageFn});
    104                         console.log("new page: " + document.location + ", name: " + pageFnName);
     104                        // console.log("new page: " + document.location + ", name: " + pageFnName);
    105105                }
    106106        },
     
    193193                        success: function(json, textStatus, jqXHR) {
    194194                                this.setState({stats: json});
    195                                 console.log("stats:", json);
     195                                // console.log("stats:", json);
    196196                        }.bind(this),
    197197                });
     
    294294
    295295        renderInstitution: function(isScan, inst) {
    296                 return  <div style={{marginBottom:30}} key={inst[0]}>
     296                return  <div style={{marginTop:30}} key={inst[0]}>
    297297                                        <h4>{inst[0]}</h4>
    298298                                        <div style={{marginLeft:20}}> {_.pairs(inst[1]).map(this.renderEndpoint.bind(this, isScan)) }</div>
     
    302302        renderStatistics: function(stats) {
    303303                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>
    309314                                                }
    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>
    317317                                        <div> { _.pairs(stats.institutions).map(this.renderInstitution.bind(this, stats.isScan)) } </div>
    318318                                </div>
     
    508508}
    509509
    510 var routeFromLocation = function(com) {
     510var routeFromLocation = function() {
     511        // console.log("routeFromLocation: " + document.location);
     512        if (!this) throw "routeFromLocation must be bound to main";
    511513        var path = window.location.pathname.split('/');
    512514        if (path.length === 3) {
    513515                var p = path[2];
    514516                if (p === 'help') {
    515                         com.toHelp(false);
     517                        this.toHelp(false);
    516518                } else if (p === 'about') {
    517                         com.toAbout(false);
     519                        this.toAbout(false);
    518520                } else if (p === 'stats') {
    519                         com.toStatistics(false);
     521                        this.toStatistics(false);
    520522                } else {
    521                         com.toAggregator(false);
     523                        this.toAggregator(false);
    522524                }
    523525        } else {
    524                 com.toAggregator(false);
     526                this.toAggregator(false);
    525527        }
    526528};
     
    529531React.render(<Footer />, document.getElementById('footer') );
    530532
    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;
     533window.onpopstate = routeFromLocation.bind(main);
     534
     535routeFromLocation.bind(main)();
    537536
    538537})();
     
    544543
    545544
    546 
    547 
    548 
    549 
    550 
    551 
    552 
    553 
    554 
    555 
    556 
    557 
Note: See TracChangeset for help on using the changeset viewer.