Uploaded image for project: 'ZABBIX FEATURE REQUESTS'
  1. ZABBIX FEATURE REQUESTS
  2. ZBXNEXT-10004

Allow newlines in trigger functions arguments

XMLWordPrintable

    • Icon: Change Request Change Request
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 6.0.40, 7.0.12, 7.2.6
    • Frontend (F), Server (S)
    • None

      Treating newlines as whitespace between trigger functions arguments will enable multiline formatting.

      Sure, it does not matter for short functions, but crowded functions involving several arguments, macros/macros overloads, being split to multiple lines, become more readable and easier to comprehend at first glance.

      Consider a trigger expression example:

      changecount(/Template ipset/ipset.entries[{#IPSETNAME}],{$IPSET_MISSING:"{#IPSETNAME}"},"all") = 0
      and count(/Template ipset/ipset.entries[{#IPSETNAME}],#1:now-{$IPSET_MISSING:"{#IPSETNAME}"}) > 0
      

      which could then be formatted as:

      changecount(
          /Template ipset/ipset.entries[{#IPSETNAME}],
          {$IPSET_MISSING:"{#IPSETNAME}"},
          "all"
      ) = 0 and count(
          /Template ipset/ipset.entries[{#IPSETNAME}],
          #1:now-{$IPSET_MISSING:"{#IPSETNAME}"}
      ) > 0
      

      Currently, when trying to split arguments with newline, frontend errors with:

      "Invalid parameter "/1/expression": incorrect expression starting from ..."
      

      Newlines in trigger expressions are not a problem by themselves. They are already being kept as-is when editing expressions, and automatically replaced by spaces in frontend tables.

            vmurzins Valdis Murzins
            alix alix
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: