Added feature flags config to technician settings #334
This commit is contained in:
9
kdb-bot/src/bot_graphql/model/featureFlags.gql
Normal file
9
kdb-bot/src/bot_graphql/model/featureFlags.gql
Normal file
@@ -0,0 +1,9 @@
|
||||
type FeatureFlag {
|
||||
key: String
|
||||
value: Boolean
|
||||
}
|
||||
|
||||
input FeatureFlagInput {
|
||||
key: String
|
||||
value: Boolean
|
||||
}
|
@@ -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]
|
||||
}
|
@@ -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
|
||||
)
|
||||
|
@@ -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],
|
||||
)
|
||||
|
@@ -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)
|
||||
|
||||
|
Reference in New Issue
Block a user