Skip to content

Commit

Permalink
feat: add ability to link monitorv2 to shared actions (#134)
Browse files Browse the repository at this point in the history
  • Loading branch information
obs-gh-owengoebel authored Aug 5, 2024
1 parent f5e6db3 commit e167e73
Show file tree
Hide file tree
Showing 12 changed files with 630 additions and 8 deletions.
8 changes: 8 additions & 0 deletions client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,14 @@ func (c *Client) DeleteMonitorV2(ctx context.Context, id string) error {
return c.Meta.DeleteMonitorV2(ctx, id)
}

func (c *Client) SaveMonitorV2Relations(ctx context.Context, monitorId string, actionRelations []meta.ActionRelationInput) (*meta.MonitorV2, error) {
if !c.Flags[flagObs2110] {
c.obs2110.Lock()
defer c.obs2110.Unlock()
}
return c.Meta.SaveMonitorV2Relations(ctx, monitorId, actionRelations)
}

func (c *Client) GetMonitorV2(ctx context.Context, id string) (*meta.MonitorV2, error) {
return c.Meta.GetMonitorV2(ctx, id)
}
Expand Down
23 changes: 22 additions & 1 deletion client/internal/meta/operation/monitorv2.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ fragment MonitorV2SearchResult on MonitorV2SearchResult {
}
}

fragment MonitorV2ActionRule on MonitorV2ActionRule {
actionID
levels
}

# @genqlient(for: "MonitorV2Input.comment", omitempty: true)
# @genqlient(for: "MonitorV2Input.iconUrl", omitempty: true)
# @genqlient(for: "MonitorV2Input.description", omitempty: true)
Expand Down Expand Up @@ -191,6 +196,10 @@ fragment MonitorV2 on MonitorV2 {
definition {
...MonitorV2Definition
}
# @genqlient(flatten: true)
actionRules {
...MonitorV2ActionRule
}
}

# definitions of monitorv2 CRUD ops
Expand Down Expand Up @@ -282,4 +291,16 @@ query lookupMonitorV2($workspaceId: ObjectId, $folderId: ObjectId, $nameExact: S
monitorV2s: searchMonitorV2(workspaceId: $workspaceId, folderId: $folderId, nameExact: $nameExact, nameSubstring: $nameSubstring) {
...MonitorV2SearchResult
}
}
}

# @genqlient(for: "ActionDestinationLinkInput.sendEndNotifications", omitempty: true)
# @genqlient(for: "ActionDestinationLinkInput.sendRemindersInterval", omitempty: true)
mutation saveMonitorV2Relations(
$monitorId: ObjectId!,
$actionRelations: [ActionRelationInput!]
) {
# @genqlient(flatten: true)
monitorV2: saveMonitorV2Relations(monitorId: $monitorId, actionRelations: $actionRelations) {
...MonitorV2
}
}
4 changes: 2 additions & 2 deletions client/internal/meta/schema/monitorv2_extend.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ extend type Mutation {
relationships with the destinations are mutateable.Hence, this API will error out if you provide destinationLinks
where the action is shared.
"""
saveMonitorV2Relations(monitorId: ObjectId!, actionRelations: [ActionRelationInput!]!): MonitorV2!
saveMonitorV2Relations(monitorId: ObjectId!, actionRelations: [ActionRelationInput!]): MonitorV2!

"""
saveActionsWithDestinations replaces all action's links to the destinations (MonitorV2) for the provided
Expand All @@ -47,7 +47,7 @@ extend type Mutation {
The purpose of the API is such that the users can create a shared action and make links to the destinations
from the shared actions page or when an action has been shared from within the monitor editing page.
"""
saveActionWithDestinationLinks(actionId: ObjectId!, destinationLinks: [ActionDestinationLinkInput!]!): MonitorV2Action!
saveActionWithDestinationLinks(actionId: ObjectId!, destinationLinks: [ActionDestinationLinkInput!]): MonitorV2Action!

"""
terminateMonitorV2Alarm allows an explicit termination of an active alarm. The purpose is to
Expand Down
Loading

0 comments on commit e167e73

Please sign in to comment.