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

Rewrite of HTML tables with React #477

Merged
merged 130 commits into from
Nov 2, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
8d5639d
extend json parsing for own classes
laurabschor Jun 22, 2019
885ba18
prepare / cleanup data in tablegenerator for frontend rendering via j…
laurabschor Jun 22, 2019
3c778e7
adjust parsing function with staistics for json
laurabschor Jun 22, 2019
abb8e4a
include static frontend assets into template
laurabschor Jun 22, 2019
75cfdf5
prepare stats for javaScript
laurabschor Jul 3, 2019
97ce674
fix multiple RunSet generation
laurabschor Jul 14, 2019
9d43339
add links to rows and columns
laurabschor Jul 14, 2019
59a5b2f
add script arguments to build different templates
laurabschor Jul 16, 2019
34a2fb8
move private react repo in table-generator
laurabschor Jul 16, 2019
40e43ad
eject react scripts
laurabschor Jul 16, 2019
e16f0fd
adapt webpack config to prevent code-splitting
laurabschor Jul 16, 2019
c26995a
use new pathes to insert frontend assets into template
laurabschor Jul 16, 2019
dab299b
use sample data only in development mode and provide build script for…
laurabschor Jul 16, 2019
b0fcc35
adapt gitignore to include frontend assets
laurabschor Jul 16, 2019
9a51615
delete unnecessary files
laurabschor Jul 17, 2019
5de982c
Fix status color
laurabschor Jul 17, 2019
eb04bc6
fixes link and source output
laurabschor Jul 20, 2019
a62bb40
fixes logarithmic state in quantile plot
laurabschor Jul 20, 2019
d832101
Fix logarithmic behaviour in Scatter Plot
laurabschor Jul 21, 2019
31620f3
Fix show columns only if visible
laurabschor Jul 21, 2019
5f68a0d
Set timeout and placeholder on filter
laurabschor Jul 21, 2019
8835e03
Fix Quantile Plot with deselected columns + adjust styling
laurabschor Jul 23, 2019
c151a6b
handle visibility of tools
laurabschor Jul 23, 2019
dd7d21d
Adjust btn-styling
laurabschor Jul 23, 2019
7a43b9a
add reset button
laurabschor Jul 23, 2019
63b1cd3
add info
laurabschor Jul 23, 2019
6fff2b5
adjust styling
laurabschor Jul 23, 2019
25f438c
adjust styling
laurabschor Jul 23, 2019
c96a0ee
Add resizer on scatter plot, remove cookie
laurabschor Jul 24, 2019
d96bf33
push built version
laurabschor Jul 24, 2019
acf166d
Fix link opening in overlay
laurabschor Jul 24, 2019
4b58c27
Refactoring of summary
laurabschor Jul 24, 2019
b47290a
adjust styling summary
laurabschor Jul 24, 2019
3abbd9e
Adjust styling with LMU green
laurabschor Jul 24, 2019
059e3df
Fix source unit
laurabschor Jul 25, 2019
fd4c971
Render padding for decimal digits dynamically
laurabschor Jul 25, 2019
7905ea9
add properties to table
laurabschor Jul 25, 2019
5ac766c
Fix lines of scatter plot
laurabschor Jul 25, 2019
370b749
Round numbers in Plot-Hints
laurabschor Jul 26, 2019
8778fc5
Render summary-tooltips
laurabschor Jul 26, 2019
cb1ad67
Alert if no correct values + Refactoring
laurabschor Jul 28, 2019
f1f7cdc
Fix building logfile link to load from zip
laurabschor Jul 29, 2019
9ba16b6
Adjust style of options in summary
laurabschor Jul 29, 2019
58b00cc
Fix scolling behaviour
laurabschor Jul 30, 2019
8a7825b
Fix Legende of Quantile Plot
laurabschor Jul 30, 2019
6c6853e
format values of stats and rows
laurabschor Jul 30, 2019
c6b55c1
Fix spacing issue in summary
laurabschor Jul 30, 2019
a064808
Fix handling with formatted values in table
laurabschor Jul 30, 2019
ce31928
Fix opacity switch of legende in quantile plot
laurabschor Jul 31, 2019
a59a735
change title to display_title
laurabschor Jul 31, 2019
8b6605e
Fix options in summary
laurabschor Jul 31, 2019
330801a
Fix logarithmic view of Scatter Plot
laurabschor Jul 31, 2019
2fbd1bc
Fix data format of Quantile Plot
laurabschor Jul 31, 2019
62ce615
Fix column id in tables
laurabschor Jul 31, 2019
c63995b
Fix display unit in column header
laurabschor Jul 31, 2019
6a8615b
format code
PhilippWendler Aug 8, 2019
132d963
Refactoring
laurabschor Aug 16, 2019
2a106f2
Merge branch 'react-table' of https://github.com/sosy-lab/benchexec i…
laurabschor Aug 16, 2019
64d8305
Merge branch 'master' into react-table
laurabschor Aug 16, 2019
bcfc1c2
small styling adjustments
laurabschor Aug 19, 2019
126a0ee
Small refactorings
laurabschor Aug 20, 2019
cbe5cb3
Fix display name
laurabschor Aug 30, 2019
74124de
Fix incorrect values
laurabschor Aug 30, 2019
f1a3360
outsource methods in utils and adjust styling
laurabschor Aug 30, 2019
48fa5ff
add first utils tests
laurabschor Aug 30, 2019
c81b254
add and adjust comments
laurabschor Sep 15, 2019
460422f
remove main_status
laurabschor Sep 15, 2019
7aef6b8
add reset button as component (for testing)
laurabschor Sep 15, 2019
e2f8268
adjust decorative middle line
laurabschor Sep 15, 2019
17e9b3f
Merge branch 'master' into react-table
PhilippWendler Sep 16, 2019
b6064b6
preperation for snapshot tests
laurabschor Sep 16, 2019
57b5978
Merge branch 'react-table' of https://github.com/sosy-lab/benchexec i…
laurabschor Sep 16, 2019
d0a74b1
Update two JS libraries as suggested by npm audit fix
PhilippWendler Sep 27, 2019
d9ffddb
small refactoring selectColumns
laurabschor Sep 29, 2019
da305d9
delete unnecessary files
laurabschor Oct 8, 2019
5298ccb
add enzyme function and snapshot test for reset button
laurabschor Oct 8, 2019
8f4848a
Refactoring
laurabschor Oct 9, 2019
5fcbd85
Merge branch 'react-table' of https://github.com/sosy-lab/benchexec i…
laurabschor Oct 9, 2019
07ac455
Retest & Refactor
laurabschor Oct 9, 2019
1c0917f
deactivate apply button when no column is selected
laurabschor Oct 13, 2019
1815996
format files and bundle final application
laurabschor Oct 13, 2019
f25a923
sort and update dependencies
laurabschor Oct 13, 2019
90b8f6e
Recreate bundled JS and CSS files
PhilippWendler Oct 17, 2019
73571e9
Recreate package-lock.json, this removes one optional dependency
PhilippWendler Oct 17, 2019
a8129aa
Mock uniqid during Javascript tests
PhilippWendler Oct 17, 2019
7959c8e
Add CI tests for HTML tables
PhilippWendler Oct 17, 2019
4ab8743
Merge branch 'master' into react-table
PhilippWendler Oct 17, 2019
7226802
Remove unused files in wrong location
PhilippWendler Oct 18, 2019
8f5353f
Remove duplicate utility method that leaks file descriptors
PhilippWendler Oct 18, 2019
2ac6674
Cleanup some comments and debugging code
PhilippWendler Oct 25, 2019
ac6f586
simplify code
PhilippWendler Oct 25, 2019
f88e704
Mark react-dev-utils as dev dependency
PhilippWendler Oct 22, 2019
563c9b3
Remove several unused production dependencies from react-table
PhilippWendler Oct 22, 2019
ad6368e
Remove some unused dev dependencies from react-table
PhilippWendler Oct 22, 2019
73f9e0a
Merge branch master into react-table
PhilippWendler Oct 25, 2019
91b3b48
Add license and copyright to all Javascript and CSS files.
PhilippWendler Oct 25, 2019
1a9f5d0
update some metadata of our Javascript code
PhilippWendler Oct 22, 2019
3ce48f6
remove outdated commands for debugging
PhilippWendler Oct 28, 2019
3955309
Add Javascript code formatter "prettier" and format code with it
PhilippWendler Oct 25, 2019
17cb533
Exclude .eggs directory from formatting (appears on Travis)
PhilippWendler Oct 29, 2019
c15d0d8
Improve prettier config and make it a warning
PhilippWendler Oct 29, 2019
c044adc
Add eslint to CI and fix one warning
PhilippWendler Oct 25, 2019
01142ad
Reformat all JS files outside src (config, scripts) and add CI check
PhilippWendler Oct 29, 2019
18f38ba
Merge branch master into react-table
PhilippWendler Oct 29, 2019
0d69d6d
format another file (with test data)
PhilippWendler Oct 29, 2019
990e9cf
Refactor to async/await, refactor single char vars, fixing typos
Oct 31, 2019
86efccd
Remove webpack-manifest-plugin, we do not need it
PhilippWendler Oct 29, 2019
181630a
Apply prettier recursively, this was forgotten.
PhilippWendler Oct 31, 2019
ce9f737
move build files
PhilippWendler Oct 31, 2019
424a988
Fix react table when running table-generator from package instead of …
PhilippWendler Oct 29, 2019
cafb70a
Refactor sort functions and small other changes
Oct 31, 2019
e1edab4
Add more tests
Nov 1, 2019
f2729a8
Refactor filter function
Nov 1, 2019
9f9a761
Move code from third-party JS libs into separate JS files
PhilippWendler Oct 29, 2019
3e69f2f
Disable source maps of JS code, we do not need them.
PhilippWendler Oct 29, 2019
04ebedf
Add licenses of all our JS dependencies to Info section of new tables
PhilippWendler Oct 25, 2019
dfb0ffe
Update development dependencies for react table
PhilippWendler Oct 31, 2019
b8f740b
Update runtime dependencies of react table
PhilippWendler Oct 31, 2019
7ff35a8
Improve Info page of react table and polish a few more things
PhilippWendler Nov 1, 2019
9308cb6
Rebuild bundles for JS and CSS after the recent changes and updates
PhilippWendler Oct 31, 2019
59fe667
Remove code for service worker from react table
PhilippWendler Oct 31, 2019
1b1828e
Make "table-generator --react" the default.
PhilippWendler Nov 1, 2019
cadba22
Make sure generated file is present in JS tests
PhilippWendler Nov 1, 2019
c45ceb2
In table-generator's integration tests, continue to use old HTML tables.
PhilippWendler Nov 1, 2019
0175a50
Suppress huge diff on CI
PhilippWendler Nov 1, 2019
56990b2
Fix crash in table-generator if only CSV is to be generated
PhilippWendler Nov 1, 2019
7920afb
Update bundled JS files
PhilippWendler Nov 1, 2019
fc36de2
Allow the CI check that builds our JS bundles to fail
PhilippWendler Nov 1, 2019
1afe687
Add <column href="..."> feature to react tables.
PhilippWendler Nov 1, 2019
470980b
Merge branch 'DennisSimon/react-table' into react-table (PR #473)
PhilippWendler Nov 2, 2019
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
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*.pyc
*~
build
/build
dist
BenchExec.egg-info
.coverage.*
Expand All @@ -11,3 +11,4 @@ coverage
/.idea/vcs.xml
/.idea/workspace.xml
/benchexec/.idea
node_modules/
44 changes: 44 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,50 @@ flake8:
allow_failure: true # need to fix existing code first


# For HTML tables, test that bundled files are uptodate
javascript-build:
stage: test
image: node
before_script:
- cd benchexec/tablegenerator/react-table
- npm install
script:
- npm run build
- git diff --stat --exit-code
cache:
key: "$CI_JOB_NAME"
paths:
- "benchexec/tablegenerator/react-table/node_modules"
allow_failure: true # not sure why build on CI produces different output than locally

javascript-tests:
stage: test
image: node
before_script:
- cd benchexec/tablegenerator/react-table
- npm install
script:
- npm run test
cache:
key: "$CI_JOB_NAME"
paths:
- "benchexec/tablegenerator/react-table/node_modules"

javascript-eslint:
stage: test
image: node
before_script:
- cd benchexec/tablegenerator/react-table
- npm install
script:
- npx eslint src --max-warnings 0
- 'npx prettier $(find . \( -name build -o -name node_modules \) -prune -type f -o -name "*.js" -o -name "*.json" -o -name "*.css" -o -name "*.scss") --ignore-path .gitignore --check'
cache:
key: "$CI_JOB_NAME"
paths:
- "benchexec/tablegenerator/react-table/node_modules"


# Build Docker images
# following this guideline: https://docs.gitlab.com/ee/ci/docker/using_kaniko.html
.build-docker:
Expand Down
4 changes: 3 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
include *.md
include LICENSE
include benchexec/tablegenerator/template.*
include benchexec/tablegenerator/template*
recursive-include benchexec/tablegenerator/react-table/build *.min.js
recursive-include benchexec/tablegenerator/react-table/build *.min.css
recursive-include bin *
recursive-include contrib *
recursive-include doc *
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ Maintainer: [Philipp Wendler](https://www.philippwendler.de)
Contributors:
- [Aditya Arora](https://github.com/alohamora)
- [Dirk Beyer](https://www.sosy-lab.org/people/beyer/)
- [Laura Bschor](https://github.com/laurabschor)
- [Thomas Bunk](https://github.com/TBunk)
- [Montgomery Carter](https://github.com/MontyCarter)
- [Andreas Donig](https://github.com/adonig)
Expand All @@ -91,6 +92,7 @@ Contributors:
- [Stephan Lukasczyk](https://github.com/stephanlukasczyk)
- [Alexander von Rhein](http://www.infosun.fim.uni-passau.de/se/people-rhein.php)
- [Alexander Schremmer](https://www.xing.com/profile/Alexander_Schremmer)
- [Dennis Simon](https://github.com/DennisSimon)
- [Andreas Stahlbauer](http://stahlbauer.net/)
- [Thomas Stieglmaier](https://stieglmaier.me/)
- [Ilja Zakharov](https://github.com/IljaZakharov)
Expand Down
66 changes: 56 additions & 10 deletions benchexec/tablegenerator/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,9 +75,17 @@
LIB_URL = "https://cdn.jsdelivr.net"
LIB_URL_OFFLINE = "lib/javascript"

TEMPLATE_FILE_NAME = os.path.join(os.path.dirname(__file__), "template.{format}")

REACT_FILES = [
os.path.join(os.path.dirname(__file__), "react-table", "build", path)
for path in ["vendors.min.", "bundle.min."]
]

TEMPLATE_NAME = "template"
TEMPLATE_NAME_REACT = "template_react"
TEMPLATE_FILE_NAME = os.path.join(os.path.dirname(__file__), "{template}.{format}")

TEMPLATE_FORMATS = ["html", "csv"]
TEMPLATE_ENCODING = "UTF-8"
TEMPLATE_NAMESPACE = {
"flatten": Util.flatten,
"json": Util.to_json,
Expand Down Expand Up @@ -1862,13 +1870,38 @@ def create_tables(
)
template_values.version = __version__

# prepare data for js react application
if options.template_name == TEMPLATE_NAME_REACT:
template_values.tools = Util.prepare_run_sets_for_js(
template_values.run_sets, template_values.columns
)
template_values.rows = Util.prepare_rows_for_js(
rows, template_values.tools, outputPath, template_values.href_base
)

template_values.app_css = [
Util.read_bundled_file(path + "css") for path in REACT_FILES
]
template_values.app_js = [
Util.read_bundled_file(path + "js") for path in REACT_FILES
]
# template_values.stats = <see below>
else:
logging.warning("Option --static-table will be removed in BenchExec 3.0.")

futures = []

def write_table(table_type, title, rows, use_local_summary):
# calculate statistics if necessary
if not options.format == ["csv"]:
local_summary = get_summary(runSetResults) if use_local_summary else None
stats, stats_columns = get_stats(rows, local_summary, options.correct_only)

# prepare data for js react application (stats)
if options.template_name == TEMPLATE_NAME_REACT:
template_values.stats = Util.prepare_stats_for_js(
stats, template_values.tools
)
else:
stats = stats_columns = None

Expand Down Expand Up @@ -1901,6 +1934,9 @@ def write_table(table_type, title, rows, use_local_summary):
outfile,
this_template_values,
options.show_table and template_format == "html",
options.template_name
if template_format == "html"
else TEMPLATE_NAME,
)
)

Expand All @@ -1919,15 +1955,15 @@ def write_table(table_type, title, rows, use_local_summary):
return futures


def write_table_in_format(template_format, outfile, template_values, show_table):
def write_table_in_format(
template_format, outfile, template_values, show_table, template_name
):
# read template
Template = tempita.HTMLTemplate if template_format == "html" else tempita.Template
template_file = TEMPLATE_FILE_NAME.format(format=template_format)
try:
template_content = __loader__.get_data(template_file).decode(TEMPLATE_ENCODING)
except NameError:
with open(template_file, mode="r") as f:
template_content = f.read()
template_file = TEMPLATE_FILE_NAME.format(
template=template_name, format=template_format
)
template_content = Util.read_bundled_file(template_file)
template = Template(template_content, namespace=TEMPLATE_NAMESPACE)

result = template.substitute(**template_values)
Expand Down Expand Up @@ -2025,6 +2061,16 @@ def create_argument_parser():
choices=TEMPLATE_FORMATS,
help="Which format to generate (HTML or CSV). Can be specified multiple times. If not specified, all are generated.",
)
parser.add_argument(
"--static-table",
action="store_const",
dest="template_name",
const=TEMPLATE_NAME,
default=TEMPLATE_NAME_REACT,
help="Generate HTML table with static HTML code as known until BenchExec 2.2 "
"instead of the new React-based table. "
"This option will be removed in BenchExec 3.0.",
)
parser.add_argument(
"-c",
"--common",
Expand Down Expand Up @@ -2057,7 +2103,7 @@ def create_argument_parser():
const=LIB_URL_OFFLINE,
default=LIB_URL,
help="Expect JS libs in libs/javascript/ instead of retrieving them from a CDN. "
"Currently does not work for all libs.",
"Currently does not work for all libs, and only relevant for --static-table.",
)
parser.add_argument(
"--show",
Expand Down
28 changes: 28 additions & 0 deletions benchexec/tablegenerator/react-table/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# generated files
/src/data/dependencies.json

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production - include bundle JS
/build/*
!/build/*.min.js
!/build/*.min.css

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*
79 changes: 79 additions & 0 deletions benchexec/tablegenerator/react-table/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br>
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.<br>
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

## Test Datasets

There are 4 different Data sets to test the App in the folder data.
Change the data:

- Go to Overview.js line 2, there the data is imported
- Change the filter to the one you want from the data folder (e.g. new_middle.json)
- Save the file

### next section is not important for the normal testing

### `npm run build`

Builds the app for production to the `build` folder.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).

### Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

### Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

### Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

### Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

### Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

### `npm run build` fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
1 change: 1 addition & 0 deletions benchexec/tablegenerator/react-table/build/bundle.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions benchexec/tablegenerator/react-table/build/bundle.min.js

Large diffs are not rendered by default.

Loading