Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
adapt nova:debug to Apollo version + link to docs
Browse files Browse the repository at this point in the history
  • Loading branch information
xavxyz committed Feb 10, 2017
1 parent c33ebd5 commit 109ebcc
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 47 deletions.
13 changes: 0 additions & 13 deletions packages/nova-debug/lib/components/Cheatsheet.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import Comments from "meteor/nova:comments";
import Users from 'meteor/nova:users';
import { Callbacks, Utils, registerComponent } from 'meteor/nova:core';

const methodList = Meteor.isServer ? Meteor.server.method_handlers : Meteor.connection._methodHandlers;

const renderFunction = (func, name) => {
const s = func.toString();
Expand Down Expand Up @@ -48,10 +47,6 @@ const Cheatsheet = props => {
<ul>
{_.map(Users.is, renderFunction)}
</ul>
<h3>Methods</h3>
<ul>
{_.map(methodList, (item, key) => (key.indexOf("users.") !== -1 ? renderFunction(item, key) : null))}
</ul>
</div>

<div className="cheatsheet-block">
Expand All @@ -60,10 +55,6 @@ const Cheatsheet = props => {
<ul>
{_.map(Posts, (item, key) => (key[0] !== "_" ? renderFunction(item, key) : null) )}
</ul>
<h3>Methods</h3>
<ul>
{_.map(methodList, (item, key) => (key.indexOf("posts.") !== -1 ? renderFunction(item, key) : null))}
</ul>
</div>

<div className="cheatsheet-block">
Expand All @@ -72,10 +63,6 @@ const Cheatsheet = props => {
<ul>
{_.map(Comments, (item, key) => (key[0] !== "_" ? renderFunction(item, key) : null) )}
</ul>
<h3>Methods</h3>
<ul>
{_.map(methodList, (item, key) => (key.indexOf("comments.") !== -1 ? renderFunction(item, key) : null))}
</ul>
</div>

<div className="cheatsheet-block">
Expand Down
2 changes: 1 addition & 1 deletion packages/nova-debug/lib/components/Groups.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const Group = ({name, actions}) => {
return (
<tr>
<td>{name}</td>
<td><ul>{actions.map(action => <li><code>{action}</code></li>)}</ul></td>
<td><ul>{actions.map((action, index) => <li key={index}><code>{action}</code></li>)}</ul></td>
</tr>
)
}
Expand Down
68 changes: 35 additions & 33 deletions packages/nova-debug/lib/components/Settings.jsx
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
import React from 'react';
import { getSetting, registerComponent } from 'meteor/nova:core';
import { FormattedMessage } from 'react-intl';
import { getSetting, registerComponent, Components } from 'meteor/nova:core';

const renderSetting = (field, key) => {
return (
<tr key={key}>
<td><code>{key}</code></td>
<td>{field.type && field.type.name}</td>
<td>{field.private ? <span className="private">private</span> : getSetting(key)}</td>
<td>{field.defaultValue && field.defaultValue.toString()}</td>
<td>{field.form && field.form.instructions}</td>
</tr>
)
}
const renderSetting = key => (
<tr key={key}>
<td><code>{key}</code></td>
<td>{JSON.stringify(getSetting(key))}</td>
</tr>
);

const Settings = props => {

const publicSettings = Meteor.settings.public;

return (
<div className="settings">
<h1>Settings</h1>

<div className="settings-wrapper">
<Components.ShowIf check={user => user && user.isAdmin} failureComponent={<FormattedMessage id="app.noPermission" />}>
<div className="settings">

<h1>Public settings</h1>

<div>To access your private settings, have a look at your <code>settings.json</code> file.</div>

<div>More info about settings <a href="http://nova-docs.telescopeapp.org/settings.html">in the docs</a></div>

<div className="settings-wrapper">

<table className="table">
<thead>
<tr>
<td>Name</td>
<td>Type</td>
<td>Value</td>
<td>Default</td>
<td>Description</td>
</tr>
</thead>
<tbody>
{_.map(_.omit(Meteor.settings, (value, key) => key.indexOf("$") >= 0), renderSetting)}
</tbody>
</table>
<table className="table">
<thead>
<tr>
<td>Name</td>
<td>Value</td>
</tr>
</thead>
<tbody>
{Object.keys(publicSettings).filter(key => !Array.isArray(publicSettings[key])).map(renderSetting)}
</tbody>
</table>

</div>
</div>

</div>
)
</Components.ShowIf>
);
}

registerComponent('Settings', Settings);

0 comments on commit 109ebcc

Please sign in to comment.