Skip to content

Commit 9944a1a

Browse files
committed
Resolves jshint/test failures with splainer-search upgrade
- Searchers no longer set 'inError' they reject their promise, so an explicit failure needs to be handled - dependencies need to be upgraded to all use angular 1.4.x libs - jshint errors complaining about underscores instead of camelcase
1 parent e0cc44a commit 9944a1a

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

.jshintrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"eqeqeq": true,
99
"immed": true,
1010
"indent": 2,
11-
"latedef": true,
11+
"latedef": "nofunc",
1212
"newcap": true,
1313
"noarg": true,
1414
"quotmark": "single",

app/scripts/controllers/docSelector.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
angular.module('splain-app')
4-
.controller('DocSelectorCtrl', function DocExplainCtrl($scope, spl_searchSvc, solrUrlSvc, settingsStoreSvc) {
4+
.controller('DocSelectorCtrl', function DocExplainCtrl($scope, splSearchSvc, solrUrlSvc, settingsStoreSvc) {
55
// this controller is a bit silly just because
66
// modals need their own controller
77

@@ -25,14 +25,14 @@ angular.module('splain-app')
2525
// we should be using the solrUrlSvc to do this
2626
searchSettings.searchArgsStr = addToSolrArgs(searchSettings.searchArgsStr,
2727
{'explainOther': [altQuery]});
28-
var explainOtherSearch = spl_searchSvc.createSearch(searchSettings);
28+
var explainOtherSearch = splSearchSvc.createSearch(searchSettings);
2929
explainOtherSearch.search()
3030
.then(function() {
3131
// but we don't get anything but an explain, so let's re-search
3232
// and try to pull back the right data
3333
searchSettings = angular.copy(searchSettings);
3434
searchSettings.searchArgsStr = 'q=' + altQuery;
35-
$scope.currSearch = spl_searchSvc.createSearch(searchSettings, explainOtherSearch.searcher.othersExplained);
35+
$scope.currSearch = splSearchSvc.createSearch(searchSettings, explainOtherSearch.searcher.othersExplained);
3636
$scope.currSearch.search();
3737
});
3838
};

app/scripts/controllers/searchResults.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* Controller of the frontendApp
99
*/
1010
angular.module('splain-app')
11-
.controller('SearchResultsCtrl', function ($scope, spl_searchSvc, settingsStoreSvc) {
11+
.controller('SearchResultsCtrl', function ($scope, splSearchSvc, settingsStoreSvc) {
1212

1313

1414
$scope.search = {};
@@ -27,7 +27,7 @@ angular.module('splain-app')
2727

2828
$scope.search.reset = function() {
2929
var searchSettings = settingsStoreSvc.settings;
30-
$scope.currSearch = spl_searchSvc.createSearch(searchSettings);
30+
$scope.currSearch = splSearchSvc.createSearch(searchSettings);
3131
};
3232

3333
$scope.search.reset();

app/scripts/services/splSearchSvc.js

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
angular.module('splain-app')
4-
.service('spl_searchSvc', function solrSettingsSvc(solrUrlSvc, fieldSpecSvc, searchSvc, normalDocsSvc) {
4+
.service('splSearchSvc', function splSearchSvc(solrUrlSvc, fieldSpecSvc, searchSvc, normalDocsSvc) {
55

66
this.states = {
77
NO_SEARCH: 0,
@@ -110,13 +110,9 @@ angular.module('splain-app')
110110

111111
var thisSearch = this;
112112
this.searcher.search()
113-
.then(function() {
113+
.then(function success() {
114114
thisSearch.linkUrl = thisSearch.searcher.linkUrl;
115115
thisSearch.numFound = thisSearch.searcher.numFound;
116-
if (thisSearch.searcher.inError) {
117-
thisSearch.state = thisSvc.states.IN_ERROR;
118-
return;
119-
}
120116
angular.forEach(thisSearch.searcher.docs, function(doc) {
121117
var overridingExpl = thisSearch.getOverridingExplain(doc, fieldSpec);
122118
var normalDoc = normalDocsSvc.createNormalDoc(fieldSpec, doc, overridingExpl);
@@ -132,6 +128,9 @@ angular.module('splain-app')
132128
groupedResultToNormalDocs(fieldSpec, thisSearch.grouped);
133129
thisSearch.state = thisSvc.states.DID_SEARCH;
134130
promise.complete();
131+
}, function searchFailure() {
132+
thisSearch.state = thisSvc.states.IN_ERROR;
133+
return;
135134
});
136135

137136
return promise;

bower.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,21 @@
22
"name": "splainer",
33
"version": "0.0.0",
44
"dependencies": {
5-
"angular": "~1.2.26",
5+
"angular": "~1.4.0",
66
"json3": "~3.3.1",
77
"es5-shim": "~3.1.0",
88
"bootstrap": "~3.2.0",
99
"angular-local-storage": "~0.0.5",
1010
"angular-bootstrap": "~0.11.0",
1111
"ng-json-explorer": "git://github.com/softwaredoug/ng-json-explorer",
1212
"splainer-search": "1.3.2",
13-
"angular-sanitize": "~1.2.21",
13+
"angular-sanitize": "~1.4.0",
1414
"jquery": "~2.1.1",
1515
"inspector-gadget": "^0.2.0"
1616
},
1717
"devDependencies": {
18-
"angular-mocks": "~1.2.26",
19-
"angular-scenario": "~1.2.26"
18+
"angular-mocks": "~1.4.0",
19+
"angular-scenario": "~1.4.0"
2020
},
2121
"appPath": "app",
2222
"resolutions": {

0 commit comments

Comments
 (0)