Skip to content

GitLab Next

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
GitLab
GitLab
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 35,728
    • Issues 35,728
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge Requests 1,268
    • Merge Requests 1,268
  • Requirements
    • Requirements
    • List
  • CI / CD
    • CI / CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Operations
    • Operations
    • Metrics
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI / CD
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.org
  • GitLabGitLab
  • Merge Requests
  • !46239

Merged
Opened Oct 27, 2020 by Ragnar Hardarson@rhardarson🌴Developer7 of 13 tasks completed7/13 tasks

Do not render two alerts to inform project is locked

  • Overview 6
  • Commits 3
  • Pipelines 5
  • Changes 2

What does this MR do?

We've introduced a new storage limit alert for dotcom (behind a disabled feature flag though so our users do not get this behaviour) that also alerts the user a project has reached the storage limit.

It's obtrusive to get this many alerts, so let's only render one.

  • No changelog since this is behind a disabled feature flag

Screenshots (strongly suggested)

Before After
Screenshot_2020-10-27_at_17.00.48 Screenshot_2020-10-27_at_16.58.34

Testing this locally

Requires EE edition

Paste the following in your Rails console

# Match the 10GB limit on GitLab.com, enable application setting
ApplicationSettings::UpdateService.new(Gitlab::CurrentSettings.current_application_settings, nil, { repository_size_limit: 10240, enforce_namespace_storage_limit: true }).execute

Feature.enable(:additional_repo_storage_by_namespace)
Feature.enable(:buy_storage_link)

ACCESS_LEVEL_OWNER = 50
PACKAGE_SIZE_IN_MIB = 10240

def create_group_with_usage_and_additional_storage(owner, group_name, nr_of_packs_purchased, usage)
  group = Group.create(name: group_name, path: group_name, type: 'Group')
  GroupMember.add_user(group, owner, ACCESS_LEVEL_OWNER)
  project = ::Projects::CreateService.new(owner, { namespace_id: group.id, name: 'project-' + group_name, path: 'project-' + group_name }).execute

  group.additional_purchased_storage_size = nr_of_packs_purchased * PACKAGE_SIZE_IN_MIB
  group.save!

  project.statistics&.destroy!

  project_statistics = ProjectStatistics.new(
    project_id: project.id,
    namespace_id: group.id,
    commit_count: 12,
    repository_size: usage * 3 / 5,
    lfs_objects_size: usage * 2 / 5
  )

  project_statistics.save!
end

root_user = User.where(username: 'root').first

create_group_with_usage_and_additional_storage(root_user, 'over-free-limit', 0, 20.gigabytes)
create_group_with_usage_and_additional_storage(root_user, 'under-free-limit-no-purchase', 0, 8.gigabytes)
create_group_with_usage_and_additional_storage(root_user, 'over-purchased-limit', 1, 30.gigabytes)
create_group_with_usage_and_additional_storage(root_user, 'warning-with-purchase', 1, 17.gigabytes)
create_group_with_usage_and_additional_storage(root_user, 'under-free-limit-with-purchase', 1, 5.gigabytes)

Go to http://localhost:3000/groups/over-purchased-limit

Does this MR meet the acceptance criteria?

Conformity

  • Changelog entry
  • Documentation (if required)
  • Code review guidelines
  • Merge request performance guidelines
  • Style guides
  • Database guides
  • Separation of EE specific content

Availability and Testing

  • Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process.
  • Tested in all supported browsers
  • Informed Infrastructure department of a default or new setting change, if applicable per definition of done

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Related to #271399

Edited Oct 27, 2020 by Ragnar Hardarson
Assignee
Assign to
Reviewer
Request review from
13.6
Milestone
13.6 (Past due)
Assign milestone
Time tracking
Reference: gitlab-org/gitlab!46239
Source branch: 271399-do-not-render-two-alerts-to-inform-project-is-locked