Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a feature to enable/disbale Opening cell links in a new tab #129

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
150 changes: 76 additions & 74 deletions dist/app/app.js

Large diffs are not rendered by default.

183 changes: 93 additions & 90 deletions dist/app/boom/BoomOutput.js

Large diffs are not rendered by default.

203 changes: 102 additions & 101 deletions dist/app/boom/BoomPattern.js

Large diffs are not rendered by default.

220 changes: 111 additions & 109 deletions dist/app/boom/BoomSeries.js

Large diffs are not rendered by default.

157 changes: 79 additions & 78 deletions dist/app/config.js

Large diffs are not rendered by default.

16 changes: 10 additions & 6 deletions dist/partials/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ <h6 class="text-header">Thresholds</h6>
<div class="gf-form">
<label class="gf-form-label width-12">Thresholds</label>
<input type="text" placeholder="Thresholds" class="gf-form-input width-18" ng-model="pattern.thresholds"
bs-tooltip="'Comma seperated thresholds'" ng-blur="ctrl.render()" data-ng-change="ctrl.render();">
bs-tooltip="'Comma separated thresholds'" ng-blur="ctrl.render()" data-ng-change="ctrl.render();">
</div>
</div>

Expand All @@ -193,7 +193,7 @@ <h6 class="text-header">Thresholds</h6>
<label class="gf-form-label width-20" data-ng-if="pattern.enable_bgColor === true">BG
Colors for thresholds</label>
<input type="text" placeholder="green|orange|red" class="gf-form-input width-18" ng-model="pattern.bgColors"
bs-tooltip="'BG Colors seperated by | (pipe)'" ng-blur="ctrl.render()" data-ng-change="ctrl.render();"
bs-tooltip="'BG Colors separated by | (pipe)'" ng-blur="ctrl.render()" data-ng-change="ctrl.render();"
data-ng-if="pattern.enable_bgColor === true">
<button type="button" class="btn btn-primary btn-small" ng-click="pattern.inverseBGColors();ctrl.render();"
title="Inverse" data-ng-if="pattern.enable_bgColor === true">Inverse</button>
Expand All @@ -208,7 +208,7 @@ <h6 class="text-header">Thresholds</h6>
<label class="gf-form-label width-20" data-ng-if="pattern.enable_textColor === true">Text
Colors for thresholds</label>
<input type="text" placeholder="red|orange|green" class="gf-form-input width-18" ng-model="pattern.textColors"
bs-tooltip="'Text Colors seperated by | (pipe)'" ng-blur="ctrl.render()" data-ng-change="ctrl.render();"
bs-tooltip="'Text Colors separated by | (pipe)'" ng-blur="ctrl.render()" data-ng-change="ctrl.render();"
data-ng-if="pattern.enable_textColor === true">
<button type="button" class="btn btn-primary btn-small" ng-click="pattern.inverseTextColors();ctrl.render();"
title="Inverse" data-ng-if="pattern.enable_textColor === true">Inverse</button>
Expand Down Expand Up @@ -372,6 +372,10 @@ <h6 class="text-header">Cell Links & Tooltip</h6>
<input type="text" placeholder="Series : _series_ <br/>Row Name : _row_name_ <br/>Col Name : _col_name_ <br/>Value : _value_"
class="gf-form-input width-18" ng-model="pattern.tooltipTemplate" bs-tooltip="'Tooltip Template; Leave blank for default template; Enter - to disable tooltip'"
ng-blur="ctrl.render()">
<span class="split"></span>
<label class="gf-form-label width-26">Open Link in New Tab</label>
<input type="checkbox" class="gf-form-input width-4" ng-model="pattern.open_link_new_tab"
ng-blur="ctrl.render()" ng-change="ctrl.render()">
</div>
</div>
</div>
Expand Down Expand Up @@ -485,7 +489,7 @@ <h6 class="text-header">Options</h6>
<div class="gf-form">
<div class="gr-form-inline">
<div class="gf-form">
<label class="gf-form-label width-20">Row / Column indentification wrapper</label>
<label class="gf-form-label width-20">Row / Column identification wrapper</label>
<input type="text" placeholder="Value" class="gf-form-input width-18" ng-model="ctrl.panel.row_col_wrapper" bs-tooltip="'Default is _'"
ng-blur="ctrl.render()" data-ng-change="ctrl.render();">
</div>
Expand Down Expand Up @@ -586,15 +590,15 @@ <h6 class="text-header">Other Optons</h6>
<div class="gr-form-inline">
<div class="gf-form">
<label class="gf-form-label width-20">First Column Link</label>
<input type="text" placeholder="#" class="gf-form-input width-18" ng-model="ctrl.panel.first_column_link" bs-tooltip="'Link to URL when clicked first column'" formng-blur="ctrl.render()" data-ng-change="ctrl.render();">
<input type="text" placeholder="#" class="gf-form-input width-18" ng-model="ctrl.panel.first_column_link" bs-tooltip="'Link to URL when clicked first column'" ng-blur="ctrl.render()" data-ng-change="ctrl.render();">
</div>
</div>
</div>
<div class="gf-form">
<div class="gr-form-inline">
<div class="gf-form">
<label class="gf-form-label width-20">Font Size (in pixels or rems) </label>
<input type="text" placeholder="1.2rem" class="gf-form-input width-18" ng-model="ctrl.panel.font_size" bs-tooltip="'Font size ( ex: 1.2rem / 12px )'" formng-blur="ctrl.render()" data-ng-change="ctrl.render();">
<input type="text" placeholder="1.2rem" class="gf-form-input width-18" ng-model="ctrl.panel.font_size" bs-tooltip="'Font size ( ex: 1.2rem / 12px )'" ng-blur="ctrl.render()" data-ng-change="ctrl.render();">
</div>
</div>
</div>
Expand Down
2 changes: 2 additions & 0 deletions src/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ const seriesToTable = function(inputdata: IBoomSeries[], options: IBoomTableTran
display_value: replaceTokens(options.non_matching_cells_text),
hidden: false,
link: '-',
open_link_new_tab: false,
row_name: row_name,
tooltip: '-',
value: NaN,
Expand All @@ -38,6 +39,7 @@ const seriesToTable = function(inputdata: IBoomSeries[], options: IBoomTableTran
display_value: 'Duplicate matches',
hidden: false,
link: '-',
open_link_new_tab: false,
row_name: row_name,
tooltip: '-',
value: NaN,
Expand Down
2 changes: 2 additions & 0 deletions src/app/boom/Boom.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface IBoomPattern {
null_color: string;
null_value: string;
null_textcolor: string;
open_link_new_tab: Boolean;
pattern: string;
row_name: string;
textColors: string;
Expand Down Expand Up @@ -78,6 +79,7 @@ interface IBoomCellDetails {
color_text: string;
display_value: string;
link: string;
open_link_new_tab: Boolean;
tooltip: string;
value: number;
}
Expand Down
5 changes: 4 additions & 1 deletion src/app/boom/BoomOutput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,13 @@ BoomOutput.prototype.getDataAsHTML = function(data: IBoomTable, sorting_props):
}
_.each(o, item => {
let item_style = `padding:4px;background-color:${item.color_bg};color:${item.color_text};text-align:${this.text_alignment_values}`;
let item_link_value = item.open_link_new_tab
? `<a href="${item.link}" target="_blank" style="color:${item.color_text}">${item.display_value}</a>`
: `<a href="${item.link}" style="color:${item.color_text}">${item.display_value}</a>`;
let item_display =
item.link === '#'
? item.display_value
: `<a href="${item.link}" target="_blank" style="color:${item.color_text}">${item.display_value}</a>`;
: item_link_value;
let tooltip =
!item.tooltip || item.tooltip === '-'
? undefined
Expand Down
2 changes: 2 additions & 0 deletions src/app/boom/BoomPattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class BoomPattern implements IBoomPattern {
public enable_bgColor: Boolean;
public enable_bgColor_overrides: Boolean;
public enable_clickable_cells: Boolean;
public open_link_new_tab: Boolean;
public enable_textColor: Boolean;
public enable_textColor_overrides: Boolean;
public enable_time_based_thresholds: Boolean;
Expand Down Expand Up @@ -64,6 +65,7 @@ class BoomPattern implements IBoomPattern {
this.enable_textColor = false;
this.enable_textColor_overrides = false;
this.enable_clickable_cells = false;
this.open_link_new_tab = false;
this.enable_time_based_thresholds = false;
this.enable_transform = false;
this.enable_transform_overrides = false;
Expand Down
3 changes: 3 additions & 0 deletions src/app/boom/BoomSeries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class BoomSeries implements IBoomSeries {
public value = NaN;
public value_formatted = "-";
public link = "-";
public open_link_new_tab = false;
public thresholds: Number[];
public hidden: Boolean = false;
public _metricname = "";
Expand Down Expand Up @@ -68,6 +69,8 @@ class BoomSeries implements IBoomSeries {
this.link = getLink(this.pattern.enable_clickable_cells, this.pattern.clickable_cells_link, timeSrv.timeRangeForUrl());
this.link = replaceDelimitedColumns(this.link, this.seriesName, this.pattern.delimiter, this.row_col_wrapper);

this.open_link_new_tab = this.pattern.open_link_new_tab;

this.tooltip = this.pattern.tooltipTemplate || "Series : _series_ <br/>Row Name : _row_name_ <br/>Col Name : _col_name_ <br/>Value : _value_";

this.replaceSeriesRowColTokens();
Expand Down
1 change: 1 addition & 0 deletions src/app/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const default_pattern_options: any = {
null_color: 'darkred',
null_textcolor: 'white',
null_value: 'No data',
open_link_new_tab: false,
pattern: '*',
row_name: '_series_',
textColors: 'red|orange|green',
Expand Down
4 changes: 4 additions & 0 deletions src/partials/editor.html
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,10 @@ <h6 class="text-header">Cell Links & Tooltip</h6>
<input type="text" placeholder="Series : _series_ <br/>Row Name : _row_name_ <br/>Col Name : _col_name_ <br/>Value : _value_"
class="gf-form-input width-18" ng-model="pattern.tooltipTemplate" bs-tooltip="'Tooltip Template; Leave blank for default template; Enter - to disable tooltip'"
ng-blur="ctrl.render()">
<span class="split"></span>
<label class="gf-form-label width-26">Open Link in New Tab</label>
<input type="checkbox" class="gf-form-input width-4" ng-model="pattern.open_link_new_tab"
ng-blur="ctrl.render()" ng-change="ctrl.render()">
</div>
</div>
</div>
Expand Down