Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
f903f0b6
Commit
f903f0b6
authored
Feb 17, 2021
by
Sean Arnold
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use same graphql arugments at column names
Small tweaks Update docs
parent
16f0516f
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
31 deletions
+25
-31
doc/api/graphql/reference/index.md
doc/api/graphql/reference/index.md
+2
-2
ee/app/graphql/mutations/incident_management/oncall_rotation/create.rb
...l/mutations/incident_management/oncall_rotation/create.rb
+2
-2
ee/app/graphql/types/incident_management/oncall_rotation_active_period_input_type.rb
...nt_management/oncall_rotation_active_period_input_type.rb
+9
-9
ee/app/graphql/types/incident_management/oncall_rotation_active_period_type.rb
...incident_management/oncall_rotation_active_period_type.rb
+10
-8
ee/app/graphql/types/incident_management/oncall_rotation_type.rb
...graphql/types/incident_management/oncall_rotation_type.rb
+0
-8
ee/spec/graphql/mutations/incident_management/oncall_rotation/create_spec.rb
...ations/incident_management/oncall_rotation/create_spec.rb
+2
-2
No files found.
doc/api/graphql/reference/index.md
View file @
f903f0b6
...
...
@@ -2810,8 +2810,8 @@ Active period time range for on-call rotation.
| Field | Type | Description |
| ----- | ---- | ----------- |
|
`
from`
| String | The start of the rotation interval
. |
|
`
to`
| String | The end of the rotation interval
. |
|
`
endTime`
| String | The end of the rotation active period
. |
|
`
startTime`
| String | The start of the rotation active period
. |
### OncallRotationCreatePayload
...
...
ee/app/graphql/mutations/incident_management/oncall_rotation/create.rb
View file @
f903f0b6
...
...
@@ -75,8 +75,8 @@ module Mutations
rotation_length_unit
=
args
[
:rotation_length
][
:unit
]
starts_at
=
parse_datetime
(
schedule
,
args
[
:starts_at
])
ends_at
=
parse_datetime
(
schedule
,
args
[
:ends_at
])
if
args
[
:ends_at
]
active_period_start
=
args
.
dig
(
:active_period
,
:
from
)
active_period_end
=
args
.
dig
(
:active_period
,
:
to
)
active_period_start
=
args
.
dig
(
:active_period
,
:
start_time
)
active_period_end
=
args
.
dig
(
:active_period
,
:
end_time
)
args
.
slice
(
:name
).
merge
(
length:
rotation_length
,
...
...
ee/app/graphql/types/incident_management/oncall_rotation_active_period_input_type.rb
View file @
f903f0b6
...
...
@@ -7,25 +7,25 @@ module Types
graphql_name
'OncallRotationActivePeriodInputType'
description
'Active period time range for on-call rotation'
argument
:
from
,
GraphQL
::
STRING_TYPE
,
argument
:
start_time
,
GraphQL
::
STRING_TYPE
,
required:
true
,
description:
'The start of the rotation
interval
.'
description:
'The start of the rotation
active period
.'
argument
:
to
,
GraphQL
::
STRING_TYPE
,
argument
:
end_time
,
GraphQL
::
STRING_TYPE
,
required:
true
,
description:
'The end of the rotation
interval
.'
description:
'The end of the rotation
active period.
.'
TIME_FORMAT
=
%r[^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$]
.
freeze
def
prepare
raise
invalid_time_error
unless
TIME_FORMAT
.
match?
(
from
)
raise
invalid_time_error
unless
TIME_FORMAT
.
match?
(
to
)
raise
invalid_time_error
unless
TIME_FORMAT
.
match?
(
start_time
)
raise
invalid_time_error
unless
TIME_FORMAT
.
match?
(
end_time
)
parsed_from
=
Time
.
parse
(
from
)
parsed_to
=
Time
.
parse
(
to
)
parsed_from
=
Time
.
parse
(
start_time
)
parsed_to
=
Time
.
parse
(
end_time
)
if
parsed_to
<
parsed_from
raise
::
Gitlab
::
Graphql
::
Errors
::
ArgumentError
,
"'
from' time must be before 'to
' time"
raise
::
Gitlab
::
Graphql
::
Errors
::
ArgumentError
,
"'
start_time' time must be before 'end_time
' time"
end
to_h
...
...
ee/app/graphql/types/incident_management/oncall_rotation_active_period_type.rb
View file @
f903f0b6
...
...
@@ -7,20 +7,22 @@ module Types
graphql_name
'OncallRotationActivePeriodType'
description
'Active period time range for on-call rotation'
field
:
from
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'The start of the rotation interval
.'
field
:
start_time
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'The start of the rotation active period
.'
field
:to
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'The end of the rotation interval.'
field
:end_time
,
GraphQL
::
STRING_TYPE
,
null:
true
,
description:
'The end of the rotation active period.'
alias_method
:active_period
,
:object
def
from
object
.
start_time
&
.
strftime
(
'%H:%M'
)
active_period
.
start_time
&
.
strftime
(
'%H:%M'
)
end
def
to
object
.
end_time
&
.
strftime
(
'%H:%M'
)
active_period
.
end_time
&
.
strftime
(
'%H:%M'
)
end
end
# rubocop: enable Graphql/AuthorizeTypes
...
...
ee/app/graphql/types/incident_management/oncall_rotation_type.rb
View file @
f903f0b6
...
...
@@ -53,14 +53,6 @@ module Types
null:
true
,
description:
'Blocks of time for which a participant is on-call within a given time frame. Time frame cannot exceed one month.'
,
resolver:
::
Resolvers
::
IncidentManagement
::
OncallShiftsResolver
def
active_period_start
object
.
active_period_start
&
.
strftime
(
'%H:%M'
)
end
def
active_period_end
object
.
active_period_end
&
.
strftime
(
'%H:%M'
)
end
end
end
end
ee/spec/graphql/mutations/incident_management/oncall_rotation/create_spec.rb
View file @
f903f0b6
...
...
@@ -85,8 +85,8 @@ RSpec.describe Mutations::IncidentManagement::OncallRotation::Create do
context
'with active period times given'
do
before
do
args
[
:active_period
]
=
{
from
:
'08:00'
,
to
:
'17:00'
start_time
:
'08:00'
,
end_time
:
'17:00'
}
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment