Ignore:
Timestamp:
01/26/15 15:12:46 (9 years ago)
Author:
emanuel.dima@uni-tuebingen.de
Message:
  1. alpha14: collections view stable sorting, better filtering; upfront diagnostic messages for search
File:
1 edited

Legend:

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

    r5931 r5954  
    6565                corpus.expanded = false; // not expanded in the corpus view
    6666                corpus.priority = 1; // priority in corpus view
    67                 corpus.index = index;
     67                corpus.index = index; // original order, used for stable sort
    6868        });
    6969}
     
    7979Corpora.prototype.recurseCorpora = function(corpora, fn) {
    8080        var recfn = function(corpus, index){
    81                 if (false === fn(corpus)) {
     81                if (false === fn(corpus, index)) {
    8282                        // no recursion
    8383                } else {
     
    284284
    285285        stop: function(e) {
    286                 e.preventDefault();
    287286                e.stopPropagation();
    288287        },
     
    296295                                endRecord: corpusHit.endRecord,
    297296                                exception: corpusHit.exception,
     297                                diagnostics: corpusHit.diagnostics,
    298298                                searchString: corpusHit.searchString,
    299299                                kwics: corpusHit.kwics.filter(function(kwic){
     
    379379                                                                <span className="input-group-addon nobkg">and show up to</span>
    380380                                                                <div className="input-group-btn">
    381                                                                         <input type="number" className="form-control input" min="10" max="250" step="5"
    382                                                                                 style={{width:54}}
     381                                                                        <input type="number" className="form-control input" min="10" max="250"
     382                                                                                style={{width:60}}
    383383                                                                                onChange={this.setNumberOfResults} value={this.state.numberOfResults}
    384384                                                                                onKeyPress={this.stop}/>
     
    556556
    557557        renderRowLanguage: function(hit) {
    558                 return <span style={{fontFace:"Courier",color:"black"}}>{hit.language} </span> ;
     558                return false; //<span style={{fontFace:"Courier",color:"black"}}>{hit.language} </span> ;
    559559        },
    560560
     
    619619        },
    620620
     621        renderDiagnostics: function(corpusHit) {
     622                if (!corpusHit.diagnostics || corpusHit.diagnostics.length === 0) {
     623                        return false;
     624                }
     625
     626                return corpusHit.diagnostics.map(function(d) {
     627                        return  <div className="alert alert-danger" role="alert">
     628                                                {d.dgnMessage}{": "}{d.dgnDiagnostic}
     629                                        </div>;
     630                });
     631        },
     632
    621633        renderPanelBody: function(corpusHit) {
    622                 var fulllength = {width:"100%"};               
     634                var fulllength = {width:"100%"};
    623635                if (this.state.displayKwic) {
    624                         return  <table className="table table-condensed table-hover" style={fulllength}>
    625                                                 <tbody>{corpusHit.kwics.map(this.renderRowsAsKwic)}</tbody>
    626                                         </table>;
     636                        return  <div>
     637                                                {this.renderDiagnostics(corpusHit)}
     638                                                <table className="table table-condensed table-hover" style={fulllength}>
     639                                                        <tbody>{corpusHit.kwics.map(this.renderRowsAsKwic)}</tbody>
     640                                                </table>
     641                                        </div>;
    627642                } else {
    628                         return  <div>{corpusHit.kwics.map(this.renderRowsAsHits)}</div>;
     643                        return  <div>
     644                                                {this.renderDiagnostics(corpusHit)}
     645                                                {corpusHit.kwics.map(this.renderRowsAsHits)}
     646                                        </div>;
    629647                }
    630648        },
    631649
    632650        renderResultPanels: function(corpusHit) {
    633                 if (corpusHit.kwics.length === 0) {
     651                if (corpusHit.kwics.length === 0 &&
     652                        corpusHit.diagnostics.length === 0) {
    634653                        return false;
    635654                }
Note: See TracChangeset for help on using the changeset viewer.