Skip to content
代码片段 群组 项目
提交 d15b9464 编辑于 作者: Joe Woodward's avatar Joe Woodward 提交者: Joe Woodward
浏览文件

Expose ID in Types::Projects::BranchRuleType

We are in the process of building mutations to update and delete branch
rules. Currently there's no way to access the branch rule IDs.

This change exposes a global ID in the branch rule type.

Changelog: added
上级 441ed3a8
No related branches found
No related tags found
无相关合并请求
......@@ -230,3 +230,11 @@ overrides:
- '{,ee/}spec/contracts/consumer/**/*'
rules:
'@gitlab/require-i18n-strings': off
- files:
- 'app/assets/javascripts/projects/settings/branch_rules/queries/branch_rules_details.query.graphql'
- 'app/assets/javascripts/projects/settings/repository/branch_rules/graphql/mutations/create_branch_rule.mutation.graphql'
- 'app/assets/javascripts/projects/settings/repository/branch_rules/graphql/queries/branch_rules.query.graphql'
- 'ee/app/assets/javascripts/projects/settings/branch_rules/queries/branch_rules_details.query.graphql'
- 'ee/app/assets/javascripts/projects/settings/repository/branch_rules/graphql/queries/branch_rules.query.graphql'
rules:
'@graphql-eslint/require-id-when-available': off
......@@ -9,6 +9,9 @@ class BranchRuleType < BaseObject
alias_method :branch_rule, :object
field :id, ::Types::GlobalIDType[::Projects::BranchRule],
description: 'ID of the branch rule.'
field :name,
type: GraphQL::Types::String,
null: false,
......
......@@ -15552,6 +15552,7 @@ Branch rules configured for a rule target.
| <a id="branchrulebranchprotection"></a>`branchProtection` | [`BranchProtection`](#branchprotection) | Branch protections configured for this branch rule. |
| <a id="branchrulecreatedat"></a>`createdAt` | [`Time!`](#time) | Timestamp of when the branch rule was created. |
| <a id="branchruleexternalstatuschecks"></a>`externalStatusChecks` | [`ExternalStatusCheckConnection`](#externalstatuscheckconnection) | External status checks configured for this branch rule. (see [Connections](#connections)) |
| <a id="branchruleid"></a>`id` | [`ProjectsBranchRuleID`](#projectsbranchruleid) | ID of the branch rule. |
| <a id="branchruleisdefault"></a>`isDefault` | [`Boolean!`](#boolean) | Check if this branch rule protects the project's default branch. |
| <a id="branchruleisprotected"></a>`isProtected` | [`Boolean!`](#boolean) | Check if this branch rule protects access for the branch. |
| <a id="branchrulematchingbranchescount"></a>`matchingBranchesCount` | [`Int!`](#int) | Number of existing branches that match this branch rule. |
......@@ -33056,6 +33057,12 @@ A `ProjectImportStateID` is a global ID. It is encoded as a string.
 
An example `ProjectImportStateID` is: `"gid://gitlab/ProjectImportState/1"`.
 
### `ProjectsBranchRuleID`
A `ProjectsBranchRuleID` is a global ID. It is encoded as a string.
An example `ProjectsBranchRuleID` is: `"gid://gitlab/Projects::BranchRule/1"`.
### `ProtectedBranchID`
 
A `ProtectedBranchID` is a global ID. It is encoded as a string.
......@@ -119,6 +119,7 @@ def expect_n_matching_branches_count_fields(count)
it 'includes all fields', :use_sql_query_cache, :aggregate_failures do
expect(all_branches_rule_data).to include(
'id' => all_branches_rule.to_global_id.to_s,
'name' => all_branches_rule.name,
'isDefault' => all_branches_rule.default_branch?,
'isProtected' => all_branches_rule.protected?,
......@@ -143,6 +144,7 @@ def expect_n_matching_branches_count_fields(count)
'externalUrl' => all_branches_external_status_check.external_url
}])
expect(all_protected_branches_rule_data).to include(
'id' => all_protected_branches_rule.to_global_id.to_s,
'name' => all_protected_branches_rule.name,
'isDefault' => all_protected_branches_rule.default_branch?,
'isProtected' => all_protected_branches_rule.protected?,
......@@ -162,6 +164,7 @@ def expect_n_matching_branches_count_fields(count)
}])
expect(branch_rule_a_data).to include(
'id' => branch_rule_a.to_global_id.to_s,
'name' => branch_rule_a.name,
'isDefault' => branch_rule_a.default_branch?,
'isProtected' => branch_rule_a.protected?,
......@@ -177,6 +180,7 @@ def expect_n_matching_branches_count_fields(count)
)
expect(branch_rule_b_data).to include(
'id' => branch_rule_b.to_global_id.to_s,
'name' => branch_rule_b.name,
'isDefault' => branch_rule_b.default_branch?,
'isProtected' => branch_rule_b.protected?,
......
......@@ -124,6 +124,7 @@ def expect_n_matching_branches_count_fields(count)
it 'includes all fields', :use_sql_query_cache, :aggregate_failures do
expect(branch_rule_a_data).to include(
'id' => branch_rule_a.to_global_id.to_s,
'name' => branch_name_a,
'isDefault' => be_boolean,
'isProtected' => true,
......@@ -137,6 +138,7 @@ def expect_n_matching_branches_count_fields(count)
branch_name.starts_with?('diff-')
end
expect(branch_rule_b_data).to include(
'id' => branch_rule_b.to_global_id.to_s,
'name' => branch_name_b,
'isDefault' => be_boolean,
'isProtected' => true,
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册