mirror of
https://github.com/grafana/grafana.git
synced 2025-09-21 06:16:45 +08:00
Chore: fix jsdoc desc and return (#28383)
This commit is contained in:
@ -40,7 +40,7 @@ export function createViewedBoundsFunc(viewRange: { min: number; max: number; vi
|
||||
* View bounds function
|
||||
* @param {number} start The start of the sub-range.
|
||||
* @param {number} end The end of the sub-range.
|
||||
* @return {Object} The resultant range.
|
||||
* @returns {Object} The resultant range.
|
||||
*/
|
||||
return (start: number, end: number) => ({
|
||||
start: (start - viewMin) / viewWindow,
|
||||
@ -55,7 +55,7 @@ export function createViewedBoundsFunc(viewRange: { min: number; max: number; vi
|
||||
* @param {any} value The tag value to match.
|
||||
* @param {{tags}} span An object with a `tags` property of { key, value }
|
||||
* items.
|
||||
* @return {boolean} True if a match was found.
|
||||
* @returns {boolean} True if a match was found.
|
||||
*/
|
||||
export function spanHasTag(key: string, value: any, span: TraceSpan) {
|
||||
if (!Array.isArray(span.tags) || !span.tags.length) {
|
||||
@ -80,7 +80,7 @@ export const isErrorSpan = (span: TraceSpan) => isErrorBool(span) || isErrorStr(
|
||||
* @param {number} parentSpanIndex The index of the parent span - only
|
||||
* subsequent spans with depth less than
|
||||
* the parent span will be checked.
|
||||
* @return {boolean} Returns `true` if a descendant contains an error tag.
|
||||
* @returns {boolean} Returns `true` if a descendant contains an error tag.
|
||||
*/
|
||||
export function spanContainsErredSpan(spans: TraceSpan[], parentSpanIndex: number) {
|
||||
const { depth } = spans[parentSpanIndex];
|
||||
|
@ -17,7 +17,7 @@ import { TraceSpan } from '@grafana/data';
|
||||
/**
|
||||
* Searches the span.references to find 'CHILD_OF' reference type or returns null.
|
||||
* @param {TraceSpan} span The span whose parent is to be returned.
|
||||
* @return {TraceSpan|null} The parent span if there is one, null otherwise.
|
||||
* @returns {TraceSpan|null} The parent span if there is one, null otherwise.
|
||||
*/
|
||||
export function getParent(span: TraceSpan) {
|
||||
const parentRef = span.references ? span.references.find(ref => ref.refType === 'CHILD_OF') : null;
|
||||
|
@ -62,7 +62,7 @@ class ColorGenerator {
|
||||
/**
|
||||
* Retrieve the RGB values associated with a key. Adds the key and associates
|
||||
* it with a color if the key is not recognized.
|
||||
* @return {number[]} An array of three ints [0, 255] representing a color.
|
||||
* @returns {number[]} An array of three ints [0, 255] representing a color.
|
||||
*/
|
||||
getRgbColorByKey(key: string): [number, number, number] {
|
||||
const i = this._getColorIndex(key);
|
||||
|
@ -31,7 +31,7 @@ export const DEFAULT_MS_PRECISION = Math.log10(ONE_MILLISECOND);
|
||||
* @param {number} timestamp
|
||||
* @param {number} initialTimestamp
|
||||
* @param {number} totalDuration
|
||||
* @return {number} 0-100 percentage
|
||||
* @returns {number} 0-100 percentage
|
||||
*/
|
||||
export function getPercentageOfDuration(duration: number, totalDuration: number) {
|
||||
return (duration / totalDuration) * 100;
|
||||
@ -42,7 +42,7 @@ const quantizeDuration = (duration: number, floatPrecision: number, conversionFa
|
||||
|
||||
/**
|
||||
* @param {number} duration (in microseconds)
|
||||
* @return {string} formatted, unit-labelled string with time in milliseconds
|
||||
* @returns {string} formatted, unit-labelled string with time in milliseconds
|
||||
*/
|
||||
export function formatDate(duration: number) {
|
||||
return moment(duration / ONE_MILLISECOND).format(STANDARD_DATE_FORMAT);
|
||||
@ -50,7 +50,7 @@ export function formatDate(duration: number) {
|
||||
|
||||
/**
|
||||
* @param {number} duration (in microseconds)
|
||||
* @return {string} formatted, unit-labelled string with time in milliseconds
|
||||
* @returns {string} formatted, unit-labelled string with time in milliseconds
|
||||
*/
|
||||
export function formatTime(duration: number) {
|
||||
return moment(duration / ONE_MILLISECOND).format(STANDARD_TIME_FORMAT);
|
||||
@ -58,7 +58,7 @@ export function formatTime(duration: number) {
|
||||
|
||||
/**
|
||||
* @param {number} duration (in microseconds)
|
||||
* @return {string} formatted, unit-labelled string with time in milliseconds
|
||||
* @returns {string} formatted, unit-labelled string with time in milliseconds
|
||||
*/
|
||||
export function formatDatetime(duration: number) {
|
||||
return moment(duration / ONE_MILLISECOND).format(STANDARD_DATETIME_FORMAT);
|
||||
@ -66,7 +66,7 @@ export function formatDatetime(duration: number) {
|
||||
|
||||
/**
|
||||
* @param {number} duration (in microseconds)
|
||||
* @return {string} formatted, unit-labelled string with time in milliseconds
|
||||
* @returns {string} formatted, unit-labelled string with time in milliseconds
|
||||
*/
|
||||
export function formatMillisecondTime(duration: number) {
|
||||
const targetDuration = quantizeDuration(duration, DEFAULT_MS_PRECISION, ONE_MILLISECOND);
|
||||
@ -75,7 +75,7 @@ export function formatMillisecondTime(duration: number) {
|
||||
|
||||
/**
|
||||
* @param {number} duration (in microseconds)
|
||||
* @return {string} formatted, unit-labelled string with time in seconds
|
||||
* @returns {string} formatted, unit-labelled string with time in seconds
|
||||
*/
|
||||
export function formatSecondTime(duration: number) {
|
||||
const targetDuration = quantizeDuration(duration, DEFAULT_MS_PRECISION, ONE_SECOND);
|
||||
|
@ -24,7 +24,7 @@
|
||||
*
|
||||
* @param {number} number
|
||||
* @param {number} precision
|
||||
* @return {number} number at new floating precision
|
||||
* @returns {number} number at new floating precision
|
||||
*/
|
||||
export function toFloatPrecision(number: number, precision: number): number {
|
||||
const log10Length = Math.floor(Math.log10(Math.abs(number))) + 1;
|
||||
|
Reference in New Issue
Block a user