Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 1939 sectors and technology tab breaks app #1940

Open
wants to merge 8 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -425,14 +425,22 @@ def post(self, request, schema, table):
@api_exception
def put(self, request, schema, table):
"""
Every request to unsave http methods have to contain a "csrftoken".
This token is used to deny cross site reference forwarding.
In every request the header had to contain "X-CSRFToken"
with the actual csrftoken.
The token can be requested at / and will be returned as cookie.

:param request:
:return:
REST-API endpoint used to create a new table in the database.
The table is created with the columns and constraints specified in the
request body. The request body must contain a JSON object with the following
keys: 'columns', 'constraints' and 'metadata'.
The payload must be a groped in a 'query' key.

For authentication, the request must contain a valid token in the
Authentication header.

Args:
request: The request object
schema: The schema in which the table should be created
table: The name of the table to be created

Returns:
JsonResponse: A JSON response with the status code 201 CREATED
"""
if schema not in PLAYGROUNDS and schema not in UNVERSIONED_SCHEMAS:
raise APIError("Schema is not in allowed set of schemes for upload")
Expand Down
11 changes: 10 additions & 1 deletion docs/installation/guides/development-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,18 @@ You can run your own local copy of the OEP website server with

python manage.py runserver

By default, you should be able to connect to this copy by visiting [localhost:8000](http://localhost:8000) in your web browser.
By default, you should be able to connect to this copy by visiting [127.0.0.1:8000](http://127.0.0.1:8000) in your web browser.
This way you can insert your changes without worrying about breaking anything in the production system.

### Deploy react app´s locally

!!! Note
This solution is not the best developer experience and needs optimization

As some Apps of the Oeplatform integrate React apps they need to be build using npm locally. We offer build scripts that can be triggered using django management commands. For example to build the scenario bundles react app and deploy it in the django app factsheet you can run the command `python manage.py build_factsheet_app`. Once done you can access the scenario bundles app via your locally deployed django instance (see above).

Keep in mind that you now use a bundled version of the react app and all changes you might want to add to the React jsx components will only show up once you build the app again. For development this might be a bit clunky but since the app is deployed inside the django app this enables the React app to use the django authentication. An alternative that will not be able to use the django user authentication currently is to deploy the React app alongside the locally deployed django instance. You can use npm start while being inside the `factsheet/frontend/` directory in the terminal. To make this work you will have to change the config.json inside the same directory. In this file you find the key `"toep": "/"` you'll have to change this `/` value to `http://127.0.0.1:8000` to point to the django instance currently deployed locally. If your react test server is still running (`npm start`) you can now access it at `http://127.0.0.1:3000/scenario-bundles/main`. All changes made to the React jsx components will now be reflected instantly using live reloading.

## User Management - Setup a test user

To create a dummy user for functionality testing purposes
Expand Down
2 changes: 1 addition & 1 deletion docs/installation/guides/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Below we describe the manual installation of the oeplatform code and infrastruct

We provide 2 [docker container images](https://docs.docker.com/get-started/#what-is-a-container-image) (OEP-website and OEP-database). The images are updated & published with each release. They can be pulled from [GitHub packages](https://github.com/OpenEnergyPlatform/oeplatform/pkgs/container/oeplatform).

[Here you can find instructions on how to install the docker images.](https://github.com/OpenEnergyPlatform/oeplatform/blob/develop/docker/USAGE.md)
[Here you can find instructions on how to install the docker images.](https://github.com/OpenEnergyPlatform/oeplatform/tree/develop/docker)

!!! danger
Currently the docker based installation does not cover the installation of the additional database `jenna-fuseki` a triple store that stores graph data used in some of our features.
Expand Down
5 changes: 5 additions & 0 deletions versions/changelogs/current.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,8 @@
## Documentation updates

- Updated documentation to simplify usage of vendor software swagger ui and update the documentation on scenario bundles. Add documentation on how to use the updated OEKG web API [(#1928)](https://github.com/OpenEnergyPlatform/oeplatform/pull/1928).

- Bulk documentation enhancements [(#1940)](https://github.com/OpenEnergyPlatform/oeplatform/pull/1940)
- Fix outdated docstring in HTTP-API view: Table.put
- Fix broken link in documentation linking the docker setup instructions
- Add section to the development setup documentation on how to run npm start alongside the django oeplatform instance
Loading