Skip to content

Commit 7921045

Browse files
committed
Add status field as response option in Branch query
1 parent cf2e6ce commit 7921045

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

backend/infrahub/core/branch/enums.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44
class BranchStatus(InfrahubStringEnum):
55
OPEN = "OPEN"
66
NEED_REBASE = "NEED_REBASE"
7-
CLOSED = "CLOSED"
87
DELETING = "DELETING"

backend/infrahub/graphql/types/branch.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from infrahub.core.branch import Branch
88
from infrahub.core.constants import GLOBAL_BRANCH_NAME
99

10+
from .enums import InfrahubBranchStatus
1011
from .standard_node import InfrahubObjectType
1112

1213
if TYPE_CHECKING:
@@ -19,6 +20,7 @@ class BranchType(InfrahubObjectType):
1920
description = String(required=False)
2021
origin_branch = String(required=False)
2122
branched_from = String(required=False)
23+
status = InfrahubBranchStatus(required=True)
2224
created_at = String(required=False)
2325
sync_with_git = Boolean(required=False)
2426
is_default = Boolean(required=False)

backend/infrahub/graphql/types/enums.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from graphene import Enum
22

33
from infrahub.core import constants
4+
from infrahub.core.branch.enums import BranchStatus
45
from infrahub.permissions import constants as permission_constants
56

67
CheckType = Enum.from_enum(constants.CheckType)
@@ -10,3 +11,5 @@
1011
Severity = Enum.from_enum(constants.Severity)
1112

1213
BranchRelativePermissionDecision = Enum.from_enum(permission_constants.BranchRelativePermissionDecision)
14+
15+
InfrahubBranchStatus = Enum.from_enum(BranchStatus)

schema/schema.graphql

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ type Branch {
150150
is_isolated: Boolean @deprecated(reason: "non isolated mode is not supported anymore")
151151
name: String!
152152
origin_branch: String
153+
status: BranchStatus!
153154
sync_with_git: Boolean
154155
}
155156

@@ -318,6 +319,13 @@ enum BranchRelativePermissionDecision {
318319
DENY
319320
}
320321

322+
"""An enumeration."""
323+
enum BranchStatus {
324+
DELETING
325+
NEED_REBASE
326+
OPEN
327+
}
328+
321329
type BranchUpdate {
322330
ok: Boolean
323331
}

0 commit comments

Comments
 (0)