Skip to content

Commit 48a428e

Browse files
committed
Added capabililty for grabbing guide links on entity detail popup
1 parent 46991e4 commit 48a428e

File tree

2 files changed

+45
-187248
lines changed

2 files changed

+45
-187248
lines changed

pubdev/jsdev/react_components/modal/entity_detail.jsx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -892,6 +892,50 @@ let EntityReferences = React.createClass( {
892892
}.bind( this )
893893
} );
894894

895+
///GUIDES
896+
this.guidesRequest = $.ajax( {
897+
type: 'get',
898+
url: 'scot/api/v2/entity/' + this.props.entityid + '/guide',
899+
data: {sort:JSON.stringify( {'id':-1} )},
900+
traditional: true,
901+
success: function( result ) {
902+
var result = result.records;
903+
let recordNumber = result.length;
904+
let arr = [];
905+
let arrPromoted = [];
906+
let arrClosed = [];
907+
let arrOpen = [];
908+
if ( this.state.maxRecords ) { recordNumber = this.state.maxRecords; }
909+
for( let i=0; i < recordNumber; i++ ) {
910+
if ( result[i] != null ) {
911+
if ( result[i].status == 'promoted' ){
912+
arrPromoted.push( <ReferencesBody type={'guide'} data={result[i]} index={i} errorToggle={this.props.errorToggle}/> );
913+
} else if ( result[i].status == 'closed' ) {
914+
arrClosed.push( <ReferencesBody type={'guide'} data={result[i]} index={i} errorToggle={this.props.errorToggle}/> );
915+
} else {
916+
arrOpen.push( <ReferencesBody type={'guide'} data={result[i]} index={i} errorToggle={this.props.errorToggle}/> );
917+
}
918+
}
919+
}
920+
arr.push( arrPromoted );
921+
arr.push( arrClosed );
922+
arr.push( arrOpen );
923+
if ( this.state.isMounted ) {
924+
if ( result.length >= 100 ) {
925+
this.props.showFullEntityButton();
926+
}
927+
this.props.updateAppearances( result.length );
928+
this.setState( {entityDataIncident:arr, loadingIncidents:false} );
929+
if ( this.state.loadingAlerts == false && this.state.loadingEvents == false && this.state.loadingIncidents == false && this.state.loadingIntel == false && this.state.loadingSignature == false ) {
930+
this.setState( {loading:false} );
931+
}
932+
}
933+
}.bind( this ),
934+
error: function( data ) {
935+
this.props.errorToggle( 'failed to get entity references for guides', data );
936+
}.bind( this )
937+
} );
938+
895939
this.incidentRequest = $.ajax( {
896940
type: 'get',
897941
url: 'scot/api/v2/entity/' + this.props.entityid + '/incident',

0 commit comments

Comments
 (0)