Skip to content

Commit dc5baec

Browse files
committed
feat: implement device group subscriptions
- implement GraphQL subscriptions for device group changes Signed-off-by: Osman Hadzic <osman.hadzic@secomind.com>
1 parent 81ac9d0 commit dc5baec

2 files changed

Lines changed: 272 additions & 67 deletions

File tree

frontend/src/api/schema.graphql

Lines changed: 116 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ type Modem {
559559
"The cell tower's Mobile Network Code."
560560
mobileNetworkCode: Int
561561

562-
"The GSM/LTE registration status of the modem."
562+
"The GSM\/LTE registration status of the modem."
563563
registrationStatus: ModemRegistrationStatus
564564

565565
"Signal strength in dBm."
@@ -581,13 +581,7 @@ input CampaignMechanismInput {
581581
firmwareUpgrade: CampaignCampaignMechanismFirmwareUpgradeInput
582582
}
583583

584-
union CampaignMechanism =
585-
| DeploymentDelete
586-
| DeploymentDeploy
587-
| DeploymentStart
588-
| DeploymentStop
589-
| DeploymentUpgrade
590-
| FirmwareUpgrade
584+
union CampaignMechanism = DeploymentDelete | DeploymentDeploy | DeploymentStart | DeploymentStop | DeploymentUpgrade | FirmwareUpgrade
591585

592586
enum CampaignTargetStatus {
593587
"Something went wrong while attempting operation on the target."
@@ -741,7 +735,7 @@ enum ModemRegistrationStatus {
741735
"Not registered, but modem is currently searching a new operator to register to."
742736
SEARCHING_OPERATOR
743737

744-
"Unknown (e.g. out of GERAN/UTRAN/E-UTRAN coverage)."
738+
"Unknown (e.g. out of GERAN\/UTRAN\/E-UTRAN coverage)."
745739
UNKNOWN
746740
}
747741

@@ -900,6 +894,12 @@ type LocalizedAttribute {
900894
languageTag: String!
901895
}
902896

897+
type base_image_collection_result {
898+
created: BaseImageCollection
899+
updated: BaseImageCollection
900+
destroyed: ID
901+
}
902+
903903
"The result of the :delete_base_image_collection mutation"
904904
type DeleteBaseImageCollectionResult {
905905
"The record that was successfully deleted"
@@ -1092,6 +1092,12 @@ type BaseImageCollection implements Node {
10921092
): BaseImageConnection!
10931093
}
10941094

1095+
type base_image_result {
1096+
created: BaseImage
1097+
updated: BaseImage
1098+
destroyed: ID
1099+
}
1100+
10951101
"The result of the :delete_base_image mutation"
10961102
type DeleteBaseImageResult {
10971103
"The record that was successfully deleted"
@@ -1279,9 +1285,7 @@ type BaseImage implements Node {
12791285
localizedDescriptions(preferredLanguageTags: [String!]): [LocalizedAttribute!]
12801286

12811287
"A list of release display names in different languages."
1282-
localizedReleaseDisplayNames(
1283-
preferredLanguageTags: [String!]
1284-
): [LocalizedAttribute!]
1288+
localizedReleaseDisplayNames(preferredLanguageTags: [String!]): [LocalizedAttribute!]
12851289

12861290
"Derived Base Image Name from version and localized release display name"
12871291
name: String
@@ -4716,6 +4720,12 @@ type ForwarderConfig {
47164720
secureSessions: Boolean!
47174721
}
47184722

4723+
type device_group_result {
4724+
created: DeviceGroup
4725+
updated: DeviceGroup
4726+
destroyed: ID
4727+
}
4728+
47194729
"The result of the :delete_device_group mutation"
47204730
type DeleteDeviceGroupResult {
47214731
"The record that was successfully deleted"
@@ -5005,6 +5015,15 @@ type Tag {
50055015
name: String!
50065016
}
50075017

5018+
"The result of the :cancel_ota_operation mutation"
5019+
type CancelOtaOperationResult {
5020+
"The successful result of the mutation"
5021+
result: OtaOperation
5022+
5023+
"Any errors generated, if the mutation failed"
5024+
errors: [MutationError!]!
5025+
}
5026+
50085027
"The result of the :create_manual_ota_operation mutation"
50095028
type CreateManualOtaOperationResult {
50105029
"The successful result of the mutation"
@@ -5867,7 +5886,10 @@ type Campaign implements Node {
58675886

58685887
type RootQueryType {
58695888
"Returns the desired campaign."
5870-
campaign("The id of the record" id: ID!): Campaign
5889+
campaign(
5890+
"The id of the record"
5891+
id: ID!
5892+
): Campaign
58715893

58725894
"Returns all update campaigns."
58735895
updateCampaigns(
@@ -5937,7 +5959,10 @@ type RootQueryType {
59375959
): CampaignConnection
59385960

59395961
"Returns a single channel."
5940-
channel("The id of the record" id: ID!): Channel
5962+
channel(
5963+
"The id of the record"
5964+
id: ID!
5965+
): Channel
59415966

59425967
"Returns a list of channels."
59435968
channels(
@@ -5985,7 +6010,10 @@ type RootQueryType {
59856010
): TagConnection
59866011

59876012
"Returns a single device group."
5988-
deviceGroup("The id of the record" id: ID!): DeviceGroup
6013+
deviceGroup(
6014+
"The id of the record"
6015+
id: ID!
6016+
): DeviceGroup
59896017

59906018
"Returns a list of device groups."
59916019
deviceGroups(
@@ -6018,7 +6046,10 @@ type RootQueryType {
60186046
forwarderSession(token: String!, deviceId: ID!): ForwarderSession
60196047

60206048
"Returns a single device."
6021-
device("The id of the record" id: ID!): Device
6049+
device(
6050+
"The id of the record"
6051+
id: ID!
6052+
): Device
60226053

60236054
"Returns a list of devices."
60246055
devices(
@@ -6042,7 +6073,10 @@ type RootQueryType {
60426073
): DeviceConnection
60436074

60446075
"Returns a single hardware type."
6045-
hardwareType("The id of the record" id: ID!): HardwareType
6076+
hardwareType(
6077+
"The id of the record"
6078+
id: ID!
6079+
): HardwareType
60466080

60476081
"Returns a list of hardware types."
60486082
hardwareTypes(
@@ -6066,7 +6100,10 @@ type RootQueryType {
60666100
): HardwareTypeConnection
60676101

60686102
"Returns a single system model."
6069-
systemModel("The id of the record" id: ID!): SystemModel
6103+
systemModel(
6104+
"The id of the record"
6105+
id: ID!
6106+
): SystemModel
60706107

60716108
"Returns a list of system models."
60726109
systemModels(
@@ -6111,7 +6148,10 @@ type RootQueryType {
61116148
): ApplicationConnection
61126149

61136150
"Returns the desired application."
6114-
application("The id of the record" id: ID!): Application
6151+
application(
6152+
"The id of the record"
6153+
id: ID!
6154+
): Application
61156155

61166156
"Returns all available deployments."
61176157
deployments(
@@ -6135,10 +6175,16 @@ type RootQueryType {
61356175
): DeploymentConnection
61366176

61376177
"Returns the desired deployment."
6138-
deployment("The id of the record" id: ID!): Deployment
6178+
deployment(
6179+
"The id of the record"
6180+
id: ID!
6181+
): Deployment
61396182

61406183
"Returns the desired image credentials."
6141-
imageCredentials("The id of the record" id: ID!): ImageCredentials
6184+
imageCredentials(
6185+
"The id of the record"
6186+
id: ID!
6187+
): ImageCredentials
61426188

61436189
"Returns all available image credentials."
61446190
listImageCredentials(
@@ -6162,10 +6208,16 @@ type RootQueryType {
61626208
): ImageCredentialsConnection
61636209

61646210
"Returns the desired release."
6165-
release("The id of the record" id: ID!): Release
6211+
release(
6212+
"The id of the record"
6213+
id: ID!
6214+
): Release
61666215

61676216
"Returns the desired network."
6168-
network("The id of the record" id: ID!): Network
6217+
network(
6218+
"The id of the record"
6219+
id: ID!
6220+
): Network
61696221

61706222
"Returns all available networks."
61716223
networks(
@@ -6189,7 +6241,10 @@ type RootQueryType {
61896241
): NetworkConnection
61906242

61916243
"Returns the desired volume."
6192-
volume("The id of the record" id: ID!): Volume
6244+
volume(
6245+
"The id of the record"
6246+
id: ID!
6247+
): Volume
61936248

61946249
"Returns all available volumes."
61956250
volumes(
@@ -6213,13 +6268,22 @@ type RootQueryType {
62136268
): VolumeConnection
62146269

62156270
"Retrieves a Node from its global id"
6216-
node("The Node unique identifier" id: ID!): Node!
6271+
node(
6272+
"The Node unique identifier"
6273+
id: ID!
6274+
): Node!
62176275

62186276
"Returns a single base image."
6219-
baseImage("The id of the record" id: ID!): BaseImage
6277+
baseImage(
6278+
"The id of the record"
6279+
id: ID!
6280+
): BaseImage
62206281

62216282
"Returns a single base image collection."
6222-
baseImageCollection("The id of the record" id: ID!): BaseImageCollection
6283+
baseImageCollection(
6284+
"The id of the record"
6285+
id: ID!
6286+
): BaseImageCollection
62236287

62246288
"Returns a list of base image collections."
62256289
baseImageCollections(
@@ -6257,18 +6321,16 @@ type RootMutationType {
62576321
deleteChannel(id: ID!): DeleteChannelResult
62586322

62596323
"Initiates an OTA update with a user provided OS image"
6260-
createManualOtaOperation(
6261-
input: CreateManualOtaOperationInput!
6262-
): CreateManualOtaOperationResult
6324+
createManualOtaOperation(input: CreateManualOtaOperationInput!): CreateManualOtaOperationResult
6325+
6326+
"Cancels an OTA update operation"
6327+
cancelOtaOperation(id: ID!): CancelOtaOperationResult
62636328

62646329
"Creates a new device group."
62656330
createDeviceGroup(input: CreateDeviceGroupInput!): CreateDeviceGroupResult
62666331

62676332
"Updates a device group."
6268-
updateDeviceGroup(
6269-
id: ID!
6270-
input: UpdateDeviceGroupInput
6271-
): UpdateDeviceGroupResult
6333+
updateDeviceGroup(id: ID!, input: UpdateDeviceGroupInput): UpdateDeviceGroupResult
62726334

62736335
"Deletes a device group."
62746336
deleteDeviceGroup(id: ID!): DeleteDeviceGroupResult
@@ -6286,25 +6348,16 @@ type RootMutationType {
62866348
addDeviceTags(id: ID!, input: AddDeviceTagsInput!): AddDeviceTagsResult
62876349

62886350
"Remove tags from a device."
6289-
removeDeviceTags(
6290-
id: ID!
6291-
input: RemoveDeviceTagsInput!
6292-
): RemoveDeviceTagsResult
6351+
removeDeviceTags(id: ID!, input: RemoveDeviceTagsInput!): RemoveDeviceTagsResult
62936352

62946353
"Sets led behavior."
6295-
setDeviceLedBehavior(
6296-
id: ID!
6297-
input: SetDeviceLedBehaviorInput!
6298-
): SetDeviceLedBehaviorResult
6354+
setDeviceLedBehavior(id: ID!, input: SetDeviceLedBehaviorInput!): SetDeviceLedBehaviorResult
62996355

63006356
"Creates a hardware type."
63016357
createHardwareType(input: CreateHardwareTypeInput!): CreateHardwareTypeResult
63026358

63036359
"Updates a hardware type."
6304-
updateHardwareType(
6305-
id: ID!
6306-
input: UpdateHardwareTypeInput
6307-
): UpdateHardwareTypeResult
6360+
updateHardwareType(id: ID!, input: UpdateHardwareTypeInput): UpdateHardwareTypeResult
63086361

63096362
"Deletes a hardware type."
63106363
deleteHardwareType(id: ID!): DeleteHardwareTypeResult
@@ -6313,10 +6366,7 @@ type RootMutationType {
63136366
createSystemModel(input: CreateSystemModelInput!): CreateSystemModelResult
63146367

63156368
"Updates an system model."
6316-
updateSystemModel(
6317-
id: ID!
6318-
input: UpdateSystemModelInput
6319-
): UpdateSystemModelResult
6369+
updateSystemModel(id: ID!, input: UpdateSystemModelInput): UpdateSystemModelResult
63206370

63216371
"Deletes a system model."
63226372
deleteSystemModel(id: ID!): DeleteSystemModelResult
@@ -6344,15 +6394,10 @@ type RootMutationType {
63446394
"""
63456395
sendDeployment(id: ID!): SendDeploymentResult
63466396

6347-
upgradeDeployment(
6348-
id: ID!
6349-
input: UpgradeDeploymentInput!
6350-
): UpgradeDeploymentResult
6397+
upgradeDeployment(id: ID!, input: UpgradeDeploymentInput!): UpgradeDeploymentResult
63516398

63526399
"Create image credentials."
6353-
createImageCredentials(
6354-
input: CreateImageCredentialsInput!
6355-
): CreateImageCredentialsResult
6400+
createImageCredentials(input: CreateImageCredentialsInput!): CreateImageCredentialsResult
63566401

63576402
deleteImageCredentials(id: ID!): DeleteImageCredentialsResult
63586403

@@ -6384,25 +6429,32 @@ type RootMutationType {
63846429
deleteBaseImage(id: ID!): DeleteBaseImageResult
63856430

63866431
"Creates a new base image collection."
6387-
createBaseImageCollection(
6388-
input: CreateBaseImageCollectionInput!
6389-
): CreateBaseImageCollectionResult
6432+
createBaseImageCollection(input: CreateBaseImageCollectionInput!): CreateBaseImageCollectionResult
63906433

63916434
"Updates a base image collection."
6392-
updateBaseImageCollection(
6393-
id: ID!
6394-
input: UpdateBaseImageCollectionInput
6395-
): UpdateBaseImageCollectionResult
6435+
updateBaseImageCollection(id: ID!, input: UpdateBaseImageCollectionInput): UpdateBaseImageCollectionResult
63966436

63976437
"Deletes a base image collection."
63986438
deleteBaseImageCollection(id: ID!): DeleteBaseImageCollectionResult
63996439
}
64006440

64016441
type RootSubscriptionType {
6442+
deviceGroup(
6443+
"A filter to limit the results"
6444+
filter: DeviceGroupFilterInput
6445+
): device_group_result
64026446
deviceChanged(
64036447
"A filter to limit the results"
64046448
filter: DeviceFilterInput
64056449
): device_changed_result
6450+
baseImage(
6451+
"A filter to limit the results"
6452+
filter: BaseImageFilterInput
6453+
): base_image_result
6454+
baseImageCollection(
6455+
"A filter to limit the results"
6456+
filter: BaseImageCollectionFilterInput
6457+
): base_image_collection_result
64066458
}
64076459

64086460
"""

0 commit comments

Comments
 (0)