On Fri, Mar 19, 2021 at 08:35:51AM +0800, Wu Fengguang wrote:
On Wed, Mar 17, 2021 at 05:01:53PM +0800, Lu Weitao wrote:
[Example] curl -X GET 'localhost:30000/get_job_error?group_id=wcl_ansible-openeuler-03-10' return: { "filter":{"group_id":"wcl_ansible-openeuler-03-10"},
That's good to have.
:)
"table_fields":["job_id","error_id","error_message","link to result"], "data_table":[
That 2 fields look plain mapping to table header and data lines. However may not be flexible enough for scripts (javascript, ruby clients) to handle.
Imagine the client script need embed the link into another field, what should it do? Hard code this?
data_line[3]
A better data exchange model could be
attributes: [job_id, error_id, error_message, link_to_result]
ok
objects: - { job_id: crystal.1354921, error_id: ..., error_message: ..., link_to_result: ... } - { job_id: crystal.1354929, error_id: ..., error_message: ..., link_to_result: ... }
ok
It could be a bit more bloated, however allows the client to use
object['link_to_result']
yes
More importantly, backend API in general should focus on passing k/v pairs (data), not table columns (final representation).
got it
It'll allow the client to do more creative logic and evolve over time. For example,
- some k/v pairs can be used as mouse hover tips
- link_to_result could be embed into another data column
got it
Thanks a lot! Weitao