diff --git a/RELEASE.md b/RELEASE.md index e68596830..e0b295425 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -16,6 +16,7 @@ Please follow the established format: - Improve `kedro viz build` usage documentation (#2126) - Fix unserializable parameters value (#2122) +- Display full dataset type with library prefix in metadata panel (#2136) # Release 10.0.0 diff --git a/src/components/metadata/metadata.js b/src/components/metadata/metadata.js index 49241e000..5b0ed7080 100644 --- a/src/components/metadata/metadata.js +++ b/src/components/metadata/metadata.js @@ -121,10 +121,17 @@ const MetaData = ({ const shortenDatasetType = (value) => { const isList = Array.isArray(value); + // Extract the library (first part) and the dataset type (last part) + const getQualifier = (val) => { + if (typeof val === 'string' && val.includes('.')) { + const parts = val.split('.'); + return `${parts[0]}.${parts.pop()}`; + } + // If val is not a string or does not include a dot return as is + return val; + }; - return isList - ? value.map((val) => val.split('.').pop()) - : value?.split('.').pop(); + return isList ? value.map(getQualifier) : getQualifier(value); }; return ( diff --git a/src/components/metadata/metadata.test.js b/src/components/metadata/metadata.test.js index 12ab05d39..849d8cc3e 100644 --- a/src/components/metadata/metadata.test.js +++ b/src/components/metadata/metadata.test.js @@ -303,7 +303,7 @@ describe('MetaData', () => { mockMetadata: nodeData, }); const row = rowByLabel(wrapper, 'Dataset Type:'); - expect(textOf(rowValue(row))).toEqual(['CSVDataset']); + expect(textOf(rowValue(row))).toEqual(['pandas.CSVDataset']); }); it('shows the node filepath', () => { @@ -402,7 +402,7 @@ describe('MetaData', () => { mockMetadata: nodeTranscodedData, }); const row = rowByLabel(wrapper, 'Original Type:'); - expect(textOf(rowValue(row))).toEqual(['SparkDataset']); + expect(textOf(rowValue(row))).toEqual(['spark.SparkDataset']); }); it('shows the node transcoded type', () => { @@ -411,7 +411,7 @@ describe('MetaData', () => { mockMetadata: nodeTranscodedData, }); const row = rowByLabel(wrapper, 'Transcoded Types:'); - expect(textOf(rowValue(row))).toEqual(['ParquetDataset']); + expect(textOf(rowValue(row))).toEqual(['pandas.ParquetDataset']); }); }); describe('Metrics dataset nodes', () => {