Repository navigation
feat: alerts/reports add/edit modal - #11770
Conversation
Codecov Report
@@ Coverage Diff @@
## master #11770 +/- ##
==========================================
- Coverage 67.23% 60.56% -6.68%
==========================================
Files 948 906 -42
Lines 46177 44641 -1536
Branches 4405 4038 -367
==========================================
- Hits 31046 27035 -4011
- Misses 15019 17606 +2587
+ Partials 112 0 -112
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
76f8d03 to
426d4bd
Compare
8f0c15c to
ecc5506
Compare
There was a problem hiding this comment.
if you assign this to a var with a type, you should be able to assign it. Eg,
const validatorConfig: AlertObject["validator_config_json"] = JSON.parse(resource.validator_config_json)
...
validator_config_json: validatorConfigor (JSON.parse(resource.validator_config_json) as AlertObject["validator_config_json"])
There was a problem hiding this comment.
I think the issue here if more that resource is expecting validator_config_json to be an object, not a string. I considered adding string to the type definition but it ended up creating more errors/checks I would need to handle, so ignoring this one case with the stringified response felt like less work in the long run.
There was a problem hiding this comment.
right, I don't think having to always serialize the validator config object to json before adding it to an AlertObject is desirable or practical. This suggestion is to get rid of the ts-ignore comment by casting the output of the json parse to the desired type or to store it in typed var.
There was a problem hiding this comment.
wondering if we should handle this client side before we make the request. It is confusing having json inside json. Or perhaps add a check to see if validator_config_json is already a json string before running this, that way the api would support both (json string or json object).
There was a problem hiding this comment.
@dpgaspar added this logic to make it easier for the FE (you can see it in the create logic already), by not requiring us to stringify our json beforehand, which I'm fine with. Do you see it as being an issue in the long run?
There was a problem hiding this comment.
My main concern is with the api spec (ie, /swagger/v1). If it specifies a json string for this field a user will likely make an api request with a json string and possibly encounter a opaque error message from the api server.
f333a08 to
9d95e36
Compare
There was a problem hiding this comment.
this is a very large file, it's kind of hard to parse out the various pieces. Moving the styled components into a seperate file would help. Separating out some of the stateful logic from the jsx markup would also help.
We're planning another round of changes for this feature so we can wait to address this then.
e5175ee to
c22de64
Compare
c22de64 to
38f19ef
Compare


SUMMARY
AlertReportModalSelectandRadioBEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TEST PLAN
AlertReportModalADDITIONAL INFORMATION