mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
Merge pull request #7 from felizbear/search-fix
Fix bugs in search front-end
This commit is contained in:
commit
29da337871
3 changed files with 30 additions and 5 deletions
|
|
@ -71,13 +71,18 @@ angular.module('zeppelinWebApp').controller('NotebookCtrl',
|
|||
var currentRoute = $route.current;
|
||||
|
||||
if (currentRoute) {
|
||||
var routeParams = currentRoute.params;
|
||||
var id = '#' + routeParams.paragraph + '_container';
|
||||
|
||||
setTimeout(
|
||||
function() {
|
||||
// adjust for navbar
|
||||
var top = $(id).offset().top - 103;
|
||||
$('html, body').scrollTo({top: top, left: 0});
|
||||
var routeParams = currentRoute.params;
|
||||
var $id = $('#' + routeParams.paragraph + '_container');
|
||||
|
||||
if ($id.length > 0) {
|
||||
// adjust for navbar
|
||||
var top = $id.offset().top - 103;
|
||||
$('html, body').scrollTo({top: top, left: 0});
|
||||
}
|
||||
|
||||
},
|
||||
1000
|
||||
);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,12 @@ angular
|
|||
|
||||
results.$promise.then(function(result) {
|
||||
$scope.notes = result.body.map(function(note) {
|
||||
// redirect to notebook when search result is a notebook itself,
|
||||
// not a paragraph
|
||||
if (!/\/paragraph\//.test(note.id)) {
|
||||
return note;
|
||||
}
|
||||
|
||||
note.id = note.id.replace('paragraph/', '?paragraph=') +
|
||||
'&term=' +
|
||||
$routeParams.searchTerm;
|
||||
|
|
|
|||
|
|
@ -1,3 +1,17 @@
|
|||
/*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
.search-results {
|
||||
list-style-type: none;
|
||||
margin: 10% auto 0;
|
||||
|
|
|
|||
Loading…
Reference in a new issue