2018-09-11 19:08:34 +00:00
# frozen_string_literal: true
2018-05-23 07:55:14 +00:00
module Types
class ProjectType < BaseObject
graphql_name 'Project'
2017-08-16 13:04:41 +00:00
2022-06-03 15:09:26 +00:00
connection_type_class ( Types :: CountableConnectionType )
2019-03-04 02:30:32 +00:00
authorize :read_project
expose_permissions Types :: PermissionTypes :: Project
2021-07-22 09:08:22 +00:00
field :id , GraphQL :: Types :: ID , null : false ,
2021-02-05 15:09:28 +00:00
description : 'ID of the project.'
2017-08-16 13:04:41 +00:00
2022-03-01 12:19:32 +00:00
field :ci_config_path_or_default , GraphQL :: Types :: String , null : false ,
description : 'Path of the CI configuration file.'
2021-07-22 09:08:22 +00:00
field :full_path , GraphQL :: Types :: ID , null : false ,
2021-02-05 15:09:28 +00:00
description : 'Full path of the project.'
2021-07-22 09:08:22 +00:00
field :path , GraphQL :: Types :: String , null : false ,
2021-02-05 15:09:28 +00:00
description : 'Path of the project.'
2017-08-16 13:04:41 +00:00
2021-01-19 21:10:45 +00:00
field :sast_ci_configuration , Types :: CiConfiguration :: Sast :: Type , null : true ,
calls_gitaly : true ,
2021-02-05 15:09:28 +00:00
description : 'SAST CI configuration for the project.'
2021-01-19 21:10:45 +00:00
2021-07-22 09:08:22 +00:00
field :name , GraphQL :: Types :: String , null : false ,
2021-02-05 15:09:28 +00:00
description : 'Name of the project (without namespace).'
2022-03-01 12:19:32 +00:00
field :name_with_namespace , GraphQL :: Types :: String , null : false ,
description : 'Full name of the project with its namespace.'
2017-08-16 13:04:41 +00:00
2021-07-22 09:08:22 +00:00
field :description , GraphQL :: Types :: String , null : true ,
2021-02-05 15:09:28 +00:00
description : 'Short description of the project.'
2017-08-16 13:04:41 +00:00
2021-07-22 09:08:22 +00:00
field :tag_list , GraphQL :: Types :: String , null : true ,
2021-05-12 09:10:19 +00:00
deprecated : { reason : 'Use `topics`' , milestone : '13.12' } ,
2022-03-12 00:07:24 +00:00
description : 'List of project topics (not Git tags).' , method : :topic_list
2019-10-31 12:06:26 +00:00
2021-07-22 09:08:22 +00:00
field :topics , [ GraphQL :: Types :: String ] , null : true ,
2022-03-12 00:07:24 +00:00
description : 'List of project topics.' , method : :topic_list
2021-05-12 09:10:19 +00:00
2021-07-22 09:08:22 +00:00
field :http_url_to_repo , GraphQL :: Types :: String , null : true ,
2021-02-05 15:09:28 +00:00
description : 'URL to connect to the project via HTTPS.'
2022-03-01 12:19:32 +00:00
field :ssh_url_to_repo , GraphQL :: Types :: String , null : true ,
description : 'URL to connect to the project via SSH.'
2021-07-22 09:08:22 +00:00
field :web_url , GraphQL :: Types :: String , null : true ,
2021-02-05 15:09:28 +00:00
description : 'Web URL of the project.'
2019-10-31 12:06:26 +00:00
2021-07-22 09:08:22 +00:00
field :forks_count , GraphQL :: Types :: Int , null : false , calls_gitaly : true , # 4 times
2021-02-05 15:09:28 +00:00
description : 'Number of times the project has been forked.'
2022-03-01 12:19:32 +00:00
field :star_count , GraphQL :: Types :: Int , null : false ,
description : 'Number of times the project has been starred.'
2019-10-31 12:06:26 +00:00
field :created_at , Types :: TimeType , null : true ,
2021-02-05 15:09:28 +00:00
description : 'Timestamp of the project creation.'
2019-10-31 12:06:26 +00:00
field :last_activity_at , Types :: TimeType , null : true ,
2021-02-05 15:09:28 +00:00
description : 'Timestamp of the project last activity.'
2019-10-31 12:06:26 +00:00
2021-07-22 09:08:22 +00:00
field :archived , GraphQL :: Types :: Boolean , null : true ,
2021-02-05 15:09:28 +00:00
description : 'Indicates the archived status of the project.'
2019-10-31 12:06:26 +00:00
2021-07-22 09:08:22 +00:00
field :visibility , GraphQL :: Types :: String , null : true ,
2021-02-05 15:09:28 +00:00
description : 'Visibility of the project.'
2019-10-31 12:06:26 +00:00
2021-07-22 09:08:22 +00:00
field :lfs_enabled , GraphQL :: Types :: Boolean , null : true ,
2021-02-05 15:09:28 +00:00
description : 'Indicates if the project has Large File Storage (LFS) enabled.'
2021-07-22 09:08:22 +00:00
field :merge_requests_ff_only_enabled , GraphQL :: Types :: Boolean , null : true ,
2019-10-31 12:06:26 +00:00
description : 'Indicates if no merge commits should be created and all merges should instead be fast-forwarded, which means that merging is only allowed if the branch could be fast-forwarded.'
2022-03-01 12:19:32 +00:00
field :shared_runners_enabled , GraphQL :: Types :: Boolean , null : true ,
description : 'Indicates if shared runners are enabled for the project.'
2019-10-31 12:06:26 +00:00
2021-07-22 09:08:22 +00:00
field :service_desk_enabled , GraphQL :: Types :: Boolean , null : true ,
2020-07-09 09:09:27 +00:00
description : 'Indicates if the project has service desk enabled.'
2021-07-22 09:08:22 +00:00
field :service_desk_address , GraphQL :: Types :: String , null : true ,
2020-07-09 09:09:27 +00:00
description : 'E-mail address of the service desk.'
2021-07-22 09:08:22 +00:00
field :avatar_url , GraphQL :: Types :: String , null : true , calls_gitaly : true ,
2021-02-05 15:09:28 +00:00
description : 'URL to avatar image file of the project.'
2017-08-16 13:04:41 +00:00
2021-07-22 09:08:22 +00:00
field :jobs_enabled , GraphQL :: Types :: Boolean , null : true ,
2021-02-05 15:09:28 +00:00
description : 'Indicates if CI/CD pipeline jobs are enabled for the current user.'
2019-10-31 12:06:26 +00:00
2021-07-22 09:08:22 +00:00
field :public_jobs , GraphQL :: Types :: Boolean , method : :public_builds , null : true ,
2021-02-05 15:09:28 +00:00
description : 'Indicates if there is public access to pipelines and job details of the project, including output logs and artifacts.'
2019-10-31 12:06:26 +00:00
2021-07-22 09:08:22 +00:00
field :open_issues_count , GraphQL :: Types :: Int , null : true ,
2021-02-05 15:09:28 +00:00
description : 'Number of open issues for the project.'
2019-10-31 12:06:26 +00:00
2022-03-01 12:19:32 +00:00
field :allow_merge_on_skipped_pipeline , GraphQL :: Types :: Boolean , null : true ,
description : 'If `only_allow_merge_if_pipeline_succeeds` is true, indicates if merge requests of the project can also be merged with skipped jobs.'
field :autoclose_referenced_issues , GraphQL :: Types :: Boolean , null : true ,
description : 'Indicates if issues referenced by merge requests and commits within the default branch are closed automatically.'
2021-07-22 09:08:22 +00:00
field :import_status , GraphQL :: Types :: String , null : true ,
2021-02-05 15:09:28 +00:00
description : 'Status of import background job of the project.'
2021-07-22 09:08:22 +00:00
field :jira_import_status , GraphQL :: Types :: String , null : true ,
2021-02-05 15:09:28 +00:00
description : 'Status of Jira import background job of the project.'
2021-07-22 09:08:22 +00:00
field :only_allow_merge_if_all_discussions_are_resolved , GraphQL :: Types :: Boolean , null : true ,
2021-02-05 15:09:28 +00:00
description : 'Indicates if merge requests of the project can only be merged when all the discussions are resolved.'
2022-03-01 12:19:32 +00:00
field :only_allow_merge_if_pipeline_succeeds , GraphQL :: Types :: Boolean , null : true ,
description : 'Indicates if merge requests of the project can only be merged with successful jobs.'
2021-07-22 09:08:22 +00:00
field :printing_merge_request_link_enabled , GraphQL :: Types :: Boolean , null : true ,
2021-02-05 15:09:28 +00:00
description : 'Indicates if a link to create or view a merge request should display after a push to Git repositories of the project from the command line.'
2021-07-22 09:08:22 +00:00
field :remove_source_branch_after_merge , GraphQL :: Types :: Boolean , null : true ,
2021-02-05 15:09:28 +00:00
description : 'Indicates if `Delete source branch` option should be enabled by default for all new merge requests of the project.'
2022-03-01 12:19:32 +00:00
field :request_access_enabled , GraphQL :: Types :: Boolean , null : true ,
description : 'Indicates if users can request member access to the project.'
2021-07-22 09:08:22 +00:00
field :squash_read_only , GraphQL :: Types :: Boolean , null : false , method : :squash_readonly? ,
2021-02-05 15:09:28 +00:00
description : 'Indicates if `squashReadOnly` is enabled.'
2022-03-01 12:19:32 +00:00
field :suggestion_commit_message , GraphQL :: Types :: String , null : true ,
description : 'Commit message used to apply merge request suggestions.'
2019-10-31 12:06:26 +00:00
2022-03-11 09:07:59 +00:00
# No, the quotes are not a typo. Used to get around circular dependencies.
# See https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27536#note_871009675
field :group , 'Types::GroupType' , null : true ,
2021-02-05 15:09:28 +00:00
description : 'Group of the project.'
2022-03-01 12:19:32 +00:00
field :namespace , Types :: NamespaceType , null : true ,
description : 'Namespace of the project.'
2019-10-31 12:06:26 +00:00
field :statistics , Types :: ProjectStatisticsType ,
2019-06-14 20:40:21 +00:00
null : true ,
2021-02-05 15:09:28 +00:00
description : 'Statistics of the project.'
2019-05-12 21:10:46 +00:00
2019-10-31 12:06:26 +00:00
field :repository , Types :: RepositoryType , null : true ,
2021-02-05 15:09:28 +00:00
description : 'Git repository of the project.'
2019-05-22 11:43:35 +00:00
2019-10-31 12:06:26 +00:00
field :merge_requests ,
2019-01-30 19:00:30 +00:00
Types :: MergeRequestType . connection_type ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'Merge requests of the project.' ,
2020-06-05 21:08:27 +00:00
extras : [ :lookahead ] ,
2020-08-28 06:10:45 +00:00
resolver : Resolvers :: ProjectMergeRequestsResolver
2019-01-30 19:00:30 +00:00
2019-10-31 12:06:26 +00:00
field :merge_request ,
2018-06-14 13:06:53 +00:00
Types :: MergeRequestType ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'A single merge request of the project.' ,
2019-03-04 02:30:32 +00:00
resolver : Resolvers :: MergeRequestsResolver . single
2018-06-26 16:31:05 +00:00
2019-10-31 12:06:26 +00:00
field :issues ,
2018-11-27 15:10:40 +00:00
Types :: IssueType . connection_type ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'Issues of the project.' ,
2020-08-25 18:10:49 +00:00
extras : [ :lookahead ] ,
2018-11-27 15:10:40 +00:00
resolver : Resolvers :: IssuesResolver
2020-08-12 03:10:17 +00:00
field :issue_status_counts ,
Types :: IssueStatusCountsType ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'Counts of issues by status for the project.' ,
2020-08-25 18:10:49 +00:00
extras : [ :lookahead ] ,
2020-08-12 03:10:17 +00:00
resolver : Resolvers :: IssueStatusCountsResolver
2020-07-30 18:09:39 +00:00
field :milestones , Types :: MilestoneType . connection_type , null : true ,
2021-02-05 15:09:28 +00:00
description : 'Milestones of the project.' ,
2020-08-10 18:09:54 +00:00
resolver : Resolvers :: ProjectMilestonesResolver
2020-07-30 18:09:39 +00:00
2020-06-04 15:08:21 +00:00
field :project_members ,
2021-02-05 15:09:28 +00:00
description : 'Members of the project.' ,
2020-06-04 15:08:21 +00:00
resolver : Resolvers :: ProjectMembersResolver
2020-01-16 18:08:46 +00:00
field :environments ,
Types :: EnvironmentType . connection_type ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'Environments of the project.' ,
2020-01-16 18:08:46 +00:00
resolver : Resolvers :: EnvironmentsResolver
2020-08-13 18:10:36 +00:00
field :environment ,
Types :: EnvironmentType ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'A single environment of the project.' ,
2020-08-13 18:10:36 +00:00
resolver : Resolvers :: EnvironmentsResolver . single
2019-10-31 12:06:26 +00:00
field :issue ,
2019-11-18 15:06:27 +00:00
Types :: IssueType ,
2019-02-12 16:31:18 +00:00
null : true ,
2021-02-05 15:09:28 +00:00
description : 'A single issue of the project.' ,
2019-02-12 16:31:18 +00:00
resolver : Resolvers :: IssuesResolver . single
2021-02-01 15:08:56 +00:00
field :packages ,
2021-05-06 12:10:38 +00:00
description : 'Packages of the project.' ,
resolver : Resolvers :: ProjectPackagesResolver
2020-07-17 06:09:11 +00:00
2022-06-07 15:08:12 +00:00
field :packages_cleanup_policy ,
Types :: Packages :: Cleanup :: PolicyType ,
null : true ,
description : 'Packages cleanup policy for the project.'
2021-04-06 15:09:23 +00:00
field :jobs ,
2021-05-06 12:10:38 +00:00
type : Types :: Ci :: JobType . connection_type ,
null : true ,
2021-11-30 03:13:04 +00:00
authorize : :read_build ,
2021-05-06 12:10:38 +00:00
description : 'Jobs of a project. This field can only be resolved for one project in any single request.' ,
resolver : Resolvers :: ProjectJobsResolver
2021-04-06 15:09:23 +00:00
2019-10-31 12:06:26 +00:00
field :pipelines ,
2019-03-04 02:30:32 +00:00
null : true ,
2021-02-05 15:09:28 +00:00
description : 'Build pipelines of the project.' ,
2020-10-30 06:08:54 +00:00
extras : [ :lookahead ] ,
2018-06-26 16:31:05 +00:00
resolver : Resolvers :: ProjectPipelinesResolver
2019-12-06 09:06:39 +00:00
2020-06-15 18:08:43 +00:00
field :pipeline ,
Types :: Ci :: PipelineType ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'Build pipeline of the project.' ,
2021-09-27 21:09:27 +00:00
extras : [ :lookahead ] ,
2020-06-15 18:08:43 +00:00
resolver : Resolvers :: ProjectPipelineResolver
2022-01-27 18:14:37 +00:00
field :pipeline_counts ,
Types :: Ci :: PipelineCountsType ,
null : true ,
description : 'Build pipeline counts of the project.' ,
resolver : Resolvers :: Ci :: ProjectPipelineCountsResolver
2020-12-15 00:10:07 +00:00
field :ci_cd_settings ,
Types :: Ci :: CiCdSettingType ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'CI/CD settings for the project.'
2020-12-15 00:10:07 +00:00
2019-12-06 09:06:39 +00:00
field :sentry_detailed_error ,
Types :: ErrorTracking :: SentryDetailedErrorType ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'Detailed version of a Sentry error on the project.' ,
2019-12-06 09:06:39 +00:00
resolver : Resolvers :: ErrorTracking :: SentryDetailedErrorResolver
2019-12-10 07:53:40 +00:00
2020-01-07 21:07:50 +00:00
field :grafana_integration ,
Types :: GrafanaIntegrationType ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'Grafana integration details for the project.' ,
2020-01-07 21:07:50 +00:00
resolver : Resolvers :: Projects :: GrafanaIntegrationResolver
2019-12-10 07:53:40 +00:00
field :snippets ,
Types :: SnippetType . connection_type ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'Snippets of the project.' ,
2019-12-10 07:53:40 +00:00
resolver : Resolvers :: Projects :: SnippetsResolver
2020-01-29 12:09:08 +00:00
field :sentry_errors ,
Types :: ErrorTracking :: SentryErrorCollectionType ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'Paginated collection of Sentry errors on the project.' ,
2020-01-29 12:09:08 +00:00
resolver : Resolvers :: ErrorTracking :: SentryErrorCollectionResolver
2020-02-19 00:09:15 +00:00
field :boards ,
Types :: BoardType . connection_type ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'Boards of the project.' ,
2020-03-18 15:09:45 +00:00
max_page_size : 2000 ,
2020-02-19 00:09:15 +00:00
resolver : Resolvers :: BoardsResolver
2020-02-24 18:09:05 +00:00
2022-01-20 12:16:19 +00:00
field :recent_issue_boards ,
Types :: BoardType . connection_type ,
null : true ,
description : 'List of recently visited boards of the project. Maximum size is 4.' ,
resolver : Resolvers :: RecentBoardsResolver
2020-02-24 18:09:05 +00:00
field :board ,
Types :: BoardType ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'A single board of the project.' ,
2020-09-30 18:09:52 +00:00
resolver : Resolvers :: BoardResolver
2020-03-26 12:07:48 +00:00
field :jira_imports ,
Types :: JiraImportType . connection_type ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'Jira imports into the project.'
2020-04-08 06:09:54 +00:00
field :services ,
Types :: Projects :: ServiceType . connection_type ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'Project services.' ,
2020-04-08 06:09:54 +00:00
resolver : Resolvers :: Projects :: ServicesResolver
2020-04-28 15:09:29 +00:00
field :alert_management_alerts ,
Types :: AlertManagement :: AlertType . connection_type ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'Alert Management alerts of the project.' ,
2020-06-11 00:08:35 +00:00
extras : [ :lookahead ] ,
2020-06-09 00:08:47 +00:00
resolver : Resolvers :: AlertManagement :: AlertResolver
2020-04-28 15:09:29 +00:00
field :alert_management_alert ,
Types :: AlertManagement :: AlertType ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'A single Alert Management alert of the project.' ,
2020-06-09 00:08:47 +00:00
resolver : Resolvers :: AlertManagement :: AlertResolver . single
2020-05-07 00:11:11 +00:00
2020-05-20 00:08:20 +00:00
field :alert_management_alert_status_counts ,
Types :: AlertManagement :: AlertStatusCountsType ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'Counts of alerts by status for the project.' ,
2020-05-20 00:08:20 +00:00
resolver : Resolvers :: AlertManagement :: AlertStatusCountsResolver
2020-10-29 00:08:36 +00:00
field :alert_management_integrations ,
Types :: AlertManagement :: IntegrationType . connection_type ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'Integrations which can receive alerts for the project.' ,
2020-10-29 00:08:36 +00:00
resolver : Resolvers :: AlertManagement :: IntegrationsResolver
2021-02-18 12:09:34 +00:00
field :alert_management_http_integrations ,
Types :: AlertManagement :: HttpIntegrationType . connection_type ,
null : true ,
description : 'HTTP Integrations which can receive alerts for the project.' ,
resolver : Resolvers :: AlertManagement :: HttpIntegrationsResolver
2022-05-13 03:08:13 +00:00
field :incident_management_timeline_events ,
Types :: IncidentManagement :: TimelineEventType . connection_type ,
null : true ,
description : 'Incident Management Timeline events associated with the incident.' ,
extras : [ :lookahead ] ,
resolver : Resolvers :: IncidentManagement :: TimelineEventsResolver
field :incident_management_timeline_event ,
Types :: IncidentManagement :: TimelineEventType ,
null : true ,
description : 'Incident Management Timeline event associated with the incident.' ,
resolver : Resolvers :: IncidentManagement :: TimelineEventsResolver . single
2020-05-07 00:11:11 +00:00
field :releases ,
Types :: ReleaseType . connection_type ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'Releases of the project.' ,
2020-06-25 03:08:52 +00:00
resolver : Resolvers :: ReleasesResolver
2020-05-07 00:11:11 +00:00
field :release ,
Types :: ReleaseType ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'A single release of the project.' ,
2020-05-07 00:11:11 +00:00
resolver : Resolvers :: ReleasesResolver . single ,
2021-11-16 12:10:23 +00:00
authorize : :read_release
2020-05-28 00:08:37 +00:00
field :container_expiration_policy ,
Types :: ContainerExpirationPolicyType ,
null : true ,
2021-08-25 15:11:14 +00:00
description : 'Container expiration policy of the project.'
2020-06-03 00:08:38 +00:00
2020-10-22 15:08:25 +00:00
field :container_repositories ,
Types :: ContainerRepositoryType . connection_type ,
null : true ,
2021-02-05 15:09:28 +00:00
description : 'Container repositories of the project.' ,
2020-11-10 21:08:51 +00:00
resolver : Resolvers :: ContainerRepositoriesResolver
2020-10-22 15:08:25 +00:00
2021-07-22 09:08:22 +00:00
field :container_repositories_count , GraphQL :: Types :: Int , null : false ,
2021-02-05 15:09:28 +00:00
description : 'Number of container repositories in the project.'
2020-12-01 18:09:42 +00:00
2020-06-03 00:08:38 +00:00
field :label ,
Types :: LabelType ,
null : true ,
2021-08-25 15:11:14 +00:00
description : 'Label available on this project.' do
2021-07-22 09:08:22 +00:00
argument :title , GraphQL :: Types :: String ,
2020-06-03 00:08:38 +00:00
required : true ,
2021-02-05 15:09:28 +00:00
description : 'Title of the label.'
2020-06-03 00:08:38 +00:00
end
2021-01-21 00:11:07 +00:00
field :terraform_state ,
Types :: Terraform :: StateType ,
null : true ,
description : 'Find a single Terraform state by name.' ,
resolver : Resolvers :: Terraform :: StatesResolver . single
2020-09-30 12:09:53 +00:00
field :terraform_states ,
Types :: Terraform :: StateType . connection_type ,
null : true ,
2021-01-21 00:11:07 +00:00
description : 'Terraform states associated with the project.' ,
2020-09-30 12:09:53 +00:00
resolver : Resolvers :: Terraform :: StatesResolver
2020-12-08 00:09:45 +00:00
field :pipeline_analytics , Types :: Ci :: AnalyticsType , null : true ,
2021-02-05 15:09:28 +00:00
description : 'Pipeline analytics.' ,
2020-12-08 00:09:45 +00:00
resolver : Resolvers :: ProjectPipelineStatisticsResolver
2021-05-05 06:10:38 +00:00
field :ci_template , Types :: Ci :: TemplateType , null : true ,
description : 'Find a single CI/CD template by name.' ,
resolver : Resolvers :: Ci :: TemplateResolver
2021-06-21 18:08:00 +00:00
field :ci_job_token_scope , Types :: Ci :: JobTokenScopeType , null : true ,
description : 'The CI Job Tokens scope of access.' ,
resolver : Resolvers :: Ci :: JobTokenScopeResolver
2021-08-10 12:11:00 +00:00
field :timelogs ,
Types :: TimelogType . connection_type , null : true ,
description : 'Time logged on issues and merge requests in the project.' ,
extras : [ :lookahead ] ,
complexity : 5 ,
resolver : :: Resolvers :: TimelogResolver
2021-09-23 03:09:49 +00:00
field :agent_configurations ,
:: Types :: Kas :: AgentConfigurationType . connection_type ,
null : true ,
description : 'Agent configurations defined by the project' ,
resolver : :: Resolvers :: Kas :: AgentConfigurationsResolver
field :cluster_agent ,
:: Types :: Clusters :: AgentType ,
null : true ,
description : 'Find a single cluster agent by name.' ,
resolver : :: Resolvers :: Clusters :: AgentsResolver . single
field :cluster_agents ,
:: Types :: Clusters :: AgentType . connection_type ,
extras : [ :lookahead ] ,
null : true ,
description : 'Cluster agents associated with the project.' ,
resolver : :: Resolvers :: Clusters :: AgentsResolver
2021-11-11 09:12:21 +00:00
field :merge_commit_template ,
GraphQL :: Types :: String ,
null : true ,
description : 'Template used to create merge commit message in merge requests.'
2021-11-25 00:10:49 +00:00
field :squash_commit_template ,
GraphQL :: Types :: String ,
null : true ,
description : 'Template used to create squash commit message in merge requests.'
2020-06-03 00:08:38 +00:00
field :labels ,
Types :: LabelType . connection_type ,
null : true ,
2021-02-15 12:09:29 +00:00
description : 'Labels available on this project.' ,
resolver : Resolvers :: LabelsResolver
2020-06-03 00:08:38 +00:00
2022-01-14 00:16:06 +00:00
field :work_item_types , Types :: WorkItems :: TypeType . connection_type ,
resolver : Resolvers :: WorkItems :: TypesResolver ,
2022-03-07 06:15:33 +00:00
description : 'Work item types available to the project.' \
' Returns `null` if `work_items` feature flag is disabled.' \
' This flag is disabled by default, because the feature is experimental and is subject to change without notice.'
2022-01-14 00:16:06 +00:00
2022-01-17 15:16:12 +00:00
def label ( title : )
BatchLoader :: GraphQL . for ( title ) . batch ( key : project ) do | titles , loader , args |
LabelsFinder
. new ( current_user , project : args [ :key ] , title : titles )
. execute
. each { | label | loader . call ( label . title , label ) }
end
end
{
issues : " Issues are " ,
merge_requests : " Merge Requests are " ,
wiki : 'Wikis are' ,
snippets : 'Snippets are' ,
container_registry : 'Container Registry is'
} . each do | feature , name_string |
field " #{ feature } _enabled " , GraphQL :: Types :: Boolean , null : true ,
description : " Indicates if #{ name_string } enabled for the current user "
define_method " #{ feature } _enabled " do
object . feature_available? ( feature , context [ :current_user ] )
end
end
markdown_field :description_html , null : true
2020-12-01 12:09:17 +00:00
def avatar_url
object . avatar_url ( only_path : false )
end
def jobs_enabled
object . feature_available? ( :builds , context [ :current_user ] )
end
def open_issues_count
object . open_issues_count if object . feature_available? ( :issues , context [ :current_user ] )
end
def statistics
Gitlab :: Graphql :: Loaders :: BatchProjectStatisticsLoader . new ( object . id ) . find
end
2020-12-01 18:09:42 +00:00
def container_repositories_count
project . container_repositories . size
end
2021-01-19 21:10:45 +00:00
def sast_ci_configuration
return unless Ability . allowed? ( current_user , :download_code , object )
:: Security :: CiConfiguration :: SastParserService . new ( object ) . configuration
end
2022-02-04 00:13:53 +00:00
def service_desk_address
return unless Ability . allowed? ( current_user , :admin_issue , project )
object . service_desk_address
end
2020-06-03 00:08:38 +00:00
private
def project
@project || = object . respond_to? ( :sync ) ? object . sync : object
end
2018-05-23 07:55:14 +00:00
end
2017-08-16 13:04:41 +00:00
end
2019-12-11 12:08:10 +00:00
2021-05-11 21:10:21 +00:00
Types :: ProjectType . prepend_mod_with ( 'Types::ProjectType' )