ZettaKonsult/zetta-workspace

Dynamically generated error messages

開放

#74 建立於 2018年1月11日

 (4 則留言) (0 個反應) (0 位負責人)JavaScript (0 個分叉)auto 404
enhancementhelp wanted

倉庫指標

星標
 (0 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

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

貢獻者指南