2016-04-04 14:39:08 +09:00
|
|
|
import React from 'react';
|
2017-06-01 11:42:30 +09:00
|
|
|
import { FormattedMessage } from 'meteor/vulcan:i18n';
|
2017-03-23 16:27:59 +09:00
|
|
|
import { getSetting, registerComponent, Components } from 'meteor/vulcan:core';
|
2016-04-04 14:39:08 +09:00
|
|
|
|
2017-02-10 10:41:08 +01:00
|
|
|
const renderSetting = key => (
|
|
|
|
<tr key={key}>
|
|
|
|
<td><code>{key}</code></td>
|
|
|
|
<td>{JSON.stringify(getSetting(key))}</td>
|
|
|
|
</tr>
|
|
|
|
);
|
2016-04-04 14:39:08 +09:00
|
|
|
|
|
|
|
const Settings = props => {
|
2017-02-10 10:41:08 +01:00
|
|
|
|
|
|
|
const publicSettings = Meteor.settings.public;
|
|
|
|
|
2016-04-04 14:39:08 +09:00
|
|
|
return (
|
2017-02-10 10:41:08 +01:00
|
|
|
<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>
|
|
|
|
|
2017-03-24 10:35:19 +09:00
|
|
|
<div>More info about settings <a href="http://docs.vulcanjs.org/settings.html">in the docs</a></div>
|
2017-02-10 10:41:08 +01:00
|
|
|
|
|
|
|
<div className="settings-wrapper">
|
2016-04-04 14:39:08 +09:00
|
|
|
|
2017-02-10 10:41:08 +01:00
|
|
|
<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>
|
2016-04-04 14:39:08 +09:00
|
|
|
|
2017-02-10 10:41:08 +01:00
|
|
|
</div>
|
2016-04-04 14:39:08 +09:00
|
|
|
</div>
|
2017-02-10 10:41:08 +01:00
|
|
|
</Components.ShowIf>
|
|
|
|
);
|
2016-04-04 14:39:08 +09:00
|
|
|
}
|
|
|
|
|
2017-01-18 12:51:10 +01:00
|
|
|
registerComponent('Settings', Settings);
|