Skip to content
Snippets Groups Projects

Display action buttons for the widget

Merged Savas Vedova requested to merge 368593-handle-action-buttons into master
All threads resolved!

What does this MR do and why?

Displays action buttons when the actionButtons property is populated.

Screenshots or screen recordings

action-buttons

How to set up and validate locally

  1. This feature is behind a feature flag. Enable :refactor_security_extension to turn this feature on.
echo "Feature.enable(:refactor_security_extension)" | rails c
  1. Visit an MR page with Security Scanning

The easiest way to populate data for testing is using this extension https://chrome.google.com/webstore/detail/mokku-mock-api-calls-seam/llflfcikklhgamfmnjkgpdadpmdplmji?hl=en and importing mokku-mocks-22-8-2022.json this json.

Once you have enabled the extension:

  1. Open the developer tools
  2. Find Mokku tab
  3. Click on import
  4. Import the file mentioned above

Apply the following patch to force displaying a button:

diff --git a/ee/app/assets/javascripts/vue_merge_request_widget/extensions/security_reports/mr_widget_security_reports.vue b/ee/app/assets/javascripts/vue_merge_request_widget/extensions/security_reports/mr_widget_security_reports.vue
index aa5e88420080..adf2bed13b4a 100644
--- a/ee/app/assets/javascripts/vue_merge_request_widget/extensions/security_reports/mr_widget_security_reports.vue
+++ b/ee/app/assets/javascripts/vue_merge_request_widget/extensions/security_reports/mr_widget_security_reports.vue
@@ -23,6 +23,7 @@ export default {
   data() {
     return {
       isLoading: false,
+      clickText: 'click-me',
       vulnerabilities: {
         collapsed: null,
         extended: null,
@@ -30,6 +31,26 @@ export default {
     };
   },
   computed: {
+    actionButtons() {
+      return [
+        {
+          text: this.clickText,
+          href: '#',
+          target: '_blank',
+          onClick: () => {
+            this.clickText = 'you-have-clicked';
+          },
+        },
+        {
+          text: `click-me-2`,
+          href: '#',
+          onClick: () => {
+            alert('hello-world');
+          },
+        },
+      ];
+    },
+
     isCollapsible() {
       if (!this.vulnerabilities.collapsed) {
         return false;
@@ -129,6 +150,7 @@ export default {
     :status-icon-name="statusIconName"
     :widget-name="$options.name"
     :is-collapsible="isCollapsible"
+    :action-buttons="actionButtons"
     multi-polling
     @is-loading="handleIsLoading"
   >

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #368593 (closed)

Merge request reports

Merged results pipeline #620665834 passed

Pipeline: GitLab

#620721267

    Merged results pipeline passed for 6cd6f13d

    Test coverage 83.45% (11.80%) from 2 jobs

    Merged by Jannik LehmannJannik Lehmann 2 years ago (Aug 23, 2022 4:58pm UTC)

    Loading

    Pipeline #620820544 passed

    Pipeline passed for c8df5654 on master

    Test coverage 71.65% (11.80%) from 2 jobs
    10 environments impacted.

    Activity

    Filter activity
    • Approvals
    • Assignees & reviewers
    • Comments (from bots)
    • Comments (from users)
    • Commits & branches
    • Edits
    • Labels
    • Lock status
    • Mentions
    • Merge request status
    • Tracking
  • 1 Warning
    :warning: Please add a merge request subtype to this merge request.
    1 Message
    :book: CHANGELOG missing:

    If you want to create a changelog entry for GitLab FOSS, add the Changelog trailer to the commit message you want to add to the changelog.

    If you want to create a changelog entry for GitLab EE, also add the EE: true trailer to your commit message.

    If this merge request doesn't need a CHANGELOG entry, feel free to ignore this message.

    Reviewer roulette

    Changes that require review have been detected!

    Please refer to the table below for assigning reviewers and maintainers suggested by Danger in the specified category:

    Category Reviewer Maintainer
    frontend Sheldon Led (@sheldonled) (UTC+1, 2 hours behind @svedova) Natalia Tepluhina (@ntepluhina) (UTC+2, 1 hour behind @svedova)

    To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot, based on their timezone. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.

    To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.

    Once you've decided who will review this merge request, assign them as a reviewer! Danger does not automatically notify them for you.

    If needed, you can retry the :repeat: danger-review job that generated this comment.

    Generated by :no_entry_sign: Danger

  • mentioned in issue #368593 (closed)

  • Bundle size analysis [beta]

    This compares changes in bundle size for entry points between the commits aef5ed10 and 38a20548

    :sparkles: Special assets

    Entrypoint / Name Size before Size after Diff Diff in percent
    average 3.6 MB 3.6 MB - 0.0 %
    mainChunk 1.98 MB 1.98 MB - 0.0 %

    Note: We do not have exact data for aef5ed10. So we have used data from: 59240212.
    The intended commit has no webpack pipeline, so we chose the last commit with one before it.

    Please look at the full report for more details


    Read more about how this report works.

    Generated by :no_entry_sign: Danger

  • Allure report

    allure-report-publisher generated test report!

    review-qa-blocking: :exclamation: test report for 7f408837

    expand test summary
    +-----------------------------------------------------------------------------------------+
    |                                     suites summary                                      |
    +------------------------------------+--------+--------+---------+-------+-------+--------+
    |                                    | passed | failed | skipped | flaky | total | result |
    +------------------------------------+--------+--------+---------+-------+-------+--------+
    | Plan                               | 47     | 0      | 1       | 17    | 48    | ❗     |
    | Create                             | 28     | 0      | 1       | 5     | 29    | ❗     |
    | Manage                             | 46     | 0      | 3       | 18    | 49    | ❗     |
    | Package                            | 0      | 0      | 1       | 0     | 1     | ➖     |
    | Verify                             | 12     | 0      | 1       | 6     | 13    | ❗     |
    | Protect                            | 2      | 0      | 0       | 2     | 2     | ❗     |
    | Secure                             | 2      | 0      | 0       | 2     | 2     | ❗     |
    | Feature flag handler sanity checks | 9      | 0      | 0       | 0     | 9     | ✅     |
    | Configure                          | 0      | 0      | 1       | 0     | 1     | ➖     |
    | Version sanity check               | 0      | 0      | 1       | 0     | 1     | ➖     |
    +------------------------------------+--------+--------+---------+-------+-------+--------+
    | Total                              | 146    | 0      | 9       | 50    | 155   | ❗     |
    +------------------------------------+--------+--------+---------+-------+-------+--------+
  • Savas Vedova requested review from @dpisek and removed review request for @farias-gl

    requested review from @dpisek and removed review request for @farias-gl

  • Savas Vedova added 159 commits

    added 159 commits

    Compare with previous version

  • Reviewer roulette

    Changes that require review have been detected!

    Please refer to the table below for assigning reviewers and maintainers suggested by Danger in the specified category:

    Category Reviewer Maintainer
    frontend Thomas Randolph (@thomasrandolph) (UTC-6, 9 hours behind @svedova) Natalia Tepluhina (@ntepluhina) (UTC+2, 1 hour behind @svedova)

    To spread load more evenly across eligible reviewers, Danger has picked a candidate for each review slot, based on their timezone. Feel free to override these selections if you think someone else would be better-suited or use the GitLab Review Workload Dashboard to find other available reviewers.

    To read more on how to use the reviewer roulette, please take a look at the Engineering workflow and code review guidelines. Please consider assigning a reviewer or maintainer who is a domain expert in the area of the merge request.

    Once you've decided who will review this merge request, assign them as a reviewer! Danger does not automatically notify them for you.

    If needed, you can retry the :repeat: danger-review job that generated this comment.

    Generated by :no_entry_sign: Danger

  • Bundle size analysis [beta]

    This compares changes in bundle size for entry points between the commits 439ca344 and 7f408837

    :sparkles: Special assets

    Entrypoint / Name Size before Size after Diff Diff in percent
    average 3.6 MB 3.59 MB - -0.0 %
    mainChunk 1.98 MB 1.98 MB - -0.0 %

    Please look at the full report for more details


    Read more about how this report works.

    Generated by :no_entry_sign: Danger

  • David Pisek approved this merge request

    approved this merge request

  • :wave: @dpisek, thanks for approving this merge request.

    This is the first time the merge request is approved. To ensure full test coverage, a new pipeline has been started.

    For more info, please refer to the following links:

  • David Pisek requested review from @jannik_lehmann and removed review request for @dpisek

    requested review from @jannik_lehmann and removed review request for @dpisek

  • Jannik Lehmann added 43 commits

    added 43 commits

    Compare with previous version

  • Jannik Lehmann removed review request for @jannik_lehmann

    removed review request for @jannik_lehmann

  • Savas Vedova added 1 commit

    added 1 commit

    • 7f408837 - Apply 1 suggestion(s) to 1 file(s)

    Compare with previous version

  • requested review from @jannik_lehmann

  • Jannik Lehmann approved this merge request

    approved this merge request

  • Jannik Lehmann resolved all threads

    resolved all threads

  • Jannik Lehmann enabled an automatic merge when the pipeline for 6cd6f13d succeeds

    enabled an automatic merge when the pipeline for 6cd6f13d succeeds

  • Jannik Lehmann mentioned in commit c8df5654

    mentioned in commit c8df5654

  • added workflowstaging label and removed workflowcanary label

  • Phil Calder added devopsgovern label and removed devopssecure label

    added devopsgovern label and removed devopssecure label

  • 🤖 GitLab Bot 🤖 added sectionsec label and removed sectiondev label

    added sectionsec label and removed sectiondev label

  • Please register or sign in to reply
    Loading