Commit 0a7dc675 authored by Corinna Wiesner's avatar Corinna Wiesner Committed by Tyler Amos

Pass excess storage info storage excess endpoint

Adds the necessary fields to the storage excess endpoint in order to
have the excess storage data in GraphQL. Also updates the docs and
schema for GraphQL.
parent cc864263
......@@ -7195,6 +7195,11 @@ type GrafanaIntegration {
}
type Group {
"""
Additional storage purchased for the root namespace in bytes
"""
additionalPurchasedStorageSize: Float
"""
Indicates whether Auto DevOps is enabled for all projects within this group
"""
......@@ -7245,6 +7250,11 @@ type Group {
last: Int
): BoardConnection
"""
Includes at least one project where the repository size exceeds the limit
"""
containsLockedProjects: Boolean!
"""
Description of the namespace
"""
......@@ -7696,6 +7706,11 @@ type Group {
"""
lfsEnabled: Boolean
"""
Number of projects in the root namespace where the repository size exceeds the limit
"""
lockedProjectCount: Int!
"""
Indicates if a group is disabled from getting mentioned
"""
......@@ -7983,6 +7998,16 @@ type Group {
startTime: Time
): TimelogConnection!
"""
Total repository size of all projects in the root namespace in bytes
"""
totalRepositorySize: Float
"""
Total excess repository size of all projects in the root namespace in bytes
"""
totalRepositorySizeExcess: Float
"""
Time before two-factor authentication is enforced
"""
......@@ -11888,6 +11913,16 @@ enum MutationOperationMode {
}
type Namespace {
"""
Additional storage purchased for the root namespace in bytes
"""
additionalPurchasedStorageSize: Float
"""
Includes at least one project where the repository size exceeds the limit
"""
containsLockedProjects: Boolean!
"""
Description of the namespace
"""
......@@ -11923,6 +11958,11 @@ type Namespace {
"""
lfsEnabled: Boolean
"""
Number of projects in the root namespace where the repository size exceeds the limit
"""
lockedProjectCount: Int!
"""
Name of the namespace
"""
......@@ -11998,6 +12038,16 @@ type Namespace {
"""
temporaryStorageIncreaseEndsOn: Time
"""
Total repository size of all projects in the root namespace in bytes
"""
totalRepositorySize: Float
"""
Total excess repository size of all projects in the root namespace in bytes
"""
totalRepositorySizeExcess: Float
"""
Visibility of the namespace
"""
......@@ -14055,6 +14105,11 @@ type Project {
"""
repository: Repository
"""
Size of repository that exceeds the limit in bytes
"""
repositorySizeExcess: Float
"""
Indicates if users can request member access to the project
"""
......
......@@ -19906,6 +19906,20 @@
"name": "Group",
"description": null,
"fields": [
{
"name": "additionalPurchasedStorageSize",
"description": "Additional storage purchased for the root namespace in bytes",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Float",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "autoDevopsEnabled",
"description": "Indicates whether Auto DevOps is enabled for all projects within this group",
......@@ -20024,6 +20038,24 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "containsLockedProjects",
"description": "Includes at least one project where the repository size exceeds the limit",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "description",
"description": "Description of the namespace",
......@@ -21063,6 +21095,24 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "lockedProjectCount",
"description": "Number of projects in the root namespace where the repository size exceeds the limit",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "mentionsDisabled",
"description": "Indicates if a group is disabled from getting mentioned",
......@@ -21749,6 +21799,34 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "totalRepositorySize",
"description": "Total repository size of all projects in the root namespace in bytes",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Float",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "totalRepositorySizeExcess",
"description": "Total excess repository size of all projects in the root namespace in bytes",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Float",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "twoFactorGracePeriod",
"description": "Time before two-factor authentication is enforced",
......@@ -35022,6 +35100,38 @@
"name": "Namespace",
"description": null,
"fields": [
{
"name": "additionalPurchasedStorageSize",
"description": "Additional storage purchased for the root namespace in bytes",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Float",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "containsLockedProjects",
"description": "Includes at least one project where the repository size exceeds the limit",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "description",
"description": "Description of the namespace",
......@@ -35136,6 +35246,24 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "lockedProjectCount",
"description": "Number of projects in the root namespace where the repository size exceeds the limit",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Int",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "name",
"description": "Name of the namespace",
......@@ -35325,6 +35453,34 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "totalRepositorySize",
"description": "Total repository size of all projects in the root namespace in bytes",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Float",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "totalRepositorySizeExcess",
"description": "Total excess repository size of all projects in the root namespace in bytes",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Float",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "visibility",
"description": "Visibility of the namespace",
......@@ -40799,6 +40955,20 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "repositorySizeExcess",
"description": "Size of repository that exceeds the limit in bytes",
"args": [
],
"type": {
"kind": "SCALAR",
"name": "Float",
"ofType": null
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "requestAccessEnabled",
"description": "Indicates if users can request member access to the project",
......@@ -1136,9 +1136,11 @@ Autogenerated return type of EpicTreeReorder.
| Field | Type | Description |
| ----- | ---- | ----------- |
| `additionalPurchasedStorageSize` | Float | Additional storage purchased for the root namespace in bytes |
| `autoDevopsEnabled` | Boolean | Indicates whether Auto DevOps is enabled for all projects within this group |
| `avatarUrl` | String | Avatar URL of the group |
| `board` | Board | A single board of the group |
| `containsLockedProjects` | Boolean! | Includes at least one project where the repository size exceeds the limit |
| `description` | String | Description of the namespace |
| `descriptionHtml` | String | The GitLab Flavored Markdown rendering of `description` |
| `emailsDisabled` | Boolean | Indicates if a group has email notifications disabled |
......@@ -1151,6 +1153,7 @@ Autogenerated return type of EpicTreeReorder.
| `isTemporaryStorageIncreaseEnabled` | Boolean! | Status of the temporary storage increase |
| `label` | Label | A label available on this group |
| `lfsEnabled` | Boolean | Indicates if Large File Storage (LFS) is enabled for namespace |
| `lockedProjectCount` | Int! | Number of projects in the root namespace where the repository size exceeds the limit |
| `mentionsDisabled` | Boolean | Indicates if a group is disabled from getting mentioned |
| `name` | String! | Name of the namespace |
| `parent` | Group | Parent group |
......@@ -1163,6 +1166,8 @@ Autogenerated return type of EpicTreeReorder.
| `storageSizeLimit` | Float | Total storage limit of the root namespace in bytes |
| `subgroupCreationLevel` | String | The permission level required to create subgroups within the group |
| `temporaryStorageIncreaseEndsOn` | Time | Date until the temporary storage increase is active |
| `totalRepositorySize` | Float | Total repository size of all projects in the root namespace in bytes |
| `totalRepositorySizeExcess` | Float | Total excess repository size of all projects in the root namespace in bytes |
| `twoFactorGracePeriod` | Int | Time before two-factor authentication is enforced |
| `userPermissions` | GroupPermissions! | Permissions for the current user on the resource |
| `visibility` | String | Visibility of the namespace |
......@@ -1712,6 +1717,8 @@ Contains statistics about a milestone.
| Field | Type | Description |
| ----- | ---- | ----------- |
| `additionalPurchasedStorageSize` | Float | Additional storage purchased for the root namespace in bytes |
| `containsLockedProjects` | Boolean! | Includes at least one project where the repository size exceeds the limit |
| `description` | String | Description of the namespace |
| `descriptionHtml` | String | The GitLab Flavored Markdown rendering of `description` |
| `fullName` | String! | Full name of the namespace |
......@@ -1719,12 +1726,15 @@ Contains statistics about a milestone.
| `id` | ID! | ID of the namespace |
| `isTemporaryStorageIncreaseEnabled` | Boolean! | Status of the temporary storage increase |
| `lfsEnabled` | Boolean | Indicates if Large File Storage (LFS) is enabled for namespace |
| `lockedProjectCount` | Int! | Number of projects in the root namespace where the repository size exceeds the limit |
| `name` | String! | Name of the namespace |
| `path` | String! | Path of the namespace |
| `requestAccessEnabled` | Boolean | Indicates if users can request access to namespace |
| `rootStorageStatistics` | RootStorageStatistics | Aggregated storage statistics of the namespace. Only available for root namespaces |
| `storageSizeLimit` | Float | Total storage limit of the root namespace in bytes |
| `temporaryStorageIncreaseEndsOn` | Time | Date until the temporary storage increase is active |
| `totalRepositorySize` | Float | Total repository size of all projects in the root namespace in bytes |
| `totalRepositorySizeExcess` | Float | Total excess repository size of all projects in the root namespace in bytes |
| `visibility` | String | Visibility of the namespace |
### NamespaceIncreaseStorageTemporarilyPayload
......@@ -1918,6 +1928,7 @@ Autogenerated return type of PipelineRetry.
| `release` | Release | A single release of the project |
| `removeSourceBranchAfterMerge` | Boolean | Indicates if `Delete source branch` option should be enabled by default for all new merge requests of the project |
| `repository` | Repository | Git repository of the project |
| `repositorySizeExcess` | Float | Size of repository that exceeds the limit in bytes |
| `requestAccessEnabled` | Boolean | Indicates if users can request member access to the project |
| `requirement` | Requirement | Find a single requirement |
| `requirementStatesCount` | RequirementStatesCount | Number of requirements for the project by their state |
......
......@@ -2,6 +2,11 @@ query getStorageCounter($fullPath: ID!) {
namespace(fullPath: $fullPath) {
id
storageSizeLimit
additionalPurchasedStorageSize
totalRepositorySizeExcess
totalRepositorySize
containsLockedProjects
lockedProjectCount
rootStorageStatistics {
storageSize
repositorySize
......@@ -20,6 +25,7 @@ query getStorageCounter($fullPath: ID!) {
avatarUrl
webUrl
name
repositorySizeExcess
statistics {
commitCount
storageSize
......
......@@ -6,6 +6,32 @@ module EE
extend ActiveSupport::Concern
prepended do
field :additional_purchased_storage_size,
GraphQL::FLOAT_TYPE,
null: true,
description: 'Additional storage purchased for the root namespace in bytes'
field :total_repository_size_excess,
GraphQL::FLOAT_TYPE,
null: true,
description: 'Total excess repository size of all projects in the root namespace in bytes'
field :total_repository_size,
GraphQL::FLOAT_TYPE,
null: true,
description: 'Total repository size of all projects in the root namespace in bytes'
field :contains_locked_projects,
GraphQL::BOOLEAN_TYPE,
null: false,
description: 'Includes at least one project where the repository size exceeds the limit',
resolve: -> (obj, _args, _ctx) { obj.contains_locked_projects? }
field :locked_project_count,
GraphQL::INT_TYPE,
null: false,
description: 'Number of projects in the root namespace where the repository size exceeds the limit'
field :storage_size_limit,
GraphQL::FLOAT_TYPE,
null: true,
......
......@@ -115,6 +115,15 @@ module EE
description: 'Cluster agents associated with the project',
resolver: ::Resolvers::Clusters::AgentsResolver
field :repository_size_excess,
GraphQL::FLOAT_TYPE,
null: true,
description: 'Size of repository that exceeds the limit in bytes'
def self.requirements_available?(project, user)
::Feature.enabled?(:requirements_management, project, default_enabled: true) && Ability.allowed?(user, :read_requirement, project)
end
def self.sast_ci_configuration(project)
::Security::CiConfiguration::SastParserService.new(project).configuration
end
......
......@@ -4,7 +4,16 @@ require 'spec_helper'
RSpec.describe GitlabSchema.types['Namespace'] do
it 'has specific fields' do
expected_fields = %w[storage_size_limit is_temporary_storage_increase_enabled temporary_storage_increase_ends_on]
expected_fields = %w[
additional_purchased_storage_size
total_repository_size_excess
total_repository_size
contains_locked_projects
locked_project_count
storage_size_limit
is_temporary_storage_increase_enabled
temporary_storage_increase_ends_on
]
expect(described_class).to include_graphql_fields(*expected_fields)
end
......
......@@ -17,7 +17,7 @@ RSpec.describe GitlabSchema.types['Project'] do
expected_fields = %w[
vulnerabilities sast_ci_configuration vulnerability_scanners requirement_states_count
vulnerability_severities_count packages compliance_frameworks vulnerabilities_count_by_day
security_dashboard_path iterations cluster_agents
security_dashboard_path iterations cluster_agents repository_size_excess
]
expect(described_class).to include_graphql_fields(*expected_fields)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment