corrections found while writing documentation

This commit is contained in:
rglover 2017-06-05 16:44:35 -05:00
parent 5485eb9260
commit ab22ebc967
17 changed files with 127 additions and 42 deletions

View file

@ -1,14 +1,30 @@
import { Meteor } from 'meteor/meteor';
import { check } from 'meteor/check';
import { ServiceConfiguration } from 'meteor/service-configuration';
import rateLimit from '../../../modules/rate-limit';
Meteor.methods({
'oauth.verifyConfiguration': function oauthVerifyConfiguration(services) {
check(services, Array);
const verifiedServices = [];
services.forEach((service) => {
if (ServiceConfiguration.configurations.findOne({ service })) verifiedServices.push(service);
});
return verifiedServices.sort();
try {
const verifiedServices = [];
services.forEach((service) => {
if (ServiceConfiguration.configurations.findOne({ service })) {
verifiedServices.push(service);
}
});
return verifiedServices.sort();
} catch (exception) {
throw new Meteor.Error('500', exception);
}
},
});
rateLimit({
methods: [
'oauth.verifyConfiguration',
],
limit: 5,
timeRange: 1000,
});

View file

@ -1,6 +1,6 @@
import { Meteor } from 'meteor/meteor';
import { check, Match } from 'meteor/check';
import editProfile from '../../../modules/server/edit-profile';
import editProfile from './edit-profile';
import rateLimit from '../../../modules/rate-limit';
Meteor.methods({

View file

@ -4,7 +4,7 @@ import getPrivateFile from '../../../modules/server/get-private-file';
import parseMarkdown from '../../../modules/parse-markdown';
Meteor.methods({
'utility.getPage': function utilityReadFileAsText(fileName) {
'utility.getPage': function utilityGetPage(fileName) {
check(fileName, String);
return parseMarkdown(getPrivateFile(`pages/${fileName}.md`));
},

View file

@ -1,7 +1,7 @@
import React from 'react';
import PropTypes from 'prop-types';
import './InputHint.scss';
import './InputHint.css';
const InputHint = ({ children }) => (
<div className="InputHint">

View file

@ -0,0 +1,56 @@
import React from 'react';
const Loading = () => (
<div className="Loading">
<svg width="44" height="44" viewBox="0 0 44 44" xmlns="http://www.w3.org/2000/svg" stroke="#4285F4">
<g fill="none" fillRule="evenodd" strokeWidth="2">
<circle cx="22" cy="22" r="1">
<animate
attributeName="r"
begin="0s"
dur="1.8s"
values="1; 20"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.165, 0.84, 0.44, 1"
repeatCount="indefinite"
/>
<animate
attributeName="stroke-opacity"
begin="0s"
dur="1.8s"
values="1; 0"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.3, 0.61, 0.355, 1"
repeatCount="indefinite"
/>
</circle>
<circle cx="22" cy="22" r="1">
<animate
attributeName="r"
begin="-0.9s"
dur="1.8s"
values="1; 20"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.165, 0.84, 0.44, 1"
repeatCount="indefinite"
/>
<animate
attributeName="stroke-opacity"
begin="-0.9s"
dur="1.8s"
values="1; 0"
calcMode="spline"
keyTimes="0; 1"
keySplines="0.3, 0.61, 0.355, 1"
repeatCount="indefinite"
/>
</circle>
</g>
</svg>
</div>
);
export default Loading;

View file

@ -7,6 +7,7 @@ import { Meteor } from 'meteor/meteor';
import { createContainer } from 'meteor/react-meteor-data';
import { Bert } from 'meteor/themeteorchef:bert';
import DocumentsCollection from '../../../api/Documents/Documents';
import Loading from '../../components/Loading/Loading';
import './Documents.scss';
@ -22,7 +23,7 @@ const handleRemove = (documentId) => {
}
};
const Documents = ({ documents, match, history }) => (
const Documents = ({ loading, documents, match, history }) => (!loading ? (
<div className="Documents">
<div className="page-header clearfix">
<h4 className="pull-left">Documents</h4>
@ -63,9 +64,10 @@ const Documents = ({ documents, match, history }) => (
</tbody>
</Table> : <Alert bsStyle="warning">No documents yet!</Alert>}
</div>
);
) : <Loading />);
Documents.propTypes = {
loading: PropTypes.bool.isRequired,
documents: PropTypes.arrayOf(PropTypes.object).isRequired,
match: PropTypes.object.isRequired,
history: PropTypes.object.isRequired,

View file

@ -6,6 +6,7 @@ import { Meteor } from 'meteor/meteor';
import { Bert } from 'meteor/themeteorchef:bert';
import Documents from '../../../api/Documents/Documents';
import NotFound from '../NotFound/NotFound';
import Loading from '../../components/Loading/Loading';
const handleRemove = (documentId, history) => {
if (confirm('Are you sure? This is permanent!')) {
@ -20,7 +21,7 @@ const handleRemove = (documentId, history) => {
}
};
const ViewDocument = ({ doc, match, history }) => (doc ? (
const renderDocument = (doc, match, history) => (doc ? (
<div className="ViewDocument">
<div className="page-header clearfix">
<h4 className="pull-left">{ doc && doc.title }</h4>
@ -37,7 +38,12 @@ const ViewDocument = ({ doc, match, history }) => (doc ? (
</div>
) : <NotFound />);
const ViewDocument = ({ loading, doc, match, history }) => (
!loading ? renderDocument(doc, match, history) : <Loading />
);
ViewDocument.propTypes = {
loading: PropTypes.bool.isRequired,
doc: PropTypes.object.isRequired,
match: PropTypes.object.isRequired,
history: PropTypes.object.isRequired,