{
    "type": "panel",
    "label": "InfluxDB Backup",
    "items": {
        "_checkConfig": {
            // this component is not visible in the UI
            // it checks the configuration
            "type": "custom",
            "i18n": true,
            "url": "custom/customComponents.js",
            "name": "ConfigCustomBackItUpSet/Components/CheckAllConfigInvisible"
        },
        "_header": {
            "type": "header",
            "size": 2,
            "text": "InfluxDB Backup",
            "sm": 12
        },
        "detectNow": {
            "type": "custom",
            "hidden": "data.influxDBMulti",
            "button": true,
            "variant": "contained",
            "url": "custom/customComponents.js",
            "name": "ConfigCustomBackItUpSet/Components/DetectConfig",
            "adapter": "influxDB",
            "icon": "search",
            "label": "Detect config",
            "xs": 12,
            "sm": 9,
            "md": 6,
            "lg": 3
        },
        "_helpLine1": {
            "hidden": "data.influxDBMulti",
            "newLine": true,
            "type": "divider",
            "color": "primary"
        },
        "influxDBType": {
            "type": "select",
            "label": "Source type",
            "xs": 12,
            "sm": 9,
            "md": 6,
            "lg": 4,
            "options": [
                {
                    "label": "Remote",
                    "value": "remote"
                },
                {
                    "label": "Local",
                    "value": "local"
                }
            ],
            "newLine": true
        },
        "influxDBHost": {
            "hidden": "data.influxDBMulti || data.influxDBType == 'local'",
            "xs": 12,
            "sm": 9,
            "md": 6,
            "lg": 4,
            "type": "text",
            "label": "host",
            "help": "InfluxDB Hostname (leave blank to save locally only)",
            "validator": "data.influxDBHost && data.influxDBType == 'remote'",
			"validatorNoSaveOnError": true,
            "newLine": true
        },
        "influxDBPort": {
            "hidden": "data.influxDBMulti || data.influxDBType == 'local'",
            "xs": 12,
            "sm": 9,
            "md": 6,
            "lg": 4,
            "min": 1,
            "max": 65535,
            "type": "number",
            "label": "InfluxDB port",
            "validator": "data.influxDBPort && data.influxDBType == 'remote'",
			"validatorNoSaveOnError": true,
            "help": "default: 8088"
        },
        "influxDBProtocol": {
            "hidden": "data.influxDBMulti || data.influxDBType == 'local'",
            "type": "select",
            "label": "Protocol",
            "xs": 12,
            "sm": 9,
            "md": 6,
            "lg": 4,
            "noTranslations": true,
            "options": [
                {
                    "label": "http",
                    "value": "http"
                },
                {
                    "label": "https",
                    "value": "https"
                }
            ],
        },
        "influxDBVersion": {
            "hidden": "data.influxDBMulti",
            "type": "select",
            "label": "Database version",
            "xs": 12,
            "sm": 9,
            "md": 6,
            "lg": 4,
            "noTranslations": true,
            "options": [
                {
                    "label": "1.x",
                    "value": "1.x"
                },
                {
                    "label": "2.x",
                    "value": "2.x"
                }
            ],
            "newLine": true
        },
        "influxDBName": {
            "hidden": "data.influxDBMulti",
            "xs": 12,
            "sm": 9,
            "md": 6,
            "lg": 4,
            "type": "text",
            "label": "InfluxDB database name",
            "validator": "data.influxDBName",
			"validatorNoSaveOnError": true,
        },
        "influxDBDumpExe": {
            "xs": 12,
            "sm": 9,
            "md": 6,
            "lg": 4,
            "type": "text",
            "label": "Full path",
            "help": "Path with filename to InfluxDB executable (leave empty to use default)",
        },
        "influxDBToken": {
            "hidden": "data.influxDBMulti || data.influxDBVersion == '1.x'",
            "xs": 12,
            "sm": 12,
            "md": 12,
            "lg": 12,
            "type": "password",
            "visible": true,
            "label": "InfluxDB database token",
            "validator": "data.influxDBToken || data.influxDBVersion == '1.x'",
			"validatorNoSaveOnError": true,
            "newLine": true
        },
        "influxDBMulti": {
            "type": "checkbox",
            "label": "Backup of several systems",
            "xs": 12,
            "sm": 9,
            "md": 6,
            "lg": 4,
            "newLine": true
        },
        "deleteOldDataBase": {
            "hidden": "data.influxDBType == 'remote'",
            "type": "checkbox",
            "label": "Automatically delete old Influx-database before restore",
            "xs": 12,
            "sm": 9,
            "md": 6,
            "lg": 4,
        },
        "_helpLine2": {
            "hidden": "!data.influxDBMulti",
            "newLine": true,
            "type": "divider",
            "color": "primary"
        },
        "influxDBEvents": {
            "newLine": true,
            "type": "table",
            "xs": 12,
            "sm": 12,
            "md": 12,
            "lg": 12,
            "label": "InfluxDB hosts",
            "hidden": "!data.influxDBMulti",
            "labelsInHeader": true,
            "items": [
                {
                    "attr": "host",
                    "type": "text",
                    "title": "host",
                    "hidden": "globalData.influxDBType == 'local'",
                    "validator": "data.host && globalData.influxDBType == 'remote'",
			        "validatorNoSaveOnError": true,
                    width: "15%"
                },
                {
                    "attr": "port",
                    "type": "number",
                    "title": "Port",
                    "hidden": "globalData.influxDBType == 'local'",
                    default: 8088,
                    "validator": "data.port && globalData.influxDBType == 'remote'",
			        "validatorNoSaveOnError": true,
                    width: "7%"
                },
                {
                    "attr": "dbName",
                    "type": "text",
                    "title": "Database name",
                    "validator": "data.dbName",
			        "validatorNoSaveOnError": true,
                    width: "15%"
                },
                {
                    "attr": "nameSuffix",
                    "type": "text",
                    "title": "Name suffix",
                    width: "15%"
                },
                {
                    "attr": "token",
                    "type": "password",
                    "title": "Token (only for v2.x)",
                    "disabled": "data.dbversion == '1.x'",
                    "validator": "data.token || data.dbversion == '1.x'",
			        "validatorNoSaveOnError": true,
                    width: "25%"
                },
                {
                    "attr": "protocol",
                    "type": "select",
                    default: "http",
                    "noTranslations": true,
                    "options": [
                        {
                            "label": "http",
                            "value": "http"
                        },
                        {
                            "label": "https",
                            "value": "https"
                        }
                    ],
                    "title": "Protocol",
                    "hidden": "globalData.influxDBType == 'local'",
                    width: "10%"
                },
                {
                    "attr": "dbversion",
                    "type": "select",
                    "noTranslations": true,
                    default: "1.x",
                    "options": [
                        {
                            "label": "1.x",
                            "value": "1.x"
                        },
                        {
                            "label": "2.x",
                            "value": "2.x"
                        }
                    ],
                    "title": "Version",
                    width: "10%"
                }
            ]
        },
        "_helpText1": {
            "type": "staticText",
            "text": "Configuring remote connections. For detailed information please read the documentation of InfluxDB!",
            "sm": 12,
            "newLine": true
        },
        "_helpLink": {
            "type": "staticLink",
            "button": true,
            "variant": "outlined",
            "icon": "info",
            "label": "*** Open InfluxDB Documentation ***",
            "href": "https://docs.influxdata.com/influxdb/v1.8/administration/backup_and_restore/#configuring-remote-connections",
            "newLine": true,
            "xs": 12,
            "sm": 12,
            "md": 12,
            "lg": 12,
        }
    }
}
