Commit cdd241d2 authored by Luke Duncalfe's avatar Luke Duncalfe

Merge branch...

Merge branch '216795-add-visibility-and-last-published-information-to-the-image-repository-detail-view' into 'master'

Add project to container_registry graphql type

See merge request gitlab-org/gitlab!49019
parents d63d3e1d af7c5ef5
...@@ -19,9 +19,14 @@ module Types ...@@ -19,9 +19,14 @@ module Types
field :status, Types::ContainerRepositoryStatusEnum, null: true, description: 'Status of the container repository.' field :status, Types::ContainerRepositoryStatusEnum, null: true, description: 'Status of the container repository.'
field :tags_count, GraphQL::INT_TYPE, null: false, description: 'Number of tags associated with this image.' field :tags_count, GraphQL::INT_TYPE, null: false, description: 'Number of tags associated with this image.'
field :can_delete, GraphQL::BOOLEAN_TYPE, null: false, description: 'Can the current user delete the container repository.' field :can_delete, GraphQL::BOOLEAN_TYPE, null: false, description: 'Can the current user delete the container repository.'
field :project, Types::ProjectType, null: false, description: 'Project of the container registry'
def can_delete def can_delete
Ability.allowed?(current_user, :update_container_image, object) Ability.allowed?(current_user, :update_container_image, object)
end end
def project
Gitlab::Graphql::Loaders::BatchModelLoader.new(Project, object.project_id).find
end
end end
end end
---
title: Add Project to ContainerRepository GraphQL type
merge_request: 49019
author:
type: added
...@@ -3510,6 +3510,11 @@ type ContainerRepository { ...@@ -3510,6 +3510,11 @@ type ContainerRepository {
""" """
path: String! path: String!
"""
Project of the container registry
"""
project: Project!
""" """
Status of the container repository. Status of the container repository.
""" """
...@@ -3615,6 +3620,11 @@ type ContainerRepositoryDetails { ...@@ -3615,6 +3620,11 @@ type ContainerRepositoryDetails {
""" """
path: String! path: String!
"""
Project of the container registry
"""
project: Project!
""" """
Status of the container repository. Status of the container repository.
""" """
......
...@@ -9598,6 +9598,24 @@ ...@@ -9598,6 +9598,24 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "project",
"description": "Project of the container registry",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "Project",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "status", "name": "status",
"description": "Status of the container repository.", "description": "Status of the container repository.",
...@@ -9899,6 +9917,24 @@ ...@@ -9899,6 +9917,24 @@
"isDeprecated": false, "isDeprecated": false,
"deprecationReason": null "deprecationReason": null
}, },
{
"name": "project",
"description": "Project of the container registry",
"args": [
],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "OBJECT",
"name": "Project",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{ {
"name": "status", "name": "status",
"description": "Status of the container repository.", "description": "Status of the container repository.",
...@@ -592,6 +592,7 @@ A container repository. ...@@ -592,6 +592,7 @@ A container repository.
| `location` | String! | URL of the container repository. | | `location` | String! | URL of the container repository. |
| `name` | String! | Name of the container repository. | | `name` | String! | Name of the container repository. |
| `path` | String! | Path of the container repository. | | `path` | String! | Path of the container repository. |
| `project` | Project! | Project of the container registry |
| `status` | ContainerRepositoryStatus | Status of the container repository. | | `status` | ContainerRepositoryStatus | Status of the container repository. |
| `tagsCount` | Int! | Number of tags associated with this image. | | `tagsCount` | Int! | Number of tags associated with this image. |
| `updatedAt` | Time! | Timestamp when the container repository was updated. | | `updatedAt` | Time! | Timestamp when the container repository was updated. |
...@@ -610,6 +611,7 @@ Details of a container repository. ...@@ -610,6 +611,7 @@ Details of a container repository.
| `location` | String! | URL of the container repository. | | `location` | String! | URL of the container repository. |
| `name` | String! | Name of the container repository. | | `name` | String! | Name of the container repository. |
| `path` | String! | Path of the container repository. | | `path` | String! | Path of the container repository. |
| `project` | Project! | Project of the container registry |
| `status` | ContainerRepositoryStatus | Status of the container repository. | | `status` | ContainerRepositoryStatus | Status of the container repository. |
| `tags` | ContainerRepositoryTagConnection | Tags of the container repository | | `tags` | ContainerRepositoryTagConnection | Tags of the container repository |
| `tagsCount` | Int! | Number of tags associated with this image. | | `tagsCount` | Int! | Number of tags associated with this image. |
......
{ {
"type": "object", "type": "object",
"required": ["id", "name", "path", "location", "createdAt", "updatedAt", "tagsCount", "canDelete", "expirationPolicyCleanupStatus"], "required": ["id", "name", "path", "location", "createdAt", "updatedAt", "tagsCount", "canDelete", "expirationPolicyCleanupStatus", "project"],
"properties": { "properties": {
"id": { "id": {
"type": "string" "type": "string"
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
"expirationPolicyCleanupStatus": { "expirationPolicyCleanupStatus": {
"type": "string", "type": "string",
"enum": ["UNSCHEDULED", "SCHEDULED", "UNFINISHED", "ONGOING"] "enum": ["UNSCHEDULED", "SCHEDULED", "UNFINISHED", "ONGOING"]
},
"project": {
"type": "object"
} }
} }
} }
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe GitlabSchema.types['ContainerRepositoryDetails'] do RSpec.describe GitlabSchema.types['ContainerRepositoryDetails'] do
fields = %i[id name path location created_at updated_at expiration_policy_started_at status tags_count can_delete expiration_policy_cleanup_status tags] fields = %i[id name path location created_at updated_at expiration_policy_started_at status tags_count can_delete expiration_policy_cleanup_status tags project]
it { expect(described_class.graphql_name).to eq('ContainerRepositoryDetails') } it { expect(described_class.graphql_name).to eq('ContainerRepositoryDetails') }
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe GitlabSchema.types['ContainerRepository'] do RSpec.describe GitlabSchema.types['ContainerRepository'] do
fields = %i[id name path location created_at updated_at expiration_policy_started_at status tags_count can_delete expiration_policy_cleanup_status] fields = %i[id name path location created_at updated_at expiration_policy_started_at status tags_count can_delete expiration_policy_cleanup_status project]
it { expect(described_class.graphql_name).to eq('ContainerRepository') } it { expect(described_class.graphql_name).to eq('ContainerRepository') }
......
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