Skip to content

Commit

Permalink
bump version, support config toggle of add/remove search, exclude que…
Browse files Browse the repository at this point in the history
…ry, term hyperlinks and new window
  • Loading branch information
billmurrin committed Jan 14, 2018
1 parent a88f694 commit 6e72d97
Show file tree
Hide file tree
Showing 15 changed files with 509 additions and 188 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## [3.1.0](https://github.com/billmurrin/graylog-plugin-quickvaluesplus-widget/tree/3.1.0) (2018-01-12)
* Merged #32 (@pbr0ck3r) - Add options to show/hide search buttons when creating a widget
* Now supports the configuration of defaults for the following:
- Add / Remove to Search Bar (Field Analyzer)
- Pie Chart Visibility
- Show Terms with Hyperlinks (Only applies to Dashboards)
- Exclude Term from Widget Search query button (Only applies to Dashboards)
- Open Search Term Query in New Window (Only applies to Dashboards)
- *Data Table Visibility is not a global configuration, only on widgets*
* Fixed #31 - Quick Values in Dashboard keep changing colors
* Removed debug code added in version 3.0. Not needed.

## [3.0.3](https://github.com/billmurrin/graylog-plugin-quickvaluesplus-widget/tree/3.0.2) (2018-01-06)
* Fixed *Open Search in New Window* button for `undefined` stream_id. 3.0.2 only fixed the links, not the button.
* Fixed bug - Global config value wasn't being sent to the widget upon the initial widget load - it required a menu selection first.
Expand Down
88 changes: 45 additions & 43 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,96 +3,98 @@
[![GitHub Release](https://img.shields.io/github/release/billmurrin/graylog-plugin-quickvaluesplus-widget.svg)](https://github.com/billmurrin/graylog-plugin-quickvaluesplus-widget/releases)
[![Build Status](https://travis-ci.org/billmurrin/graylog-plugin-quickvaluesplus-widget.svg?branch=master)](https://travis-ci.org/billmurrin/graylog-plugin-quickvaluesplus-widget)

The QuickValuesPlus Widget is an enhancement to the Quick Values Widget that ships with GrayLog2. The QuickValuesPlus Widget can be added to a Stream as a Field Analyzer and to Dashboards as a widget.

Several **NEW** features have been added to version 3.0.0 (See below). Version 3.0.0 is only compatible with Graylog 2.3.0 and above.
The QuickValuesPlus Widget is an enhancement to the original Quick Values Widget that shipped with GrayLog2. It can be added to a Stream as a Field Analyzer and to Dashboards as a widget.

Several **NEW** features have been added to version 3.1.0 (See below). Version 3.1.0 is only compatible with Graylog 2.3 (not 2.4 yet).

Field Analyzer Features
-----------
- "Customize" menu supports modifying the Sort Order (Ascending or Descending), Table Size and number of Top Values displayed by the widget.
- Exclude from search button - Add negated search directly to the Search Bar (E.g. !field_name:foo).
- **New in 3.1** - Can prevent Add to Search/Remove from search buttons via global configuration.

*Field Analyzer Features*
![alt text](http://i.imgur.com/H9SRkRo.png "Field Analyzer Features")


New Dashboard Features
Dashboard Features
-----------
- Widgets now contain links so that you can drill into a Term search and view the results.
- Widgets now contain a button to open the Term search inside of a new window.
- Added Exclude Term from Query button - Negate a search term directly from the widget (Requires dashboard edit permissions)
- Terms can be hyperlinked - drill-down into a Term search and view the results.
- Term searches can be opened inside of a new window.
- Can exclude a Term from the Query using a button - Negate a search term directly from the widget (*Requires dashboard edit permissions*)
- **New in 3.1** - Term hyperlinks, Remove from query, and Open Term search in new window buttons can be hidden - very customizable!

*NEW - Version 3 Dashboard Features*
![alt text](http://i.imgur.com/viZ3AoK.png "Version 3 Dashboard Features")
*Customize your dashboards*
![alt text](https://i.imgur.com/GSm9Yb1.png "Dashboard customization")

New Dashboard Configuration Feature
Dashboard Configuration Feature
-----------
- Can now customize the field name used by the widget (Requires dashboard edit permissions)

- Can customize the field name used by the widget (Requires dashboard edit permissions)
- **New in 3.1** Can now control display of term hyperlinks, remove from query, open term in new window buttons in dashboards.

*NEW - Version 3 Editable Field Name*
![alt text](http://i.imgur.com/Ezs7DL3.png "Edit Field Name")

New Global System Configuration
Global System Configuration
-----------
- Can now Customize the Quick Values Plus default values in the System/Configuration page.

*NEW - Version 3 Globally Configurable Default Values*
![alt text](http://i.imgur.com/DZHbWzh.png "System Global Default Values")
Customize the default display values in the System/Configuration page.
- Pie Chart
- Add to Search Bar button
- Remove from Search Bar button
- Term Hyperlinks (Dashboards)
- Exclude From Search Button (Dashboards)
- Open Term Search in New Window Button (Dashboards)

Supported Graylog Versions
-----------
* Version 3.0.1 was tested and is compatible with Graylog version 2.3.0 and above.
* Version 2.1.0 was tested and is compatible with Graylog versions 2.2.1, 2.2.2, and 2.2.3.
* Version 1.0.0 was tested and is compatible with Graylog version 2.1.3.
* **Not currently compatible with Graylog 2.4.0 - *coming soon!***
* Version 3.1.0 - Tested and compatible with Graylog version 2.3 - not currently compatible with 2.4.0.
* Version 2.1.0 - Tested and compatible with Graylog versions 2.2.1, 2.2.2, and 2.2.3.
* Version 1.0.0 - Tested and compatible with Graylog version 2.1.3.

Installation
------------
* [Download the plugin](https://github.com/billmurrin/graylog-plugin-quickvaluesplus-widget/releases/)
and place the `.jar` file in your Graylog plugin directory. The plugin directory is the `plugins/` folder relative from your `graylog-server` directory by default and can be configured in your `graylog.conf` file.
* Restart `graylog-server`.
* In your web browser, force refresh (Ctrl + F5) a couple of times or clear your cache.

Features and Bugs
-----------
If you come across a bug, require further assistance, or have a great feature request, please file an [Issue](https://github.com/billmurrin/graylog-plugin-quickvaluesplus-widget/issues) providing as much detail as possible.

Contributions to the code-base are greatly appreciated.
Contributions to the code-base are greatly appreciated!

Way Ahead - Version 4.0.0
-----------
* Update codebase to work with Graylog 2.4.0

Related Graylog Issues
-----------
The following are Graylog issues that the QuickValuesPlus widget currently attempts to resolve.
The following are Graylog issues that the QuickValuesPlus widget attempts to resolve.
* [#2459](https://github.com/Graylog2/graylog2-server/issues/2459) - Reverse quick values/Bottom-N
* [#2631](https://github.com/Graylog2/graylog2-server/issues/2631) - Feature request: rare values #2631
* [#1684](https://github.com/Graylog2/graylog2-server/issues/1684) - Make number of terms in quick values widget configurable
* [#3694](https://github.com/Graylog2/graylog2-server/issues/3694) - Add hyperlinks to "Quick Values" dashboard widgets
* [#3394](https://github.com/Graylog2/graylog2-server/issues/3394) - Widgets has no way to edit all properties after creation

Installation
------------
[Download the plugin](https://github.com/billmurrin/graylog-plugin-quickvaluesplus-widget/releases/)
and place the `.jar` file in your Graylog plugin directory. The plugin directory is the `plugins/` folder relative from your `graylog-server` directory by default and can be configured in your `graylog.conf` file.

Restart `graylog-server` and you are done.

Way Ahead - Version 3.1.0
-----------
* Add additional Default Configuration options (show table, show pie chart, links, exclude query button)
* Add ability to Turn Off links and/or exclude from Query buttons for each individual widget in the Widget Configuration.
* Add debug configuration option to enable console messaging in order to help in troubleshooting issues with the plugin.

Development
-----------
You can improve your development experience for the web interface part of your plugin dramatically by making use of hot reloading.

To hot reload using Graylog 2.3.0, your plugin directory should be located two directories above your graylog2-web-server directory (../../) and the folder name of your plugin should be begin with graylog-plugin (More info[HERE](https://github.com/Graylog2/graylog2-server/blob/2.3/graylog2-web-interface/webpack.combined.config.js#L11))
To hot reload using Graylog 2.3, your plugin directory should be located two directories above your graylog2-web-server directory (../../) and the folder name of your plugin should be begin with graylog-plugin (More info[HERE](https://github.com/Graylog2/graylog2-server/blob/2.3/graylog2-web-interface/webpack.combined.config.js#L11))

##### Hot-loading setup with the plugin.

#####Steps for hot-loading setup with the plugin.
* Clone the Repositories
```
git clone -b "2.3.1" https://github.com/Graylog2/graylog2-server.git
git clone -b "2.3.2" https://github.com/Graylog2/graylog2-server.git
git clone https://github.com/billmurrin/graylog-plugin-quickvaluesplus-widget.git
```

* Install the `graylog2-web-interface` node modules and build the Vendor Manifest
```
cd graylog2-server/graylog2-web-interface
npm install
webpack --config webpack.vendor.js
```

* Install the `graylog-plugin-quickvaluesplus-widget` node modules
```
cd graylog-plugin-quickvaluesplus-widget
Expand All @@ -105,7 +107,7 @@ cd graylog2-server/graylog2-web-interface
npm start
```

#####Steps to build the plugin.
##### Building the plugin.
* Follow the steps above for hot-loading, but **DO NOT** run the `npm start` command. (no need to start the dev web-server)
* Run `mvn package`
* Copy the generated JAR file located in the `/target` folder to the Graylog plugin directory.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "QuickValuesPlusWidget",
"version": "3.0.3",
"version": "3.1.0",
"description": "GrayLog2 QuickValuesPlus Widget Plugin",
"repository": {
"type": "git",
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<groupId>org.graylog.plugins</groupId>
<artifactId>graylog-plugin-quickvaluesplus-widget</artifactId>
<version>3.0.3</version>
<version>3.1.0</version>
<packaging>jar</packaging>

<name>${project.artifactId}</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,25 @@ public ZonedDateTime createdAt() {
@Override
@SuppressWarnings("unchecked")
public void upgrade() {
if (clusterConfigService.get(QuickValuesPlusPluginConfiguration.class) != null) {
LOG.debug("Migration already done.");

final QuickValuesPlusPluginConfiguration quickValuesPlusPluginConfiguration = clusterConfigService.get(QuickValuesPlusPluginConfiguration.class);
final QuickValuesPlusPluginConfiguration3_1 quickValuesPlusPluginConfiguration3_1 = clusterConfigService.get(QuickValuesPlusPluginConfiguration3_1.class);

if (quickValuesPlusPluginConfiguration3_1 == null) {
if (quickValuesPlusPluginConfiguration == null) {
LOG.info("No Migration Found. Writing values for Quick Values Plugin Configuration");
clusterConfigService.write(QuickValuesPlusPluginConfiguration3_1.create(25, 5, "descending", true, true,true,true, true, true,"3.1.0"));
} else {
LOG.info("3.0 Migration Found. Updating to 3.1");
clusterConfigService.write(QuickValuesPlusPluginConfiguration3_1.create(quickValuesPlusPluginConfiguration.tableSize(), quickValuesPlusPluginConfiguration.topValues(), quickValuesPlusPluginConfiguration.sortOrder(), true, true, true, true, true,true, "3.1.0"));
LOG.info("Removing 3.0 migration information");
clusterConfigService.remove(QuickValuesPlusPluginConfiguration.class);
}
} else {
LOG.info("Migration has already completed. Exiting.");
return;
}

LOG.info("Writing values for Quick Values Plugin Configuration");
clusterConfigService.write(QuickValuesPlusPluginConfiguration.create(25, 5, "descending"));
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ public abstract class QuickValuesPlusPluginConfiguration {

@JsonCreator
public static QuickValuesPlusPluginConfiguration create(@JsonProperty("table_size") Number tableSize,
@JsonProperty("top_values") Number topValues,
@JsonProperty("sort_order") String sortOrder) {
@JsonProperty("top_values") Number topValues,
@JsonProperty("sort_order") String sortOrder) {
return builder()
.tableSize(tableSize)
.topValues(topValues)
.sortOrder(sortOrder)
.build();
.tableSize(tableSize)
.topValues(topValues)
.sortOrder(sortOrder)
.build();
}

public static Builder builder() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
package org.graylog.plugins.quickvaluesplus;

import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.auto.value.AutoValue;

@JsonAutoDetect
@JsonIgnoreProperties(ignoreUnknown = true)
@AutoValue
public abstract class QuickValuesPlusPluginConfiguration3_1 {

@JsonProperty("table_size")
public abstract Number tableSize();

@JsonProperty("top_values")
public abstract Number topValues();

@JsonProperty("sort_order")
public abstract String sortOrder();

@JsonProperty("show_pie_chart")
public abstract Boolean showPieChart();

@JsonProperty("display_add_to_search_button")
public abstract Boolean addToSearch();

@JsonProperty("display_remove_from_search_button")
public abstract Boolean removeFromSearch();

@JsonProperty("display_term_hyperlinks")
public abstract Boolean termHyperlinks();

@JsonProperty("display_exclude_from_query_button")
public abstract Boolean excludeQuery();

@JsonProperty("display_get_term_reply_in_new_window_button")
public abstract Boolean termNewWindow();

@JsonProperty("version")
public abstract String version();

@JsonCreator
public static QuickValuesPlusPluginConfiguration3_1 create(@JsonProperty("table_size") Number tableSize,
@JsonProperty("top_values") Number topValues,
@JsonProperty("sort_order") String sortOrder,
@JsonProperty("show_pie_chart") Boolean showPieChart,
@JsonProperty("display_add_to_search_button") Boolean addToSearch,
@JsonProperty("display_remove_from_search_button") Boolean removeFromSearch,
@JsonProperty("display_term_hyperlinks") Boolean termHyperlinks,
@JsonProperty("display_exclude_from_query_button") Boolean excludeQuery,
@JsonProperty("display_get_term_reply_in_new_window_button") Boolean termNewWindow,
@JsonProperty("version") String version) {
return builder()
.tableSize(tableSize)
.topValues(topValues)
.sortOrder(sortOrder)
.showPieChart(showPieChart)
.addToSearch(addToSearch)
.removeFromSearch(removeFromSearch)
.termHyperlinks(termHyperlinks)
.excludeQuery(excludeQuery)
.termNewWindow(termNewWindow)
.version(version)
.build();
}

public static Builder builder() {
return new AutoValue_QuickValuesPlusPluginConfiguration3_1.Builder();
}

@AutoValue.Builder
public static abstract class Builder {
public abstract Builder tableSize(Number tableSize);

public abstract Builder topValues(Number topValues);

public abstract Builder sortOrder(String sortOrder);

public abstract Builder showPieChart(Boolean showPieChart);

public abstract Builder addToSearch(Boolean addToSearch);

public abstract Builder removeFromSearch(Boolean removeFromSearch);

public abstract Builder termHyperlinks(Boolean termHyperlinks);

public abstract Builder excludeQuery(Boolean excludeQuery);

public abstract Builder termNewWindow(Boolean termNewWindow);

public abstract Builder version(String version);

public abstract QuickValuesPlusPluginConfiguration3_1 build();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
import org.graylog2.plugin.PluginModule;
import org.graylog2.plugin.PluginConfigBean;
import org.graylog.plugins.quickvaluesplus.widget.strategy.QuickValuesPlusWidgetStrategy;
import com.github.joschi.jadconfig.Parameter;
import com.google.inject.multibindings.Multibinder;
import org.graylog2.migrations.Migration;
import org.graylog.plugins.quickvaluesplus.QuickValuesPlusDefaultValuesMigration;
import java.util.Collections;
import java.util.Set;

Expand Down
Loading

0 comments on commit 6e72d97

Please sign in to comment.