run prettier

pull/90836/head
Ashley Harrison 11 months ago committed by renovate[bot]
parent 486815606c
commit 219f4776a2
  1. 4
      packages/grafana-data/src/dataframe/StreamingDataFrame.ts
  2. 2
      packages/grafana-data/src/transformations/transformers/histogram.ts
  3. 2
      packages/grafana-prometheus/src/querybuilder/shared/OperationInfoButton.tsx
  4. 2
      packages/grafana-prometheus/src/querybuilder/shared/OperationListExplained.tsx
  5. 6
      packages/grafana-ui/src/components/Table/styles.ts
  6. 2
      packages/grafana-ui/src/components/uPlot/config/UPlotAxisBuilder.ts
  7. 5
      packages/grafana-ui/src/components/uPlot/config/UPlotScaleBuilder.ts
  8. 2
      public/app/core/components/TimeSeries/utils.ts
  9. 4
      public/app/core/components/TimelineChart/utils.ts
  10. 2
      public/app/features/alerting/unified/MuteTimings.tsx
  11. 4
      public/app/features/alerting/unified/components/contact-points/utils.ts
  12. 2
      public/app/features/alerting/unified/components/rule-viewer/tabs/Details.tsx
  13. 3
      public/app/features/alerting/unified/hooks/useCombinedRule.ts
  14. 2
      public/app/features/alerting/unified/utils/datasource.ts
  15. 2
      public/app/features/alerting/unified/utils/receiver-form.ts
  16. 2
      public/app/features/connections/tabs/ConnectData/Search/Search.tsx
  17. 2
      public/app/features/dashboard-scene/settings/variables/components/VariableTextField.tsx
  18. 2
      public/app/features/dashboard/components/TransformationsEditor/TransformationOperationRow.tsx
  19. 2
      public/app/features/explore/CorrelationTransformationAddModal.tsx
  20. 2
      public/app/features/explore/Logs/LogsTable.tsx
  21. 2
      public/app/features/gops/configuration-tracker/components/Essentials.tsx
  22. 2
      public/app/plugins/datasource/azuremonitor/azure_monitor/azure_monitor_datasource.test.ts
  23. 2
      public/app/plugins/datasource/grafana-pyroscope-datasource/QueryEditor/Stack.tsx
  24. 2
      public/app/plugins/datasource/grafana/components/QueryEditor.tsx
  25. 2
      public/app/plugins/datasource/influxdb/components/editor/query/influxql/utils/tagUtils.ts
  26. 2
      public/app/plugins/datasource/influxdb/components/editor/query/influxql/visual/InputSection.tsx
  27. 2
      public/app/plugins/datasource/parca/QueryEditor/Stack.tsx
  28. 4
      public/app/plugins/panel/heatmap/utils.ts
  29. 2
      public/app/plugins/panel/piechart/PieChartPanel.tsx
  30. 2
      public/app/plugins/panel/state-timeline/StateTimelineTooltip2.tsx
  31. 2
      public/app/plugins/panel/timeseries/TimeSeriesTooltip.tsx
  32. 2
      public/app/plugins/panel/xychart/v2/migrations.ts
  33. 4
      public/app/plugins/panel/xychart/v2/scatter.ts

@ -268,8 +268,8 @@ export class StreamingDataFrame implements DataFrame {
type: f.type ?? FieldType.other, type: f.type ?? FieldType.other,
// transfer old values by type & name, unless we relied on labels to match fields // transfer old values by type & name, unless we relied on labels to match fields
values: isWide values: isWide
? this.fields.find((of) => of.name === f.name && f.type === of.type)?.values ?? ? (this.fields.find((of) => of.name === f.name && f.type === of.type)?.values ??
Array(this.length).fill(undefined) Array(this.length).fill(undefined))
: [], : [],
}; };
}); });

@ -459,7 +459,7 @@ export function buildHistogram(frames: DataFrame[], options?: HistogramTransform
state: undefined, state: undefined,
config: config:
bucketDecimals === 0 bucketDecimals === 0
? config ?? {} ? (config ?? {})
: { : {
...config, ...config,
decimals: bucketDecimals, decimals: bucketDecimals,

@ -118,5 +118,5 @@ const getStyles = (theme: GrafanaTheme2) => {
}; };
function getOperationDocs(def: QueryBuilderOperationDef, op: QueryBuilderOperation): string { function getOperationDocs(def: QueryBuilderOperationDef, op: QueryBuilderOperation): string {
return renderMarkdown(def.explainHandler ? def.explainHandler(op, def) : def.documentation ?? 'no docs'); return renderMarkdown(def.explainHandler ? def.explainHandler(op, def) : (def.documentation ?? 'no docs'));
} }

@ -34,7 +34,7 @@ export function OperationListExplained<T extends QueryWithOperations>({
return `Operation ${op.id} not found`; return `Operation ${op.id} not found`;
} }
const title = def.renderer(op, def, '<expr>'); const title = def.renderer(op, def, '<expr>');
const body = def.explainHandler ? def.explainHandler(op, def) : def.documentation ?? 'no docs'; const body = def.explainHandler ? def.explainHandler(op, def) : (def.documentation ?? 'no docs');
return ( return (
<div <div

@ -44,8 +44,8 @@ export function useTableStyles(theme: GrafanaTheme2, cellHeightOption: TableCell
alignItems: 'center', alignItems: 'center',
borderRight: `1px solid ${borderColor}`, borderRight: `1px solid ${borderColor}`,
color: rowStyled ? 'inherit' : color ?? undefined, color: rowStyled ? 'inherit' : (color ?? undefined),
background: rowStyled ? undefined : background ?? undefined, background: rowStyled ? undefined : (background ?? undefined),
backgroundClip: 'padding-box', backgroundClip: 'padding-box',
'&:last-child:not(:only-child)': { '&:last-child:not(:only-child)': {
@ -60,7 +60,7 @@ export function useTableStyles(theme: GrafanaTheme2, cellHeightOption: TableCell
wordBreak: textShouldWrap ? 'break-word' : undefined, wordBreak: textShouldWrap ? 'break-word' : undefined,
whiteSpace: textShouldWrap && overflowOnHover ? 'normal' : 'nowrap', whiteSpace: textShouldWrap && overflowOnHover ? 'normal' : 'nowrap',
boxShadow: overflowOnHover ? `0 0 2px ${theme.colors.primary.main}` : undefined, boxShadow: overflowOnHover ? `0 0 2px ${theme.colors.primary.main}` : undefined,
background: rowStyled ? 'inherit' : backgroundHover ?? theme.colors.background.primary, background: rowStyled ? 'inherit' : (backgroundHover ?? theme.colors.background.primary),
zIndex: 1, zIndex: 1,
'.cellActions': { '.cellActions': {
color: '#FFF', color: '#FFF',

@ -163,7 +163,7 @@ export class UPlotAxisBuilder extends PlotConfigBuilder<AxisProps, Axis> {
ticks: Object.assign( ticks: Object.assign(
{ {
show: true, show: true,
stroke: border?.show ? color ?? theme.colors.text.primary : gridColor, stroke: border?.show ? (color ?? theme.colors.text.primary) : gridColor,
width: 1 / devicePixelRatio, width: 1 / devicePixelRatio,
size: 4, size: 4,
}, },

@ -55,8 +55,9 @@ export class UPlotScaleBuilder extends PlotConfigBuilder<ScaleProps, Scale> {
: distr === ScaleDistribution.Ordinal : distr === ScaleDistribution.Ordinal
? 2 ? 2
: 1, : 1,
log: distr === ScaleDistribution.Log || distr === ScaleDistribution.Symlog ? this.props.log ?? 2 : undefined, log:
asinh: distr === ScaleDistribution.Symlog ? this.props.linearThreshold ?? 1 : undefined, distr === ScaleDistribution.Log || distr === ScaleDistribution.Symlog ? (this.props.log ?? 2) : undefined,
asinh: distr === ScaleDistribution.Symlog ? (this.props.linearThreshold ?? 1) : undefined,
} }
: {}; : {};

@ -323,7 +323,7 @@ export const preparePlotConfigBuilder: UPlotConfigPrepFn = ({
scaleKey, scaleKey,
label: customConfig.axisLabel, label: customConfig.axisLabel,
size: customConfig.axisWidth, size: customConfig.axisWidth,
placement: isHorizontal ? customConfig.axisPlacement ?? AxisPlacement.Auto : AxisPlacement.Bottom, placement: isHorizontal ? (customConfig.axisPlacement ?? AxisPlacement.Auto) : AxisPlacement.Bottom,
formatValue: (v, decimals) => formattedValueToString(fmt(v, decimals)), formatValue: (v, decimals) => formattedValueToString(fmt(v, decimals)),
theme, theme,
grid: { show: customConfig.axisGridShow }, grid: { show: customConfig.axisGridShow },

@ -443,7 +443,9 @@ export function getThresholdItems(fieldConfig: FieldConfig, theme: GrafanaTheme2
} }
const steps = thresholds.steps; const steps = thresholds.steps;
const getDisplay = getValueFormat(thresholds.mode === ThresholdsMode.Percentage ? 'percent' : fieldConfig.unit ?? ''); const getDisplay = getValueFormat(
thresholds.mode === ThresholdsMode.Percentage ? 'percent' : (fieldConfig.unit ?? '')
);
// `undefined` value for decimals will use `auto` // `undefined` value for decimals will use `auto`
const format = (value: number) => formattedValueToString(getDisplay(value, fieldConfig.decimals ?? undefined)); const format = (value: number) => formattedValueToString(getDisplay(value, fieldConfig.decimals ?? undefined));

@ -22,7 +22,7 @@ const MuteTimings = () => {
const getMuteTimingByName = useCallback( const getMuteTimingByName = useCallback(
(id: string, fromTimeIntervals: boolean): MuteTimeInterval | undefined => { (id: string, fromTimeIntervals: boolean): MuteTimeInterval | undefined => {
const time_intervals = fromTimeIntervals ? config?.time_intervals ?? [] : config?.mute_time_intervals ?? []; const time_intervals = fromTimeIntervals ? (config?.time_intervals ?? []) : (config?.mute_time_intervals ?? []);
const timing = time_intervals.find(({ name }: MuteTimeInterval) => name === id); const timing = time_intervals.find(({ name }: MuteTimeInterval) => name === id);
if (timing) { if (timing) {

@ -124,8 +124,8 @@ export function enhanceContactPointsWithMetadata(
const usedContactPointsByName = groupBy(usedContactPoints, 'receiver'); const usedContactPointsByName = groupBy(usedContactPoints, 'receiver');
const contactPointsList = alertmanagerConfiguration const contactPointsList = alertmanagerConfiguration
? alertmanagerConfiguration?.alertmanager_config.receivers ?? [] ? (alertmanagerConfiguration?.alertmanager_config.receivers ?? [])
: contactPoints ?? []; : (contactPoints ?? []);
return contactPointsList.map((contactPoint) => { return contactPointsList.map((contactPoint) => {
const receivers = extractReceivers(contactPoint); const receivers = extractReceivers(contactPoint);

@ -47,7 +47,7 @@ const Details = ({ rule }: DetailsProps) => {
}, [rule.rulerRule]); }, [rule.rulerRule]);
const annotations: Annotations | undefined = !isRecordingRulerRule(rule.rulerRule) const annotations: Annotations | undefined = !isRecordingRulerRule(rule.rulerRule)
? rule.annotations ?? [] ? (rule.annotations ?? [])
: undefined; : undefined;
const hasEvaluationDuration = Number.isFinite(evaluationDuration); const hasEvaluationDuration = Number.isFinite(evaluationDuration);

@ -143,7 +143,8 @@ function useCombinedRulesLoader(
return { return {
loading, loading,
error: promRuleRequest.error ?? isRulerNotSupportedResponse(rulerRuleRequest) ? undefined : rulerRuleRequest.error, error:
(promRuleRequest.error ?? isRulerNotSupportedResponse(rulerRuleRequest)) ? undefined : rulerRuleRequest.error,
dispatched: promRuleRequest.dispatched && rulerRuleRequest.dispatched, dispatched: promRuleRequest.dispatched && rulerRuleRequest.dispatched,
}; };
} }

@ -47,7 +47,7 @@ export function getRulesDataSources() {
} }
export function getRulesSourceUniqueKey(rulesSource: RulesSource): string { export function getRulesSourceUniqueKey(rulesSource: RulesSource): string {
return isGrafanaRulesSource(rulesSource) ? 'grafana' : rulesSource.uid ?? rulesSource.id; return isGrafanaRulesSource(rulesSource) ? 'grafana' : (rulesSource.uid ?? rulesSource.id);
} }
export function getRulesDataSource(rulesSourceName: string) { export function getRulesDataSource(rulesSourceName: string) {

@ -233,7 +233,7 @@ export function formChannelValuesToGrafanaChannelConfig(
): GrafanaManagedReceiverConfig { ): GrafanaManagedReceiverConfig {
const channel: GrafanaManagedReceiverConfig = { const channel: GrafanaManagedReceiverConfig = {
settings: omitEmptyValues({ settings: omitEmptyValues({
...(existing && existing.type === values.type ? existing.settings ?? {} : {}), ...(existing && existing.type === values.type ? (existing.settings ?? {}) : {}),
...(values.settings ?? {}), ...(values.settings ?? {}),
}), }),
secureSettings: omitEmptyUnlessExisting(values.secureSettings, existing?.secureFields), secureSettings: omitEmptyUnlessExisting(values.secureSettings, existing?.secureFields),

@ -28,7 +28,7 @@ export interface Props {
export const Search = ({ onChange, value }: Props) => { export const Search = ({ onChange, value }: Props) => {
const chromeHeaderHeight = useChromeHeaderHeight(); const chromeHeaderHeight = useChromeHeaderHeight();
const styles = useStyles2(getStyles, config.featureToggles.bodyScrolling ? chromeHeaderHeight ?? 0 : 0); const styles = useStyles2(getStyles, config.featureToggles.bodyScrolling ? (chromeHeaderHeight ?? 0) : 0);
return ( return (
<div className={styles.searchContainer}> <div className={styles.searchContainer}>

@ -49,7 +49,7 @@ export function VariableTextField({
defaultValue={defaultValue} defaultValue={defaultValue}
onChange={onChange} onChange={onChange}
onBlur={onBlur} onBlur={onBlur}
width={grow ? undefined : width ?? 30} width={grow ? undefined : (width ?? 30)}
data-testid={testId} data-testid={testId}
maxLength={maxLength} maxLength={maxLength}
required={required} required={required}

@ -168,7 +168,7 @@ export const TransformationOperationRow = ({
<TransformationEditor <TransformationEditor
debugMode={showDebug} debugMode={showDebug}
index={index} index={index}
data={topic === DataTopic.Annotations ? data.annotations ?? [] : data.series} data={topic === DataTopic.Annotations ? (data.annotations ?? []) : data.series}
configs={configs} configs={configs}
uiConfig={uiConfig} uiConfig={uiConfig}
onChange={onChange} onChange={onChange}

@ -164,7 +164,7 @@ export const CorrelationTransformationAddModal = ({
<pre> <pre>
<Highlighter <Highlighter
textToHighlight={exampleValue} textToHighlight={exampleValue}
searchWords={[isExpValid ? getValues('expression') ?? '' : '']} searchWords={[isExpValid ? (getValues('expression') ?? '') : '']}
autoEscape={false} autoEscape={false}
/> />
</pre> </pre>

@ -89,7 +89,7 @@ export function LogsTable(props: Props) {
}; };
// If it's a string, then try to guess for a better type for numeric support in viz // If it's a string, then try to guess for a better type for numeric support in viz
field.type = field.type === FieldType.string ? guessFieldTypeForField(field) ?? FieldType.string : field.type; field.type = field.type === FieldType.string ? (guessFieldTypeForField(field) ?? FieldType.string) : field.type;
} }
return frameWithOverrides; return frameWithOverrides;

@ -109,7 +109,7 @@ function OpenLinkButton(props: LinkButtonProps) {
const urlToGo = done ? urlToGoWhenDone : urlToGoWhenNotDone; const urlToGo = done ? urlToGoWhenDone : urlToGoWhenNotDone;
return ( return (
<LinkButton href={urlToGo} variant="secondary"> <LinkButton href={urlToGo} variant="secondary">
{done ? labelOnDone ?? label : label} {done ? (labelOnDone ?? label) : label}
</LinkButton> </LinkButton>
); );
} }

@ -748,7 +748,7 @@ describe('AzureMonitorDatasource', () => {
if (target?.includes('$reg')) { if (target?.includes('$reg')) {
return 'eastus'; return 'eastus';
} }
return target === `$${multiVariable.id}` ? 'foo,bar' : target ?? ''; return target === `$${multiVariable.id}` ? 'foo,bar' : (target ?? '');
}; };
const ds = new AzureMonitorDatasource(ctx.instanceSettings); const ds = new AzureMonitorDatasource(ctx.instanceSettings);
//ds.azureMonitorDatasource.templateSrv = tsrv; //ds.azureMonitorDatasource.templateSrv = tsrv;

@ -23,7 +23,7 @@ const getStyles = (theme: GrafanaTheme2, props: StackProps) => ({
root: css({ root: css({
display: 'flex', display: 'flex',
flexDirection: props.direction ?? 'row', flexDirection: props.direction ?? 'row',
flexWrap: props.wrap ?? true ? 'wrap' : undefined, flexWrap: (props.wrap ?? true) ? 'wrap' : undefined,
alignItems: props.alignItems, alignItems: props.alignItems,
gap: theme.spacing(props.gap ?? 2), gap: theme.spacing(props.gap ?? 2),
flexGrow: props.flexGrow, flexGrow: props.flexGrow,

@ -217,7 +217,7 @@ export class UnthemedQueryEditor extends PureComponent<Props, State> {
} }
const distinctFields = new Set<string>(); const distinctFields = new Set<string>();
const fields: Array<SelectableValue<string>> = channel ? channelFields[channel] ?? [] : []; const fields: Array<SelectableValue<string>> = channel ? (channelFields[channel] ?? []) : [];
// if (data && data.series?.length) { // if (data && data.series?.length) {
// for (const frame of data.series) { // for (const frame of data.series) {
// for (const field of frame.fields) { // for (const field of frame.fields) {

@ -13,7 +13,7 @@ export function getOperator(tag: InfluxQueryTag): string {
// FIXME: sync these to the query-string-generation-code // FIXME: sync these to the query-string-generation-code
// probably it's in influx_query_model.ts // probably it's in influx_query_model.ts
export function getCondition(tag: InfluxQueryTag, isFirst: boolean): string | undefined { export function getCondition(tag: InfluxQueryTag, isFirst: boolean): string | undefined {
return isFirst ? undefined : tag.condition ?? 'AND'; return isFirst ? undefined : (tag.condition ?? 'AND');
} }
export function adjustOperatorIfNeeded(currentOperator: string, newTagValue: string): string { export function adjustOperatorIfNeeded(currentOperator: string, newTagValue: string): string {

@ -26,7 +26,7 @@ export const InputSection = ({ value, onChange, isWide, placeholder }: Props): J
<> <>
<Input <Input
placeholder={placeholder} placeholder={placeholder}
className={cx(isWide ?? false ? 'width-14' : 'width-8', paddingRightClass)} className={cx((isWide ?? false) ? 'width-14' : 'width-8', paddingRightClass)}
type="text" type="text"
spellCheck={false} spellCheck={false}
onBlur={onBlur} onBlur={onBlur}

@ -23,7 +23,7 @@ const getStyles = (theme: GrafanaTheme2, props: StackProps) => ({
root: css({ root: css({
display: 'flex', display: 'flex',
flexDirection: props.direction ?? 'row', flexDirection: props.direction ?? 'row',
flexWrap: props.wrap ?? true ? 'wrap' : undefined, flexWrap: (props.wrap ?? true) ? 'wrap' : undefined,
alignItems: props.alignItems, alignItems: props.alignItems,
gap: theme.spacing(props.gap ?? 2), gap: theme.spacing(props.gap ?? 2),
flexGrow: props.flexGrow, flexGrow: props.flexGrow,

@ -367,8 +367,8 @@ export function prepConfig(opts: PrepConfigOpts) {
if (meta.yOrdinalDisplay) { if (meta.yOrdinalDisplay) {
return splits.map((v) => return splits.map((v) =>
v < 0 v < 0
? meta.yMinDisplay ?? '' // Check prometheus style labels ? (meta.yMinDisplay ?? '') // Check prometheus style labels
: meta.yOrdinalDisplay[v] ?? '' : (meta.yOrdinalDisplay[v] ?? '')
); );
} }
return splits; return splits;

@ -127,7 +127,7 @@ function getLegend(props: Props, displayValues: FieldDisplay[]) {
percent: percentOfTotal, percent: percentOfTotal,
text: text:
hideFromViz || isNaN(fractionOfTotal) hideFromViz || isNaN(fractionOfTotal)
? props.fieldConfig.defaults.noValue ?? '-' ? (props.fieldConfig.defaults.noValue ?? '-')
: percentOfTotal.toFixed(value.field.decimals ?? 0) + '%', : percentOfTotal.toFixed(value.field.decimals ?? 0) + '%',
title: valuesToShow.length > 1 ? 'Percent' : '', title: valuesToShow.length > 1 ? 'Percent' : '',
}); });

@ -76,7 +76,7 @@ export const StateTimelineTooltip2 = ({
} }
const headerItem: VizTooltipItem = { const headerItem: VizTooltipItem = {
label: xField.type === FieldType.time ? '' : xField.state?.displayName ?? xField.name, label: xField.type === FieldType.time ? '' : (xField.state?.displayName ?? xField.name),
value: xVal, value: xVal,
}; };

@ -86,7 +86,7 @@ export const TimeSeriesTooltip = ({
const headerItem: VizTooltipItem | null = xField.config.custom?.hideFrom?.tooltip const headerItem: VizTooltipItem | null = xField.config.custom?.hideFrom?.tooltip
? null ? null
: { : {
label: xField.type === FieldType.time ? '' : xField.state?.displayName ?? xField.name, label: xField.type === FieldType.time ? '' : (xField.state?.displayName ?? xField.name),
value: xVal, value: xVal,
}; };

@ -189,7 +189,7 @@ function migrateOptions(panel: PanelModel): Options {
frame: { frame: {
matcher: { matcher: {
id: FrameMatcherID.byIndex, id: FrameMatcherID.byIndex,
options: frame ?? (seriesMapping === SeriesMapping.Manual ? i++ : frameShared ?? 0), options: frame ?? (seriesMapping === SeriesMapping.Manual ? i++ : (frameShared ?? 0)),
}, },
}, },
x: { x: {

@ -327,7 +327,7 @@ export const prepConfig = (xySeries: XYSeries[], theme: GrafanaTheme2) => {
let xAxisAutoLabel = let xAxisAutoLabel =
xySeries.length === 1 xySeries.length === 1
? xField.state?.displayName ?? xField.name ? (xField.state?.displayName ?? xField.name)
: new Set(dispNames).size === 1 : new Set(dispNames).size === 1
? dispNames[0] ? dispNames[0]
: getCommonPrefixSuffix(dispNames); : getCommonPrefixSuffix(dispNames);
@ -384,7 +384,7 @@ export const prepConfig = (xySeries: XYSeries[], theme: GrafanaTheme2) => {
let yAxisAutoLabel = let yAxisAutoLabel =
xySeries.length === 1 xySeries.length === 1
? field.state?.displayName ?? field.name ? (field.state?.displayName ?? field.name)
: new Set(dispNames).size === 1 : new Set(dispNames).size === 1
? dispNames[0] ? dispNames[0]
: getCommonPrefixSuffix(dispNames); : getCommonPrefixSuffix(dispNames);

Loading…
Cancel
Save