Fix parsing timeout (use number instead of string), fixes #1254
This commit is contained in:
@@ -2,16 +2,11 @@ package datasource
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/alexanderzobnin/grafana-zabbix/pkg/gtime"
|
||||
"github.com/alexanderzobnin/grafana-zabbix/pkg/httpclient"
|
||||
"github.com/alexanderzobnin/grafana-zabbix/pkg/settings"
|
||||
"github.com/alexanderzobnin/grafana-zabbix/pkg/zabbix"
|
||||
"github.com/alexanderzobnin/grafana-zabbix/pkg/zabbixapi"
|
||||
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend/datasource"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend/instancemgmt"
|
||||
@@ -33,7 +28,7 @@ type ZabbixDatasource struct {
|
||||
type ZabbixDatasourceInstance struct {
|
||||
zabbix *zabbix.Zabbix
|
||||
dsInfo *backend.DataSourceInstanceSettings
|
||||
Settings *ZabbixDatasourceSettings
|
||||
Settings *settings.ZabbixDatasourceSettings
|
||||
logger log.Logger
|
||||
}
|
||||
|
||||
@@ -46,36 +41,36 @@ func NewZabbixDatasource() *ZabbixDatasource {
|
||||
}
|
||||
|
||||
// newZabbixDatasourceInstance returns an initialized zabbix datasource instance
|
||||
func newZabbixDatasourceInstance(settings backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) {
|
||||
func newZabbixDatasourceInstance(dsSettings backend.DataSourceInstanceSettings) (instancemgmt.Instance, error) {
|
||||
logger := log.New()
|
||||
logger.Debug("Initializing new data source instance")
|
||||
|
||||
zabbixSettings, err := readZabbixSettings(&settings)
|
||||
zabbixSettings, err := settings.ReadZabbixSettings(&dsSettings)
|
||||
if err != nil {
|
||||
logger.Error("Error parsing Zabbix settings", "error", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
client, err := httpclient.New(&settings, zabbixSettings.Timeout)
|
||||
client, err := httpclient.New(&dsSettings, zabbixSettings.Timeout)
|
||||
if err != nil {
|
||||
logger.Error("Error initializing HTTP client", "error", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
zabbixAPI, err := zabbixapi.New(settings.URL, client)
|
||||
zabbixAPI, err := zabbixapi.New(dsSettings.URL, client)
|
||||
if err != nil {
|
||||
logger.Error("Error initializing Zabbix API", "error", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
zabbixClient, err := zabbix.New(&settings, zabbixAPI)
|
||||
zabbixClient, err := zabbix.New(&dsSettings, zabbixSettings, zabbixAPI)
|
||||
if err != nil {
|
||||
logger.Error("Error initializing Zabbix client", "error", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &ZabbixDatasourceInstance{
|
||||
dsInfo: &settings,
|
||||
dsInfo: &dsSettings,
|
||||
zabbix: zabbixClient,
|
||||
Settings: zabbixSettings,
|
||||
logger: logger,
|
||||
@@ -153,58 +148,3 @@ func (ds *ZabbixDatasource) getDSInstance(pluginContext backend.PluginContext) (
|
||||
}
|
||||
return instance.(*ZabbixDatasourceInstance), nil
|
||||
}
|
||||
|
||||
func readZabbixSettings(dsInstanceSettings *backend.DataSourceInstanceSettings) (*ZabbixDatasourceSettings, error) {
|
||||
zabbixSettingsDTO := &ZabbixDatasourceSettingsDTO{}
|
||||
|
||||
err := json.Unmarshal(dsInstanceSettings.JSONData, &zabbixSettingsDTO)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if zabbixSettingsDTO.TrendsFrom == "" {
|
||||
zabbixSettingsDTO.TrendsFrom = "7d"
|
||||
}
|
||||
if zabbixSettingsDTO.TrendsRange == "" {
|
||||
zabbixSettingsDTO.TrendsRange = "4d"
|
||||
}
|
||||
if zabbixSettingsDTO.CacheTTL == "" {
|
||||
zabbixSettingsDTO.CacheTTL = "1h"
|
||||
}
|
||||
|
||||
if zabbixSettingsDTO.Timeout == "" {
|
||||
zabbixSettingsDTO.Timeout = "30"
|
||||
}
|
||||
|
||||
trendsFrom, err := gtime.ParseInterval(zabbixSettingsDTO.TrendsFrom)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
trendsRange, err := gtime.ParseInterval(zabbixSettingsDTO.TrendsRange)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
cacheTTL, err := gtime.ParseInterval(zabbixSettingsDTO.CacheTTL)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
timeout, err := strconv.Atoi(zabbixSettingsDTO.Timeout)
|
||||
if err != nil {
|
||||
return nil, errors.New("failed to parse timeout: " + err.Error())
|
||||
}
|
||||
|
||||
zabbixSettings := &ZabbixDatasourceSettings{
|
||||
Trends: zabbixSettingsDTO.Trends,
|
||||
TrendsFrom: trendsFrom,
|
||||
TrendsRange: trendsRange,
|
||||
CacheTTL: cacheTTL,
|
||||
Timeout: time.Duration(timeout) * time.Second,
|
||||
DisableDataAlignment: zabbixSettingsDTO.DisableDataAlignment,
|
||||
DisableReadOnlyUsersAck: zabbixSettingsDTO.DisableReadOnlyUsersAck,
|
||||
}
|
||||
|
||||
return zabbixSettings, nil
|
||||
}
|
||||
|
||||
@@ -21,30 +21,6 @@ const (
|
||||
MODE_PROBLEMS = "5"
|
||||
)
|
||||
|
||||
// ZabbixDatasourceSettingsDTO model
|
||||
type ZabbixDatasourceSettingsDTO struct {
|
||||
Trends bool `json:"trends"`
|
||||
TrendsFrom string `json:"trendsFrom"`
|
||||
TrendsRange string `json:"trendsRange"`
|
||||
CacheTTL string `json:"cacheTTL"`
|
||||
Timeout string `json:"timeout"`
|
||||
|
||||
DisableDataAlignment bool `json:"disableDataAlignment"`
|
||||
DisableReadOnlyUsersAck bool `json:"disableReadOnlyUsersAck"`
|
||||
}
|
||||
|
||||
// ZabbixDatasourceSettings model
|
||||
type ZabbixDatasourceSettings struct {
|
||||
Trends bool
|
||||
TrendsFrom time.Duration
|
||||
TrendsRange time.Duration
|
||||
CacheTTL time.Duration
|
||||
Timeout time.Duration
|
||||
|
||||
DisableDataAlignment bool `json:"disableDataAlignment"`
|
||||
DisableReadOnlyUsersAck bool `json:"disableReadOnlyUsersAck"`
|
||||
}
|
||||
|
||||
type DBConnectionPostProcessingRequest struct {
|
||||
Query QueryModel `json:"query"`
|
||||
TimeRange TimeRangePostProcessingRequest `json:"timeRange"`
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package datasource
|
||||
|
||||
import (
|
||||
"github.com/alexanderzobnin/grafana-zabbix/pkg/settings"
|
||||
"github.com/alexanderzobnin/grafana-zabbix/pkg/zabbix"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
|
||||
@@ -23,7 +24,7 @@ func mockZabbixQuery(method string, params zabbix.ZabbixAPIParams) *zabbix.Zabbi
|
||||
}
|
||||
|
||||
func MockZabbixDataSource(body string, statusCode int) *ZabbixDatasourceInstance {
|
||||
zabbixSettings, _ := readZabbixSettings(basicDatasourceInfo)
|
||||
zabbixSettings, _ := settings.ReadZabbixSettings(basicDatasourceInfo)
|
||||
zabbixClient, _ := zabbix.MockZabbixClient(basicDatasourceInfo, body, statusCode)
|
||||
|
||||
return &ZabbixDatasourceInstance{
|
||||
|
||||
27
pkg/settings/models.go
Normal file
27
pkg/settings/models.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package settings
|
||||
|
||||
import "time"
|
||||
|
||||
// ZabbixDatasourceSettingsDTO model
|
||||
type ZabbixDatasourceSettingsDTO struct {
|
||||
Trends bool `json:"trends"`
|
||||
TrendsFrom string `json:"trendsFrom"`
|
||||
TrendsRange string `json:"trendsRange"`
|
||||
CacheTTL string `json:"cacheTTL"`
|
||||
Timeout interface{} `json:"timeout"`
|
||||
|
||||
DisableDataAlignment bool `json:"disableDataAlignment"`
|
||||
DisableReadOnlyUsersAck bool `json:"disableReadOnlyUsersAck"`
|
||||
}
|
||||
|
||||
// ZabbixDatasourceSettings model
|
||||
type ZabbixDatasourceSettings struct {
|
||||
Trends bool
|
||||
TrendsFrom time.Duration
|
||||
TrendsRange time.Duration
|
||||
CacheTTL time.Duration
|
||||
Timeout time.Duration
|
||||
|
||||
DisableDataAlignment bool `json:"disableDataAlignment"`
|
||||
DisableReadOnlyUsersAck bool `json:"disableReadOnlyUsersAck"`
|
||||
}
|
||||
@@ -1,16 +1,15 @@
|
||||
package zabbix
|
||||
package settings
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/alexanderzobnin/grafana-zabbix/pkg/gtime"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
"strconv"
|
||||
"time"
|
||||
)
|
||||
|
||||
func readZabbixSettings(dsInstanceSettings *backend.DataSourceInstanceSettings) (*ZabbixDatasourceSettings, error) {
|
||||
func ReadZabbixSettings(dsInstanceSettings *backend.DataSourceInstanceSettings) (*ZabbixDatasourceSettings, error) {
|
||||
zabbixSettingsDTO := &ZabbixDatasourceSettingsDTO{}
|
||||
|
||||
err := json.Unmarshal(dsInstanceSettings.JSONData, &zabbixSettingsDTO)
|
||||
@@ -28,9 +27,9 @@ func readZabbixSettings(dsInstanceSettings *backend.DataSourceInstanceSettings)
|
||||
zabbixSettingsDTO.CacheTTL = "1h"
|
||||
}
|
||||
|
||||
if zabbixSettingsDTO.Timeout == "" {
|
||||
zabbixSettingsDTO.Timeout = "30"
|
||||
}
|
||||
//if zabbixSettingsDTO.Timeout == 0 {
|
||||
// zabbixSettingsDTO.Timeout = 30
|
||||
//}
|
||||
|
||||
trendsFrom, err := gtime.ParseInterval(zabbixSettingsDTO.TrendsFrom)
|
||||
if err != nil {
|
||||
@@ -47,17 +46,32 @@ func readZabbixSettings(dsInstanceSettings *backend.DataSourceInstanceSettings)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
timeout, err := strconv.Atoi(zabbixSettingsDTO.Timeout)
|
||||
if err != nil {
|
||||
return nil, errors.New("failed to parse timeout: " + err.Error())
|
||||
var timeout int64
|
||||
switch t := zabbixSettingsDTO.Timeout.(type) {
|
||||
case string:
|
||||
if t == "" {
|
||||
timeout = 30
|
||||
break
|
||||
}
|
||||
timeoutInt, err := strconv.Atoi(t)
|
||||
if err != nil {
|
||||
return nil, errors.New("failed to parse timeout: " + err.Error())
|
||||
}
|
||||
timeout = int64(timeoutInt)
|
||||
case float64:
|
||||
timeout = int64(t)
|
||||
default:
|
||||
timeout = 30
|
||||
}
|
||||
|
||||
zabbixSettings := &ZabbixDatasourceSettings{
|
||||
Trends: zabbixSettingsDTO.Trends,
|
||||
TrendsFrom: trendsFrom,
|
||||
TrendsRange: trendsRange,
|
||||
CacheTTL: cacheTTL,
|
||||
Timeout: time.Duration(timeout) * time.Second,
|
||||
Trends: zabbixSettingsDTO.Trends,
|
||||
TrendsFrom: trendsFrom,
|
||||
TrendsRange: trendsRange,
|
||||
CacheTTL: cacheTTL,
|
||||
Timeout: time.Duration(timeout) * time.Second,
|
||||
DisableDataAlignment: zabbixSettingsDTO.DisableDataAlignment,
|
||||
DisableReadOnlyUsersAck: zabbixSettingsDTO.DisableReadOnlyUsersAck,
|
||||
}
|
||||
|
||||
return zabbixSettings, nil
|
||||
@@ -1,8 +1,10 @@
|
||||
package zabbix
|
||||
|
||||
import (
|
||||
"github.com/alexanderzobnin/grafana-zabbix/pkg/settings"
|
||||
"github.com/alexanderzobnin/grafana-zabbix/pkg/zabbixapi"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
"time"
|
||||
)
|
||||
|
||||
func MockZabbixClient(dsInfo *backend.DataSourceInstanceSettings, body string, statusCode int) (*Zabbix, error) {
|
||||
@@ -10,8 +12,11 @@ func MockZabbixClient(dsInfo *backend.DataSourceInstanceSettings, body string, s
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
zabbixSettings := &settings.ZabbixDatasourceSettings{
|
||||
Timeout: 10 * time.Second,
|
||||
}
|
||||
|
||||
client, err := New(dsInfo, zabbixAPI)
|
||||
client, err := New(dsInfo, zabbixSettings, zabbixAPI)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/alexanderzobnin/grafana-zabbix/pkg/settings"
|
||||
"github.com/alexanderzobnin/grafana-zabbix/pkg/zabbixapi"
|
||||
"github.com/bitly/go-simplejson"
|
||||
"github.com/grafana/grafana-plugin-sdk-go/backend"
|
||||
@@ -22,15 +23,8 @@ type Zabbix struct {
|
||||
}
|
||||
|
||||
// New returns new instance of Zabbix client.
|
||||
func New(dsInfo *backend.DataSourceInstanceSettings, zabbixAPI *zabbixapi.ZabbixAPI) (*Zabbix, error) {
|
||||
func New(dsInfo *backend.DataSourceInstanceSettings, zabbixSettings *settings.ZabbixDatasourceSettings, zabbixAPI *zabbixapi.ZabbixAPI) (*Zabbix, error) {
|
||||
logger := log.New()
|
||||
|
||||
zabbixSettings, err := readZabbixSettings(dsInfo)
|
||||
if err != nil {
|
||||
logger.Error("Error parsing Zabbix settings", "error", err)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
zabbixCache := NewZabbixCache(zabbixSettings.CacheTTL, 10*time.Minute)
|
||||
|
||||
return &Zabbix{
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import React, { useEffect, useState } from 'react';
|
||||
import { getDataSourceSrv } from '@grafana/runtime';
|
||||
import { DataSourcePluginOptionsEditorProps, DataSourceSettings, SelectableValue } from '@grafana/data';
|
||||
import { DataSourceHttpSettings, LegacyForms, Field, Input, Button, InlineFormLabel, Select } from '@grafana/ui';
|
||||
const { FormField, Switch } = LegacyForms;
|
||||
import { Button, DataSourceHttpSettings, InlineFormLabel, LegacyForms, Select } from '@grafana/ui';
|
||||
import { ZabbixDSOptions, ZabbixSecureJSONData } from '../types';
|
||||
|
||||
const { FormField, Switch } = LegacyForms;
|
||||
|
||||
const SUPPORTED_SQL_DS = ['mysql', 'postgres', 'influxdb'];
|
||||
|
||||
export type Props = DataSourcePluginOptionsEditorProps<ZabbixDSOptions, ZabbixSecureJSONData>;
|
||||
@@ -34,7 +35,7 @@ export const ConfigEditor = (props: Props) => {
|
||||
trendsFrom: '',
|
||||
trendsRange: '',
|
||||
cacheTTL: '',
|
||||
timeout: '',
|
||||
timeout: undefined,
|
||||
disableDataAlignment: false,
|
||||
...restJsonData,
|
||||
},
|
||||
@@ -99,7 +100,7 @@ export const ConfigEditor = (props: Props) => {
|
||||
placeholder="Configured"
|
||||
/>
|
||||
<Button onClick={resetSecureJsonField('password', options, onOptionsChange)}>Reset</Button>
|
||||
</>:
|
||||
</> :
|
||||
<FormField
|
||||
labelWidth={7}
|
||||
inputWidth={15}
|
||||
@@ -118,32 +119,32 @@ export const ConfigEditor = (props: Props) => {
|
||||
onChange={jsonDataSwitchHandler('trends', options, onOptionsChange)}
|
||||
/>
|
||||
{options.jsonData.trends &&
|
||||
<>
|
||||
<div className="gf-form">
|
||||
<FormField
|
||||
labelWidth={7}
|
||||
inputWidth={4}
|
||||
label="After"
|
||||
value={options.jsonData.trendsFrom || ''}
|
||||
placeholder="7d"
|
||||
onChange={jsonDataChangeHandler('trendsFrom', options, onOptionsChange)}
|
||||
tooltip="Time after which trends will be used.
|
||||
<>
|
||||
<div className="gf-form">
|
||||
<FormField
|
||||
labelWidth={7}
|
||||
inputWidth={4}
|
||||
label="After"
|
||||
value={options.jsonData.trendsFrom || ''}
|
||||
placeholder="7d"
|
||||
onChange={jsonDataChangeHandler('trendsFrom', options, onOptionsChange)}
|
||||
tooltip="Time after which trends will be used.
|
||||
Best practice is to set this value to your history storage period (7d, 30d, etc)."
|
||||
/>
|
||||
</div>
|
||||
<div className="gf-form">
|
||||
<FormField
|
||||
labelWidth={7}
|
||||
inputWidth={4}
|
||||
label="Range"
|
||||
value={options.jsonData.trendsRange || ''}
|
||||
placeholder="4d"
|
||||
onChange={jsonDataChangeHandler('trendsRange', options, onOptionsChange)}
|
||||
tooltip="Time range width after which trends will be used instead of history.
|
||||
/>
|
||||
</div>
|
||||
<div className="gf-form">
|
||||
<FormField
|
||||
labelWidth={7}
|
||||
inputWidth={4}
|
||||
label="Range"
|
||||
value={options.jsonData.trendsRange || ''}
|
||||
placeholder="4d"
|
||||
onChange={jsonDataChangeHandler('trendsRange', options, onOptionsChange)}
|
||||
tooltip="Time range width after which trends will be used instead of history.
|
||||
It's better to set this value in range of 4 to 7 days to prevent loading large amount of history data."
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
/>
|
||||
</div>
|
||||
</>
|
||||
}
|
||||
<div className="gf-form">
|
||||
<FormField
|
||||
@@ -160,10 +161,15 @@ export const ConfigEditor = (props: Props) => {
|
||||
<FormField
|
||||
labelWidth={7}
|
||||
inputWidth={4}
|
||||
type="number"
|
||||
label="Timeout"
|
||||
value={options.jsonData.timeout || ''}
|
||||
placeholder="30"
|
||||
onChange={jsonDataChangeHandler('timeout', options, onOptionsChange)}
|
||||
value={options.jsonData.timeout}
|
||||
onChange={(event) => {
|
||||
onOptionsChange({
|
||||
...options,
|
||||
jsonData: { ...options.jsonData, timeout: parseInt(event.currentTarget.value, 10) },
|
||||
});
|
||||
}}
|
||||
tooltip="Zabbix API connection timeout in seconds. Default is 30."
|
||||
/>
|
||||
</div>
|
||||
@@ -178,31 +184,31 @@ export const ConfigEditor = (props: Props) => {
|
||||
onChange={jsonDataSwitchHandler('dbConnectionEnable', options, onOptionsChange)}
|
||||
/>
|
||||
{options.jsonData.dbConnectionEnable &&
|
||||
<>
|
||||
<div className="gf-form">
|
||||
<InlineFormLabel width={9}>Data Source</InlineFormLabel>
|
||||
<Select
|
||||
width={32}
|
||||
options={getDirectDBDSOptions()}
|
||||
value={selectedDBDatasource}
|
||||
onChange={directDBDatasourceChanegeHandler(options, onOptionsChange, setSelectedDBDatasource, setCurrentDSType)}
|
||||
/>
|
||||
</div>
|
||||
{currentDSType === 'influxdb' &&
|
||||
<div className="gf-form">
|
||||
<FormField
|
||||
labelWidth={9}
|
||||
inputWidth={16}
|
||||
label="Retention Policy"
|
||||
value={options.jsonData.dbConnectionRetentionPolicy || ''}
|
||||
placeholder="Retention policy name"
|
||||
onChange={jsonDataChangeHandler('dbConnectionRetentionPolicy', options, onOptionsChange)}
|
||||
tooltip="Specify retention policy name for fetching long-term stored data (optional).
|
||||
<>
|
||||
<div className="gf-form">
|
||||
<InlineFormLabel width={9}>Data Source</InlineFormLabel>
|
||||
<Select
|
||||
width={32}
|
||||
options={getDirectDBDSOptions()}
|
||||
value={selectedDBDatasource}
|
||||
onChange={directDBDatasourceChanegeHandler(options, onOptionsChange, setSelectedDBDatasource, setCurrentDSType)}
|
||||
/>
|
||||
</div>
|
||||
{currentDSType === 'influxdb' &&
|
||||
<div className="gf-form">
|
||||
<FormField
|
||||
labelWidth={9}
|
||||
inputWidth={16}
|
||||
label="Retention Policy"
|
||||
value={options.jsonData.dbConnectionRetentionPolicy || ''}
|
||||
placeholder="Retention policy name"
|
||||
onChange={jsonDataChangeHandler('dbConnectionRetentionPolicy', options, onOptionsChange)}
|
||||
tooltip="Specify retention policy name for fetching long-term stored data (optional).
|
||||
Leave it blank if only default retention policy used."
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
</>
|
||||
/>
|
||||
</div>
|
||||
}
|
||||
</>
|
||||
}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -106,7 +106,7 @@ function convertToRegex(str) {
|
||||
}
|
||||
}
|
||||
|
||||
export const DS_CONFIG_SCHEMA = 2;
|
||||
export const DS_CONFIG_SCHEMA = 3;
|
||||
|
||||
export function migrateDSConfig(jsonData) {
|
||||
if (!jsonData) {
|
||||
@@ -127,6 +127,10 @@ export function migrateDSConfig(jsonData) {
|
||||
delete jsonData.dbConnection;
|
||||
}
|
||||
|
||||
if (oldVersion < 3) {
|
||||
jsonData.timeout = (jsonData.timeout as string) === "" ? null : Number(jsonData.timeout as string);
|
||||
}
|
||||
|
||||
return jsonData;
|
||||
}
|
||||
|
||||
@@ -134,7 +138,7 @@ function shouldMigrateDSConfig(jsonData): boolean {
|
||||
if (jsonData.dbConnection && !_.isEmpty(jsonData.dbConnection)) {
|
||||
return true;
|
||||
}
|
||||
if (jsonData.schema && jsonData.schema !== DS_CONFIG_SCHEMA) {
|
||||
if (jsonData.schema && jsonData.schema < DS_CONFIG_SCHEMA) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -7,7 +7,7 @@ export interface ZabbixDSOptions extends DataSourceJsonData {
|
||||
trendsFrom: string;
|
||||
trendsRange: string;
|
||||
cacheTTL: string;
|
||||
timeout?: string;
|
||||
timeout?: number;
|
||||
dbConnectionEnable: boolean;
|
||||
dbConnectionDatasourceId?: number;
|
||||
dbConnectionDatasourceName?: string;
|
||||
|
||||
Reference in New Issue
Block a user