Problems: add default limit

This commit is contained in:
Alexander Zobnin
2020-05-15 18:33:22 +03:00
parent 056f82731e
commit b94a6c4841
4 changed files with 13 additions and 2 deletions

View File

@@ -44,3 +44,5 @@ export const TRIGGER_SEVERITY = [
export const MIN_SLA_INTERVAL = 3600; export const MIN_SLA_INTERVAL = 3600;
export const RANGE_VARIABLE_VALUE = 'range_series'; export const RANGE_VARIABLE_VALUE = 'range_series';
export const DEFAULT_ZABBIX_PROBLEMS_LIMIT = 1001;

View File

@@ -42,10 +42,11 @@ function getProblemsTargetDefaults() {
return { return {
showProblems: ShowProblemTypes.Problems, showProblems: ShowProblemTypes.Problems,
options: { options: {
sortTriggersBy: 'default', sortProblems: 'default',
acknowledged: 2, acknowledged: 2,
hostsInMaintenance: false, hostsInMaintenance: false,
hostProxy: false, hostProxy: false,
limit: c.DEFAULT_ZABBIX_PROBLEMS_LIMIT,
}, },
}; };
} }
@@ -386,7 +387,7 @@ export class ZabbixQueryController extends QueryCtrl {
}; };
const problemsOptionsMap = { const problemsOptionsMap = {
sortTriggersBy: "Sort problems", sortProblems: "Sort problems",
acknowledged: "Acknowledged", acknowledged: "Acknowledged",
skipEmptyValues: "Skip empty values", skipEmptyValues: "Skip empty values",
hostsInMaintenance: "Show hosts in maintenance", hostsInMaintenance: "Show hosts in maintenance",

View File

@@ -123,10 +123,17 @@ function migrateOptions(panel) {
acknowledged = 0; acknowledged = 0;
} }
// Default limit in Zabbix
let limit = 1001;
if (panel.limit && panel.limit !== 100) {
limit = panel.limit;
}
return { return {
hostsInMaintenance: panel.hostsInMaintenance, hostsInMaintenance: panel.hostsInMaintenance,
sortProblems: panel.sortTriggersBy?.value === 'priority' ? 'priority' : 'default', sortProblems: panel.sortTriggersBy?.value === 'priority' ? 'priority' : 'default',
acknowledged: acknowledged, acknowledged: acknowledged,
limit: limit,
}; };
} }

View File

@@ -67,6 +67,7 @@ describe('Triggers Panel schema migration', () => {
hostsInMaintenance: false, hostsInMaintenance: false,
acknowledged: 0, acknowledged: 0,
sortProblems: 'default', sortProblems: 'default',
limit: 10,
}, },
} }
], ],