diff --git a/.env.sample b/.env.sample index db8c5a02..8a79a217 100644 --- a/.env.sample +++ b/.env.sample @@ -14,10 +14,13 @@ DEPLOYMENT=self ENABLE_UPDATES=true DEBUG=sql,cache,presenters,events -# Third party credentials (required) +# Third party signin credentials (at least one is required) SLACK_KEY=71315967491.XXXXXXXXXX SLACK_SECRET=d2dc414f9953226bad0a356cXXXXYYYY +GOOGLE_CLIENT_ID= +GOOGLE_CLIENT_SECRET= + # Third party credentials (optional) SLACK_VERIFICATION_TOKEN=PLxk6OlXXXXXVj3YYYY SLACK_APP_ID=A0XXXXXXX diff --git a/.gitignore b/.gitignore index 2885433a..f00129f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ dist node_modules/* .env +.log npm-debug.log stats.json .DS_Store diff --git a/app/components/Auth.js b/app/components/Auth.js index 6a9d3f86..8952f87c 100644 --- a/app/components/Auth.js +++ b/app/components/Auth.js @@ -1,29 +1,39 @@ // @flow import * as React from 'react'; -import { Provider } from 'mobx-react'; +import { Provider, observer, inject } from 'mobx-react'; import stores from 'stores'; +import AuthStore from 'stores/AuthStore'; import ApiKeysStore from 'stores/ApiKeysStore'; import UsersStore from 'stores/UsersStore'; import CollectionsStore from 'stores/CollectionsStore'; import IntegrationsStore from 'stores/IntegrationsStore'; import CacheStore from 'stores/CacheStore'; +import LoadingIndicator from 'components/LoadingIndicator'; type Props = { + auth: AuthStore, children?: React.Node, }; let authenticatedStores; -const Auth = ({ children }: Props) => { - if (stores.auth.authenticated && stores.auth.team && stores.auth.user) { +const Auth = observer(({ auth, children }: Props) => { + if (auth.authenticated) { + const { user, team } = auth; + + if (!team || !user) { + return ; + } + // Only initialize stores once. Kept in global scope because otherwise they // will get overridden on route change if (!authenticatedStores) { // Stores for authenticated user - const { user, team } = stores.auth; const cache = new CacheStore(user.id); authenticatedStores = { - integrations: new IntegrationsStore(), + integrations: new IntegrationsStore({ + ui: stores.ui, + }), apiKeys: new ApiKeysStore(), users: new UsersStore(), collections: new CollectionsStore({ @@ -42,15 +52,14 @@ const Auth = ({ children }: Props) => { }; } - stores.auth.fetch(); authenticatedStores.collections.fetchPage({ limit: 100 }); } return {children}; } - stores.auth.logout(); + auth.logout(); return null; -}; +}); -export default Auth; +export default inject('auth')(Auth); diff --git a/app/components/Input/Input.js b/app/components/Input/Input.js index 05e6cf8f..0e2ed868 100644 --- a/app/components/Input/Input.js +++ b/app/components/Input/Input.js @@ -30,7 +30,9 @@ const RealInput = styled.input` } `; -const Wrapper = styled.div``; +const Wrapper = styled.div` + max-width: ${props => (props.short ? '350px' : '100%')}; +`; export const Outline = styled(Flex)` display: flex; @@ -58,18 +60,20 @@ export type Props = { value?: string, label?: string, className?: string, + short?: boolean, }; export default function Input({ type = 'text', label, className, + short, ...rest }: Props) { const InputComponent = type === 'textarea' ? RealTextarea : RealInput; return ( - +