mirror of
				https://github.com/grafana/grafana.git
				synced 2025-02-25 18:55:37 -06:00 
			
		
		
		
	Prometheus: Add beta tag to mode switch for Builder mode (#47376)
* Add beta tag to mode switch * Fix selectors
This commit is contained in:
		@@ -87,7 +87,7 @@ export function RadioButtonGroup<T>({
 | 
			
		||||
          >
 | 
			
		||||
            {o.icon && <Icon name={o.icon as IconName} className={styles.icon} />}
 | 
			
		||||
            {o.imgUrl && <img src={o.imgUrl} alt={o.label} className={styles.img} />}
 | 
			
		||||
            {o.label}
 | 
			
		||||
            {o.label} {o.component ? <o.component /> : null}
 | 
			
		||||
          </RadioButton>
 | 
			
		||||
        );
 | 
			
		||||
      })}
 | 
			
		||||
 
 | 
			
		||||
@@ -187,9 +187,9 @@ function expectExplain() {
 | 
			
		||||
 | 
			
		||||
function switchToMode(mode: QueryEditorMode) {
 | 
			
		||||
  const label = {
 | 
			
		||||
    [QueryEditorMode.Code]: 'Code',
 | 
			
		||||
    [QueryEditorMode.Explain]: 'Explain',
 | 
			
		||||
    [QueryEditorMode.Builder]: 'Builder',
 | 
			
		||||
    [QueryEditorMode.Code]: /Code/,
 | 
			
		||||
    [QueryEditorMode.Explain]: /Explain/,
 | 
			
		||||
    [QueryEditorMode.Builder]: /Builder/,
 | 
			
		||||
  }[mode];
 | 
			
		||||
 | 
			
		||||
  const switchEl = screen.getByLabelText(label);
 | 
			
		||||
 
 | 
			
		||||
@@ -189,9 +189,9 @@ function expectExplain() {
 | 
			
		||||
 | 
			
		||||
function switchToMode(mode: QueryEditorMode) {
 | 
			
		||||
  const label = {
 | 
			
		||||
    [QueryEditorMode.Code]: 'Code',
 | 
			
		||||
    [QueryEditorMode.Explain]: 'Explain',
 | 
			
		||||
    [QueryEditorMode.Builder]: 'Builder',
 | 
			
		||||
    [QueryEditorMode.Code]: /Code/,
 | 
			
		||||
    [QueryEditorMode.Explain]: /Explain/,
 | 
			
		||||
    [QueryEditorMode.Builder]: /Builder/,
 | 
			
		||||
  }[mode];
 | 
			
		||||
 | 
			
		||||
  const switchEl = screen.getByLabelText(label);
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,6 @@
 | 
			
		||||
import { RadioButtonGroup } from '@grafana/ui';
 | 
			
		||||
import { RadioButtonGroup, Tag } from '@grafana/ui';
 | 
			
		||||
import React from 'react';
 | 
			
		||||
import { css } from '@emotion/css';
 | 
			
		||||
import { QueryEditorMode } from './types';
 | 
			
		||||
 | 
			
		||||
export interface Props {
 | 
			
		||||
@@ -9,7 +10,21 @@ export interface Props {
 | 
			
		||||
 | 
			
		||||
const editorModes = [
 | 
			
		||||
  { label: 'Explain', value: QueryEditorMode.Explain },
 | 
			
		||||
  { label: 'Builder', value: QueryEditorMode.Builder },
 | 
			
		||||
  {
 | 
			
		||||
    label: 'Builder',
 | 
			
		||||
    value: QueryEditorMode.Builder,
 | 
			
		||||
    component: () => (
 | 
			
		||||
      <Tag
 | 
			
		||||
        className={css({
 | 
			
		||||
          fontSize: 10,
 | 
			
		||||
          padding: '1px 5px',
 | 
			
		||||
          verticalAlign: 'text-bottom',
 | 
			
		||||
        })}
 | 
			
		||||
        name={'Beta'}
 | 
			
		||||
        colorIndex={1}
 | 
			
		||||
      />
 | 
			
		||||
    ),
 | 
			
		||||
  },
 | 
			
		||||
  { label: 'Code', value: QueryEditorMode.Code },
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user