ZettaKonsult/zetta-workspace

Dynamically generated error messages

Aperta

#74 aperta il 11 gen 2018

 (4 commenti) (0 reazioni) (0 assegnatari)JavaScript (0 fork)auto 404
enhancementhelp wanted

Metriche repository

Star
 (0 stelle)
Metriche merge PR
 (Metriche PR in attesa)

Descrizione

Plans right now contain a error field for what error message to print.

However given the information a plan rule contains this should be possible to generate on the fly. This of course puts some trust into the our users will give groups or labels good names that make sense. But the other way around we trust that they write good error messages for their own rules, so think the first approach is slightly better

{ "id": "3", "name": "trfRule", "group": "obligatory", "attribute": "id", "key": "18", "func": "only", "value": "1", "error": "TRF must be part of the subscription" },

given a rule like this a error message could be generated like There can ${func} be ${value} of ${key===id ? fetchPlanName(key) : ${attribute} group

since some of the rules are named stuff like "lessThan" and there needs to be some nifty transforms for these

A good place to implement these would be FrontEnd/src/membership/PlanTemplate.js

Guida contributor