Skip to content
Snippets Groups Projects

Add "license" filter option to group-level dependencies app

All threads resolved!

What does this MR do and why?

Adds the "license" search-option to the group-level dependency report.

Note: The backend endpoints are not yet ready, so this can't be fully tested end-to-end yet.

Screenshots or screen recordings

Before After
Screenshot_2023-10-02_at_11.07.05_am Screenshot_2023-10-02_at_11.03.09_am

How to set up and validate locally

  1. Enable the related feature flags echo "Feature.enable(:group_level_dependencies_filtering)" | rails c
  2. Apply the following patch: licenses.patch to add the needed endpoint with mock data
  3. Go to a group's dependency list: "Secure" -> "Dependency List"
  4. Verify that when focusing the "Search of filter dependencies ..." input the "License" option appears
  5. Verify that licenses can be selected/deselected
  6. Verify that when the filters get submitted, the correct request is made - for example -/dependencies.json?sort_by=packager&sort=asc&page=1&filter=all&license[]=Apache-2.0&license[]=MIT

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 #422355 (closed)

Edited by David Pisek

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
83 };
84 </script>
85
86 <template>
87 <gl-filtered-search-token
88 :config="config"
89 v-bind="{ ...$props, ...$attrs }"
90 :multi-select-values="selectedLicenses"
91 v-on="$listeners"
92 @select="toggleSelectedLicenses"
93 @input="searchLicenses"
94 >
95 <template #view>
96 <span v-for="(component, index) in selectedLicenses" :key="index">
97 {{ component }}
98 <span v-if="!isLastLicense(index)" class="gl-mx-2">,&nbsp;</span>
  • David Pisek added 1 commit

    added 1 commit

    • 3482178e - WIP: Fix multi-select spacing

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    Compare with previous version

  • David Pisek added 2 commits

    added 2 commits

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    • 5d497a3a - WIP: add specs for loading indicator

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    • c9d9097d - WIP: Switch to axios instead of fetch

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    • ad455ad7 - WIP: small refactor of specs

    Compare with previous version

  • David Pisek added 343 commits

    added 343 commits

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    • 58c047f4 - WIP: Add specs for selection text

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    Compare with previous version

  • David Pisek added 128 commits

    added 128 commits

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    Compare with previous version

  • David Pisek
  • 40 },
    41 methods: {
    42 searchLicenses: debounce(function debouncedSearchLicenses(searchValue) {
    43 const { data: searchTerm } = searchValue;
    44 this.fetchLicenses(searchTerm);
    45 }, 500),
    46 async fetchLicenses(searchTerm) {
    47 this.isLoadingLicenses = true;
    48
    49 try {
    50 const { data } = await axios.get(this.groupLicensesEndpoint, {
    51 params: { search: searchTerm },
    52 });
    53 // const { licenses } = await axios.get(`${groupLicensesEndpoint}?${queryParams}`);
    54 // NOTE: For local testing - remove before checking in
    55 // const { licenses } = await (await fetch(`${groupLicensesEndpoint}?${queryParams}`)).json();
  • David Pisek added 1 commit

    added 1 commit

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    • 924bfdd2 - Add license as filter option to group-dependencies

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    • 18903177 - Add license as filter option to group-dependencies

    Compare with previous version

  • David Pisek added 79 commits

    added 79 commits

    Compare with previous version

  • David Pisek changed the description

    changed the description

  • David Pisek added 11 commits

    added 11 commits

    Compare with previous version

  • David Pisek changed the description

    changed the description

  • David Pisek added 1 commit

    added 1 commit

    • 9612b0c9 - Add license as filter option to group-dependencies

    Compare with previous version

  • David Pisek changed the description

    changed the description

  • David Pisek added 1 commit

    added 1 commit

    • a8b56def - Add license as filter option to group-dependencies

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    • bf821889 - Add license as filter option to group-dependencies

    Compare with previous version

  • David Pisek changed the description

    changed the description

  • David Pisek added 149 commits

    added 149 commits

    • bf821889...4289c903 - 148 commits from branch master
    • fbef376c - Add license as filter option to group-dependencies

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    • fd589648 - Add license as filter option to group-dependencies

    Compare with previous version

  • David Pisek changed the description

    changed the description

  • 28 value: {
    29 type: Object,
    30 required: true,
    31 },
    32 },
    33 data() {
    34 return {
    35 licenses: [],
    36 selectedLicenseSpdxIds: this.value.data ? this.value.data.split(',') : [],
    37 isLoadingLicenses: true,
    38 };
    39 },
    40 computed: {
    41 selectedLicenses() {
    42 return this.licenses.filter((license) =>
    43 this.selectedLicenseSpdxIds.includes(license.spdx_identifier),
  • David Pisek added 1 commit

    added 1 commit

    • f5581641 - Add license as filter option to group-dependencies

    Compare with previous version

  • David Pisek requested review from @zmartins

    requested review from @zmartins

  • David Pisek marked this merge request as ready

    marked this merge request as ready

  • David Pisek changed title from Resolve "Add "license" filter option to group-level dependencies app" to Add "license" filter option to group-level dependencies app

    changed title from Resolve "Add "license" filter option to group-level dependencies app" to Add "license" filter option to group-level dependencies app

    • Author Maintainer
      Resolved by David Pisek

      @mokhax - FYI, I based the patch that I've linked to in the description for testing this on your branch #422293 (closed) ... just wanted to check some points:

      1. I am expecting the licenses endpoint to return an array of objects, which at least contain a name and spdx_identifier property.
      2. The endpoint will support a search parameter
      3. Once your MR is in, we will need to provide the endpoint's URL to the frontend, via a data-property in ee/app/views/groups/dependencies/index.html.haml. Could we add that in your MR or maybe do separately? :thinking:
  • David Pisek mentioned in epic &10090

    mentioned in epic &10090

  • David Pisek added 211 commits

    added 211 commits

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    • 0224bd1f - Change shape of API response

    Compare with previous version

  • David Pisek changed the description

    changed the description

  • David Pisek added 257 commits

    added 257 commits

    Compare with previous version

  • David Pisek added 52 commits

    added 52 commits

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    • 212e26ae - Change filter name to licenses

    Compare with previous version

  • Zamir Martins mentioned in merge request !132597 (merged)

    mentioned in merge request !132597 (merged)

  • Zamir Martins approved this merge request

    approved this merge request

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

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

    For more info, please refer to the following links:

  • Zamir Martins removed review request for @zmartins

    removed review request for @zmartins

  • Contributor

    @dpisek Some end-to-end (E2E) tests should run based on the stage label.

    Please start the trigger-omnibus-and-follow-up-e2e job in the qa stage and ensure tests in the follow-up-e2e:package-and-test-ee pipeline pass before this MR is merged. (E2E tests are computationally intensive and don't run automatically for every push/rebase, so we ask you to run this job manually at least once.)

    To run all E2E tests, apply the pipeline:run-all-e2e label and run a new pipeline.

    E2E test jobs are allowed to fail due to flakiness. See current failures at the latest pipeline triage issue.

    Once done, apply the :white_check_mark: emoji on this comment.

    Team members only: for any questions or help, reach out on the internal #quality Slack channel.

  • David Pisek added 193 commits

    added 193 commits

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    • dc6a93e9 - Review suggestion: use spdx as key

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    Compare with previous version

  • David Pisek requested review from @svedova

    requested review from @svedova

  • David Pisek added 240 commits

    added 240 commits

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    • 6b6f8663 - Update to use client-side search only

    Compare with previous version

  • David Pisek added 162 commits

    added 162 commits

    Compare with previous version

  • David Pisek added 1 commit

    added 1 commit

    • 9854f60b - Add license as filter option to group-dependencies

    Compare with previous version

  • David Pisek changed the description

    changed the description

  • David Pisek added 1 commit

    added 1 commit

    • b0766231 - Add license as filter option to group-dependencies

    Compare with previous version

  • Savas Vedova
  • Savas Vedova
  • David Pisek added 116 commits

    added 116 commits

    Compare with previous version

  • Savas Vedova approved this merge request

    approved this merge request

  • Savas Vedova resolved all threads

    resolved all threads

  • Savas Vedova enabled an automatic merge when the pipeline for db2c0e4e succeeds

    enabled an automatic merge when the pipeline for db2c0e4e succeeds

  • merged

  • Savas Vedova mentioned in commit 52e7312f

    mentioned in commit 52e7312f

  • added workflowstaging label and removed workflowcanary label

  • Please register or sign in to reply
    Loading