Skip to content

Commit

Permalink
Configuration injection (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
barroco authored Aug 14, 2023
1 parent e6cfea0 commit 134356d
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 9 deletions.
11 changes: 10 additions & 1 deletion reports/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,18 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<!--
To configure the application, set the window.interuss object.
See TemplatedReportApplicationConfiguration in [1] for details about the expected structure.
[1] https://github.com/interuss/monitoring/blob/main/monitoring/uss_qualifier/configurations/configuration.py
Do not remove the next commented tag since it used by the templating engine to automate configuration injection.
-->
<!-- Configuration goes here -->

</head>
<body>
<div id="root"></div>
Expand Down
3 changes: 2 additions & 1 deletion reports/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"typescript": "^5.0.2",
"vite": "^4.4.5"
"vite": "^4.4.5",
"vite-plugin-singlefile": "^0.13.5"
}
}
1 change: 0 additions & 1 deletion reports/public/vite.svg

This file was deleted.

12 changes: 8 additions & 4 deletions reports/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import './App.css'
import { ReportsReportTestRunReport } from './types/TestRunReport'

// TODO: Replace with actual JSON report. Placeholder to verify proper typing.
const report: ReportsReportTestRunReport = {
const report: ReportsReportTestRunReport =
{
baseline_signature: '',
codebase_version: '',
commit_hash: '',
Expand All @@ -18,11 +19,14 @@ const report: ReportsReportTestRunReport = {
}

function App() {

// FIXME
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const configuration = JSON.stringify((window as any)["interuss"])
console.log("Configuration:", configuration)
return (
<>
<h1>Report</h1>
<code>{JSON.stringify(report, null, 2)}</code>
<h1>Report</h1>
<code>{JSON.stringify(report, null, 2)}</code>
</>
)
}
Expand Down
4 changes: 3 additions & 1 deletion reports/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import { viteSingleFile } from "vite-plugin-singlefile"

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
base: './',
plugins: [react(), viteSingleFile()],
})
9 changes: 8 additions & 1 deletion reports/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1170,7 +1170,7 @@ merge2@^1.3.0, merge2@^1.4.1:
resolved "https://registry.yarnpkg.com/merge2/-/merge2-1.4.1.tgz#4368892f885e907455a6fd7dc55c0c9d404990ae"
integrity sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==

micromatch@^4.0.4:
micromatch@^4.0.4, micromatch@^4.0.5:
version "4.0.5"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-4.0.5.tgz#bc8999a7cbbf77cdc89f132f6e467051b49090c6"
integrity sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==
Expand Down Expand Up @@ -1476,6 +1476,13 @@ uri-js@^4.2.2:
dependencies:
punycode "^2.1.0"

vite-plugin-singlefile@^0.13.5:
version "0.13.5"
resolved "https://registry.yarnpkg.com/vite-plugin-singlefile/-/vite-plugin-singlefile-0.13.5.tgz#9465dbb0b06afb2a73600a50fcce4b51c8d10999"
integrity sha512-y/aRGh8qHmw2f1IhaI/C6PJAaov47ESYDvUv1am1YHMhpY+19B5k5Odp8P+tgs+zhfvak6QB1ykrALQErEAo7g==
dependencies:
micromatch "^4.0.5"

vite@^4.4.5:
version "4.4.9"
resolved "https://registry.yarnpkg.com/vite/-/vite-4.4.9.tgz#1402423f1a2f8d66fd8d15e351127c7236d29d3d"
Expand Down

0 comments on commit 134356d

Please sign in to comment.