Fixed integers fields in alert rules to be string (#9496)

DO NOT DELETE THIS TEXT

#### Please note

> Please read this information carefully. You can run `./scripts/pre-commit.php` to check your code before submitting.

- [x] Have you followed our [code guidelines?](http://docs.librenms.org/Developing/Code-Guidelines/)

#### Testers

If you would like to test this pull request then please run: `./scripts/github-apply <pr_id>`, i.e `./scripts/github-apply 5926`
After you are done testing, you can remove the changes with `./scripts/github-remove`.  If there are schema changes, you can ask on discord how to revert.
This commit is contained in:
TheGreatDoc
2018-12-05 13:13:46 +01:00
committed by Neil Lathwood
parent a0d7666b90
commit eeac7060c5
2 changed files with 3 additions and 2 deletions

View File

@@ -144,7 +144,8 @@ class QueryBuilderFilter implements \JsonSerializable
if (starts_with($type, ['varchar', 'text', 'double', 'float'])) {
return 'string';
} elseif (starts_with($type, ['int', 'tinyint', 'smallint', 'mediumint', 'bigint'])) {
return 'integer';
//TODO implement field selection and change back to integer
return 'string';
} elseif (starts_with($type, ['timestamp', 'datetime'])) {
return 'datetime';
} elseif (starts_with($type, 'enum')) {

View File

@@ -109,7 +109,7 @@
],
[
"%ports.ifOutErrors_rate >= \"100\" || %ports.ifInErrors_rate >= \"100\"",
{"condition":"OR","rules":[{"id":"ports.ifOutErrors_rate","field":"ports.ifOutErrors_rate","type":"integer","input":"text","operator":"greater_or_equal","value":"100"},{"id":"ports.ifInErrors_rate","field":"ports.ifInErrors_rate","type":"integer","input":"text","operator":"greater_or_equal","value":"100"}],"valid":true},
{"condition":"OR","rules":[{"id":"ports.ifOutErrors_rate","field":"ports.ifOutErrors_rate","type":"string","input":"text","operator":"greater_or_equal","value":"100"},{"id":"ports.ifInErrors_rate","field":"ports.ifInErrors_rate","type":"string","input":"text","operator":"greater_or_equal","value":"100"}],"valid":true},
"ports.ifOutErrors_rate >= 100 OR ports.ifInErrors_rate >= 100",
"SELECT * FROM devices,ports WHERE (devices.device_id = ? AND devices.device_id = ports.device_id) AND (ports.ifOutErrors_rate >= 100 OR ports.ifInErrors_rate >= 100)"
]