⚝
One Hat Cyber Team
⚝
Your IP:
216.73.217.4
Server IP:
41.128.143.86
Server:
Linux host.raqmix.cloud 6.8.0-1025-azure #30~22.04.1-Ubuntu SMP Wed Mar 12 15:28:20 UTC 2025 x86_64
Server Software:
Apache
PHP Version:
8.3.23
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
usr
/
share
/
grafana
/
public
/
app
/
plugins
/
panel
/
stat
/
View File Name :
common.ts
// These are used in some other plugins for some reason import { escapeStringForRegex, FieldOverrideContext, getFieldDisplayName, PanelOptionsEditorBuilder, ReducerID, standardEditorsRegistry, } from '@grafana/data'; import { SingleStatBaseOptions, VizOrientation } from '@grafana/schema'; export function addStandardDataReduceOptions
( builder: PanelOptionsEditorBuilder
, includeFieldMatcher = true ) { const valueOptionsCategory = ['Value options']; builder.addRadio({ path: 'reduceOptions.values', name: 'Show', description: 'Calculate a single value per column or series or show each row', settings: { options: [ { value: false, label: 'Calculate' }, { value: true, label: 'All values' }, ], }, category: valueOptionsCategory, defaultValue: false, }); builder.addNumberInput({ path: 'reduceOptions.limit', name: 'Limit', description: 'Max number of rows to display', category: valueOptionsCategory, settings: { placeholder: '25', integer: true, min: 1, max: 5000, }, showIf: (options) => options.reduceOptions.values === true, }); builder.addCustomEditor({ id: 'reduceOptions.calcs', path: 'reduceOptions.calcs', name: 'Calculation', description: 'Choose a reducer function / calculation', category: valueOptionsCategory, editor: standardEditorsRegistry.get('stats-picker').editor, // TODO: Get ReducerID from generated schema one day? defaultValue: [ReducerID.lastNotNull], // Hides it when all values mode is on showIf: (currentConfig) => currentConfig.reduceOptions.values === false, }); if (includeFieldMatcher) { builder.addSelect({ path: 'reduceOptions.fields', name: 'Fields', description: 'Select the fields that should be included in the panel', category: valueOptionsCategory, settings: { allowCustomValue: true, options: [], getOptions: async (context: FieldOverrideContext) => { const options = [ { value: '', label: 'Numeric Fields' }, { value: '/.*/', label: 'All Fields' }, ]; if (context && context.data) { for (const frame of context.data) { for (const field of frame.fields) { const name = getFieldDisplayName(field, frame, context.data); const value = `/^${escapeStringForRegex(name)}$/`; options.push({ value, label: name }); } } } return Promise.resolve(options); }, }, defaultValue: '', }); } } export function addOrientationOption
( builder: PanelOptionsEditorBuilder
, category?: string[] ) { builder.addRadio({ path: 'orientation', name: 'Orientation', description: 'Layout orientation', category, settings: { options: [ { value: VizOrientation.Auto, label: 'Auto' }, { value: VizOrientation.Horizontal, label: 'Horizontal' }, { value: VizOrientation.Vertical, label: 'Vertical' }, ], }, defaultValue: VizOrientation.Auto, }); }