Added feature flags config to technician settings #334

This commit is contained in:
2023-08-15 20:29:44 +02:00
parent 02e0c72a80
commit 4b57d7f102
30 changed files with 256 additions and 13 deletions

View File

@@ -0,0 +1,9 @@
type FeatureFlag {
key: String
value: Boolean
}
input FeatureFlagInput {
key: String
value: Boolean
}

View File

@@ -4,6 +4,7 @@ type TechnicianConfig implements TableWithHistoryQuery {
waitForRestart: Int
waitForShutdown: Int
cacheMaxMessages: Int
featureFlags: [FeatureFlag]
pingURLs: [String]
technicianIds: [String]
@@ -21,6 +22,7 @@ type TechnicianConfigHistory implements HistoryTableQuery {
waitForRestart: Int
waitForShutdown: Int
cacheMaxMessages: Int
featureFlags: [FeatureFlag]
deleted: Boolean
dateFrom: String
@@ -55,6 +57,7 @@ input TechnicianConfigInput {
waitForRestart: Int
waitForShutdown: Int
cacheMaxMessages: Int
featureFlags: [FeatureFlagInput]
pingURLs: [String]
technicianIds: [String]
}

View File

@@ -49,6 +49,11 @@ class TechnicianConfigMutation(QueryABC):
technician_config.cache_max_messages = (
input["cacheMaxMessages"] if "cacheMaxMessages" in input else technician_config.cache_max_messages
)
technician_config.feature_flags = (
dict(zip([x["key"] for x in input["featureFlags"]], [x["value"] for x in input["featureFlags"]]))
if "featureFlags" in input
else technician_config.feature_flags
)
technician_config.ping_urls = (
List(str, input["pingURLs"]) if "pingURLs" in input else technician_config.ping_urls
)

View File

@@ -9,3 +9,7 @@ class TechnicianConfigHistoryQuery(HistoryQueryABC):
self.set_field("waitForRestart", lambda config, *_: config.wait_for_restart)
self.set_field("waitForShutdown", lambda config, *_: config.wait_for_shutdown)
self.set_field("cacheMaxMessages", lambda config, *_: config.cache_max_messages)
self.set_field(
"featureFlags",
lambda config, *_: [{"key": x, "value": config.feature_flags[x]} for x in config.feature_flags],
)

View File

@@ -16,6 +16,10 @@ class TechnicianConfigQuery(DataQueryWithHistoryABC):
self.set_field("waitForRestart", lambda config, *_: config.wait_for_restart)
self.set_field("waitForShutdown", lambda config, *_: config.wait_for_shutdown)
self.set_field("cacheMaxMessages", lambda config, *_: config.cache_max_messages)
self.set_field(
"featureFlags",
lambda config, *_: [{"key": x, "value": config.feature_flags[x]} for x in config.feature_flags],
)
self.set_field("pingURLs", lambda config, *_: config.ping_urls)
self.set_field("technicianIds", lambda config, *_: config.technician_ids)