Skip to content

Commit

Permalink
Set new react-based seach as default
Browse files Browse the repository at this point in the history
  • Loading branch information
Edmundo Alvarez committed May 15, 2015
1 parent 6dd914d commit abeab42
Show file tree
Hide file tree
Showing 32 changed files with 543 additions and 1,576 deletions.
11 changes: 8 additions & 3 deletions app/assets/stylesheets/graylog2.less
Expand Up @@ -273,8 +273,7 @@ label {
}

#sidebar {
padding-left: 10px;
padding-right: 10px;
padding-left: 0;
}

#sidebar .affix {
Expand All @@ -284,13 +283,19 @@ label {

#main-content-sidebar {
padding-left: 0;
padding-right: 10px;
padding-right: 0;
}

#main-content {
padding: 15px 25px;
}

// This is rendered inside a #main-content, and we need to compensate the margin-top to make it look nicer
#main-content-search {
margin-bottom: 0;
margin-top: -15px;
}

#universalsearch {
padding: 5px;
margin-bottom: 0px;
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/SavedSearchesController.java
Expand Up @@ -113,7 +113,7 @@ private Call callFromSavedSearch(SavedSearch search, String streamId, boolean in
}

if (streamId == null || streamId.isEmpty()) {
return routes.SearchControllerV2.index(
return routes.SearchController.index(
(String) searchQuery.get("query"),
(String) searchQuery.get("rangeType"),
relative,
Expand Down
529 changes: 490 additions & 39 deletions app/controllers/SearchController.java

Large diffs are not rendered by default.

762 changes: 0 additions & 762 deletions app/controllers/SearchControllerV2.java

This file was deleted.

2 changes: 1 addition & 1 deletion app/controllers/StreamSearchController.java
Expand Up @@ -11,7 +11,7 @@

import java.io.IOException;

public class StreamSearchController extends SearchControllerV2 {
public class StreamSearchController extends SearchController {
@Inject
private StreamService streamService;

Expand Down
6 changes: 3 additions & 3 deletions app/controllers/api/StreamsApiController.java
Expand Up @@ -2,7 +2,7 @@

import com.google.common.collect.Lists;
import controllers.AuthenticatedController;
import controllers.SearchControllerV2;
import controllers.SearchController;
import org.graylog2.restclient.lib.APIException;
import org.graylog2.restclient.models.Stream;
import org.graylog2.restclient.models.StreamService;
Expand Down Expand Up @@ -42,11 +42,11 @@ public Result testMatch(String stream_id) {
}

public Result listStreams() {
List<SearchControllerV2.StreamDescription> streamDescriptions = Lists.newArrayList();
List<SearchController.StreamDescription> streamDescriptions = Lists.newArrayList();
try {
final List<Stream> streams = streamService.all();
for (Stream stream : streams) {
streamDescriptions.add(new SearchControllerV2.StreamDescription(stream));
streamDescriptions.add(new SearchController.StreamDescription(stream));
}
} catch (IOException e) {
return status(500, "Could not load streams");
Expand Down
2 changes: 1 addition & 1 deletion app/views/alerts/manage.scala.html
Expand Up @@ -11,7 +11,7 @@
@import views.helpers.Permissions._
@import views.helpers.Permissions

@main("Alerts", null, "", currentUser, false, false) {
@main("Alerts", null, "", currentUser, false) {
<div class="row content content-head">
<div class="col-md-12">
<h1>
Expand Down
31 changes: 5 additions & 26 deletions app/views/main.scala.html
@@ -1,4 +1,4 @@
@(title: String, sidebarContent: Html, searchQuery: String = "", currentUser: org.graylog2.restclient.models.User, hasSearch: Boolean = true, reactSearch: Boolean = false)(content: Html)(implicit stream: org.graylog2.restclient.models.Stream = null)
@(title: String, sidebarContent: Html, searchQuery: String = "", currentUser: org.graylog2.restclient.models.User, reactSearch: Boolean = true)(content: Html)(implicit stream: org.graylog2.restclient.models.Stream = null)
@import play.libs.Json
@import views.helpers.Permissions._
@import lib.security.RestPermissions._
Expand All @@ -25,10 +25,7 @@

<div class="container-fluid">

@if(hasSearch && (stream != null || (isPermitted(SEARCHES_ABSOLUTE) || isPermitted(SEARCHES_RELATIVE) || isPermitted(SEARCHES_KEYWORD)))) {
@partials.universalsearch(searchQuery)
}
@if(reactSearch) {
@if(reactSearch && (stream != null || (isPermitted(SEARCHES_ABSOLUTE) || isPermitted(SEARCHES_RELATIVE) || isPermitted(SEARCHES_KEYWORD)))) {
<div id="react-search-bar"></div>
}

Expand All @@ -51,27 +48,9 @@
</div>
</div>
<div class="row">
@if(reactSearch) {
@content
} else {
@if(sidebarContent != null) {
<div class="col-md-3" id="sidebar">
<div class="content-col" id="sidebar-inner">
@sidebarContent
</div>
</div>
}

@if(sidebarContent != null) {
<div class="col-md-9" id="main-content-sidebar">
@content
</div>
} else {
<div class="col-md-12" id="main-content">
@content
</div>
}
}
<div class="col-md-12" id="main-content">
@content
</div>
</div>
</div>

Expand Down
4 changes: 2 additions & 2 deletions app/views/messages/show_as_partial.scala.html
Expand Up @@ -10,7 +10,7 @@

<h2>
<i class="fa fa-envelope copy-clipboard" data-clipboard-text="@message.getId" data-toggle="tooltip" data-initial-title="Copy Id" data-trigger="manual"></i>
<a href="@routes.SearchControllerV2.showMessage(message.getIndex, message.getId)">
<a href="@routes.SearchController.showMessage(message.getIndex, message.getId)">
@message.getId
</a>
</h2>
Expand Down Expand Up @@ -82,7 +82,7 @@ <h2>
</ul>
</li>
<li><a href="#terms-msg-@message.getId()" role="button" data-toggle="modal" data-backdrop="true">Show message terms</a></li>
<li><a href="@routes.SearchControllerV2.showMessage(message.getIndex, message.getId)">Permalink</a></li>
<li><a href="@routes.SearchController.showMessage(message.getIndex, message.getId)">Permalink</a></li>
</ul>
</div>

Expand Down
7 changes: 3 additions & 4 deletions app/views/partials/navbar.scala.html
Expand Up @@ -33,10 +33,9 @@
routes.javascript.OutputsController.index,
routes.javascript.SavedSearchesController.execute,
routes.javascript.SavedSearchesController.delete,
routes.javascript.SearchController.globalSearch,
routes.javascript.SearchControllerV2.index,
routes.javascript.SearchControllerV2.showMessage,
routes.javascript.SearchControllerV2.exportAsCsv,
routes.javascript.SearchController.index,
routes.javascript.SearchController.showMessage,
routes.javascript.SearchController.exportAsCsv,
routes.javascript.SessionsController.destroy,
routes.javascript.StreamsController.index,
routes.javascript.StreamSearchController.index,
Expand Down
88 changes: 0 additions & 88 deletions app/views/partials/universalsearch.scala.html

This file was deleted.

17 changes: 0 additions & 17 deletions app/views/search/global.scala.html

This file was deleted.

Expand Up @@ -8,13 +8,13 @@
searchResult: org.graylog2.restclient.models.api.results.SearchResult,
histogram: org.graylog2.restclient.models.api.results.DateHistogramResult,
formattedHistogramResults: String,
nodes: Map[String, controllers.SearchControllerV2.NodeDescription],
streams: Map[String, controllers.SearchControllerV2.StreamDescription],
inputs: Map[String, controllers.SearchControllerV2.InputDescription]
nodes: Map[String, controllers.SearchController.NodeDescription],
streams: Map[String, controllers.SearchController.StreamDescription],
inputs: Map[String, controllers.SearchController.InputDescription]
)(implicit stream: org.graylog2.restclient.models.Stream)

@import play.libs.Json;
@import controllers.SearchControllerV2.StreamDescription
@import controllers.SearchController.StreamDescription

@streamId = @{
if (stream == null) {
Expand All @@ -24,7 +24,7 @@
}
}

@main("Search V2", null, query, currentUser, false, true) {
@main("Search", null, query, currentUser, true) {

<div id="react-search-result"
data-query="@query"
Expand Down
41 changes: 0 additions & 41 deletions app/views/search/noresults.scala.html

This file was deleted.

34 changes: 0 additions & 34 deletions app/views/search/partials/column_sorter.scala.html

This file was deleted.

24 changes: 0 additions & 24 deletions app/views/search/partials/show_query_modal.scala.html

This file was deleted.

0 comments on commit abeab42

Please sign in to comment.