Components Dashboard now shows all hocs

Previously, the hocs registered with options (ex: registerComponent('Foo', FooComponent, [withBar,barOptions])   ) were not shown in the dashboard from the debug package.
This commit is contained in:
Apollinaire 2018-03-06 12:32:51 +01:00
parent 926f155655
commit 936f98d359

View file

@ -1,10 +1,21 @@
import React from 'react';
import { registerComponent, Components, ComponentsTable } from 'meteor/vulcan:lib';
import React from "react";
import {
registerComponent,
Components,
ComponentsTable
} from "meteor/vulcan:lib";
const ComponentHOCs = ({ document }) =>
<div><ul>{document.hocs.map((hoc, i) => <li key={i}>{hoc.name}</li>)}</ul></div>
const ComponentHOCs = ({ document }) => (
<div>
<ul>
{document.hocs.map((hoc, i) => (
<li key={i}>{typeof hoc.name === "string" ? hoc.name : hoc[0].name}</li>
))}
</ul>
</div>
);
const ComponentsDashboard = props =>
const ComponentsDashboard = props => (
<div className="components">
<Components.Datatable
showSearch={false}
@ -12,13 +23,14 @@ const ComponentsDashboard = props =>
showEdit={false}
data={Object.values(ComponentsTable)}
columns={[
'name',
"name",
{
name: 'hocs',
name: "hocs",
component: ComponentHOCs
},
}
]}
/>
</div>
);
registerComponent('Components', ComponentsDashboard);
registerComponent("Components", ComponentsDashboard);