AlphaNotice: replaced big popover tooltip with native tooltip (#18997)

pull/19002/head
Torkel Ödegaard 6 years ago committed by GitHub
parent 196f8503a8
commit f2ca3abf07
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 19
      packages/grafana-ui/src/components/AlphaNotice/AlphaNotice.tsx
  2. 2
      public/app/features/dashboard/panel_editor/QueriesTab.tsx
  3. 4
      public/app/features/dashboard/panel_editor/QueryOptions.tsx
  4. 17
      public/app/features/plugins/PluginStateInfo.tsx

@ -1,22 +1,15 @@
import React, { FC, useContext } from 'react'; import React, { FC, useContext } from 'react';
import { css, cx } from 'emotion'; import { css, cx } from 'emotion';
import { PluginState, ThemeContext } from '../../index'; import { PluginState, ThemeContext } from '../../index';
import { Tooltip } from '../index';
interface Props { interface Props {
state?: PluginState; state?: PluginState;
text?: JSX.Element; text?: string;
className?: string; className?: string;
} }
export const AlphaNotice: FC<Props> = ({ state, text, className }) => { export const AlphaNotice: FC<Props> = ({ state, text, className }) => {
const tooltipContent = text || ( const tooltipContent = text || 'This feature is a work in progress and updates may include breaking changes';
<div>
<h5>Alpha Feature</h5>
<p>This feature is a work in progress and updates may include breaking changes.</p>
</div>
);
const theme = useContext(ThemeContext); const theme = useContext(ThemeContext);
const styles = cx( const styles = cx(
@ -35,10 +28,8 @@ export const AlphaNotice: FC<Props> = ({ state, text, className }) => {
); );
return ( return (
<Tooltip content={tooltipContent} theme={'info'} placement={'top'}> <div className={styles} title={tooltipContent}>
<div className={styles}> <i className="fa fa-warning" /> {state}
<i className="fa fa-warning" /> {state} </div>
</div>
</Tooltip>
); );
}; };

@ -287,7 +287,7 @@ export class QueriesTab extends PureComponent<Props, State> {
<PanelOptionsGroup <PanelOptionsGroup
title={ title={
<> <>
Transform query results Query results
<AlphaNotice <AlphaNotice
state={PluginState.alpha} state={PluginState.alpha}
className={css` className={css`

@ -168,9 +168,11 @@ export class QueryOptions extends PureComponent<Props, State> {
return Object.keys(this.allOptions).map(key => { return Object.keys(this.allOptions).map(key => {
const options = this.allOptions[key]; const options = this.allOptions[key];
const panelKey = options.panelKey || key; const panelKey = options.panelKey || key;
// @ts-ignore // @ts-ignore
const value = this.state[panelKey]; const value = this.state[panelKey];
if (value || queryOptions[key]) {
if (queryOptions[key]) {
return ( return (
<DataSourceOption <DataSourceOption
key={key} key={key}

@ -6,23 +6,12 @@ interface Props {
state?: PluginState; state?: PluginState;
} }
function getPluginStateInfoText(state?: PluginState): JSX.Element | null { function getPluginStateInfoText(state?: PluginState): string | null {
switch (state) { switch (state) {
case PluginState.alpha: case PluginState.alpha:
return ( return 'Alpha Plugin: This plugin is a work in progress and updates may include breaking changes';
<div>
<h5>Alpha Plugin</h5>
<p>This plugin is a work in progress and updates may include breaking changes.</p>
</div>
);
case PluginState.beta: case PluginState.beta:
return ( return 'Beta Plugin: There could be bugs and minor breaking changes to this plugin';
<div>
<h5>Beta Plugin</h5>
<p>There could be bugs and minor breaking changes to this plugin.</p>
</div>
);
} }
return null; return null;
} }

Loading…
Cancel
Save