Skip to content

Commit ad0dacc

Browse files
committed
[frontend] replace location popover with link to filebrowser
1 parent a7c1299 commit ad0dacc

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

apps/metastore/src/metastore/templates/metastore.mako

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,16 @@ ${ components.menubar(is_embeddable) }
263263
${_('and stored in')}
264264
<!-- ko if: details.properties.format === 'kudu' -->
265265
<div>${_('Kudu')}</div>
266+
<!-- /ko -->
267+
<!-- ko if: details.properties.format !== 'kudu' -->
268+
<!-- ko if: hdfs_link -->
269+
<div>
270+
<a data-bind="hueLink: hdfs_link, attr: { title: $parent.catalogEntry.getHdfsFilePath() }" target="_blank" >${_('location')}</a>
271+
</div>
272+
<!-- /ko -->
273+
<!-- ko ifnot: hdfs_link -->
274+
<div>${_('unknown location')}</div>
266275
<!-- /ko -->
267-
<!-- ko if: details.properties.format !== 'kudu' -->
268-
<div>
269-
<a href="javascript: void(0);" data-bind="storageContextPopover: { path: hdfs_link.replace('/filebrowser/view=', ''), offset: { left: 5 } }"> ${_('location')}</a>
270-
</div>
271276
<!-- /ko -->
272277
</div>
273278
<!-- /ko -->
@@ -480,12 +485,14 @@ ${ components.menubar(is_embeddable) }
480485
<div>${ _('Owner') }</div>
481486
<div><span data-bind="text: owner_name ? owner_name : '${ _ko('None') }'"></span> <span data-bind="visible: owner_type">(<span data-bind="text: owner_type"></span>)</span></div>
482487
</div>
483-
<div class="metastore-property">
484-
<div>${ _('Location') }</div>
485-
<div>
486-
<a href="javascript: void(0);" data-bind="storageContextPopover: { path: hdfs_link.replace('/filebrowser/view=', ''), offset: { left: 5 } }"> ${_('Location')}</a>
488+
<!-- ko if: hdfs_link -->
489+
<div class="metastore-property">
490+
<div>${ _('Location') }</div>
491+
<div>
492+
<a data-bind="hueLink: hdfs_link, attr: { title: $parent.catalogEntry.getHdfsFilePath() }" target="_blank" >${_('location')}</a>
493+
</div>
487494
</div>
488-
</div>
495+
<!-- /ko -->
489496
</div>
490497
</div>
491498
<!-- ko with: parameters -->

desktop/core/src/desktop/js/catalog/DataCatalogEntry.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,6 +1414,11 @@ export default class DataCatalogEntry {
14141414
return false;
14151415
}
14161416

1417+
getHdfsFilePath(): string {
1418+
const hdfs_link = this.analysis?.hdfs_link || '';
1419+
return hdfs_link.replace('/filebrowser/view=', '');
1420+
}
1421+
14171422
/**
14181423
* Returns true if the entry is an Iceberg table
14191424
*/

desktop/core/src/desktop/js/catalog/dataCatalogEntry.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe('dataCatalogEntry.ts', () => {
6969
partition_keys: [],
7070
cols: [{ name: 'i', type: 'int', comment: '' }],
7171
path_location: 'test',
72-
hdfs_link: '/test',
72+
hdfs_link: '/filebrowser/view=/warehouse/tablespace/managed/hive/sample_07',
7373
is_view: false,
7474
properties: [],
7575
details: {
@@ -94,6 +94,13 @@ describe('dataCatalogEntry.ts', () => {
9494
expect(entry.isIcebergTable()).toBeTruthy();
9595
});
9696

97+
it('should return the hdfs path based on the hdfs_link', async () => {
98+
emptyAnalysisApiSpy();
99+
const entry = await getEntry('someDb.someTable');
100+
await entry.getAnalysis();
101+
expect(entry.getHdfsFilePath()).toEqual('/warehouse/tablespace/managed/hive/sample_07');
102+
});
103+
97104
it('rejects a cachedOnly request if there is no previous promise', async () => {
98105
emptyAnalysisApiSpy();
99106
const entryA = await getEntry('someDb.someTable');

0 commit comments

Comments
 (0)