|
@@ -1,5 +1,5 @@
|
|
|
import React from 'react';
|
|
|
-import {browserHistory} from 'react-router';
|
|
|
+import {browserHistory, WithRouterProps} from 'react-router';
|
|
|
import DocumentTitle from 'react-document-title';
|
|
|
|
|
|
import {getUserTimezone, getUtcToLocalDateObject} from 'app/utils/dates';
|
|
@@ -10,6 +10,8 @@ import withOrganization from 'app/utils/withOrganization';
|
|
|
import Feature from 'app/components/acl/feature';
|
|
|
import Alert from 'app/components/alert';
|
|
|
import {GlobalSelection, Organization} from 'app/types';
|
|
|
+import {getDiscoverLandingUrl} from 'app/utils/discover/urls';
|
|
|
+import Redirect from 'app/utils/redirect';
|
|
|
|
|
|
import Discover from './discover';
|
|
|
import createQueryBuilder from './queryBuilder';
|
|
@@ -22,14 +24,12 @@ import {
|
|
|
import {DiscoverWrapper} from './styles';
|
|
|
import {SavedQuery} from './types';
|
|
|
|
|
|
-const AlertAsAny: any = Alert;
|
|
|
-
|
|
|
type Props = {
|
|
|
organization: Organization;
|
|
|
selection: GlobalSelection;
|
|
|
params: any;
|
|
|
location: any;
|
|
|
-};
|
|
|
+} & Pick<WithRouterProps, 'router'>;
|
|
|
|
|
|
type State = {
|
|
|
isLoading: boolean;
|
|
@@ -204,11 +204,18 @@ class DiscoverContainer extends React.Component<Props, State> {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
- renderNoAccess() {
|
|
|
- return (
|
|
|
- <AlertAsAny type="warning">{t("You don't have access to this feature")}</AlertAsAny>
|
|
|
- );
|
|
|
- }
|
|
|
+ renderNoAccess = () => {
|
|
|
+ const {router, organization} = this.props;
|
|
|
+
|
|
|
+ if (
|
|
|
+ organization.features.includes('discover-query') ||
|
|
|
+ organization.features.includes('discover-basic')
|
|
|
+ ) {
|
|
|
+ return <Redirect router={router} to={getDiscoverLandingUrl(organization)} />;
|
|
|
+ } else {
|
|
|
+ return <Alert type="warning">{t("You don't have access to this feature")}</Alert>;
|
|
|
+ }
|
|
|
+ };
|
|
|
|
|
|
render() {
|
|
|
const {isLoading, savedQuery, view} = this.state;
|