From 78dbf58536c6573cd40f54554ed8c563fd11f74a Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Fri, 30 Aug 2013 08:47:35 -0700 Subject: [PATCH] Added clickable urls to table row details view --- js/filters.js | 36 ++++++++++++++++++++++++++++++++++++ panels/table/module.html | 3 ++- 2 files changed, 38 insertions(+), 1 deletion(-) diff --git a/js/filters.js b/js/filters.js index d5dba67fa35..241497d8897 100644 --- a/js/filters.js +++ b/js/filters.js @@ -32,4 +32,40 @@ angular.module('kibana.filters', []) return arr.toString(); } }; + +}).filter('noXml', function() { + return function(text) { + if(!_.isString(text)) { + return text; + } + return text. + replace(/&/g, '&'). + replace(//g, '>'). + replace(/'/g, '''). + replace(/"/g, '"'); + }; +}).filter('urlLink', function() { + var //URLs starting with http://, https://, or ftp:// + r1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim, + //URLs starting with "www." (without // before it, or it'd re-link the ones done above). + r2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim, + //Change email addresses to mailto:: links. + r3 = /(\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/gim; + + return function(text, target, otherProp) { + if(!_.isString(text)) { + return text; + } + _.each(text.match(r1), function(url) { + text = text.replace(r1, "$1"); + }); + _.each(text.match(r2), function(url) { + text = text.replace(r2, "$1$2"); + }); + _.each(text.match(r3), function(url) { + text = text.replace(r3, "$1"); + }); + return text; + }; }); \ No newline at end of file diff --git a/panels/table/module.html b/panels/table/module.html index 51536d28492..c872549f9cb 100644 --- a/panels/table/module.html +++ b/panels/table/module.html @@ -74,7 +74,8 @@ - {{value}} + +