ZettaKonsult/zetta-workspace

Dynamically generated error messages

オープン

#74 opened on 2018/01/11

 (4 件のコメント) (0 件のリアクション) (0 人の担当者)JavaScript (0 件のフォーク)auto 404
enhancementhelp wanted

Repository metrics

Stars
 (0 個のスター)
PR merge metrics
 (PR metrics pending)

説明

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

コントリビューターガイド