Skip to content

Add Code Suggestions section to DuoProDiscover page ...

Buck O'Leary requested to merge 462653-code-suggestions-section into master

What does this MR do and why?

Add Code Suggestions section to DuoProDiscover page

    - Adds Code Suggestions section

    - Adds tracking for documentation links within each feature card

    - Creates helper method for generating code suggestion cards content

    - Creates helper method for rendering footer links correctly for collections

    - Refactors view to use new Pajamas::Card #with_collection functionality

    - Expands test coverage with new RSpec examples for the section

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

Screenshot 2024-07-24 at 6.02.46 PM.png

Screenshot 2024-08-11 at 6.42.26 PM.pngScreenshot 2024-08-11 at 6.42.15 PM.png

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Make Duo Pro Discover show page available by following the steps in @jmontal's initial MR. Re-posting rails console commands for clarity / ease here:
  2. bin/rails c
  3. Feature.enable(:duo_pro_trials)
    GitlabSubscriptions::AddOn.find_or_create_by(name: 'code_suggestions', description: GitlabSubscriptions::AddOn.descriptions[:code_suggestions])
    GitlabSubscription.last.update(trial: true, trial_starts_on: 45.days.ago, trial_ends_on: 15.days.ago)
    GitlabSubscriptions::AddOnPurchase.create(subscription_add_on_id: GitlabSubscriptions::AddOn.find_by(name: 'code_suggestions').id, namespace: Group.last, started_at: 60.days.ago, expires_on: Date.today, trial: true, quantity: 1, purchase_xid: '1', organization_id: 1)
  4. Caveats / Troubleshooting - depending on your current local environment you may need to create additional resources for those rails console commands to execute successfully (I believe I needed to create a GitlabSubscription in the console as well.)

If you're impatient and those steps don't fully get you there, you should also be able to force the rendering of the Duo Pro Discover page by modifying the following file like so - although be careful not to commit it.

ee/app/models/gitlab_subscriptions/trials/duo_pro.rb:

def self.show_duo_pro_discover?(namespace, user)
+  return true
   return false unless namespace.present?
   return false unless user.present?
  1. Start the GDK and navigate to http://localhost:3000/groups/#{your-test-group}/-/add_ons/discover_duo_pro

Related to #462653

Edited by Serhii Yarynovskyi

Merge request reports

Loading