Browse Source

HUE-7218 [editor] Offer links if row values are pure http links in the record popup

Romain Rigaux 8 năm trước cách đây
mục cha
commit
1edda2f

+ 4 - 2
desktop/core/src/desktop/templates/common_header_footer_components.mako

@@ -528,8 +528,10 @@ from metadata.conf import has_optimizer, OPTIMIZER
       $t.html('');
       var html = '';
       $el.find('thead th').each(function (colIdx, col) {
-        if (colIdx > 0){
-          html += '<tr><th width="10%">' + $(col).text() + '</th><td>' + $el.data('data')[data.idx][colIdx] + '</td></tr>';
+        if (colIdx > 0) {
+          var value = $el.data('data')[data.idx][colIdx];
+          var link = typeof value == 'string' && value.match(/^https?:\/\//i) ? '<a href="' + escapeOutput(value) + '" target="_blank">' + value + ' <i class="fa fa-external-link"></i></a>' : value;
+          html += '<tr><th width="10%">' + $(col).text() + '</th><td>' + link + '</td></tr>';
         }
       });
       $t.html(html);