Skip to content

Commit

Permalink
* Updated docs to reflect Grafana Plugin Tools
Browse files Browse the repository at this point in the history
* Added descriptions of how to contribute to the project
* Changed Go module identifier
  • Loading branch information
carroe committed Apr 17, 2023
1 parent 466e5a0 commit 4e0b4a5
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 16 deletions.
62 changes: 62 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Contributing to the Grafana OData Data Source Plugin

Thank you for considering contributing to this project. It will help us to make this project more valuable for the
community.

We value any feedback and contributions whether it's a bug report, bugfix, additional feature or documentation.
Please read this document before submitting an issue or pull request to ensure that your contributions can
be handled effectively.

# How to report a bug

## Security vulnerability

Please do **NOT** open an issue if you find a security vulnerability.
Instead, send an e-mail to ``[email protected]`` .

In order to determine whether you are dealing with a security issue, ask yourself these two questions:
* Can I access something that's not mine, or something I shouldn't have access to?
* Can I disable something for other people?

If the answer to either of those two questions are "yes", then you're probably dealing with a security issue.
Note that even if you answer "no" to both questions, you may still be dealing with a security issue,
so if you're unsure, just email us.

## File a bug report.

You can file bug reports on the [issues page](https://github.com/d-velop/grafana-odata-datasource/issues). Please name
this issue ``Bug: <SHORT_DESCRIPTION>``.

Please follow the following steps prior to filing a bug report.

1. Search through existing [issues](https://github.com/d-velop/grafana-odata-datasource/issues) to ensure that
your specific issue has not yet been reported.

2. Ensure that you have tested the latest version of the plugin.
Although you may have an issue against an older version of the plugin, we cannot provide bug fixes for old versions.
It's also possible that the bug may have been fixed in the latest version.

When filing an issue, make sure to answer the following questions:

1. What version of the plugin are you using?

2. What operating system are you using?

3. What did you do?

4. What did you expect to see?

5. What did you see instead?

# How to submit a feature request

You can submit feature requests on the [issues page](https://github.com/d-velop/grafana-odata-datasource/issues).

# Contribute to the project

Don't hesitate to contact us if you have a feature idea or a suggestion for improvement. We are happy to discuss the
scope and potential problems of your idea in advance.

This project is released under the license specified in [LICENSE](LICENSE). Any code you submit will be released under
that license. Furthermore, it's likely that we have to reject code which depends on third party code which isn't
compatible to the aforementioned license.
21 changes: 11 additions & 10 deletions DEVELOPMENT.md → DEVELOPING.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Start Developing
This plugin is a data source backend plugin. It consists of both frontend and backend components.
This plugin is a data source backend plugin. It uses [Grafana Plugin Tools](https://grafana.github.io/plugin-tools/) and
consists of both backend and frontend components.

## Prerequisites
For this project to work you need [Node.js](https://nodejs.org/en/) and [Go](https://go.dev) installed.
Expand All @@ -17,6 +18,14 @@ Clone this repository into your local environment
git clone https://github.com/d-velop/grafana-odata-datasource.git
```

#### Backend
Backend code is located in the `pkg` folder

Build backend plugin binaries by running the mage build (`-v` stands for verbose output)
```bash
mage -v
```

#### Frontend
Frontend code is located in the `src` folder

Expand All @@ -35,14 +44,6 @@ or build plugin in production mode
yarn build
```

#### Backend
Backend code is located in the `pkg` folder

Run the mage build (`-v` stands for verbose output)
```bash
mage -v
```

### Using the OData mock-server
If you don't have a full-fledged OData server at hand, you will find a minimal mock server based on
[Express](https://expressjs.com) in the [`mock`](mock) directory.
Expand All @@ -62,7 +63,7 @@ changes to be tried out and tested directly. See folder [`provisioning`](provisi

To start, simply run the following command
```bash
docker compose up
yarn server
```
in the projects root directory. Afterwards you can open `http://localhost:3000` in your browser and begin using Grafana
with the preconfigured OData Data Source.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Now you should be able to see data for the selected time frame.

## Contributing
This project is maintained by d-velop but is looking for contributors. If you consider contributing to this project
please read [DEVELOPMENT](DEVELOPMENT.md) for details on how to get started.
please read [CONTRIBUTING](CONTRIBUTING.md) and [DEVELOPING](DEVELOPING.md) for details on how to get started.

## License
Please read [LICENSE](LICENSE) for licensing information.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module dvelop-grafana-odata-datasource
module github.com/d-velop/grafana-odata-datasource

go 1.19

Expand Down
2 changes: 1 addition & 1 deletion pkg/main.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package main

import (
"dvelop-grafana-odata-datasource/pkg/plugin"
"github.com/d-velop/grafana-odata-datasource/pkg/plugin"
"github.com/grafana/grafana-plugin-sdk-go/backend/datasource"
"github.com/grafana/grafana-plugin-sdk-go/backend/log"
"os"
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugin/client.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package plugin

import (
"dvelop-grafana-odata-datasource/pkg/plugin/odata"
"fmt"
"github.com/d-velop/grafana-odata-datasource/pkg/plugin/odata"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"net/http"
"net/url"
Expand Down
3 changes: 2 additions & 1 deletion pkg/plugin/datasource.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ package plugin

import (
"context"
"dvelop-grafana-odata-datasource/pkg/plugin/odata"
"encoding/json"
"encoding/xml"
"fmt"
"github.com/d-velop/grafana-odata-datasource/pkg/plugin/odata"
"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/httpclient"
Expand Down Expand Up @@ -109,6 +109,7 @@ func (ds *ODataSource) CallResource(_ context.Context, req *backend.CallResource
}

func (ds *ODataSource) query(clientInstance ODataClient, query backend.DataQuery) backend.DataResponse {
// TODO: query.MaxDataPoints -> $limit
log.DefaultLogger.Debug("query", "query.JSON", fmt.Sprintf("%s", query.JSON))
response := backend.DataResponse{}
var qm queryModel
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugin/testdata_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package plugin

import (
"dvelop-grafana-odata-datasource/pkg/plugin/odata"
"encoding/json"
"github.com/d-velop/grafana-odata-datasource/pkg/plugin/odata"
"github.com/grafana/grafana-plugin-sdk-go/backend"
"github.com/grafana/grafana-plugin-sdk-go/data"
"time"
Expand Down

0 comments on commit 4e0b4a5

Please sign in to comment.