Skip to content

Commit

Permalink
remove mobile app feature flag (#1484)
Browse files Browse the repository at this point in the history
# What this PR does

## Which issue(s) this PR fixes

## Checklist

- [x] Tests updated
- [ ] Documentation added (N/A)
- [x] `CHANGELOG.md` updated
  • Loading branch information
joeyorlando authored Mar 8, 2023
1 parent 2e63a9f commit 7c8722e
Show file tree
Hide file tree
Showing 11 changed files with 38 additions and 73 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Jinja2 based routes ([1319](https://github.com/grafana/oncall/pull/1319))

### Changed

- Remove mobile app feature flag ([1484](https://github.com/grafana/oncall/pull/1484))

### Fixed

- Prohibit creating & updating past overrides ([1474](https://github.com/grafana/oncall/pull/1474))
Expand Down
2 changes: 0 additions & 2 deletions engine/apps/api/tests/test_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
FEATURE_GRAFANA_CLOUD_CONNECTION,
FEATURE_GRAFANA_CLOUD_NOTIFICATIONS,
FEATURE_LIVE_SETTINGS,
FEATURE_MOBILE_APP,
FEATURE_SLACK,
FEATURE_TELEGRAM,
FEATURE_WEB_SCHEDULES,
Expand Down Expand Up @@ -39,7 +38,6 @@ def test_features_view(
("FEATURE_TELEGRAM_INTEGRATION_ENABLED", FEATURE_TELEGRAM),
("FEATURE_LIVE_SETTINGS_ENABLED", FEATURE_LIVE_SETTINGS),
("FEATURE_WEB_SCHEDULES_ENABLED", FEATURE_WEB_SCHEDULES),
("FEATURE_MOBILE_APP_INTEGRATION_ENABLED", FEATURE_MOBILE_APP),
],
)
def test_core_features_switch(
Expand Down
4 changes: 0 additions & 4 deletions engine/apps/api/views/features.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
FEATURE_SLACK = "slack"
FEATURE_TELEGRAM = "telegram"
FEATURE_LIVE_SETTINGS = "live_settings"
FEATURE_MOBILE_APP = "mobile_app"
FEATURE_GRAFANA_CLOUD_NOTIFICATIONS = "grafana_cloud_notifications"
FEATURE_GRAFANA_CLOUD_CONNECTION = "grafana_cloud_connection"
FEATURE_WEB_SCHEDULES = "web_schedules"
Expand All @@ -36,9 +35,6 @@ def _get_enabled_features(self, request):
if settings.FEATURE_TELEGRAM_INTEGRATION_ENABLED:
enabled_features.append(FEATURE_TELEGRAM)

if settings.FEATURE_MOBILE_APP_INTEGRATION_ENABLED:
enabled_features.append(FEATURE_MOBILE_APP)

if settings.IS_OPEN_SOURCE:
# Features below should be enabled only in OSS
enabled_features.append(FEATURE_GRAFANA_CLOUD_CONNECTION)
Expand Down
3 changes: 0 additions & 3 deletions engine/apps/mobile_app/tests/test_fcm_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
@pytest.mark.django_db
def test_fcm_relay_disabled(
settings,
load_mobile_app_urls,
make_organization_and_user_with_plugin_token,
make_user_auth_headers,
make_public_api_token,
Expand All @@ -33,7 +32,6 @@ def test_fcm_relay_disabled(
@pytest.mark.django_db
def test_fcm_relay_post(
settings,
load_mobile_app_urls,
make_organization_and_user_with_plugin_token,
make_user_auth_headers,
make_public_api_token,
Expand All @@ -59,7 +57,6 @@ def test_fcm_relay_post(
@pytest.mark.django_db
def test_fcm_relay_ratelimit(
settings,
load_mobile_app_urls,
make_organization_and_user_with_plugin_token,
make_user_auth_headers,
make_public_api_token,
Expand Down
6 changes: 0 additions & 6 deletions engine/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -755,12 +755,6 @@ def load_slack_urls(settings):
reload_urls(settings)


@pytest.fixture()
def load_mobile_app_urls(settings):
settings.FEATURE_MOBILE_APP_INTEGRATION_ENABLED = True
reload_urls(settings)


@pytest.fixture
def make_region():
def _make_region(**kwargs):
Expand Down
9 changes: 2 additions & 7 deletions engine/engine/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
path("integrations/v1/", include("apps.integrations.urls", namespace="integrations")),
path("twilioapp/", include("apps.twilioapp.urls")),
path("api/v1/", include("apps.public_api.urls", namespace="api-public")),
path("mobile_app/v1/", include("apps.mobile_app.urls", namespace="mobile_app")),
path("api/internal/v1/mobile_app/", include("apps.mobile_app.urls", namespace="mobile_app_tmp")),
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)

if settings.FEATURE_SLACK_INTEGRATION_ENABLED:
Expand All @@ -50,13 +52,6 @@
path("slack/", include("apps.slack.urls")),
]

if settings.FEATURE_MOBILE_APP_INTEGRATION_ENABLED:
urlpatterns += [
path("mobile_app/v1/", include("apps.mobile_app.urls", namespace="mobile_app")),
path("api/internal/v1/mobile_app/", include("apps.mobile_app.urls", namespace="mobile_app_tmp")),
]


if settings.IS_OPEN_SOURCE:
urlpatterns += [
path("api/internal/v1/", include("apps.oss_installation.urls", namespace="oss_installation")),
Expand Down
16 changes: 6 additions & 10 deletions engine/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from random import randrange

from celery.schedules import crontab
from firebase_admin import initialize_app

from common.utils import getenv_boolean, getenv_integer

Expand Down Expand Up @@ -55,7 +56,6 @@
FEATURE_TELEGRAM_INTEGRATION_ENABLED = getenv_boolean("FEATURE_TELEGRAM_INTEGRATION_ENABLED", default=True)
FEATURE_EMAIL_INTEGRATION_ENABLED = getenv_boolean("FEATURE_EMAIL_INTEGRATION_ENABLED", default=True)
FEATURE_SLACK_INTEGRATION_ENABLED = getenv_boolean("FEATURE_SLACK_INTEGRATION_ENABLED", default=True)
FEATURE_MOBILE_APP_INTEGRATION_ENABLED = getenv_boolean("FEATURE_MOBILE_APP_INTEGRATION_ENABLED", default=True)
FEATURE_WEB_SCHEDULES_ENABLED = getenv_boolean("FEATURE_WEB_SCHEDULES_ENABLED", default=False)
FEATURE_MULTIREGION_ENABLED = getenv_boolean("FEATURE_MULTIREGION_ENABLED", default=False)
GRAFANA_CLOUD_ONCALL_HEARTBEAT_ENABLED = getenv_boolean("GRAFANA_CLOUD_ONCALL_HEARTBEAT_ENABLED", default=True)
Expand Down Expand Up @@ -556,16 +556,12 @@ class BrokerTypes:

GRAFANA_API_KEY_NAME = "Grafana OnCall"

EXTRA_MESSAGING_BACKENDS = []
if FEATURE_MOBILE_APP_INTEGRATION_ENABLED:
from firebase_admin import initialize_app

EXTRA_MESSAGING_BACKENDS += [
("apps.mobile_app.backend.MobileAppBackend", 5),
("apps.mobile_app.backend.MobileAppCriticalBackend", 6),
]
EXTRA_MESSAGING_BACKENDS = [
("apps.mobile_app.backend.MobileAppBackend", 5),
("apps.mobile_app.backend.MobileAppCriticalBackend", 6),
]

FIREBASE_APP = initialize_app(options={"projectId": os.environ.get("FCM_PROJECT_ID", None)})
FIREBASE_APP = initialize_app(options={"projectId": os.environ.get("FCM_PROJECT_ID", None)})

FCM_RELAY_ENABLED = getenv_boolean("FCM_RELAY_ENABLED", default=False)
FCM_DJANGO_SETTINGS = {
Expand Down
3 changes: 1 addition & 2 deletions grafana-plugin/src/containers/UserSettings/UserSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { useMediaQuery } from 'react-responsive';

import { Tabs, TabsContent } from 'containers/UserSettings/parts';
import { User as UserType } from 'models/user/user.types';
import { AppFeature } from 'state/features';
import { useStore } from 'state/useStore';
import { isUserActionAllowed, UserActions } from 'utils/authorization';
import { BREAKPOINT_TABS } from 'utils/consts';
Expand Down Expand Up @@ -53,7 +52,7 @@ const UserSettings = observer(({ id, onHide, tab = UserSettingsTab.UserInfo }: U
!isDesktopOrLaptop,
isCurrent && teamStore.currentTeam?.slack_team_identity && !storeUser.slack_user_identity,
isCurrent && !storeUser.telegram_configuration,
isCurrent && store.hasFeature(AppFeature.MobileApp) && isUserActionAllowed(UserActions.UserSettingsWrite),
isCurrent && isUserActionAllowed(UserActions.UserSettingsWrite),
];

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,22 @@ import { Button, Label } from '@grafana/ui';
import cn from 'classnames/bind';

import { UserSettingsTab } from 'containers/UserSettings/UserSettings.types';
import { AppFeature } from 'state/features';
import { useStore } from 'state/useStore';

import styles from './index.module.css';

const cx = cn.bind(styles);

interface SlackConnectorProps {
interface MobileAppConnectorProps {
onTabChange: (tab: UserSettingsTab) => void;
}

const SlackConnector = (props: SlackConnectorProps) => {
const MobileAppConnector = (props: MobileAppConnectorProps) => {
const { onTabChange } = props;

const store = useStore();

const handleClickConfirmMobileAppButton = useCallback(() => {
onTabChange(UserSettingsTab.MobileAppConnection);
}, [onTabChange]);

if (!store.hasFeature(AppFeature.MobileApp)) {
return null;
}

return (
<div className={cx('user-item')}>
<Label>Mobile App:</Label>
Expand All @@ -40,4 +32,4 @@ const SlackConnector = (props: SlackConnectorProps) => {
);
};

export default SlackConnector;
export default MobileAppConnector;
49 changes: 22 additions & 27 deletions grafana-plugin/src/pages/settings/tabs/Cloud/CloudPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import Text from 'components/Text/Text';
import WithConfirm from 'components/WithConfirm/WithConfirm';
import { CrossCircleIcon, HeartIcon } from 'icons';
import { Cloud } from 'models/cloud/cloud.types';
import { AppFeature } from 'state/features';
import { WithStoreProps } from 'state/types';
import { useStore } from 'state/useStore';
import { withMobXProviderContext } from 'state/withStore';
Expand Down Expand Up @@ -309,19 +308,17 @@ const CloudPage = observer((props: CloudPageProps) => {
</VerticalGroup>
)}
</Block>
{store.hasFeature(AppFeature.MobileApp) && (
<Block bordered withBackground className={cx('info-block')}>
<VerticalGroup>
<Text.Title level={4}>
<Icon name="mobile-android" className={cx('block-icon')} size="lg" /> Mobile app push notifications
</Text.Title>
<Text type="secondary">
Connecting to Cloud OnCall enables sending push notifications on mobile devices using the Grafana OnCall
mobile app.
</Text>
</VerticalGroup>
</Block>
)}
<Block bordered withBackground className={cx('info-block')}>
<VerticalGroup>
<Text.Title level={4}>
<Icon name="mobile-android" className={cx('block-icon')} size="lg" /> Mobile app push notifications
</Text.Title>
<Text type="secondary">
Connecting to Cloud OnCall enables sending push notifications on mobile devices using the Grafana OnCall
mobile app.
</Text>
</VerticalGroup>
</Block>
</VerticalGroup>
);

Expand Down Expand Up @@ -370,19 +367,17 @@ const CloudPage = observer((props: CloudPageProps) => {
</Text>
</VerticalGroup>
</Block>
{store.hasFeature(AppFeature.MobileApp) && (
<Block bordered withBackground className={cx('info-block')}>
<VerticalGroup>
<Text.Title level={4}>
<Icon name="mobile-android" className={cx('block-icon')} size="lg" /> Mobile app push notifications
</Text.Title>
<Text type="secondary">
Connecting to Cloud OnCall enables sending push notifications on mobile devices using the Grafana OnCall
mobile app.
</Text>
</VerticalGroup>
</Block>
)}
<Block bordered withBackground className={cx('info-block')}>
<VerticalGroup>
<Text.Title level={4}>
<Icon name="mobile-android" className={cx('block-icon')} size="lg" /> Mobile app push notifications
</Text.Title>
<Text type="secondary">
Connecting to Cloud OnCall enables sending push notifications on mobile devices using the Grafana OnCall
mobile app.
</Text>
</VerticalGroup>
</Block>
</VerticalGroup>
);

Expand Down
1 change: 0 additions & 1 deletion grafana-plugin/src/state/features.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ export enum AppFeature {
Slack = 'slack',
Telegram = 'telegram',
LiveSettings = 'live_settings',
MobileApp = 'mobile_app',
CloudNotifications = 'grafana_cloud_notifications',
CloudConnection = 'grafana_cloud_connection',
WebSchedules = 'web_schedules',
Expand Down

0 comments on commit 7c8722e

Please sign in to comment.