Skip to content

Commit

Permalink
Merge branch 'main' into doc-readme-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
rashidakanchwala authored Oct 14, 2024
2 parents 15690ce + 90355f8 commit 37e24e1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 10 additions & 3 deletions src/components/metadata/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
6 changes: 3 additions & 3 deletions src/components/metadata/metadata.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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', () => {
Expand All @@ -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', () => {
Expand Down

0 comments on commit 37e24e1

Please sign in to comment.