Skip to content

Commit

Permalink
feat(report)!: Migrate to DSFR version (#31)
Browse files Browse the repository at this point in the history
* feat: responsive dashboard
Fixes #13

* fix: update jest snapshot

* feat: responsive dashboard
Fixes #13

* chore: update test snapshots

* feat: design system de l'Etat
Fixes #29
- add dsfr header and footer
- add theme settings dark or light

* chore: update snapshot test

* use react dsfr

* make theme settings modal properly working

* Adapt home container and first url data

* Add basic eslint config

* Use webpack

* Use proper css modules

* Finish URL page

* Improve table display

* First version of the DSFR table

* Intro page

* Wappalizer

* Fix remaining issues

* Update ts issues

* Replace package-lock by yarn.lock

* Update packages

* Improve badges

* Improve sort on table

* chore: prettier (#34)

* chore(eslint): ignore build

* chore: prettier

* fix(Dashboard): a11y warning fix

* chore: lint

* chore: prettier + eslint config

* Update title

* some more adjustments (#35)

* fix: favicon

* cosmetics

* fix: center-align UnknownIcon

* fix(dev): fix sample config.json

* fix: center-align all badges

* fix: bigger gauges

* fix: trends

* fix(panel): bigger subtitle

* fix: category link

* feat(branding): add entity, description, footer in config

* fix: adjustements for Tristanrobert/issue29 2 (#38)

* fix: center-align UnknownIcon

* fix: center-align all badges

* fixes

* fix: use better report.json

* tests: better report.json

* fix(report): no pagination and shorter urls

* fix(report): hide category menu when not necessary

* fix(report): remove footer html

* fix Gh test

Co-authored-by: Tristan Robert <tristan.robert.44@gmail.com>
Co-authored-by: Julien Bouquillon <julien.bouquillon@sg.social.gouv.fr>
  • Loading branch information
3 people authored Sep 2, 2021
1 parent 0f01e30 commit d32d727
Show file tree
Hide file tree
Showing 80 changed files with 42,762 additions and 29,753 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/init-matrix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
uses: "./init"
- id: test
run: |
EXPECTED='[{url:https://www.free.fr,title:Free,repositories:[iliad/free-ui,iliad/free-api],tools:{screenshot:true,nmap:true,zaproxy:true,wappalyzer:true,httpobs:true,testssl:true,lighthouse:true,thirdparties:true,nuclei:true,updownio:true,dependabot:true,codescan:true,stats:true}},{url:http://chez.com,repositories:[chez/chez-ui,chez/chez-api],tools:{screenshot:false,nmap:true,zaproxy:true,wappalyzer:true,httpobs:true,testssl:true,lighthouse:true,thirdparties:true,nuclei:true,updownio:false,dependabot:true,codescan:true,stats:false}},{url:https://voila.fr,tools:{screenshot:true,nmap:true,zaproxy:true,wappalyzer:true,httpobs:true,testssl:true,lighthouse:true,thirdparties:true,nuclei:true,updownio:true,dependabot:true,codescan:true,stats:true}}]'
EXPECTED='[{url:https://www.free.fr,title:Free,repositories:[iliad/free-ui,iliad/free-api],tools:{screenshot:true,nmap:true,zaproxy:true,wappalyzer:true,http:true,testssl:true,lighthouse:true,thirdparties:true,nuclei:true,updownio:true,dependabot:true,codescan:true,stats:true}},{url:http://chez.com,repositories:[chez/chez-ui,chez/chez-api],tools:{screenshot:false,nmap:true,zaproxy:true,wappalyzer:true,http:true,testssl:true,lighthouse:true,thirdparties:true,nuclei:true,updownio:false,dependabot:true,codescan:true,stats:false}},{url:https://voila.fr,tools:{screenshot:true,nmap:true,zaproxy:true,wappalyzer:true,http:true,testssl:true,lighthouse:true,thirdparties:true,nuclei:true,updownio:true,dependabot:true,codescan:true,stats:true}}]'
RESULT="${{ steps.init.outputs.sites }}"
echo "RESULT=$RESULT"
[[ "$EXPECTED" == "$RESULT" ]]
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
url: "https://www.free.fr,https://voila.fr"
- id: test
run: |
EXPECTED='[{url:https://www.free.fr,title:Free,repositories:[iliad/free-ui,iliad/free-api],tools:{screenshot:true,nmap:true,zaproxy:true,wappalyzer:true,httpobs:true,testssl:true,lighthouse:true,thirdparties:true,nuclei:true,updownio:true,dependabot:true,codescan:true,stats:true}},{url:https://voila.fr,tools:{screenshot:true,nmap:true,zaproxy:true,wappalyzer:true,httpobs:true,testssl:true,lighthouse:true,thirdparties:true,nuclei:true,updownio:true,dependabot:true,codescan:true,stats:true}}]'
EXPECTED='[{url:https://www.free.fr,title:Free,repositories:[iliad/free-ui,iliad/free-api],tools:{screenshot:true,nmap:true,zaproxy:true,wappalyzer:true,http:true,testssl:true,lighthouse:true,thirdparties:true,nuclei:true,updownio:true,dependabot:true,codescan:true,stats:true}},{url:https://voila.fr,tools:{screenshot:true,nmap:true,zaproxy:true,wappalyzer:true,http:true,testssl:true,lighthouse:true,thirdparties:true,nuclei:true,updownio:true,dependabot:true,codescan:true,stats:true}}]'
RESULT="${{ steps.init.outputs.sites }}"
echo "RESULT=$RESULT"
[[ "$EXPECTED" == "$RESULT" ]]
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

.DS_Store
5 changes: 4 additions & 1 deletion dashlord.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
title: Test 1
description: my dashboard
entity: some entity
footer: Powered by BetaGouv
tools:
screenshot: true
nmap: true
zaproxy: true
wappalyzer: true
httpobs: true
http: true
testssl: true
lighthouse: true
thirdparties: true
Expand Down
1 change: 1 addition & 0 deletions report/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
.DS_Store
dist
4 changes: 2 additions & 2 deletions report/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ runs:
yarn
CI=false yarn build
# prevent gh-pages jekyll build
touch build/.nojekyll
touch dist/.nojekyll
# save report in workspace for artifact
cp src/report.json ${{ github.workspace }}/report.json
# save the build for gh-pages publication
mv build ${{ github.workspace }}/build
mv dist ${{ github.workspace }}/build
50 changes: 50 additions & 0 deletions report/www/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
module.exports = {
env: {
browser: true,
es2021: true,
"jest/globals": true,
},
globals: {
__PUBLIC_URL__: false,
},
settings: {
"import/resolver": {
node: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
},
},
extends: [
"plugin:react/recommended",
"airbnb",
"plugin:prettier/recommended",
],
parser: "@typescript-eslint/parser",
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 12,
sourceType: "module",
},
plugins: ["prettier", "react", "@typescript-eslint", "jest"],
ignorePatterns: ["*.d.ts", "build"],
rules: {
"import/prefer-default-export": 0,
"max-classes-per-file": 0,
"max-len": 0,
"import/extensions": ["error", "never", { json: "always" }],
"no-use-before-define": "off",
"@typescript-eslint/no-use-before-define": ["error"],
"react/destructuring-assignment": 0,
"react/no-unescaped-entities": 0,
"react/prop-types": 0,
"react/jsx-props-no-spreading": 0,
"react/jsx-filename-extension": [
1,
{
extensions: [".js", ".tsx"],
},
],
},
};
97 changes: 97 additions & 0 deletions report/www/config/webpack.base.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
const path = require("path");
const webpack = require("webpack");
const { CleanWebpackPlugin } = require("clean-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");

const rootPath = path.resolve(__dirname, "..");

const getConfig = () => ({
context: rootPath,
entry: { main: path.resolve(rootPath, "src/index.tsx") },
output: {
filename: "[name].[contenthash].bundle.js",
path: path.resolve(rootPath, "dist"),
publicPath: "./",
},
optimization: {
moduleIds: "deterministic",
removeEmptyChunks: true,
splitChunks: {
cacheGroups: {
vendor: {
test: /[\\/]node_modules[\\/]/,
name: "vendors",
chunks(chunk) {
return chunk.name === "main";
},
},
},
},
runtimeChunk: { name: "manifest" },
},
module: {
rules: [
{
test: /\.(js|jsx|ts|tsx)?$/,
exclude: [/node_modules/],
use: {
loader: "babel-loader",
options: {
presets: [
"@babel/preset-env",
"@babel/preset-react",
"@babel/preset-typescript",
],
},
},
},
{
test: /\.css$/,
rules: [
{
use: ["style-loader", "css-loader", "sass-loader"],
},
],
},
{
test: /\.svg/,
use: ["svg-url-loader"],
},
{
test: /\.(jpg|png|ttf|eot|svg|woff(2)?)(\?[a-z0-9=&.]+)?$/,
rules: [{ use: ["file-loader"] }],
},
{
test: /\.md$/,
use: [{ loader: "html-loader" }, { loader: "markdown-loader" }],
},
],
},
resolve: {
extensions: [".js", ".jsx", ".ts", ".tsx"],
},
plugins: [
new CleanWebpackPlugin(),
new HtmlWebpackPlugin({
alwaysWriteToDisk: true,
filename: path.resolve(rootPath, "dist/index.html"),
template: path.resolve(rootPath, "index.html"),
}),
new CopyPlugin({
patterns: ["public"],
}),
new webpack.DefinePlugin({
__PUBLIC_URL__: "'http://localhost:3000'",
}),
],
performance: {
hints: "warning",
// Calculates sizes of gziped bundles.
assetFilter(assetFilename) {
return assetFilename.endsWith(".js.gz");
},
},
});

module.exports = getConfig;
57 changes: 57 additions & 0 deletions report/www/config/webpack.dev.hot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
const webpack = require("webpack");
const path = require("path");

const defaultConfig = require("./webpack.base");

const baseConfig = defaultConfig();

module.exports = {
...baseConfig,
mode: "development",
devtool: "inline-source-map",
entry: {
main: [
"webpack-dev-server/client?http://localhost:3000/",
"./src/index.tsx",
],
},
devServer: {
contentBase: path.resolve(baseConfig.context, "dist"),
headers: {
"Access-Control-Allow-Origin": "*",
},
historyApiFallback: true,
port: 3000,
},
output: {
filename: "[name].bundle.js",
path: path.resolve(baseConfig.context, "dist"),
publicPath: "/",
},
module: {
rules: [
{
test: /\.cssmodule\.scss$/,
use: [
"style-loader",
{
loader: "css-loader",
options: {
modules: {
localIdentName: "[path][name]__[local]",
},
importLoaders: 1,
},
},
"sass-loader",
],
},
].concat(baseConfig.module.rules),
},
plugins: baseConfig.plugins.concat([
new webpack.HotModuleReplacementPlugin(),
]),
performance: {
hints: false,
},
};
35 changes: 35 additions & 0 deletions report/www/config/webpack.production.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
const webpack = require("webpack");

const defaultConfig = require("./webpack.base");

const baseConfig = defaultConfig();

module.exports = (apiUrl) => ({
...baseConfig,
mode: "production",
module: {
rules: [
{
test: /\.cssmodule\.scss$/,
use: [
"style-loader",
{
loader: "css-loader",
options: {
modules: {
localIdentName: "[hash:base64]",
},
importLoaders: 1,
},
},
"sass-loader",
],
},
].concat(baseConfig.module.rules),
},
plugins: baseConfig.plugins.concat([
new webpack.DefinePlugin({
__PUBLIC_URL__: "'http://localhost:3000'",
}),
]),
});
11 changes: 11 additions & 0 deletions report/www/config/webpack.production.with.bundle.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const { BundleAnalyzerPlugin } = require("webpack-bundle-analyzer");

const defaultConfig = require("./webpack.production.js");

module.exports = (apiUrl) => {
const config = defaultConfig(apiUrl);
return {
...config,
plugins: config.plugins.concat([new BundleAnalyzerPlugin()]),
};
};
21 changes: 21 additions & 0 deletions report/www/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html lang="fr" data-fr-reset>

<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta
name="description"
content="Dashboard des applications"
/>
<link rel="icon" type="image/png" sizes="32x32" href="/favicon.ico">
<title>Dashlord</title>
</head>

<body>
<noscript>
You need to enable JavaScript to run this app.
</noscript>
<div id="root" style="height:100%"></div>
</body>
</html>
Loading

0 comments on commit d32d727

Please sign in to comment.