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

Replace the outdated HTML report generation #192 #287

Merged
merged 80 commits into from
Mar 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
21b9bd3
Add vue 3 boilerplate as preparation for #192
sebinside Oct 19, 2021
5fd0f71
Move report-viewer from jplag resources to own folder. Only the dist …
sebinside Oct 19, 2021
e63d7a6
Merge branch 'master' into 192-webreport
sebinside Oct 19, 2021
b20065b
Merge branch 'master' into 192-webreport
cholakov11 Nov 20, 2021
a6c3576
[192-webreport] Created class files for the new reporting
cholakov11 Nov 21, 2021
78e208c
[192-webreport] Moved reportV2 package to jplag package
cholakov11 Nov 21, 2021
c4cdec3
[192-webreport] Implemented the model classes
cholakov11 Nov 21, 2021
439dd47
[192-webreport] Implementing ReportObjectFactory - implemented the cr…
cholakov11 Nov 21, 2021
b117e6a
[192-webreport] Created Metric mode, changed OverviewReport to have a…
cholakov11 Nov 21, 2021
1af442e
[192-webreport] Changed String file_code in Files of Submission to Li…
cholakov11 Nov 21, 2021
39d1770
[192-webreport] Implementing ReportObjectFactory - implemented compar…
cholakov11 Nov 21, 2021
1906d38
[192-webreport] Finished ReportObjectFactory
cholakov11 Nov 21, 2021
53ed8b0
[192-webreport] Implemented JsonFactory to generate List of json strings
cholakov11 Nov 21, 2021
94c8342
[192-webreport] Declared function in ReportingStrtegy to generate rep…
cholakov11 Nov 21, 2021
5ba6733
[192-webreport] Fixed start and end lines of match - added usesIndex …
cholakov11 Nov 21, 2021
6256e70
[192-webreport] Deleted auto generated from vue project creator code …
cholakov11 Nov 24, 2021
f46c7f6
[192-webreport] Disabled prettier/prettier linting in eslint.js
cholakov11 Nov 24, 2021
c7a4c2d
[192-webreport] Implemented file upload, file upload page and started…
cholakov11 Nov 28, 2021
3504010
[192-webreport] Edited top_comparisons structure in overview json, dy…
cholakov11 Nov 29, 2021
5265152
[192-webreport] Created comparison view, implemented left panel of co…
cholakov11 Dec 2, 2021
f157f0a
[192-webreport] Implemented side by side code display
cholakov11 Dec 3, 2021
985e8e4
Make report-viewer path relative
dfuchss Dec 5, 2021
3675107
Create report-viewer.yml
dfuchss Dec 5, 2021
a4d1bd0
Update report-viewer.yml
dfuchss Dec 5, 2021
3f38aea
[192-webreport] Implemented blurring of not matched code and quicklin…
cholakov11 Dec 5, 2021
2a5db58
[192-webreport] Added coloring to matches
cholakov11 Dec 7, 2021
60eee93
[192-webreport] Added links to matches in code panel, added colors to…
cholakov11 Dec 8, 2021
ca32e7e
[192-webreport] Reordered Overview view, app is working with local fi…
cholakov11 Dec 9, 2021
2ad92c2
[192-webreport] Saving json report strings to json files
cholakov11 Dec 16, 2021
ef20a6c
[192-webreport] Displaying additional info in basic info panel
cholakov11 Dec 17, 2021
84e3026
[192-webreport] Major rework of ComparisonView, changed color palette…
cholakov11 Dec 18, 2021
074e5b6
[192-webreport] Fixed colors of matches, added navigation to MatchTable
cholakov11 Dec 19, 2021
f347c06
[192-webreport] Code and project cleanup
cholakov11 Dec 20, 2021
db93c15
[192-webreport] Removed FileUpload
cholakov11 Dec 20, 2021
18edb7d
[192-webreport] Added models of Overview and Comparison, with factori…
cholakov11 Dec 27, 2021
a046de2
[192-webreport] Added number of tokens per match information to the r…
cholakov11 Dec 27, 2021
96ff1cb
Merge branch '192-webreport' of https://github.com/cholakov11/JPlag i…
dfuchss Jan 18, 2022
8d410aa
Update to Node 16 LTS
dfuchss Jan 18, 2022
7f71dbd
[192-webreport] Syntax highlight, changed color scheme
cholakov11 Jan 21, 2022
d32fb7c
[192-webreport] Added javadoc
cholakov11 Jan 21, 2022
615a77d
[192-webreport] Created new component FilesContainer
cholakov11 Jan 25, 2022
cf847c8
[192-webreport] Added blurring in Overview with query params, removed…
cholakov11 Jan 25, 2022
1595280
[192-webreport] Added highlighting on demand, changed blur of anonymo…
cholakov11 Jan 28, 2022
67fe875
[192-webreport] Vuex store
cholakov11 Jan 28, 2022
b8949aa
[192-webreport] Reintroduced file upload window (not finished)
cholakov11 Jan 28, 2022
083a6ae
[192-webreport] Reintroduced file upload window, accepting zip, singl…
cholakov11 Feb 3, 2022
a90ddb4
Merge pull request #1 from dfuchss/192-webreport
cholakov11 Feb 3, 2022
b16ee1e
[192-webreport] Added dialogs to display clusters and clusterdiagram,…
cholakov11 Feb 4, 2022
687fc0d
[192-webreport] Finished doc, code and project clean up
cholakov11 Feb 4, 2022
32b3f69
[192-webreport] Fixed missing clusters in report error
cholakov11 Feb 10, 2022
6c02b78
Merge branch 'master' into 192-webreport
cholakov11 Feb 13, 2022
dc14741
[192-webreport] Updated project to the latest state, maven spotless a…
cholakov11 Feb 13, 2022
97c0085
[192-webreport] spotless apply
cholakov11 Feb 13, 2022
546b9fb
[192-webreport] added Clusters to Report model, factory in generator …
cholakov11 Feb 13, 2022
5b26b0a
[192-webreport] git renormalize
cholakov11 Feb 20, 2022
f0a99d0
[192-webreport] Static object mapper, switched hardcoded report folde…
cholakov11 Feb 20, 2022
2d3b676
[192-webreport] Improved readability in ReportObjectFactory, made fie…
cholakov11 Feb 20, 2022
7154433
[192-webreport] Using getExcludedFiles
cholakov11 Feb 20, 2022
09bea54
[192-webreport] added JsonProperty annotations, removed underscore na…
cholakov11 Feb 20, 2022
df37fd6
[192-webreport] renamed package reportingV2 to reporting2
cholakov11 Feb 20, 2022
0977729
[192-webreport] Updated versions in package.json, added npm to depend…
cholakov11 Feb 20, 2022
dcc603d
[192-webreport] Removed abbreviated varaibles, removed getExcludedFil…
cholakov11 Feb 20, 2022
319bd23
[192-webreport] Switched from single submission folder to multiple su…
cholakov11 Feb 20, 2022
55a06fc
[192-webreport] Added check for presence of files folder
cholakov11 Feb 20, 2022
0cdd34a
[192-webreport] Checking for two possible file names in ComparisonView
cholakov11 Feb 20, 2022
cd4d6b0
[192-webreport] Switched to reporting2 usage in CLI
cholakov11 Feb 20, 2022
185b3ea
[192-webreport] Fixed file extensions retrieval
cholakov11 Feb 21, 2022
21db19c
[192-webreport] Fixed file extensions retrieval
cholakov11 Feb 21, 2022
95f709b
[192-webreport] Switched to nth-child selector
cholakov11 Feb 21, 2022
9d667dc
[192-webreport] Switched to nth-child selector
cholakov11 Feb 21, 2022
d28c23c
[192-webreport] Set fileString in store.ts to optional
cholakov11 Feb 21, 2022
ca4f55f
[192-webreport] Renamed id1,id2, renamed FileUpload, removing logs
cholakov11 Feb 21, 2022
676204e
[192-webreport] eslint
cholakov11 Feb 21, 2022
8f0b41d
[192-webreport] Fixed redundant chart data, fixed error in clusters l…
cholakov11 Feb 22, 2022
61cfff2
[192-webreport] Added missing documentation.
cholakov11 Feb 22, 2022
e840754
[192-webreport] Added indication to selected ids in IDsList
cholakov11 Feb 22, 2022
76df598
[192-webreport] Removed highlight.js style files, using css important…
cholakov11 Mar 6, 2022
1a20445
Merge branch 'master' into 192-webreport
cholakov11 Mar 6, 2022
fbeedc1
[192-webreport] mvn spotless
cholakov11 Mar 6, 2022
3c3bdaa
[192-webreport] fixed merge error
cholakov11 Mar 6, 2022
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
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,16 @@ updates:
labels:
- "dependencies"
- "minor"
- package-ecosystem: "npm"
directory: "/report-viewer"
schedule:
interval: "weekly"
day: "wednesday"
time: "11:00"
timezone: "Europe/Berlin"
commit-message:
prefix: "Dependency"
include: "scope"



30 changes: 30 additions & 0 deletions .github/workflows/report-viewer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Report Viewer Deployment Workflow

on:
workflow_dispatch: # Use this to dispatch from the Actions Tab
push:
branches:
- 192-webreport # you might change that to main/master later on
Copy link
Member

Choose a reason for hiding this comment

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

See my original comment here :) Now it should be changed to master


jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/[email protected]

- uses: actions/setup-node@v2
with:
node-version: "16"

- name: Install and Build 🔧
working-directory: report-viewer
run: |
npm install
npm run build

- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: report-viewer/dist
5 changes: 5 additions & 0 deletions jplag/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@
<artifactId>system-rules</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.13.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
Expand Down
9 changes: 4 additions & 5 deletions jplag/src/main/java/de/jplag/CLI.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import static de.jplag.CommandLineArgument.*;

import java.io.File;
import java.util.Optional;
import java.util.Random;

Expand All @@ -20,7 +19,8 @@
import de.jplag.options.LanguageOption;
import de.jplag.options.SimilarityMetric;
import de.jplag.options.Verbosity;
import de.jplag.reporting.Report;
import de.jplag.reporting2.JsonReport;
import de.jplag.reporting2.Report;
import de.jplag.strategy.ComparisonMode;

/**
Expand Down Expand Up @@ -53,9 +53,8 @@ public static void main(String[] args) {
JPlag program = new JPlag(options);
System.out.println("JPlag initialized");
JPlagResult result = program.run();
File reportDir = new File(arguments.getString(RESULT_FOLDER.flagWithoutDash()));
Report report = new Report(reportDir, options);
report.writeResult(result);
Report report = new JsonReport();
report.saveReport(result, arguments.getString(RESULT_FOLDER.flagWithoutDash()));
} catch (ExitException exception) {
System.out.println("Error: " + exception.getMessage());
System.exit(1);
Expand Down
36 changes: 36 additions & 0 deletions jplag/src/main/java/de/jplag/reporting2/JsonReport.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package de.jplag.reporting2;

import java.io.File;
import java.util.List;

import de.jplag.JPlagResult;
import de.jplag.reporting2.jsonfactory.JsonFactory;
import de.jplag.reporting2.reportobject.ReportObjectFactory;
import de.jplag.reporting2.reportobject.model.JPlagReport;

// ReportImplementation -> JsonReport

/**
* A report generator which reports the JPlagResult in Json format.
*/
public class JsonReport implements Report {

@Override
public List<String> getReportStrings(JPlagResult result) {
JPlagReport report = ReportObjectFactory.getReportObject(result);
return JsonFactory.getJsonStrings(report);
}

@Override
public boolean saveReport(JPlagResult result, String path) {
JPlagReport report = ReportObjectFactory.getReportObject(result);
File dir = new File(path);
if (!dir.exists()) {
if (!dir.mkdir()) {
System.out.println("Failed to create dir.");
}
}
return JsonFactory.saveJsonFiles(report, path);
}

}
29 changes: 29 additions & 0 deletions jplag/src/main/java/de/jplag/reporting2/Report.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package de.jplag.reporting2;

import java.util.List;

import de.jplag.JPlagResult;

// ReportStrategy -> Report

/**
* Strategy interface for reporting. A report generator should implement this interface.
*/
public interface Report {

/**
* This function returns a list containing the report objects as simple strings. The first element is the string of the
* overview object. Each following element is a string of a comparison report object.
* @param result The result of a JPlag comparison
* @return A list containing report objects to string. First element is Overview. Other elements are comparisons.
*/
List<String> getReportStrings(JPlagResult result);

/**
* Creates and saves JPlag report files to the disk.
* @param result The result of a JPlag comparison.
* @param path Path to the directory where the report should be saved.
* @return True if the process is successful, otherwise false.
*/
boolean saveReport(JPlagResult result, String path);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package de.jplag.reporting2.jsonfactory;

import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

import de.jplag.reporting2.reportobject.model.ComparisonReport;
import de.jplag.reporting2.reportobject.model.JPlagReport;

/**
* Factory class, responsible for creating Json strings and writing them to files.
*/
public class JsonFactory {

private static final ObjectMapper mapper = new ObjectMapper();

/**
* Uses Jackson to create Json Strings from JPlagReport object.
* @return A list, first element is Json String of Overview object. The rest elements are Json Strings of Comparison
* objects.
*/
public static List<String> getJsonStrings(JPlagReport jPlagReport) {
List<String> jsonReports = new ArrayList<>();
try {
jsonReports.add(mapper.writeValueAsString(jPlagReport.getOverviewReport()));
for (ComparisonReport comparisonReport : jPlagReport.getComparisons()) {
jsonReports.add(mapper.writeValueAsString(comparisonReport));
}
} catch (JsonProcessingException e) {
System.out.println("Error converting object to json " + e.getMessage());
}
return jsonReports;
}

/**
* Creates Json Files for the given JPlagReport and saves them in the given folder.
* @return A boolean, representing whether the process was successful.
*/
public static boolean saveJsonFiles(JPlagReport jPlagReport, String folderPath) {
try {
ObjectMapper mapper = new ObjectMapper();
mapper.writeValue(Path.of(folderPath, "overview.json").toFile(), jPlagReport.getOverviewReport());
for (ComparisonReport report : jPlagReport.getComparisons()) {
String name = report.getFirstSubmissionId().concat("-").concat(report.getSecondSubmissionId()).concat(".json");
mapper.writeValue(Path.of(folderPath, name).toFile(), report);
}
} catch (IOException e) {
System.out.println("Failed to save json files: " + e.getMessage());
return false;
}
return true;
}
}
Loading