influxdata / influxdata/influxdb

Export and Import dashboard functionality on GUI not working

Open
#24,906 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

__Steps to reproduce:__
List the minimal actions needed to reproduce the behaviour.

1. Export a dashboard(JSON) from UI of Influxdb instance say named `A`. Pasted the example json below:-
```
{
"meta": {
"version": "1",
"type": "dashboard",
"name": "Sensor Connection Status-Template",
"description": "template created from dashboard: Sensor Connection Status"
},
"content": {
"data": {
"type": "dashboard",
"attributes": {
"name": "Sensor Connection Status",
"description": ""
},
"relationships": {
"label": {
"data": []
},
"cell": {
"data": [
{
"type": "cell",
"id": "0a3ef58d23587000"
},
{
"type": "cell",
"id": "0a40351ac9987000"
},
{
"type": "cell",
"id": "0a405e2ec0d87000"
},
{
"type": "cell",
"id": "0a405e5f6a187000"
},
{
"type": "cell",
"id": "0a41a389ce827000"
}
]
},
"variable": {
"data": []
}
}
},
"included": [
{
"id": "0a3ef58d23587000",
"type": "cell",
"attributes": {
"x": 0,
"y": 0,
"w": 3,
"h": 7
},
"relationships": {
"view": {
"data": {
"type": "view",
"id": "0a3ef58d23587000"
}
}
}
},
{
"id": "0a40351ac9987000",
"type": "cell",
"attributes": {
"x": 3,
"y": 0,
"w": 9,
"h": 3
},
"relationships": {
"view": {
"data": {
"type": "view",
"id": "0a40351ac9987000"
}
}
}
},
{
"id": "0a405e2ec0d87000",
"type": "cell",
"attributes": {
"x": 3,
"y": 3,
"w": 3,
"h": 4
},
"relationships": {
"view": {
"data": {
"type": "view",
"id": "0a405e2ec0d87000"
}
}
}
},
{
"id": "0a405e5f6a187000",
"type": "cell",
"attributes": {
"x": 6,
"y": 3,
"w": 3,
"h": 4
},
"relationships": {
"view": {
"data": {
"type": "view",
"id": "0a405e5f6a187000"
}
}
}
},
{
"id": "0a41a389ce827000",
"type": "cell",
"attributes": {
"x": 9,
"y": 3,
"w": 3,
"h": 4
},
"relationships": {
"view": {
"data": {
"type": "view",
"id": "0a41a389ce827000"
}
}
}
},
{
"type": "view",
"id": "0a3ef58d23587000",
"attributes": {
"name": "Power Sensors Active in Timerange",
"properties": {
"shape": "chronograf-v2",
"type": "table",
"queries": [
{
"text": "import \"strings\"\r\nimport \"sql\"\r\nimport \"join\"\r\nimport \"array\"\r\nimport \"influxdata/influxdb/secrets\"\r\n\r\nisActive = (tables=<-,x) =>\r\n\ttables\r\n \t|> timeShift(duration:x)\r\n \t|> map(fn: (r) => ({sid:r.sid,_value:(r._time >= now())}))\r\n\r\nvelidb_osdb2_password = secrets.get(key: \"velidb_osdb2_password\")\r\npower_sids = sql.from(\r\n driverName: \"sqlserver\",\r\n dataSourceName: strings.joinStr(arr: [\"sqlserver://osdb2:\" ,velidb_osdb2_password, \"@velidb.database.windows.net:1433?database=VeliDB_V2.1\"], v: \"\"),\r\n //query: \"SELECT oid FROM Deployments.Oswards\",\r\n query: strings.joinStr(arr: [\"SELECT CAST( sensor_id as varchar) as sid FROM deployment.device WHERE type='power' AND enabled='True' AND sensor_id != ''\"], v: \"\")\r\n)\r\n //|> yield(name: \"custom-name\") \r\n //|> tableFind(fn: (key) => true)\r\n //|> yield(name: \"custom-name\")\r\n //|> getColumn(column: \"sid\")\r\n |> map(fn: (r) => ({ r with _value: 0 })) \r\n\r\npower_data = from(bucket: \"oswarddata\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"power\")\r\n |> filter(fn: (r) => exists(r.sid) )\r\n\r\n\r\n \r\n\r\n //|> filter(fn: (r) => r[\"_field\"] == \"P_L1\" or r[\"_field\"] == \"P_L2\" or r[\"_field\"] == \"P_L3\")\r\n |> last()\r\n\r\n |> drop(columns: [\"_start\",\"_stop\",\"_field\",\"_value\",\"_measurement\"])\r\n \r\n |> unique(column:\"sid\")\r\n |> isActive(x: -v.timeRangeStart)\r\n |> group()\r\n |> toInt() \r\n //|> yield()\r\n \r\nres = join.left(\r\n left: power_sids,\r\n right: power_data,\r\n on: (l, r) => l.sid == r.sid,\r\n as: (l, r) => ({l with _value: r._value}),\r\n)\r\n|> fill(column: \"_value\", value: 0)\r\n|> yield()",
"editMode": "advanced",
"name": "",
"builderConfig": {
"buckets": [],
"tags": [
{
"key": "_measurement",
"values": [],
"aggregateFunctionType": "filter"
}
],
"functions": [
{
"name": "mean"
}
],
"aggregateWindow": {
"period": "auto",
"fillValues": false
}
}
}
],
"colors": [
{
"id": "base",
"type": "background",
"hex": "#DC4E58",
"name": "fire",
"value": 0
},
{
"id": "4hcC80nq-gdc43awH43pt",
"type": "background",
"hex": "#32B08C",
"name": "viridian",
"value": 1
}
],
"tableOptions": {
"verticalTimeAxis": true,
"sortBy": {
"internalName": "",
"displayName": "",
"visible": false
},
"wrapping": "",
"fixFirstColumn": false
},
"fieldOptions": [
{
"internalName": "_start",
"displayName": "_start",
"visible": true
},
{
"internalName": "_stop",
"displayName": "_stop",
"visible": true
},
{
"internalName": "_time",
"displayName": "_time",
"visible": true
},
{
"internalName": "_value",
"displayName": "_value",
"visible": true
},
{
"internalName": "_field",
"displayName": "_field",
"visible": true
},
{
"internalName": "_measurement",
"displayName": "_measurement",
"visible": true
},
{
"internalName": "device_id",
"displayName": "device_id",
"visible": true
},
{
"internalName": "sid",
"displayName": "sid",
"visible": true
}
],
"timeFormat": "YYYY-MM-DD HH:mm:ss",
"decimalPlaces": {
"isEnforced": false,
"digits": 2
},
"note": "",
"showNoteWhenEmpty": false
}
}
},
{
"type": "view",
"id": "0a40351ac9987000",
"attributes": {
"name": "Name this Cell",
"properties": {
"shape": "chronograf-v2",
"type": "markdown",
"note": "# Sensor connection status\r\nThis Dashboard shows the connection status\r\nof sensors that are expeced to send data.\r\nThe list of SIDs is fetched from the VeliDB\r\nSQL database. Only sensors that are `enabled` in the VeliDB are listed\r\nhere.\r\n\r\nA sensor's connection is active if it has\r\nsent at least 1 datapoint within the \r\ntimerange of the dashboard."
}
}
},
{
"type": "view",
"id": "0a405e2ec0d87000",
"attributes": {
"name": "Water Sensors Active in Timerange",
"properties": {
"shape": "chronograf-v2",
"type": "table",
"queries": [
{
"text": "import \"strings\"\r\nimport \"sql\"\r\nimport \"join\"\r\nimport \"array\"\r\nimport \"influxdata/influxdb/secrets\"\r\n\r\nisActive = (tables=<-,x) =>\r\n\ttables\r\n \t|> timeShift(duration:x)\r\n \t|> map(fn: (r) => ({sid:r.sid,_value:(r._time >= now())}))\r\n\r\nvelidb_osdb2_password = secrets.get(key: \"velidb_osdb2_password\")\r\n\r\nwater_sids = sql.from(\r\n driverName: \"sqlserver\",\r\n dataSourceName: strings.joinStr(arr: [\"sqlserver://osdb2:\" ,velidb_osdb2_password, \"@velidb.database.windows.net:1433?database=VeliDB_V2.1\"], v: \"\"),\r\n //query: \"SELECT oid FROM Deployments.Oswards\",\r\n query: strings.joinStr(arr: [\"SELECT CAST( sensor_id as varchar) as sid FROM deployment.device WHERE type='water' AND enabled='True' AND sensor_id != ''\"], v: \"\")\r\n)\r\n //|> yield(name: \"custom-name\") \r\n //|> tableFind(fn: (key) => true)\r\n //|> yield(name: \"custom-name\")\r\n //|> getColumn(column: \"sid\")\r\n |> map(fn: (r) => ({ r with _value: 0 })) \r\n\r\nwater_data = from(bucket: \"oswarddata\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"water\")\r\n //|> filter(fn: (r) => r[\"_field\"] == \"P_L1\" or r[\"_field\"] == \"P_L2\" or r[\"_field\"] == \"P_L3\")\r\n |> group(columns: [\"sid\"])\r\n |> last()\r\n\r\n |> drop(columns: [\"_start\",\"_stop\",\"_field\",\"_value\",\"_measurement\"])\r\n \r\n |> unique(column:\"sid\")\r\n |> isActive(x: -v.timeRangeStart)\r\n |> group()\r\n |> toInt() \r\n //|> yield()\r\n \r\nres = join.left(\r\n left: water_sids,\r\n right: water_data,\r\n on: (l, r) => l.sid == r.sid,\r\n as: (l, r) => ({l with _value: r._value}),\r\n)\r\n|> fill(column: \"_value\", value: 0)\r\n|> yield()",
"editMode": "advanced",
"name": "",
"builderConfig": {
"buckets": [],
"tags": [
{
"key": "_measurement",
"values": [],
"aggregateFunctionType": "filter"
}
],
"functions": [
{
"name": "mean"
}
],
"aggregateWindow": {
"period": "auto",
"fillValues": false
}
}
}
],
"colors": [
{
"id": "base",
"type": "background",
"hex": "#DC4E58",
"name": "fire",
"value": 0
},
{
"id": "4hcC80nq-gdc43awH43pt",
"type": "background",
"hex": "#32B08C",
"name": "viridian",
"value": 1
}
],
"tableOptions": {
"verticalTimeAxis": true,
"sortBy": {
"internalName": "",
"displayName": "",
"visible": false
},
"wrapping": "",
"fixFirstColumn": false
},
"fieldOptions": [
{
"internalName": "sid",
"displayName": "sid",
"visible": true
},
{
"internalName": "_value",
"displayName": "Connection Status",
"visible": true
},
{
"internalName": "_value_new",
"displayName": "_value_new",
"visible": true
},
{
"internalName": "sid_new",
"displayName": "sid_new",
"visible": true
}
],
"timeFormat": "YYYY-MM-DD HH:mm:ss",
"decimalPlaces": {
"isEnforced": false,
"digits": 2
},
"note": "",
"showNoteWhenEmpty": false
}
}
},
{
"type": "view",
"id": "0a405e5f6a187000",
"attributes": {
"name": "Presence Sensors Active in Timerange",
"properties": {
"shape": "chronograf-v2",
"type": "table",
"queries": [
{
"text": "import \"strings\"\r\nimport \"sql\"\r\nimport \"join\"\r\nimport \"array\"\r\nimport \"influxdata/influxdb/secrets\"\r\n\r\nisActive = (tables=<-,x) =>\r\n\ttables\r\n \t|> timeShift(duration:x)\r\n \t|> map(fn: (r) => ({sid:r.sid,_value:(r._time >= now())}))\r\n\r\n\r\nvelidb_osdb2_password = secrets.get(key: \"velidb_osdb2_password\")\r\npresence_sids = sql.from(\r\n driverName: \"sqlserver\",\r\n dataSourceName: strings.joinStr(arr: [\"sqlserver://osdb2:\" ,velidb_osdb2_password, \"@velidb.database.windows.net:1433?database=VeliDB_V2.1\"], v: \"\"),\r\n //query: \"SELECT oid FROM Deployments.Oswards\",\r\n query: strings.joinStr(arr: [\"SELECT CAST( sensor_id as varchar) as sid FROM deployment.device WHERE type='presence' AND enabled='True' AND sensor_id != ''\"], v: \"\")\r\n)\r\n //|> yield(name: \"custom-name\") \r\n //|> tableFind(fn: (key) => true)\r\n //|> yield(name: \"custom-name\")\r\n //|> getColumn(column: \"sid\")\r\n |> map(fn: (r) => ({ r with _value: 0 })) \r\n\r\npresence_data = from(bucket: \"oswarddata\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n |> filter(fn: (r) => r[\"_measurement\"] == \"presence\")\r\n //|> filter(fn: (r) => r[\"_field\"] == \"P_L1\" or r[\"_field\"] == \"P_L2\" or r[\"_field\"] == \"P_L3\")\r\n |> group(columns: [\"sid\"])\r\n |> last()\r\n\r\n |> drop(columns: [\"_start\",\"_stop\",\"_field\",\"_value\",\"_measurement\"])\r\n \r\n |> unique(column:\"sid\")\r\n |> isActive(x: -v.timeRangeStart)\r\n |> group()\r\n |> toInt() \r\n //|> yield()\r\n \r\nres = join.left(\r\n left: presence_sids,\r\n right: presence_data,\r\n on: (l, r) => l.sid == r.sid,\r\n as: (l, r) => ({l with _value: r._value}),\r\n)\r\n|> fill(column: \"_value\", value: 0)\r\n|> yield()",
"editMode": "advanced",
"name": "",
"builderConfig": {
"buckets": [],
"tags": [
{
"key": "_measurement",
"values": [],
"aggregateFunctionType": "filter"
}
],
"functions": [
{
"name": "mean"
}
],
"aggregateWindow": {
"period": "auto",
"fillValues": false
}
}
}
],
"colors": [
{
"id": "base",
"type": "background",
"hex": "#DC4E58",
"name": "fire",
"value": 0
},
{
"id": "4hcC80nq-gdc43awH43pt",
"type": "background",
"hex": "#32B08C",
"name": "viridian",
"value": 1
}
],
"tableOptions": {
"verticalTimeAxis": true,
"sortBy": {
"internalName": "",
"displayName": "",
"visible": false
},
"wrapping": "",
"fixFirstColumn": false
},
"fieldOptions": [
{
"internalName": "sid",
"displayName": "sid",
"visible": true
},
{
"internalName": "_value",
"displayName": "Connection Status",
"visible": true
},
{
"internalName": "_value_new",
"displayName": "_value_new",
"visible": true
},
{
"internalName": "sid_new",
"displayName": "sid_new",
"visible": true
}
],
"timeFormat": "YYYY-MM-DD HH:mm:ss",
"decimalPlaces": {
"isEnforced": false,
"digits": 2
},
"note": "",
"showNoteWhenEmpty": false
}
}
},
{
"type": "view",
"id": "0a41a389ce827000",
"attributes": {
"name": "Deactivated Sensors Sending Data",
"properties": {
"shape": "chronograf-v2",
"type": "table",
"queries": [
{
"text": "import \"strings\"\r\nimport \"sql\"\r\nimport \"join\"\r\nimport \"array\"\r\nimport \"influxdata/influxdb/secrets\"\r\n\r\nisActive = (tables=<-,x) =>\r\n\ttables\r\n \t|> timeShift(duration:x)\r\n \t|> map(fn: (r) => ({sid:r.sid,_value:(r._time >= now())}))\r\n\r\n\r\nvelidb_osdb2_password = secrets.get(key: \"velidb_osdb2_password\")\r\npower_sids = sql.from(\r\n driverName: \"sqlserver\",\r\n dataSourceName: strings.joinStr(arr: [\"sqlserver://osdb2:\" ,velidb_osdb2_password, \"@velidb.database.windows.net:1433?database=VeliDB_V2.1\"], v: \"\"),\r\n //query: \"SELECT oid FROM Deployments.Oswards\",\r\n query: strings.joinStr(arr: [\"SELECT CAST( sensor_id as varchar) as sid FROM deployment.device WHERE enabled='False' AND sensor_id != ''\"], v: \"\")\r\n)\r\n //|> yield(name: \"custom-name\") \r\n //|> tableFind(fn: (key) => true)\r\n //|> yield(name: \"custom-name\")\r\n //|> getColumn(column: \"sid\")\r\n |> map(fn: (r) => ({ r with _value: 0 })) \r\n\r\npower_data = from(bucket: \"oswarddata\")\r\n |> range(start: v.timeRangeStart, stop: v.timeRangeStop)\r\n //|> filter(fn: (r) => r[\"_measurement\"] == \"water\")\r\n |> filter(fn: (r) => r[\"_field\"] == \"P_L1\"\r\n or r[\"_field\"] == \"P_L2\"\r\n or r[\"_field\"] == \"P_L3\"\r\n or r[\"_field\"] == \"P\"\r\n or r[\"_field\"] == \"CR\"\r\n or r[\"_field\"] == \"Presence\")\r\n |> group(columns: [\"sid\"])\r\n |> last()\r\n\r\n |> drop(columns: [\"_start\",\"_stop\",\"_field\",\"_value\",\"_measurement\"])\r\n \r\n |> unique(column:\"sid\")\r\n |> isActive(x: -v.timeRangeStart)\r\n |> group()\r\n |> toInt() \r\n //|> yield()\r\n \r\nres = join.left(\r\n left: power_sids,\r\n right: power_data,\r\n on: (l, r) => l.sid == r.sid,\r\n as: (l, r) => ({l with _value: r._value}),\r\n)\r\n|> fill(column: \"_value\", value: 0)\r\n|> filter(fn: (r) => r._value > 0)\r\n|> yield()",
"editMode": "advanced",
"name": "",
"builderConfig": {
"buckets": [],
"tags": [
{
"key": "_measurement",
"values": [],
"aggregateFunctionType": "filter"
}
],
"functions": [
{
"name": "mean"
}
],
"aggregateWindow": {
"period": "auto",
"fillValues": false
}
}
}
],
"colors": [
{
"id": "base",
"type": "background",
"hex": "#DC4E58",
"name": "fire",
"value": 0
},
{
"id": "4hcC80nq-gdc43awH43pt",
"type": "background",
"hex": "#F48D38",
"name": "tiger",
"value": 1
}
],
"tableOptions": {
"verticalTimeAxis": true,
"sortBy": {
"internalName": "",
"displayName": "",
"visible": false
},
"wrapping": "",
"fixFirstColumn": false
},
"fieldOptions": [
{
"internalName": "sid",
"displayName": "sid",
"visible": true
},
{
"internalName": "_value",
"displayName": "Connection Status",
"visible": true
},
{
"internalName": "_value_new",
"displayName": "_value_new",
"visible": true
},
{
"internalName": "sid_new",
"displayName": "sid_new",
"visible": true
}
],
"timeFormat": "YYYY-MM-DD HH:mm:ss",
"decimalPlaces": {
"isEnforced": false,
"digits": 2
},
"note": "",
"showNoteWhenEmpty": false
}
}
}
]
},
"labels": []
}
```

2. Import the dashboard on Influxdb instance say named `B`. The pop for the import comes as successful but the dashboard isn't there to be seen on UI. Check screenshot below

![image](https://github.com/influxdata/influxdb/assets/6692132/8d487d98-48b6-418c-a357-2118b580a329)
![image](https://github.com/influxdata/influxdb/assets/6692132/3a4eb16e-4f7d-419b-bec0-12ae1288cc1a)

__Expected behaviour:__
Dashboard should be seen on UI if the import successful pop up is shown

__Actual behaviour:__

Dashboard not seen on UI

Contributor guide

Open the contributing guide

Research direction

No source files, tests, or specific import failure are identified in the issue. Start by reproducing the dashboard export and import flow in the GUI with the supplied JSON; done means an exported dashboard can be imported successfully and retains its dashboard content.

Written by the indexing model from the issue text.

Assessment

Tech stack
react
Domain
frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.