-
Notifications
You must be signed in to change notification settings - Fork 713
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Table type should be more flexible #301
Comments
This ticket is rightly motivated by how we currently abuse To sort this out and to allow other hierarchical representations such as Processes by host or Processes by container which I plan to add in the near future I propose adding support for nested tables by:
Using the example image above, when embedding the connections as a subtable, the JSON representation of the Connections would change from: {
"title": "Connections",
"numeric": false,
"rows": [
{
"key": "TCP connections",
"value_major": "2"
},
{
"key": "Client",
"value_major": "Server",
"expandable": true
},
{
"key": "127.0.0.1:59680",
"value_major": "127.0.0.1:4040",
"expandable": true
},
{
"key": "127.0.0.1:59680",
"value_major": "127.0.0.1:4040",
"expandable": true
}
]
} {
"heading": {
"key": "Connections",
"value_major": ""
},
"numeric": false,
"rows": [
{
"type": "row",
"key": "TCP connections",
"value_major": "2"
},
{
"type": "table",
"heading": {
"key": "Client",
"value_major": "Server",
"expandable": true
},
"rows": [
{
"type": "row",
"key": "127.0.0.1:3445",
"value_major": "127.0.0.1:80",
"expandable": true
},
{
"type": "row",
"key": "127.0.0.1:5647",
"value_major": "127.0.0.1:560",
"expandable": true
}
]
}
]
} There is no equivalent of nested table in Google's Material Design so I am unsure on how to represent this graphically but I would propose indenting subtables to the right. @tomwilkie @peterbourgon @davkal Please provide feedback (or a go ahead ) before I get down to coding it. |
I might be commenting from ignorance, but I thought the idea was to eschew the JSON intermediate form altogether, and serve prerendered HTML directly to the UI? (Can discuss more in person...) |
Fons and I discussed that approach - why did you favour this way, Fons? On Tuesday, 25 August 2015, Peter Bourgon [email protected] wrote:
|
I remember having a conversation where we agreed to not go generic and implement renderers for all kinds of data, e.g. a connectionRenderer would render something like If we wanna go generic, we could implement a couple of abstract render types, like tables, lists, labels, tags. In Cello we solved the nested data issue, by rendering the nested data differently, see how a "table" if return code counts is nested here: |
re HTML: I was trying to leave the presentation to the client. If I understood it correctly, the reason behind forwarding HTML was to free up @davkal from adapting the client since he is overly busy nowadays. However, the change I am proposing doesn't seem too complicated to implement in the client. If it is, ( @davkal please raise your voice on this) I will reluctantly cave in and output HTML instead :) @davkal Regarding the idea of independent renderers. Can you elaborate? Are you referring to renderers on the client/on the server? How would the data transferred from the server to the client look like? |
It's less about this specific change, more about the fact this is likely just the beginning of many iterations on the details pane... |
@2opremio I would strongly advise against sending HTML, it would be working around the react framework, plus if you construct HTML in the backend, you might as well just do it in the frontend right away. Re Independent renderers: They would be react components, eg <Connection source={source} target={target} /> Which just need an input object like {
"type": "connection",
"source": "1.2.3.4",
"target": "5.6.7.8"
} It's up to the component to implement a render function, which could be as simple as outputting:
The data object for the whole details pane would then be a hierarchical json object. Each layer of the hierarchy would have a |
@davkal Then we wouldn't (yet) need subtables/headings but still we need heterogeneous rows. Just to be 100% clear is this the change which you would expect? From: {
"title": "Connections",
"numeric": false,
"rows": [
{
"key": "TCP connections",
"value_major": "2"
},
{
"key": "Client",
"value_major": "Server",
"expandable": true
},
{
"key": "127.0.0.1:59680",
"value_major": "127.0.0.1:4040",
"expandable": true
},
{
"key": "127.0.0.1:59680",
"value_major": "127.0.0.1:4040",
"expandable": true
}
]
} To: {
"type": "table",
"title": "Connections",
"numeric": false,
"rows": [
{
"type": "row",
"key": "TCP connections",
"value_major": "2"
},
{
"type": "connection",
"source": "127.0.0.1:59680",
"destination": "127.0.0.1:4040"
},
{
"type": "connection",
"source": "127.0.0.1:59680",
"destination": "127.0.0.1:4040"
}
]
} On the Go side this can be done by changing: type Table struct {
Title string `json:"title"` // e.g. Bandwidth
Numeric bool `json:"numeric"` // should the major column be right-aligned?
Rank int `json:"-"` // used to sort tables; not emitted.
Rows []Row `json:"rows"`
} To: type Marshable interface {
func Marshal(v interface{}) ([]byte, error)
}
type Table struct {
Title string `json:"title"` // e.g. Bandwidth
Numeric bool `json:"numeric"` // should the major column be right-aligned?
Rank int `json:"-"` // used to sort tables; not emitted.
Rows []Marshable `json:"rows"`
}
type Connection struct {
Source string `json:"source"`
Destination string `json:"destination"`
} |
@2opremio It still needs to be hierachical, as in {
"type": "table",
"title": "Connections",
"numeric": false,
"rows": [
{
"type": "row",
"key": "TCP connections",
"value_major": "2",
"details": [
{
"type": "connections",
"connections": [
{
"type": "connection",
"source": "127.0.0.1:59680",
"destination": "127.0.0.1:4040"
},
{
"type": "connection",
"source": "127.0.0.1:59680",
"destination": "127.0.0.1:4040"
}
]
}
]
}
]
} The renderer then determines how each thing is rendered, e.g. What do you think? |
@davkal I like the collapsible-details concept but not so much having them in a row and them having a {
"type": "table",
"title": "Connections",
"numeric": false,
"rows": [
{
"type": "row",
"key": "TCP connections",
"value_major": "2"
}
],
"details": [
{
"type": "connection",
"source": "127.0.0.1:59680",
"destination": "127.0.0.1:4040"
},
{
"type": "connection",
"source": "127.0.0.1:59680",
"destination": "127.0.0.1:4040"
}
]
} |
@2opremio the main point I wanted to make was that of ownership. Who owns those connection details? I would argue it's the row, because it's a generic table. We dont know what details other rows might have. |
@davkal OK, I see what you mean. But what you are suggesting implies that the details always belong to a particular row and I am not sure that will always be the case. In fact:
|
@2opremio I want this to be compose-able, nothing should always belong to something.
If we need adjust where the details reside, so be it, and then that new entity will own the details. The UI code change will then be minimal because I just use the same renderer in the new component.
I dont know yet, but I want the flexibility to try out both variants. |
@davkal Makes sense. Will take this up in the coming days following what we have agreed on. |
As discussed, Paul is going to working on this kinda issue next. |
Right now the Table has a fixed and generic "schema" which isn't totally appropriate for everything we want to show in the details pane. Let's figure out a way to have different types of Tables for different types of information. Motivated by #298.
The text was updated successfully, but these errors were encountered: