chore: Remove 'DEPLOYMENT' env option

Add 'Installation' section
This commit is contained in:
Tom Moor 2020-06-19 19:11:02 -07:00
parent 4f7e7ec853
commit 64c3ff8d6b
8 changed files with 91 additions and 24 deletions

View File

@ -17,7 +17,6 @@ PORT=3000
# set to false if your SSL is terminated at a loadbalancer, for example # set to false if your SSL is terminated at a loadbalancer, for example
FORCE_HTTPS=true FORCE_HTTPS=true
DEPLOYMENT=self
ENABLE_UPDATES=true ENABLE_UPDATES=true
WEBSOCKETS_ENABLED=true WEBSOCKETS_ENABLED=true
DEBUG=cache,presenters,events DEBUG=cache,presenters,events

View File

@ -35,11 +35,6 @@
"generator": "secret", "generator": "secret",
"required": true "required": true
}, },
"DEPLOYMENT": {
"description": "Should be 'self' for self hosted installations, turns off things like pricing pages",
"value": "self",
"required": true
},
"ENABLE_UPDATES": { "ENABLE_UPDATES": {
"value": "true", "value": "true",
"required": true "required": true
@ -149,4 +144,4 @@
"required": false "required": false
} }
} }
} }

View File

@ -26,6 +26,7 @@ import Section from './components/Section';
import Header from './components/Header'; import Header from './components/Header';
import SidebarLink from './components/SidebarLink'; import SidebarLink from './components/SidebarLink';
import HeaderBlock from './components/HeaderBlock'; import HeaderBlock from './components/HeaderBlock';
import Version from './components/Version';
import PoliciesStore from 'stores/PoliciesStore'; import PoliciesStore from 'stores/PoliciesStore';
import AuthStore from 'stores/AuthStore'; import AuthStore from 'stores/AuthStore';
@ -67,17 +68,17 @@ class SettingsSidebar extends React.Component<Props> {
<Header>Account</Header> <Header>Account</Header>
<SidebarLink <SidebarLink
to="/settings" to="/settings"
icon={<ProfileIcon />} icon={<ProfileIcon color="currentColor" />}
label="Profile" label="Profile"
/> />
<SidebarLink <SidebarLink
to="/settings/notifications" to="/settings/notifications"
icon={<EmailIcon />} icon={<EmailIcon color="currentColor" />}
label="Notifications" label="Notifications"
/> />
<SidebarLink <SidebarLink
to="/settings/tokens" to="/settings/tokens"
icon={<CodeIcon />} icon={<CodeIcon color="currentColor" />}
label="API Tokens" label="API Tokens"
/> />
</Section> </Section>
@ -86,45 +87,45 @@ class SettingsSidebar extends React.Component<Props> {
{can.update && ( {can.update && (
<SidebarLink <SidebarLink
to="/settings/details" to="/settings/details"
icon={<TeamIcon />} icon={<TeamIcon color="currentColor" />}
label="Details" label="Details"
/> />
)} )}
{can.update && ( {can.update && (
<SidebarLink <SidebarLink
to="/settings/security" to="/settings/security"
icon={<PadlockIcon />} icon={<PadlockIcon color="currentColor" />}
label="Security" label="Security"
/> />
)} )}
<SidebarLink <SidebarLink
to="/settings/people" to="/settings/people"
icon={<UserIcon />} icon={<UserIcon color="currentColor" />}
exact={false} exact={false}
label="People" label="People"
/> />
<SidebarLink <SidebarLink
to="/settings/groups" to="/settings/groups"
icon={<GroupIcon />} icon={<GroupIcon color="currentColor" />}
exact={false} exact={false}
label="Groups" label="Groups"
/> />
<SidebarLink <SidebarLink
to="/settings/shares" to="/settings/shares"
icon={<LinkIcon />} icon={<LinkIcon color="currentColor" />}
label="Share Links" label="Share Links"
/> />
{can.auditLog && ( {can.auditLog && (
<SidebarLink <SidebarLink
to="/settings/events" to="/settings/events"
icon={<BulletedListIcon />} icon={<BulletedListIcon color="currentColor" />}
label="Audit Log" label="Audit Log"
/> />
)} )}
{can.export && ( {can.export && (
<SidebarLink <SidebarLink
to="/settings/export" to="/settings/export"
icon={<DocumentIcon />} icon={<DocumentIcon color="currentColor" />}
label="Export Data" label="Export Data"
/> />
)} )}
@ -134,16 +135,23 @@ class SettingsSidebar extends React.Component<Props> {
<Header>Integrations</Header> <Header>Integrations</Header>
<SidebarLink <SidebarLink
to="/settings/integrations/slack" to="/settings/integrations/slack"
icon={<SlackIcon />} icon={<SlackIcon color="currentColor" />}
label="Slack" label="Slack"
/> />
<SidebarLink <SidebarLink
to="/settings/integrations/zapier" to="/settings/integrations/zapier"
icon={<ZapierIcon />} icon={<ZapierIcon color="currentColor" />}
label="Zapier" label="Zapier"
/> />
</Section> </Section>
)} )}
{can.update &&
process.env.DEPLOYMENT !== 'hosted' && (
<Section>
<Header>Installation</Header>
<Version />
</Section>
)}
</Scrollable> </Scrollable>
</Flex> </Flex>
</Sidebar> </Sidebar>

View File

@ -9,6 +9,7 @@ import Flex from 'shared/components/Flex';
type Props = { type Props = {
to?: string | Object, to?: string | Object,
href?: string | Object,
onClick?: (SyntheticEvent<>) => void, onClick?: (SyntheticEvent<>) => void,
children?: React.Node, children?: React.Node,
icon?: React.Node, icon?: React.Node,
@ -63,6 +64,7 @@ class SidebarLink extends React.Component<Props> {
menuOpen, menuOpen,
hideDisclosure, hideDisclosure,
exact, exact,
href,
} = this.props; } = this.props;
const showDisclosure = !!children && !hideDisclosure; const showDisclosure = !!children && !hideDisclosure;
const activeStyle = { const activeStyle = {
@ -80,7 +82,8 @@ class SidebarLink extends React.Component<Props> {
onClick={onClick} onClick={onClick}
exact={exact !== false} exact={exact !== false}
to={to} to={to}
as={to ? undefined : 'div'} as={to ? undefined : href ? 'a' : 'div'}
href={href}
> >
{icon && <IconWrapper>{icon}</IconWrapper>} {icon && <IconWrapper>{icon}</IconWrapper>}
<Label onClick={this.handleExpand}> <Label onClick={this.handleExpand}>

View File

@ -0,0 +1,53 @@
// @flow
import * as React from 'react';
import styled from 'styled-components';
import Badge from 'components/Badge';
import SidebarLink from './SidebarLink';
import { version } from '../../../../package.json';
export default function Version() {
// $FlowFixMe
const [releasesBehind, setReleasesBehind] = React.useState(0);
// $FlowFixMe
React.useEffect(() => {
async function loadReleases() {
let out = 0;
const res = await fetch(
'https://api.github.com/repos/outline/outline/releases'
);
const releases = await res.json();
for (const release of releases) {
if (release.tag_name === `v${version}`) {
return setReleasesBehind(out);
} else {
out++;
}
}
}
loadReleases();
}, []);
return (
<SidebarLink
href="https://github.com/outline/outline/releases"
label={
<React.Fragment>
v{version}
<br />
<LilBadge>
{releasesBehind === 0
? 'Up to date'
: `${releasesBehind} version${
releasesBehind === 1 ? '' : 's'
} behind`}
</LilBadge>
</React.Fragment>
}
/>
);
}
const LilBadge = styled(Badge)`
margin-left: 0;
`;

View File

@ -1,10 +1,14 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
export default function SlackIcon() { type Props = {
color?: string,
};
export default function SlackIcon({ color = '#4E5C6E' }: Props) {
return ( return (
<svg <svg
fill="#4E5C6E" fill={color}
width="24px" width="24px"
height="24px" height="24px"
viewBox="0 0 24 24" viewBox="0 0 24 24"

View File

@ -1,10 +1,14 @@
// @flow // @flow
import * as React from 'react'; import * as React from 'react';
export default function ZapierIcon() { type Props = {
color?: string,
};
export default function ZapierIcon({ color = '#4E5C6E' }: Props) {
return ( return (
<svg <svg
fill="#4E5C6E" fill={color}
width="24px" width="24px"
height="24px" height="24px"
viewBox="0 0 24 24" viewBox="0 0 24 24"

View File

@ -149,6 +149,7 @@ app.use(
"'self'", "'self'",
process.env.AWS_S3_UPLOAD_BUCKET_URL.replace('s3:', 'localhost:'), process.env.AWS_S3_UPLOAD_BUCKET_URL.replace('s3:', 'localhost:'),
'www.google-analytics.com', 'www.google-analytics.com',
'api.github.com',
'sentry.io', 'sentry.io',
]), ]),
}, },