-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOP-3903: API Changelog Support to omit entries #919
Merged
Merged
Changes from 17 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
cd1b530
DOP-3938 functional
anabellabuckvar 73184b4
Merge branch 'master' into DOP-3903-b
anabellabuckvar 00dedcb
DOP-3903-b cleaning up
anabellabuckvar 6f8af87
DOP-3903-b hidefromchangelog frontend diff
anabellabuckvar 6f341b2
DOP-3903-b tested changes
anabellabuckvar 3d90d72
DOP-3903-b deleted comments
anabellabuckvar 7ef99b6
DOP-3903-b boolean and object copies refactoring
anabellabuckvar 7bac35e
DOP-3903-b stylistic changes
anabellabuckvar fe20fc9
DOP-3903-b remove extra ternary ops
anabellabuckvar 201ee3d
Merge branch 'master' into DOP-3903-b
anabellabuckvar 340bb23
DOP-3903-b cleaned up merge
anabellabuckvar 5932cd2
DOP-3903-b unit tests added
anabellabuckvar 811ce88
DOP-3903-b unit tests
anabellabuckvar c2ceae3
Merge branch 'master' into DOP-3903-b
anabellabuckvar a92ad25
DOP-3903-b refactored hidechange functions
anabellabuckvar 44e3090
DOP-3903-b redid tests
anabellabuckvar d0d54d5
Merge branch 'master' into DOP-3903-b
anabellabuckvar 9ebb673
DOP-3903-b moved function calls
anabellabuckvar 2f8a825
DOP-3903-b removing, adding comments
anabellabuckvar f9a48f2
Merge branch 'master' into DOP-3903-b
anabellabuckvar d5ad525
Merge branch 'master' into DOP-3903-b
anabellabuckvar File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/components/OpenAPIChangelog/utils/filterHiddenChanges.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
export const hideChanges = (changelog) => { | ||
const versionUpdate = (version) => { | ||
const updatedVersion = { ...version }; | ||
if (version?.changes) { | ||
updatedVersion.changes = version.changes.filter((change) => !change.hideFromChangelog); | ||
} | ||
return updatedVersion; | ||
}; | ||
|
||
//pathUpdate takes the array of versions from the specific path passed in and takes each version and runs versionUpdate on it | ||
const pathUpdate = (path) => { | ||
const updatedPath = { ...path, versions: path.versions.map(versionUpdate) }; | ||
updatedPath.versions = updatedPath.versions.filter((version) => version.changes?.length); | ||
return updatedPath; | ||
}; | ||
|
||
//dateUpdate takes the array of paths from the specific date section passed in and takes each path and runs pathUpdate on it | ||
const dateUpdate = (dateSection) => { | ||
const updatedDateSection = { ...dateSection, paths: dateSection.paths.map(pathUpdate) }; | ||
updatedDateSection.paths = updatedDateSection.paths.filter((path) => path.versions?.length); | ||
return updatedDateSection; | ||
}; | ||
|
||
//changelog is the json file with everything in it. Map at this level takes each date section and runs dateUpdate on it | ||
const updatedChangelog = changelog.map(dateUpdate); | ||
return updatedChangelog.filter((dateSection) => dateSection.paths?.length); | ||
}; | ||
|
||
//nested filtering of Diff changes with hideFromChangeloge | ||
export const hideDiffChanges = (diffData) => { | ||
const pathUpdate = (path) => { | ||
const updatedPath = { ...path }; | ||
if (path?.changes) { | ||
updatedPath.changes = path.changes.filter((change) => !change.hideFromChangelog); | ||
} | ||
return updatedPath; | ||
}; | ||
|
||
const updatedDiffData = diffData.map(pathUpdate); | ||
return updatedDiffData.filter((path) => path.changes?.length); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,4 +53,38 @@ describe('OpenAPIChangelog ChangeList', () => { | |
expect(queryByText(change.change)).toBeNull(); | ||
}); | ||
}); | ||
|
||
// it('does not render all version changelog changes with "hideFromChangelog=true"', () => { | ||
// const hiddenChanges = mockChangelog.reduce((acc, date) => { | ||
// date.paths.forEach((path) => | ||
// path.versions.forEach((version) => | ||
// version.changes.forEach((change) => change.hideFromChangelog && acc.push(change)) | ||
// ) | ||
// ); | ||
// return acc; | ||
// }, []); | ||
|
||
// const { queryByText } = render(<ChangeList changes={mockChangelog} versionMode={ALL_VERSIONS} />); | ||
|
||
// expect(hiddenChanges).toHaveLength(2); | ||
|
||
// hiddenChanges.forEach((change) => { | ||
// expect(queryByText(change.change)).toBeNull(); | ||
// }); | ||
// }); | ||
|
||
// it('does not render Diff changelog changes with "hideFromChangelog=true"', () => { | ||
// const hiddenChanges = mockDiff.reduce((acc, resource) => { | ||
// resource.changes.forEach((change) => change.hideFromChangelog && acc.push(change)); | ||
// return acc; | ||
// }, []); | ||
|
||
// const { queryByText } = render(<ChangeList changes={mockDiff} versionMode={COMPARE_VERSIONS} />); | ||
|
||
// expect(hiddenChanges).toHaveLength(2); | ||
|
||
// hiddenChanges.forEach((change) => { | ||
// expect(queryByText(change.change)).toBeNull(); | ||
// }); | ||
// }); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These can be removed, I believe |
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would also love a comment above this explaining what this first util function is doing (ie what field it's hiding and that it is meant to be used on the changelog rather than the diff