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

Use API endpoints in frontend #80

Merged
merged 59 commits into from
Jan 29, 2025
Merged

Use API endpoints in frontend #80

merged 59 commits into from
Jan 29, 2025

Conversation

NoraKri
Copy link
Contributor

@NoraKri NoraKri commented Jan 27, 2025

Aim of the PR

This PR fixes AB#218921

After creating an API for CRUD-operations against the triplestore, we wish to use this API in the frontend instead of directly communicating with the triplestore.

Implementation

NOTE: The table is now broken, since those requests are handled by the frontend. Will not be fixed until endpoints are in place for tables

  • Api.ts: This files handles request setup and sends API requests. Right now, there is no ability to rename/change color of a commissioning package, so this endpoint sits unfinished.
  • Triplestore.ts: This file will be removed when all functionality is covered by the API. For now, the unused functions are removed from this file.
  • CommissioningPackageHandler.tsx: A lot of the logic previously contained in this file is now handled by the API.

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • This change requires a documentation update

How Has This Been Tested?

Tested in demo that creation/deletion of package and selection of boundary and internal in multiple commissioning packages works as expected.
Tested the endpoints in Swagger to verify that the changes are updated.
Tested in RdFox to see if correct nodes are marked as boundary/internal.

Additional Changes

Some API fixes, docker setup fixes and datalog improvements needed to be made for this PR to work as well.
Port 5000 is stupidly used by Apple AirPlay, causing issues when running the dockerfiles on mac. Port is changed to 6000 for this reason.

Updates to Datalog rule, the following rule is added:
comp:isInPackage [?node, ?package] :-
comp:isSelectedInternalOf[?node, ?package] .

We had no predicate for stating that something is a selected internal - only that something was in the package. We need to be able to differentiate the internals from the selected internals, hence the new predicate comp:isSelectedInternalOf was introduced. The datalog rules is extended to make it easier to handle the selectedInternals, when a node is selected to be an internal node this also means that this node should be in the commissioning package. The new datalog rule makes sure that this happens automatically.

@markus-ap
Copy link
Contributor

markus-ap commented Jan 27, 2025

🎉 Snyk checks have passed. No issues have been found so far.

security/snyk check is complete. No issues have been found. (View Details)

license/snyk check is complete. No issues have been found. (View Details)

code/snyk check is complete. No issues have been found. (View Details)

# Conflicts:
#	docker/backend/Dockerfile
Copy link
Contributor

@eoye eoye left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job, this looks very good! Some small comments (I tried making code suggestions on all of them to make it easier).
I tested the Dexpi demo and it works as expected 😄

@NoraKri NoraKri merged commit 7bdbd6b into main Jan 29, 2025
6 checks passed
@NoraKri NoraKri deleted the story/218921-use-api-frontend branch January 29, 2025 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants