Skip to content

Conversation

pganesh-apphelix
Copy link

@pganesh-apphelix pganesh-apphelix commented Aug 7, 2025

Description

This PR introduces multiple UI enhancements and new functionality for the Course Optimizer page. The key updates include:


Previous Run Link Section

  • New section added to display links from previous course runs.
  • This section is conditionally rendered based on a feature flag:
    contentstore.enable_course_optimizer_check_prev_run_links
    • Enabled: Displays the section.
    • Disabled: Section is hidden.
  • If enabled but no data is found, the section will display “No result found.”

Course Update, Handouts, and Custom Page Section

  • Added UI components to display links for:
    • Course Updates
    • Handouts
    • Custom Pages
  • These links will appear under both:
    • Broken Links section
    • Previous Run Links section

UI Enhancements

  • Updated UI for the following elements:

    • Scan Course button
    • Filter Links components
  • Applied consistent styling based on the new design specifications.

  • Added functionality:

    • Update button: Replaces an individual current run link with its corresponding previous run link in course content.
    • Update All button: Bulk-replaces all applicable current run links using previous run links across supported sections.
  • 19-53-40.mp4

Jira

Testing Instructions

Please verify the following:

  • 🔘 With the feature flag disabled, the Previous Run Link section does not appear.
  • ✅ With the feature flag enabled:
    • If no previous run link is available, the section displays “No result found.”
    • All relevant Course Update, Handouts, and Custom Page links should be visible in both the Broken Links and Previous Run Links sections.
  • ⚙️ Update / Update All functionality:
    • Clicking Update should replace the specific link in course content.
    • Clicking Update All should apply updates in bulk across all eligible links.

Copy link

codecov bot commented Aug 8, 2025

Codecov Report

❌ Patch coverage is 95.22431% with 33 lines in your changes missing coverage. Please review.
✅ Project coverage is 94.62%. Comparing base (950bfee) to head (aef4ea3).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
src/optimizer-page/scan-results/ScanResults.tsx 93.62% 28 Missing and 3 partials ⚠️
src/optimizer-page/CourseOptimizerPage.tsx 95.55% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2356      +/-   ##
==========================================
+ Coverage   94.60%   94.62%   +0.02%     
==========================================
  Files        1179     1179              
  Lines       25506    26135     +629     
  Branches     5449     5820     +371     
==========================================
+ Hits        24129    24731     +602     
- Misses       1314     1333      +19     
- Partials       63       71       +8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pganesh-apphelix pganesh-apphelix force-pushed the pganesh/TNL2-141 branch 2 times, most recently from e4b049d to 24befc9 Compare August 18, 2025 11:18
@pganesh-apphelix pganesh-apphelix force-pushed the pganesh/TNL2-141 branch 3 times, most recently from 47d69b6 to c6fbd3d Compare August 29, 2025 12:51
courseId: string,
) {
const shouldPoll = rerunLinkUpdateInProgress === true
|| (rerunLinkUpdateResult && rerunLinkUpdateResult.status && rerunLinkUpdateResult.status !== 'Succeeded');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use RERUN_LINK_UPDATE_STATUSES.SUCCEEDED

Copy link
Contributor

@Faraz32123 Faraz32123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

) : (
<StatefulButton
className="px-4 rounded-0 update-link-btn"
labels={{ default: 'Update', pending: 'Update' }}
Copy link

@smartameer smartameer Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

both labels are same & translation missing?

Copy link
Contributor

@Faraz32123 Faraz32123 Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, we have only 2 states for this features, update or updated.
And StatefulButton will have same state for default and pending state.

Copy link
Contributor

@Faraz32123 Faraz32123 Sep 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be we can move it to constants file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pganesh-apphelix can we also add translation for this update state as well.

<span
className="updated-link-text d-flex align-items-center text-success"
>
Updated

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

translation missing

@@ -89,15 +160,65 @@ type TableData = {
const BrokenLinkTable: FC<BrokenLinkTableProps> = ({
unit,
filters,
linkType = 'broken',

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

move this broken to constant

} else {
blocksWithResults.add(result.id);
}
});

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const typeToSection = {
  course_updates: 'course-updates',
  custom_pages: 'custom-pages'
}; // to be maintained in constant

const addBlocksWithPrevLinks = sectionId => {
  const section = allSections.find(s => s.id === sectionId);
  if (!section) return;
  section.subsections.forEach(sub =>
    sub.units.forEach(unit =>
      unit.blocks.forEach(b => {
        if (b.previousRunLinks && b.previousRunLinks.length) blocksWithResults.add(b.id);
      })
    )
  );
};

response.results.forEach(result => {
  const sectionId = typeToSection[result.type];
  if (sectionId) {
    addBlocksWithPrevLinks(sectionId);
  } else {
    blocksWithResults.add(result.id);
  }
});

is it ok to write like this to reuse code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants