feat(changelog): add changelog widget version comparison#614
feat(changelog): add changelog widget version comparison#614vivekv1504 wants to merge 9 commits intowebex:nextfrom
Conversation
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
rarajes2
left a comment
There was a problem hiding this comment.
Let's move all the business logic to a separate file comparison-view.js and import the methods in this file and use it. We can keep all the UI related methods in this file.
docs/changelog/index.html
Outdated
| </li> | ||
| <li> | ||
| <a href="?compareStableA=1.28.0&compareStableB=1.28.2&comparePackage=@webex/widgets&compareVersionA=1.28.2-next.2&compareVersionB=1.28.2-next.3" | ||
| >Package-level comparison - @webex/widgets specific versions</a |
There was a problem hiding this comment.
nitpick: please align the angular brackets
docs/changelog/assets/css/app.css
Outdated
|
|
||
| /* Comparison Results Table */ | ||
| #comparison-results .table-wrapper { | ||
| max-height: 500px; |
There was a problem hiding this comment.
Let's use rem where recommended
There was a problem hiding this comment.
pixel units changed to rem units where it placed in px units
| Handlebars.registerHelper('forIn', function (object) { | ||
| let returnArray = []; | ||
| for (let prop in object) { | ||
| returnArray.push({key: prop, value: object[prop]}); | ||
| } | ||
| return returnArray; | ||
| Handlebars.registerHelper("forIn", function(object) { | ||
| let returnArray = []; | ||
| for(let prop in object){ | ||
| returnArray.push({key: prop, value: object[prop]}); | ||
| } | ||
| return returnArray; |
There was a problem hiding this comment.
Let's revert all these formatting changes, it will reduce the diff. Applicable everywhere
There was a problem hiding this comment.
Still see some formatting changes, please do revert them and run the eslint.
docs/changelog/assets/js/app.js
Outdated
| if (searchParams.package) { | ||
| if (!packageNameInputDropdown.disabled) { |
There was a problem hiding this comment.
these two conditiones set into one line
| versionPaths[version] = path; | ||
| optionsHtml += `<option value="${version}">${version}</option>`; | ||
| const populatePackageNames = (changelog) => { | ||
| let specialPackages = ['@webex/widgets', '@webex/cc-widgets']; |
There was a problem hiding this comment.
What are special packages ? Why they need to be treated differently from other packages ?
There was a problem hiding this comment.
this is in single search comparison that is written by old as format in sdk comparison and that special pacakges are shows separately while populated the pacages names ,that pacakages are popular or everywhere presented in stable. versions
docs/changelog/assets/js/app.js
Outdated
| console.log('effectiveVersionA:', effectiveVersionA, '(requested:', versionASpecific, ')'); | ||
| console.log('effectiveVersionB:', effectiveVersionB, '(requested:', versionBSpecific, ')'); |
There was a problem hiding this comment.
We can remove all console logs
| if (comparisonPackageSelect) comparisonPackageSelect.value = ''; | ||
| if (versionAPrereleaseSelect) versionAPrereleaseSelect.value = ''; | ||
| if (versionBPrereleaseSelect) versionBPrereleaseSelect.value = ''; | ||
| if (comparisonPackageRow) comparisonPackageRow.style.display = 'none'; | ||
| if (prereleaseRow) prereleaseRow.style.display = 'none'; |
There was a problem hiding this comment.
Do we need to have the conditions ? We can reset the values irrespective of the conditions, right ?
There was a problem hiding this comment.
conditions is better because it prevents from error where value doesn't exits .
can you sugget which one is better
another way is comparisonPackageSelect.value = '';
| if (searchForm) searchForm.classList.remove('hide'); | ||
| if (comparisonForm) comparisonForm.classList.add('hide'); | ||
| if (comparisonResults) comparisonResults.classList.add('hide'); | ||
| if (searchResults) searchResults.classList.remove('hide'); | ||
| if (helperSection) helperSection.classList.remove('hide'); | ||
| if (comparisonHelper) comparisonHelper.classList.add('hide'); |
There was a problem hiding this comment.
Same here, see if we actually need the if conditions ?
Check this logic everywhere in this file
docs/changelog/assets/js/app.js
Outdated
|
|
||
| const stableA = versionASelect.value; | ||
| const stableB = versionBSelect.value; | ||
| const selectedPackage = comparisonPackageSelect ? comparisonPackageSelect.value : null; |
There was a problem hiding this comment.
const selectedPackage = comparisonPackageSelect?.value;We can keep the logic like this and utilize the undefined value
There was a problem hiding this comment.
Done Rajesh both are same (undefined and null 's are falsy statements ) ,changes to this
const selectedPackage = comparisonPackageSelect?.value;
| if (versionAPrereleaseSelect) versionAPrereleaseSelect.addEventListener('change', updateCompareButtonState); | ||
| if (versionBPrereleaseSelect) versionBPrereleaseSelect.addEventListener('change', updateCompareButtonState); |
There was a problem hiding this comment.
Do we have any logic to remove the event listeners when we switch to another mode? We should not be adding multiple listeners as we toggle through the single and comparison views.
Applicable everywhere
There was a problem hiding this comment.
there is no remove event listeners .there is only hide elements are there in single and version comparison
And there is no duplicate listeners
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
vivekv1504
left a comment
There was a problem hiding this comment.
Rajesh almost done ,but most the comments realated to single version search ,that code previously implemented by kesava and shreyas
docs/changelog/index.html
Outdated
| </li> | ||
| <li> | ||
| <a href="?compareStableA=1.28.0&compareStableB=1.28.2&comparePackage=@webex/widgets&compareVersionA=1.28.2-next.2&compareVersionB=1.28.2-next.3" | ||
| >Package-level comparison - @webex/widgets specific versions</a |
docs/changelog/assets/css/app.css
Outdated
|
|
||
| /* Comparison Results Table */ | ||
| #comparison-results .table-wrapper { | ||
| max-height: 500px; |
There was a problem hiding this comment.
pixel units changed to rem units where it placed in px units
docs/changelog/assets/js/app.js
Outdated
| // If the package name is not empty, show all options | ||
| // If one of the commit search options is not empty, hide version input and show commit search options | ||
| // If the version field is not empty, hide the commit search options | ||
| if(formParams === undefined){ |
There was a problem hiding this comment.
changes and add space after the keyword where is placed keywords after not space
| Handlebars.registerHelper('forIn', function (object) { | ||
| let returnArray = []; | ||
| for (let prop in object) { | ||
| returnArray.push({key: prop, value: object[prop]}); | ||
| } | ||
| return returnArray; | ||
| Handlebars.registerHelper("forIn", function(object) { | ||
| let returnArray = []; | ||
| for(let prop in object){ | ||
| returnArray.push({key: prop, value: object[prop]}); | ||
| } | ||
| return returnArray; |
docs/changelog/assets/js/app.js
Outdated
| disable.commitHash = true; | ||
| disable.searchButton = false; | ||
| } | ||
| else if((formParams.commitMessage && formParams.commitMessage.trim() !== '') || (formParams.commitHash && formParams.commitHash.trim() !== '')){ |
| if (comparisonPackageSelect) comparisonPackageSelect.value = ''; | ||
| if (versionAPrereleaseSelect) versionAPrereleaseSelect.value = ''; | ||
| if (versionBPrereleaseSelect) versionBPrereleaseSelect.value = ''; | ||
| if (comparisonPackageRow) comparisonPackageRow.style.display = 'none'; | ||
| if (prereleaseRow) prereleaseRow.style.display = 'none'; |
There was a problem hiding this comment.
conditions is better because it prevents from error where value doesn't exits .
can you sugget which one is better
another way is comparisonPackageSelect.value = '';
| if (versionAPrereleaseSelect) versionAPrereleaseSelect.addEventListener('change', updateCompareButtonState); | ||
| if (versionBPrereleaseSelect) versionBPrereleaseSelect.addEventListener('change', updateCompareButtonState); |
There was a problem hiding this comment.
there is no remove event listeners .there is only hide elements are there in single and version comparison
And there is no duplicate listeners
docs/changelog/assets/js/app.js
Outdated
|
|
||
| const stableA = versionASelect.value; | ||
| const stableB = versionBSelect.value; | ||
| const selectedPackage = comparisonPackageSelect ? comparisonPackageSelect.value : null; |
There was a problem hiding this comment.
Done Rajesh both are same (undefined and null 's are falsy statements ) ,changes to this
const selectedPackage = comparisonPackageSelect?.value;
docs/changelog/assets/js/app.js
Outdated
| } | ||
| const doSearch = (searchParams) => { | ||
| const { package, version } = searchParams; | ||
| let drill_down = {...currentChangelog}, shouldTransform = true, search_results = []; |
There was a problem hiding this comment.
the drill_down is stored chnagelog data ,stores the pacakages data
… app.js and comparison-view.js
|
@codex review |
|
To use Codex here, create a Codex account and connect to github. |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 742a432432
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| allHashes = new Set(); | ||
| discontinueSearch = true; | ||
| searchResults.push({ | ||
| pacakage, |
There was a problem hiding this comment.
Return
package key in commit search results
The objects emitted by doSearch_commit use pacakage instead of package, but the changelog template and generated links read this.package. In commit-message/hash searches (shouldTransform = false), this causes package names to render empty and breaks package-specific links/actions in results, so a primary search mode returns malformed output.
Useful? React with 👍 / 👎.
| const pkgDataA = changelogA[packageName]?.[versionASpecific]; | ||
| const pkgDataB = changelogB[packageName]?.[versionBSpecific]; |
There was a problem hiding this comment.
Recompute package data after fallback version resolution
generatePackageComparisonData reads pkgDataA/pkgDataB from the requested versions before resolving fallback versions with getEffectiveVersion. If one requested version is missing (for example, package has only prerelease tags and one prerelease selector is left empty), the effective version exists but pkgData* stays null, so downstream status/alongWith logic marks the package as Added/Removed incorrectly and loses related-package context.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
implemented the changes and just replace the lines
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1b84364bc9
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| </div> | ||
| </script> | ||
|
|
||
| <script type="module" src="assets/js/app.js"></script> |
There was a problem hiding this comment.
Restore global copy handlers after switching to module script
Loading app.js as type="module" makes top-level functions module-scoped, but the page still uses inline handlers (onclick='copyToClipboard(this)' and onclick="copyComparisonLink()") that resolve names on window. In this mode, those handlers throw ReferenceError at click time, so the changelog row copy action no longer works and copy interactions become error-prone unless separately rebound.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
yes after clicking copy button in both single version and version comparison search it throws the reference error and on more issue is after click copyComparisonlink in version comparison search it throws refernce error but link is copied and data is also reloaded ,why it's because in copy button is placed in form div and not mentioned type property default is type= "submit "
Done implement the changes
| const versionA = findEarliestVersion(changelogA, packageName); | ||
| const versionB = findEarliestVersion(changelogB, packageName); |
There was a problem hiding this comment.
Compare release versions instead of earliest package entries
The full comparison path currently picks each package version with findEarliestVersion(...), i.e. the oldest publish date in each changelog. For packages that have multiple builds in a stable train (pre-releases plus stable), this compares stale versions and can mislabel rows and aggregate counts (Version Changed/Unchanged/Added/Removed). The nearby findStableVersion helper is never used, so the main comparison can report incorrect results.
Useful? React with 👍 / 👎.

COMPLETES #https://jira-eng-gpk2.cisco.com/jira/browse/SPARK-770576
This pull request addresses
ADD VERSION COMAPRISON MODE FUNCTIONALITY IN WIDGETS
by making the following changes
Version Comparison Mode
Compare all packages between two stable versions
Package-level comparison with pre-release version support
Visual status indicators (Unchanged, Changed, Added, Removed)
Statistics dashboard (total packages, changed count, etc.)
Copy comparison link for sharing
Change Type
The following scenarios were tested
< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >
The GAI Coding Policy And Copyright Annotation Best Practices
Checklist before merging
Make sure to have followed the contributing guidelines before submitting.