Skip to content
This repository was archived by the owner on Aug 4, 2025. It is now read-only.

Commit eaf0cc8

Browse files
authored
Merge pull request #19 from hoptical/issue18
Issue18
2 parents 99e8aa3 + 824654d commit eaf0cc8

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

example/api/python/run.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ def fetch_graph_fields():
1212
{"field_name": "mainStat", "type": "string"},
1313
{"field_name": "secondaryStat", "type": "number"},
1414
{"field_name": "arc__failed",
15-
"type": "number", "color": "red"},
15+
"type": "number", "color": "red", "displayName": "Failed"},
1616
{"field_name": "arc__passed",
17-
"type": "number", "color": "green"},
17+
"type": "number", "color": "green", "displayName": "Passed"},
1818
{"field_name": "detail__role",
1919
"type": "string", "displayName": "Role"}]
2020
edges_fields = [

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "hamedkarbasi93-nodegraphapi-datasource",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "",
55
"scripts": {
66
"build": "grafana-toolkit plugin:build",

src/datasource.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export class DataSource extends DataSourceApi<MyQuery, MyDataSourceOptions> {
4343
interface FrameFieldType {
4444
name: string;
4545
type: any;
46-
config?: any;
46+
config: Record<string, any>;
4747
}
4848
// This function gets the fields of the api and transforms them to what grafana dataframe prefers
4949
function fieldAssignator(FieldsResponse: any): FrameFieldType[] {
@@ -52,14 +52,14 @@ export class DataSource extends DataSourceApi<MyQuery, MyDataSourceOptions> {
5252
// fieldType can be either number of string
5353
var fieldType = field['type'] === 'number' ? FieldType.number : FieldType.string;
5454
// add 'name' and 'type' items to the output object
55-
var outputField: FrameFieldType = { name: field['field_name'], type: fieldType };
55+
var outputField: FrameFieldType = { name: field['field_name'], type: fieldType, config: {} };
5656
// add color for 'arc__*' items(only apperas for the nodes)
5757
if ('color' in field) {
58-
outputField.config = { color: { fixedColor: field['color'], mode: FieldColorModeId.Fixed } };
58+
outputField.config.color = { fixedColor: field['color'], mode: FieldColorModeId.Fixed };
5959
}
6060
// add disPlayName for 'detail__*' items
6161
if ('displayName' in field) {
62-
outputField.config = { displayName: field['displayName'] };
62+
outputField.config.displayName = field['displayName'];
6363
}
6464
outputFields.push(outputField);
6565
});

src/plugin.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"path": "img/query-string.png"
5050
}
5151
],
52-
"version": "1.0.0",
52+
"version": "1.0.1",
5353
"updated": "%TODAY%"
5454
},
5555
"dependencies": {

0 commit comments

Comments
 (0)