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,
// transfer old values by type & name, unless we relied on labels to match fields
values: isWide
? this.fields.find((of) => of.name === f.name && f.type === of.type)?.values ??
Array(this.length).fill(undefined)
? (this.fields.find((of) => of.name === f.name && f.type === of.type)?.values ??
Array(this.length).fill(undefined))
: [],
};
});

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

@ -118,5 +118,5 @@ const getStyles = (theme: GrafanaTheme2) => {
};
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`;
}
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 (
<div

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

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

@ -55,8 +55,9 @@ export class UPlotScaleBuilder extends PlotConfigBuilder<ScaleProps, Scale> {
: distr === ScaleDistribution.Ordinal
? 2
: 1,
log: distr === ScaleDistribution.Log || distr === ScaleDistribution.Symlog ? this.props.log ?? 2 : undefined,
asinh: distr === ScaleDistribution.Symlog ? this.props.linearThreshold ?? 1 : undefined,
log:
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,
label: customConfig.axisLabel,
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)),
theme,
grid: { show: customConfig.axisGridShow },

@ -443,7 +443,9 @@ export function getThresholdItems(fieldConfig: FieldConfig, theme: GrafanaTheme2
}
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`
const format = (value: number) => formattedValueToString(getDisplay(value, fieldConfig.decimals ?? undefined));

@ -22,7 +22,7 @@ const MuteTimings = () => {
const getMuteTimingByName = useCallback(
(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);
if (timing) {

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

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

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

@ -47,7 +47,7 @@ export function getRulesDataSources() {
}
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) {

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

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

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

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

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

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

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

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

@ -217,7 +217,7 @@ export class UnthemedQueryEditor extends PureComponent<Props, State> {
}
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) {
// for (const frame of data.series) {
// 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
// probably it's in influx_query_model.ts
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 {

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

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

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

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

@ -76,7 +76,7 @@ export const StateTimelineTooltip2 = ({
}
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,
};

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

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

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

Loading…
Cancel
Save