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

PKG visualization - frontend #98

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

WerLaj
Copy link
Collaborator

@WerLaj WerLaj commented Feb 2, 2024

Closes #59

Copy link

github-actions bot commented Feb 2, 2024

Unit Test Results

58 tests   57 ✔️  9s ⏱️
  1 suites    0 💤
  1 files      1

For more details on these failures, see this check.

Results for commit f09f232.

♻️ This comment has been updated with latest results.

Copy link

github-actions bot commented Feb 2, 2024

Coverage Report •
FileStmtsMissCoverMissing
pkg_api
   pkg.py1231585%78, 89, 111–121, 137, 206, 273–274, 282–>279, 313–316, 350–351
pkg_api/server
   auth.py260100% 
   pkg_exploration.py270100% 
tests/pkg_api/server
   test_auth.py240100% 
   test_pkg_exploration.py40583%73–>75, 75–>78, 102–106, 112
TOTAL11935393% 

Copy link

github-actions bot commented Feb 2, 2024

Current Branch Main Branch
Coverage Badge Coverage Badge

pkg_api/pkg.py Outdated Show resolved Hide resolved
assert response.json["message"] == "PKG visualized successfully."
assert response.json["img_path"] == "tests/data/pkg_visualizations/test.png"

with open("tests/data/pkg_visualizations/test.png", "rb") as img:
Copy link
Collaborator Author

@WerLaj WerLaj Feb 5, 2024

Choose a reason for hiding this comment

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

This test is failing. The path to the image is for some reason changed from relative to absolute when testing. I can't figure out how to fix that.

Copy link
Collaborator

@NoB0 NoB0 Feb 19, 2024

Choose a reason for hiding this comment

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

The error seems to come from send_file. Note that when using a relative path send_file only look in Flask working directory. Maybe you can try to join the relative path used during testing with the root path to give an absolute path to send_file.

@WerLaj WerLaj marked this pull request as ready for review February 8, 2024 09:01
@WerLaj WerLaj requested a review from IKostric February 8, 2024 09:02
@WerLaj WerLaj requested a review from NoB0 February 16, 2024 08:47
Copy link
Collaborator

@NoB0 NoB0 left a comment

Choose a reason for hiding this comment

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

Few nits to look at and questions for clarification.

Comment on lines +46 to +47
# TODO: Update pkg.visualize_graph() to return partial graph based
# on the query result
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: missing dot at the end.
Can you create a follow-up issue and link it here?

Comment on lines +26 to +31
<Route path="service" element={<div>Service Management</div>} />
<Route path="population" element={<div>Population form</div>} />
<Route
path="preferences"
element={<div>Personal Preferences</div>}
/>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest to remove these, they can be added in a PR related to the implementatio of their view.

Comment on lines +24 to +33
<Nav.Item>
<Nav.Link eventKey="/service" as={Link} to="/service">
Service Management
</Nav.Link>
</Nav.Item>
<Nav.Item>
<Nav.Link eventKey="/population" as={Link} to="/population">
Populate PKG
</Nav.Link>
</Nav.Item>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as before, we may want to include these routes in related PRs.

import { useContext, useEffect, useState } from "react";
import axios from "axios";
import QueryForm from "./QueryForm";
import Button from "react-bootstrap/Button";
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: remove unused import.

const PKGVisualization = () => {
const { user } = useContext(UserContext);
const [error, setError] = useState("");
const [image_path, setImagePath] = useState("");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: usually in javascript, the variable name uses a capital letter instead of _, e.g., imagePath.

const { user } = useContext(UserContext);
const [error, setError] = useState("");
const [image_path, setImagePath] = useState("");
const [query_info, setQueryInfo] = useState("");
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: same comment as for image_path.

})
.then((response) => {
setError("");
console.log(response.data);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: this can be removed.

return (
<Container>
<div>
<b>Here you can execute your own SPARQL queries to manage your PKG.</b>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should be queries to select statements within the PKG? From my understanding only SELECT queries are accepted.

<div>
<b>This is your current PKG:</b>
</div>
{/* <div>[Only for testing] Local path to the image: {image_path}</div> */}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: this can be removed.

@@ -2,7 +2,7 @@ import React, { useContext } from "react";
import "./App.css";
import APIHandler from "./components/APIHandler";
import LoginForm from "./components/LoginForm";
import Container from 'react-bootstrap/Container'
import Container from 'react-bootstrap/Container';
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: use double quotes as other imports.

Copy link
Collaborator

@NoB0 NoB0 left a comment

Choose a reason for hiding this comment

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

Few nits to look at and questions for clarification.

Copy link
Collaborator

@NoB0 NoB0 left a comment

Choose a reason for hiding this comment

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

Few nits to look at and questions for clarification.

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.

Add endpoint for PKG visualisation via form
2 participants