2021-02-10 07:01:59 -06:00
|
|
|
import { PanelPlugin, LogsSortOrder, LogsDedupStrategy, LogsDedupDescription } from '@grafana/data';
|
2022-04-22 08:33:13 -05:00
|
|
|
|
2019-08-26 01:11:07 -05:00
|
|
|
import { LogsPanel } from './LogsPanel';
|
2021-11-15 08:13:01 -06:00
|
|
|
import { LogsPanelSuggestionsSupplier } from './suggestions';
|
2022-04-22 08:33:13 -05:00
|
|
|
import { Options } from './types';
|
2019-08-26 01:11:07 -05:00
|
|
|
|
2021-11-15 08:13:01 -06:00
|
|
|
export const plugin = new PanelPlugin<Options>(LogsPanel)
|
|
|
|
.setPanelOptions((builder) => {
|
|
|
|
builder
|
|
|
|
.addBooleanSwitch({
|
|
|
|
path: 'showTime',
|
|
|
|
name: 'Time',
|
|
|
|
description: '',
|
|
|
|
defaultValue: false,
|
|
|
|
})
|
|
|
|
.addBooleanSwitch({
|
|
|
|
path: 'showLabels',
|
|
|
|
name: 'Unique labels',
|
|
|
|
description: '',
|
|
|
|
defaultValue: false,
|
|
|
|
})
|
|
|
|
.addBooleanSwitch({
|
|
|
|
path: 'showCommonLabels',
|
|
|
|
name: 'Common labels',
|
|
|
|
description: '',
|
|
|
|
defaultValue: false,
|
|
|
|
})
|
|
|
|
.addBooleanSwitch({
|
|
|
|
path: 'wrapLogMessage',
|
|
|
|
name: 'Wrap lines',
|
|
|
|
description: '',
|
|
|
|
defaultValue: false,
|
|
|
|
})
|
|
|
|
.addBooleanSwitch({
|
|
|
|
path: 'prettifyLogMessage',
|
|
|
|
name: 'Prettify JSON',
|
|
|
|
description: '',
|
|
|
|
defaultValue: false,
|
|
|
|
})
|
|
|
|
.addBooleanSwitch({
|
|
|
|
path: 'enableLogDetails',
|
|
|
|
name: 'Enable log details',
|
|
|
|
description: '',
|
|
|
|
defaultValue: true,
|
|
|
|
})
|
|
|
|
.addRadio({
|
|
|
|
path: 'dedupStrategy',
|
|
|
|
name: 'Deduplication',
|
|
|
|
description: '',
|
|
|
|
settings: {
|
|
|
|
options: [
|
|
|
|
{ value: LogsDedupStrategy.none, label: 'None', description: LogsDedupDescription[LogsDedupStrategy.none] },
|
|
|
|
{
|
|
|
|
value: LogsDedupStrategy.exact,
|
|
|
|
label: 'Exact',
|
|
|
|
description: LogsDedupDescription[LogsDedupStrategy.exact],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: LogsDedupStrategy.numbers,
|
|
|
|
label: 'Numbers',
|
|
|
|
description: LogsDedupDescription[LogsDedupStrategy.numbers],
|
|
|
|
},
|
|
|
|
{
|
|
|
|
value: LogsDedupStrategy.signature,
|
|
|
|
label: 'Signature',
|
|
|
|
description: LogsDedupDescription[LogsDedupStrategy.signature],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
defaultValue: LogsDedupStrategy.none,
|
|
|
|
})
|
|
|
|
.addRadio({
|
|
|
|
path: 'sortOrder',
|
|
|
|
name: 'Order',
|
|
|
|
description: '',
|
|
|
|
settings: {
|
|
|
|
options: [
|
2022-02-21 06:09:43 -06:00
|
|
|
{ value: LogsSortOrder.Descending, label: 'Newest first' },
|
|
|
|
{ value: LogsSortOrder.Ascending, label: 'Oldest first' },
|
2021-11-15 08:13:01 -06:00
|
|
|
],
|
|
|
|
},
|
|
|
|
defaultValue: LogsSortOrder.Descending,
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.setSuggestionsSupplier(new LogsPanelSuggestionsSupplier());
|