darabos commited on
Commit
2b83b53
·
1 Parent(s): 686fa90

Display tables in alphabetic order.

Browse files
lynxkite-app/web/src/workspace/nodes/NodeWithTableView.tsx CHANGED
@@ -19,45 +19,45 @@ export default function NodeWithTableView(props: any) {
19
  const display = props.data.display?.value;
20
  const single =
21
  display?.dataframes && Object.keys(display?.dataframes).length === 1;
 
 
22
  return (
23
  <LynxKiteNode {...props}>
24
  {display && [
25
- Object.entries(display.dataframes || {}).map(
26
- ([name, df]: [string, any]) => (
27
- <React.Fragment key={name}>
28
- {!single && (
29
- <div
30
- key={`${name}-header`}
31
- className="df-head"
32
- onClick={() => setOpen({ ...open, [name]: !open[name] })}
33
- >
34
- {name}
35
- </div>
36
- )}
37
- {(single || open[name]) &&
38
- (df.data.length > 1 ? (
39
- <Table
40
- key={`${name}-table`}
41
- columns={df.columns}
42
- data={df.data}
43
- />
44
- ) : df.data.length ? (
45
- <dl key={`${name}-dl`}>
46
- {df.columns.map((c: string, i: number) => (
47
- <React.Fragment key={`${name}-${c}`}>
48
- <dt>{c}</dt>
49
- <dd>
50
- <Markdown>{toMD(df.data[0][i])}</Markdown>
51
- </dd>
52
- </React.Fragment>
53
- ))}
54
- </dl>
55
- ) : (
56
- JSON.stringify(df.data)
57
- ))}
58
- </React.Fragment>
59
- ),
60
- ),
61
  Object.entries(display.others || {}).map(([name, o]) => (
62
  <>
63
  <div
 
19
  const display = props.data.display?.value;
20
  const single =
21
  display?.dataframes && Object.keys(display?.dataframes).length === 1;
22
+ const dfs = Object.entries(display.dataframes || {});
23
+ dfs.sort();
24
  return (
25
  <LynxKiteNode {...props}>
26
  {display && [
27
+ dfs.map(([name, df]: [string, any]) => (
28
+ <React.Fragment key={name}>
29
+ {!single && (
30
+ <div
31
+ key={`${name}-header`}
32
+ className="df-head"
33
+ onClick={() => setOpen({ ...open, [name]: !open[name] })}
34
+ >
35
+ {name}
36
+ </div>
37
+ )}
38
+ {(single || open[name]) &&
39
+ (df.data.length > 1 ? (
40
+ <Table
41
+ key={`${name}-table`}
42
+ columns={df.columns}
43
+ data={df.data}
44
+ />
45
+ ) : df.data.length ? (
46
+ <dl key={`${name}-dl`}>
47
+ {df.columns.map((c: string, i: number) => (
48
+ <React.Fragment key={`${name}-${c}`}>
49
+ <dt>{c}</dt>
50
+ <dd>
51
+ <Markdown>{toMD(df.data[0][i])}</Markdown>
52
+ </dd>
53
+ </React.Fragment>
54
+ ))}
55
+ </dl>
56
+ ) : (
57
+ JSON.stringify(df.data)
58
+ ))}
59
+ </React.Fragment>
60
+ )),
 
 
61
  Object.entries(display.others || {}).map(([name, o]) => (
62
  <>
63
  <div