Browse Source

Flip to isSelfHosted on the frontend (#31065)

Chad Whitacre 3 years ago
parent
commit
5100b1463b

+ 2 - 0
src/sentry_plugins/sessionstack/plugin.py

@@ -123,6 +123,8 @@ class SessionStackPlugin(CorePluginMixin, Plugin2):
         ]
 
         if is_self_hosted():
+            # We only support connecting to an on-premises SessionStack from a
+            # self-hosted Sentry: https://docs.sessionstack.com/docs/sentry.
             configurations.extend(
                 [
                     {

+ 2 - 2
static/app/components/footer.tsx

@@ -18,7 +18,7 @@ function BaseFooter({className}: Props) {
   return (
     <footer className={className}>
       <LeftLinks>
-        {config.isOnPremise && (
+        {config.isSelfHosted && (
           <Fragment>
             {'Sentry '}
             {getDynamicText({
@@ -47,7 +47,7 @@ function BaseFooter({className}: Props) {
         <FooterLink href="https://github.com/getsentry/sentry">
           {t('Contribute')}
         </FooterLink>
-        {config.isOnPremise && !config.demoMode && (
+        {config.isSelfHosted && !config.demoMode && (
           <FooterLink href="/out/">{t('Migrate to SaaS')}</FooterLink>
         )}
       </RightLinks>

+ 4 - 0
static/app/plugins/sessionstack/components/settings.tsx

@@ -7,6 +7,10 @@ import DefaultSettings from 'sentry/plugins/components/settings';
 type Props = DefaultSettings['props'];
 
 type State = DefaultSettings['state'] & {
+  // NB: "On-premises" here refers to on-premises SessionStack, not Sentry.
+  // That said, we only support connecting to an on-premises SessionStack from
+  // a self-hosted Sentry: https://docs.sessionstack.com/docs/sentry.
+
   showOnPremisesConfiguration?: boolean;
 };
 

+ 2 - 0
static/app/types/system.tsx

@@ -121,7 +121,9 @@ export interface Config {
   invitesEnabled: boolean;
   privacyUrl: string | null;
   termsUrl: string | null;
+  // Maintain isOnPremise key for backcompat (plugins?).
   isOnPremise: boolean;
+  isSelfHosted: boolean;
   lastOrganization: string | null;
   gravatarBaseUrl: string;
 

+ 1 - 1
static/app/views/alerts/issueRuleEditor/setupAlertIntegrationButton.tsx

@@ -55,7 +55,7 @@ export default class SetupAlertIntegrationButton extends AsyncComponent<Props, S
     const config = ConfigStore.getConfig();
     // link to docs to set up Slack for on-prem folks
     const referrerQuery = '?referrer=issue-alert-builder';
-    const buttonProps = config.isOnPremise
+    const buttonProps = config.isSelfHosted
       ? {
           href: `https://develop.sentry.dev/integrations/slack/${referrerQuery}`,
         }

+ 6 - 6
static/app/views/settings/settingsIndex.tsx

@@ -67,17 +67,17 @@ class SettingsIndex extends React.Component<Props> {
   render() {
     const {organization} = this.props;
     const user = ConfigStore.get('user');
-    const isOnPremise = ConfigStore.get('isOnPremise');
+    const isSelfHosted = ConfigStore.get('isSelfHosted');
 
     const organizationSettingsUrl =
       (organization && `/settings/${organization.slug}/`) || '';
 
     const supportLinkProps = {
-      isOnPremise,
+      isSelfHosted,
       href: LINKS.FORUM,
       to: `${organizationSettingsUrl}support`,
     };
-    const supportText = isOnPremise ? t('Community Forums') : t('Contact Support');
+    const supportText = isSelfHosted ? t('Community Forums') : t('Contact Support');
 
     return (
       <SentryDocumentTitle
@@ -340,7 +340,7 @@ const ExternalHomeLink = styled(
 `;
 
 type SupportLinkProps<T extends boolean> = {
-  isOnPremise: T;
+  isSelfHosted: T;
   href: string;
   to: string;
   isCentered?: boolean;
@@ -350,12 +350,12 @@ type SupportLinkProps<T extends boolean> = {
 
 const SupportLinkComponent = <T extends boolean>({
   isCentered,
-  isOnPremise,
+  isSelfHosted,
   href,
   to,
   ...props
 }: SupportLinkProps<T>) =>
-  isOnPremise ? (
+  isSelfHosted ? (
     <ExternalHomeLink isCentered={isCentered} href={href} {...props} />
   ) : (
     <HomeLink to={to} {...props} />

+ 2 - 0
tests/fixtures/js-stubs/config.js

@@ -15,7 +15,9 @@ export function Config(params = {}) {
     invitesEnabled: false,
     privacyUrl: null,
     termsUrl: null,
+    // Maintain isOnPremise key for backcompat (plugins?).
     isOnPremise: false,
+    isSelfHosted: false,
     lastOrganization: null,
     gravatarBaseUrl: 'https://gravatar.com',
     dsn: 'test-dsn',

+ 2 - 2
tests/js/spec/views/settings/settingsIndex.spec.jsx

@@ -26,7 +26,7 @@ describe('SettingsIndex', function () {
   });
 
   it('has different links for on premise users', function () {
-    ConfigStore.set('isOnPremise', true);
+    ConfigStore.set('isSelfHosted', true);
 
     wrapper = mountWithTheme(
       <SettingsIndex
@@ -62,7 +62,7 @@ describe('SettingsIndex', function () {
       api = MockApiClient.addMockResponse({
         url: `/organizations/${organization.slug}/`,
       });
-      ConfigStore.config.isOnPremise = false;
+      ConfigStore.config.isSelfHosted = false;
       wrapper = mountWithTheme(
         <SettingsIndex router={TestStubs.router()} params={{}} />,
         TestStubs.routerContext()