CloudWatch: Remove cloud watch flag (#23974)

This commit is contained in:
Andrej Ocenas
2020-04-27 23:53:35 +02:00
committed by GitHub
parent f13f54c84f
commit 843141d9da
5 changed files with 13 additions and 40 deletions

View File

@@ -22,7 +22,6 @@ import {
} from '@grafana/data';
import store from 'app/core/store';
import config from 'app/core/config';
import LogsContainer from './LogsContainer';
import QueryRows from './QueryRows';
import TableContainer from './TableContainer';
@@ -306,10 +305,6 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
const StartPage = datasourceInstance?.components?.ExploreStartPage;
const showStartPage = !queryResponse || queryResponse.state === LoadingState.NotStarted;
// TEMP: Remove for 7.0
const cloudwatchLogsDisabled =
datasourceInstance?.meta?.id === 'cloudwatch' && !config.featureToggles.cloudwatchLogs;
// gets an error without a refID, so non-query-row-related error, like a connection error
const queryErrors = queryResponse.error ? [queryResponse.error] : undefined;
const queryError = getFirstNonQueryRowSpecificError(queryErrors);
@@ -372,7 +367,7 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
{mode === ExploreMode.Metrics && (
<TableContainer width={width} exploreId={exploreId} onClickCell={this.onClickFilterLabel} />
)}
{mode === ExploreMode.Logs && !cloudwatchLogsDisabled && (
{mode === ExploreMode.Logs && (
<LogsContainer
width={width}
exploreId={exploreId}

View File

@@ -8,15 +8,7 @@ import { css } from 'emotion';
import { ExploreId, ExploreItemState } from 'app/types/explore';
import { ToggleButtonGroup, ToggleButton, Tooltip, LegacyForms, SetInterval, Icon, IconButton } from '@grafana/ui';
const { ButtonSelect } = LegacyForms;
import {
RawTimeRange,
TimeZone,
TimeRange,
DataQuery,
ExploreMode,
DataSourceApi,
DataSourceJsonData,
} from '@grafana/data';
import { RawTimeRange, TimeZone, TimeRange, DataQuery, ExploreMode } from '@grafana/data';
import { DataSourcePicker } from 'app/core/components/Select/DataSourcePicker';
import { StoreState } from 'app/types/store';
import {
@@ -41,7 +33,6 @@ import { RunButton } from './RunButton';
import { LiveTailControls } from './useLiveTailControls';
import { getExploreDatasources } from './state/selectors';
import { setDashboardQueriesToUpdateOnLoad } from '../dashboard/state/reducers';
import { config } from '@grafana/runtime';
const getStyles = memoizeOne(() => {
return {
@@ -77,7 +68,6 @@ interface StateProps {
datasourceLoading?: boolean;
containerWidth: number;
datasourceName?: string;
datasourceInstance: DataSourceApi<DataQuery, DataSourceJsonData>;
}
interface DispatchProps {
@@ -188,7 +178,6 @@ export class UnConnectedExploreToolbar extends PureComponent<Props> {
isPaused,
originPanelId,
datasourceLoading,
datasourceInstance,
containerWidth,
} = this.props;
@@ -202,11 +191,7 @@ export class UnConnectedExploreToolbar extends PureComponent<Props> {
const showSmallDataSourcePicker = (splitted ? containerWidth < 700 : containerWidth < 800) || false;
const showSmallTimePicker = splitted || containerWidth < 1210;
// TEMP: Remove for 7.0
const cloudwatchLogsDisabled =
datasourceInstance?.meta?.id === 'cloudwatch' && !config.featureToggles.cloudwatchLogs;
const showModeToggle = supportedModes.length > 1 && !cloudwatchLogsDisabled;
const showModeToggle = supportedModes.length > 1;
return (
<div className={splitted ? 'explore-toolbar splitted' : 'explore-toolbar'}>
@@ -395,7 +380,6 @@ const mapStateToProps = (state: StoreState, { exploreId }: OwnProps): StateProps
return {
datasourceMissing,
datasourceName: datasourceInstance?.name,
datasourceInstance,
loading,
range,
timeZone: getTimeZone(state.user),

View File

@@ -6,7 +6,6 @@ import { CloudWatchDatasource } from '../datasource';
import { QueryInlineField } from './';
import { MetricsQueryEditor } from './MetricsQueryEditor';
import LogsQueryEditor from './LogsQueryEditor';
import { config } from '@grafana/runtime';
export type Props = ExploreQueryFieldProps<CloudWatchDatasource, CloudWatchQuery>;
@@ -25,22 +24,19 @@ export class PanelQueryEditor extends PureComponent<Props, State> {
render() {
const { queryMode } = this.state;
const cloudwatchLogsDisabled = !config.featureToggles.cloudwatchLogs;
return (
<>
{!cloudwatchLogsDisabled && (
<QueryInlineField label="Query Mode">
<Segment
value={queryMode}
options={[
{ label: 'Metrics', value: ExploreMode.Metrics },
{ label: 'Logs', value: ExploreMode.Logs },
]}
onChange={({ value }) => this.onQueryModeChange(value ?? ExploreMode.Metrics)}
/>
</QueryInlineField>
)}
<QueryInlineField label="Query Mode">
<Segment
value={queryMode}
options={[
{ label: 'Metrics', value: ExploreMode.Metrics },
{ label: 'Logs', value: ExploreMode.Logs },
]}
onChange={({ value }) => this.onQueryModeChange(value ?? ExploreMode.Metrics)}
/>
</QueryInlineField>
{queryMode === ExploreMode.Logs ? <LogsQueryEditor {...this.props} /> : <MetricsQueryEditor {...this.props} />}
</>
);