@@ -6,7 +6,7 @@ angular.module('cesium.es.document.controllers', ['cesium.es.services'])
66 $stateProvider
77
88 . state ( 'app.document_search' , {
9- url : "/data/search/:index/:type?q" ,
9+ url : "/data/search/:index/:type?q&sort " ,
1010 views : {
1111 'menuContent' : {
1212 templateUrl : "plugins/es/templates/document/lookup.html" ,
@@ -47,8 +47,10 @@ function ESDocumentLookupController($scope, $ionicPopover, $location, $timeout,
4747 $scope . helptipPrefix = 'helptip-document' ;
4848 $scope . compactMode = angular . isDefined ( $scope . compactMode ) ? $scope . compactMode : true ;
4949 $scope . _source = $scope . _source || [ "issuer" , "hash" , "time" , "creationTime" , "title" , "message" , "recipient" ,
50- // Movement field:
51- "medianTime" , "amount" , "currency" , "reference"
50+ // Movement fields:
51+ "medianTime" , "amount" , "currency" , "reference" ,
52+ // Pending fields:
53+ "pubkey" , "uid" , "blockNumber"
5254 ] ;
5355 $scope . showHeaders = angular . isDefined ( $scope . showHeaders ) ? $scope . showHeaders : true ;
5456
@@ -62,6 +64,14 @@ function ESDocumentLookupController($scope, $ionicPopover, $location, $timeout,
6264 $scope . entered = true ;
6365 $scope . search . index = state . stateParams && state . stateParams . index || $scope . search . index ;
6466 $scope . search . type = state . stateParams && state . stateParams . type || $scope . search . type ;
67+ $scope . search . text = state . stateParams && state . stateParams . q || $scope . search . text ;
68+ $scope . search . sort = state . stateParams && state . stateParams . sort || $scope . search . sort ;
69+ $scope . search . last = ! $scope . search . text ;
70+ $scope . load ( ) ;
71+ }
72+
73+ // Reload only if params changed (.e.g if comes from a graph click)
74+ else if ( state . stateParams && state . stateParams . q && $scope . search . text !== state . stateParams . q ) {
6575 $scope . search . text = state . stateParams && state . stateParams . q || $scope . search . text ;
6676 $scope . search . last = ! $scope . search . text ;
6777 $scope . load ( ) ;
0 commit comments