Skip to content

Commit

Permalink
Readme clean up and AppView name fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Finevman committed Sep 26, 2023
1 parent 2cc7eae commit 66578c3
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 58 deletions.
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,6 @@

[![coverage](https://raw.githubusercontent.com/sifis-home/privacydashboard/gh-pages/reports/jacoco.svg 'Code Coverage')](https://sifis-home.github.io/privacydashboard/reports/index.html)

## Running the application

The project is a standard Maven project. To run it from the command line,
type `mvnw` (Windows), or `./mvnw` (Mac & Linux), then open
http://localhost:8080 in your browser.

You can also import the project to your IDE of choice as you would with any
Maven project. Read more on [how to import Vaadin projects to different
IDEs](https://vaadin.com/docs/latest/flow/guide/step-by-step/importing) (Eclipse, IntelliJ IDEA, NetBeans, and VS Code).

## Log in the app

To enter the application as a Data Subject: user=subject<number_between_0-49> password=subject<same_number> (e.g. user=subject25 password=subject25)
Expand Down Expand Up @@ -85,17 +75,30 @@ To run the test suite, run the command `mvn clean test`. You can run all the tes

To create a coverage report, run the command `mvn jacoco:report`

## Deploying to Production
## Compiling, Deploying and Running

To create a production build use the following command:

```
mvn clean package -Pproduction
```

If you want to use privacy-dashboard as a dependency for other Maven applications in the local repository, use the following command:

```
mvn install -Pproduction
```

To create a production build, call `mvnw clean package -Pproduction` (Windows),
or `./mvnw clean package -Pproduction` (Mac & Linux).
This will build a JAR file with all the dependencies and front-end resources,
ready to be deployed. The file can be found in the `target` folder after the build completes.
To build the project without being interrupted by eventual test failures, add the flag `-DskipTests`.
The commands will create the JAR file and place it, together with the dependencies and front-end resources, in the `target` folder after the build completes.

Once the JAR file is built, you can run it using
`java -jar target/privacydashboard-1.0-SNAPSHOT.jar`

To build the project without being interrupted by eventual test failures, add the flag `-DskipTests`
```
java -jar target/privacydashboard-1.0-SNAPSHOT.jar
```

You can also run the program by typing in the IDE terminal the `mvn` command.

## Project structure

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,45 +85,9 @@ public class AppsView extends Div implements AfterNavigationObserver, BeforeEnte
private final Grid<IoTApp> grid= new Grid<>();

private IoTApp priorityApp;
/*
private String getJsonAppsFromUrl(){
HttpURLConnection connection = null;
System.err.println("Entered getJsonAppsFromUrl()\n");
try{
URL url = new URL("https://yggio.sifis-home.eu:3000/dht-insecure/topic_name/SIFIS:container_list");
System.err.println("About to open the connection\n");
connection = (HttpURLConnection) url.openConnection();
connection.setRequestMethod("GET");
int resCode = connection.getResponseCode();
if(resCode == HttpURLConnection.HTTP_OK){
BufferedReader rd = new BufferedReader(new InputStreamReader(connection.getInputStream()));
StringBuffer res = new StringBuffer();
String line;
while((line = rd.readLine()) != null){
System.err.print(line);
res.append(line);
}
rd.close();
return res.toString();
}
else{
return null;
}
}
catch(Exception e){
e.printStackTrace();
return null;
}
finally{
if(connection != null)
connection.disconnect();
}
}
*/

private List<IoTApp> getJsonAppsFromUrl(){

private List<IoTApp> getJsonAppsFromUrl(){

TrustManager[] dummyTrustManager = new TrustManager[] { new X509TrustManager() {

Expand Down Expand Up @@ -197,6 +161,16 @@ public void checkServerTrusted(X509Certificate[] certs, String authType) {
return null;
}

private String cleanAppName(String name){
String newName = name.split("3pa-")[1].split("-")[0];
return newName;
}

private String getAppProcessor(String name){
String newName = name.split("3pa-")[1].split("-")[1];
return newName;
}

@Override
public void beforeEnter(BeforeEnterEvent event){
priorityApp=communicationService.getApp();
Expand Down Expand Up @@ -269,15 +243,17 @@ private void initializeGrid(){
}

private VerticalLayout createApp(IoTApp app){
Avatar avatar = new Avatar(app.getName());
Span name = new Span(app.getName());
Avatar avatar = new Avatar(cleanAppName(app.getName()));
Span name = new Span(cleanAppName(app.getName()));
name.addClassName("name");
Span processor = new Span(getAppProcessor(app.getName()));
processor.setClassName("bold");
Details details = new Details(new Span("More"), initializeApp(app));
VerticalLayout card = new VerticalLayout();
card.addClassName("card");
card.addClassName("canOpen");
card.setSpacing(false);
card.add(new HorizontalLayout(avatar , name) , details);
card.add(new HorizontalLayout(avatar , name), processor, details);
card.addClickListener(e-> {
if(card.hasClassName("canOpen")){
details.setOpened(true);
Expand Down

0 comments on commit 66578c3

Please sign in to comment.