Skip to content

Move to CE the Namespace Project Sort Enums related to storage size

Sheldon Led requested to merge led/440195-move-storage-size-sorts-to-ce into master

What does this MR do and why?

This relates to #440195 (closed)

In order to have the storage tab in both CE and EE GitLab distributions we need to move some sorting types from EE to CE. More details for this in the steps to validate.

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

N/A

How to set up and validate locally

The best way to test this change is to navigate to GraphQL explorer (e.g. https://gdk.test:3443/-/graphql-explorer) and use the following query:

Query

query getProjectListStorageStatistics($fullPath: ID!, $searchTerm: String = "", $first: Int, $last: Int, $after: String, $before: String, $sortKey: NamespaceProjectSort) {
  namespace(fullPath: $fullPath) {
    id
    projects(
      includeSubgroups: true
      notAimedForDeletion: true
      search: $searchTerm
      first: $first
      last: $last
      after: $after
      before: $before
      sort: $sortKey
    ) {
      nodes {
        id
        fullPath
        nameWithNamespace
        avatarUrl
        webUrl
        name
        statistics {
          storageSize
          repositorySize
          lfsObjectsSize
          containerRegistrySize
          buildArtifactsSize
          packagesSize
          wikiSize
          snippetsSize
          __typename
        }
        __typename
      }
      pageInfo {
        ...PageInfo
        __typename
      }
      __typename
    }
    __typename
  }
}

fragment PageInfo on PageInfo {
  hasNextPage
  hasPreviousPage
  startCursor
  endCursor
  __typename
}

Variables


{
  "searchTerm": "",
  "fullPath": "your-group-here",
  "first": 20,
  "sortKey": "STORAGE_SIZE_ASC"
}

Expected behavior

It will depend on each Distribution/Offering:

  • Community Edition: ability to sort by storage_size, ASC and DESC
  • EE and SaaS: Same as above + the ability to sort by excess storage

In the frontend

We use this sorting in the Group Usage Quotas (e.g. https://gdk.test:3443/groups/<your-group-here>/-/usage_quotas#storage-quota-tab), however there's a bit of complexity here. At this point this view is not yet available for CE, so you'll need to setup your GDK to EE and have a valid license. Once the page is loading, check the project list. It should be:

  • If you enable Repository size limit, there's no ability to sort (no arrow besides the Total column) and the sorting is fixed to excess storage
  • If you disable Repository size limit, you can sort by storage_size, ASC and DESC
Edited by Sheldon Led

Merge request reports