"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "packages/grafana-data/src/field/fieldDisplay.ts" between
grafana-8.0.0.tar.gz and grafana-8.0.1.tar.gz

About: Grafana is a visualization tool for monitoring, metric analytics and dashboards for Graphite, InfluxDB, Prometheus and many more.

fieldDisplay.ts  (grafana-8.0.0):fieldDisplay.ts  (grafana-8.0.1)
skipping to change at line 127 skipping to change at line 127
let config = field.config; // already set by the prepare task let config = field.config; // already set by the prepare task
if (field.state?.range) { if (field.state?.range) {
// Us the global min/max values // Us the global min/max values
config = { config = {
...config, ...config,
...field.state?.range, ...field.state?.range,
}; };
} }
// const displayName = getFieldDisplayName(field, dataFrame, data);
const displayName = field.config.displayName ?? ''; const displayName = field.config.displayName ?? '';
const display = const display =
field.display ?? field.display ??
getDisplayProcessor({ getDisplayProcessor({
field, field,
theme: options.theme, theme: options.theme,
timeZone, timeZone,
}); });
skipping to change at line 158 skipping to change at line 157
scopedVars[VAR_CELL_PREFIX + k] = { scopedVars[VAR_CELL_PREFIX + k] = {
value: v, value: v,
text: toString(v), text: toString(v),
}; };
} }
} }
field.state = setIndexForPaletteColor(field, values.length); field.state = setIndexForPaletteColor(field, values.length);
const displayValue = display(field.values.get(j)); const displayValue = display(field.values.get(j));
const rowName = getSmartDisplayNameForRow(dataFrame, field, j, replace
if (displayName !== '') { Variables, scopedVars);
displayValue.title = replaceVariables(displayName, { const overrideColor = lookupRowColorFromOverride(rowName, options.fiel
...field.state?.scopedVars, // series and field scoped vars dConfig, theme);
...scopedVars,
});
} else {
displayValue.title = getSmartDisplayNameForRow(dataFrame, field, j);
}
const overrideColor = lookupRowColorFromOverride(displayValue, options
.fieldConfig);
if (overrideColor) {
displayValue.color = theme.visualization.getColorByName(overrideColo
r);
}
values.push({ values.push({
name: '', name: '',
field: config, field: config,
display: displayValue, display: {
...displayValue,
title: rowName,
color: overrideColor ?? displayValue.color,
},
view, view,
colIndex: i, colIndex: i,
rowIndex: j, rowIndex: j,
getLinks: fieldLinksSupplier getLinks: fieldLinksSupplier
? () => ? () =>
fieldLinksSupplier({ fieldLinksSupplier({
valueRowIndex: j, valueRowIndex: j,
}) })
: () => [], : () => [],
hasLinks: hasLinks(field), hasLinks: hasLinks(field),
skipping to change at line 253 skipping to change at line 244
} }
} }
if (values.length === 0) { if (values.length === 0) {
values.push(createNoValuesFieldDisplay(options)); values.push(createNoValuesFieldDisplay(options));
} }
return values; return values;
}; };
function getSmartDisplayNameForRow(frame: DataFrame, field: Field, rowIndex: num function getSmartDisplayNameForRow(
ber): string { frame: DataFrame,
field: Field,
rowIndex: number,
replaceVariables: InterpolateFunction,
scopedVars: ScopedVars
): string {
let parts: string[] = []; let parts: string[] = [];
let otherNumericFields = 0; let otherNumericFields = 0;
if (field.config.displayName) {
return replaceVariables(field.config.displayName, {
...field.state?.scopedVars, // series and field scoped vars
...scopedVars,
});
}
for (const otherField of frame.fields) { for (const otherField of frame.fields) {
if (otherField === field) { if (otherField === field) {
continue; continue;
} }
if (otherField.type === FieldType.string) { if (otherField.type === FieldType.string) {
const value = otherField.values.get(rowIndex) ?? ''; const value = otherField.values.get(rowIndex) ?? '';
if (value.length > 0) { if (value.length > 0) {
parts.push(value); parts.push(value);
} }
skipping to change at line 293 skipping to change at line 297
function setIndexForPaletteColor(field: Field, currentLength: number) { function setIndexForPaletteColor(field: Field, currentLength: number) {
return { return {
...field.state, ...field.state,
seriesIndex: currentLength, seriesIndex: currentLength,
}; };
} }
/** /**
* This function makes overrides that set color work for row values * This function makes overrides that set color work for row values
*/ */
function lookupRowColorFromOverride(display: DisplayValue, fieldConfig: FieldCon figSource) { function lookupRowColorFromOverride(displayName: string, fieldConfig: FieldConfi gSource, theme: GrafanaTheme2) {
for (const override of fieldConfig.overrides) { for (const override of fieldConfig.overrides) {
if (override.matcher.id === 'byName' && override.matcher.options === display .title) { if (override.matcher.id === 'byName' && override.matcher.options === display Name) {
for (const prop of override.properties) { for (const prop of override.properties) {
if (prop.id === 'color' && prop.value) { if (prop.id === 'color' && prop.value) {
return prop.value.fixedColor; return theme.visualization.getColorByName(prop.value.fixedColor);
} }
} }
} }
} }
return null;
} }
export function hasLinks(field: Field): boolean { export function hasLinks(field: Field): boolean {
return field.config?.links?.length ? field.config.links.length > 0 : false; return field.config?.links?.length ? field.config.links.length > 0 : false;
} }
export function getDisplayValueAlignmentFactors(values: FieldDisplay[]): Display ValueAlignmentFactors { export function getDisplayValueAlignmentFactors(values: FieldDisplay[]): Display ValueAlignmentFactors {
const info: DisplayValueAlignmentFactors = { const info: DisplayValueAlignmentFactors = {
title: '', title: '',
text: '', text: '',
 End of changes. 9 change blocks. 
23 lines changed or deleted 28 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)