Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
UniProt
Front End
QuickGoFE
Commits
3714c0aa
Commit
3714c0aa
authored
Aug 20, 2020
by
Mahdi Mahmoudy
Browse files
Merge branch 'brakets-issue'
parents
0442b51b
7e6e5ea3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
10 deletions
+24
-10
app/scripts/services/wsService.js
app/scripts/services/wsService.js
+18
-6
app/search/facetSearch.js
app/search/facetSearch.js
+4
-1
app/search/search.js
app/search/search.js
+2
-3
No files found.
app/scripts/services/wsService.js
View file @
3714c0aa
...
...
@@ -323,9 +323,20 @@ wsService.factory('searchService', [
'
$http
'
,
'
ENV
'
,
function
(
$http
,
ENV
)
{
// to escape special characters which aren't supported
// by the API end-point
function
escapeSearchTerm
(
searchTerm
)
{
if
(
!
searchTerm
)
{
return
searchTerm
;
}
return
searchTerm
.
replace
(
/
\[(
.*
)\]
/
,
"
%5B$1%5D
"
);
// [ and ]
};
return
{
findTerms
:
function
(
searchTerm
,
limit
,
page
,
facet
,
filters
)
{
var
url
=
ENV
.
apiEndpoint
+
'
/internal/search/ontology?query=
'
+
searchTerm
+
'
&limit=
'
+
limit
+
'
&page=
'
+
(
page
var
url
=
ENV
.
apiEndpoint
+
'
/internal/search/ontology?query=
'
+
escapeSearchTerm
(
searchTerm
)
+
'
&limit=
'
+
limit
+
'
&page=
'
+
(
page
?
page
:
1
)
+
'
&facet=
'
+
(
facet
?
facet
...
...
@@ -335,7 +346,7 @@ wsService.factory('searchService', [
return
$http
.
get
(
url
);
},
findGeneProducts
:
function
(
searchTerm
,
limit
,
page
,
facet
,
filters
)
{
var
url
=
ENV
.
apiEndpoint
+
'
/geneproduct/search?query=
'
+
searchTerm
+
'
&limit=
'
+
limit
+
'
&page=
'
+
(
page
var
url
=
ENV
.
apiEndpoint
+
'
/geneproduct/search?query=
'
+
escapeSearchTerm
(
searchTerm
)
+
'
&limit=
'
+
limit
+
'
&page=
'
+
(
page
?
page
:
1
)
+
'
&facet=
'
+
(
facet
?
facet
...
...
@@ -356,13 +367,13 @@ wsService.factory('searchService', [
return
$http
.
get
(
url
);
},
getAnnotationsForTermUrl
:
function
(
searchTerm
)
{
return
'
goUsage=descendants&goUsageRelationships=is_a,part_of,occurs_in&goId=
'
+
searchTerm
;
return
'
goUsage=descendants&goUsageRelationships=is_a,part_of,occurs_in&goId=
'
+
escapeSearchTerm
(
searchTerm
)
;
},
getAnnotationsForECOUrl
:
function
(
searchTerm
)
{
return
'
evidenceCodeUsage=descendants&evidenceCode=
'
+
searchTerm
;
return
'
evidenceCodeUsage=descendants&evidenceCode=
'
+
escapeSearchTerm
(
searchTerm
)
;
},
getAnnotationsForProductUrl
:
function
(
searchTerm
)
{
return
'
geneProductId=
'
+
searchTerm
;
return
'
geneProductId=
'
+
escapeSearchTerm
(
searchTerm
)
;
},
findAnnotationsForFilterUrl
:
function
(
url
)
{
return
$http
.
get
(
ENV
.
apiEndpoint
+
'
/annotation/search?
'
+
url
);
...
...
@@ -375,7 +386,8 @@ wsService.factory('searchService', [
}
});
return
queryString
;
}
},
escapeSearchTerm
:
escapeSearchTerm
,
};
}
]);
...
...
app/search/facetSearch.js
View file @
3714c0aa
...
...
@@ -107,7 +107,10 @@ app.controller('FacetSearchCtrl', function($scope, $location, searchService, $ro
if
(
!
text
)
{
return
text
;
}
return
text
.
replace
(
new
RegExp
(
$scope
.
searchTerm
,
'
gi
'
),
'
<em>
'
+
$scope
.
searchTerm
+
'
</em>
'
);
return
text
.
replace
(
new
RegExp
(
searchService
.
escapeSearchTerm
(
$scope
.
searchTerm
),
'
gi
'
),
'
<em>
'
+
$scope
.
searchTerm
+
'
</em>
'
);
};
getResultsPage
(
type
);
...
...
app/search/search.js
View file @
3714c0aa
'
use strict
'
;
app
.
controller
(
'
SearchCtrl
'
,
function
(
$scope
,
$location
,
$routeParams
)
{
$scope
.
searchTerm
=
$routeParams
.
searchTerm
.
replace
(
/
\[(
.*
)\]
/
,
"
%5B$1%5D
"
);
app
.
controller
(
'
SearchCtrl
'
,
function
(
$scope
,
$location
,
$routeParams
,
searchService
)
{
$scope
.
searchTerm
=
$routeParams
.
searchTerm
;
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment