Skip to content

Commit

Permalink
feat: show all previous revisions in compare revision dropdown (#47)
Browse files Browse the repository at this point in the history
This change updates the Compare Revision dropdown on the Package Revision Page to include all previous revisions. Previously the comparison dropdown only showed one previous revision.
  • Loading branch information
ChristopherFry committed Jun 17, 2022
1 parent 89d090d commit 923e81d
Showing 1 changed file with 9 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,21 +197,15 @@ export const PackageRevisionPage = ({ mode }: PackageRevisionPageProps) => {
{ label: 'Hide comparison', value: 'none' },
];

if (
thisSortedRevisions.indexOf(thisPackageRevision) !==
thisSortedRevisions.length - 1
) {
const basePackageRevision =
thisSortedRevisions[
thisSortedRevisions.indexOf(thisPackageRevision) + 1
];

if (basePackageRevision) {
diffItems.push({
label: `Previous Revision (${basePackageRevision.spec.revision})`,
value: basePackageRevision.metadata.name,
});
}
const currentRevisionIdx = thisSortedRevisions.indexOf(thisPackageRevision);

for (let i = currentRevisionIdx + 1; i < thisSortedRevisions.length; i++) {
const previousPackageRevision = thisSortedRevisions[i];

diffItems.push({
label: `Previous Revision (${previousPackageRevision.spec.revision})`,
value: previousPackageRevision.metadata.name,
});
}

const upstream = getUpstreamPackageRevisionDetails(thisPackageRevision);
Expand Down

0 comments on commit 923e81d

Please sign in to comment.