Vue.js 3 based frontend
This commit is contained in:
parent
5fe7f45728
commit
b6f21b8192
@ -1,5 +1,17 @@
|
||||
./node_modules
|
||||
./build
|
||||
.git
|
||||
*.md
|
||||
.gitignore
|
||||
.kpt-pipeline/
|
||||
k8s/
|
||||
skaffold.yaml
|
||||
README.md
|
||||
.git/
|
||||
node_modules/
|
||||
|
||||
# Editor directories and files
|
||||
.vscode/*
|
||||
!.vscode/extensions.json
|
||||
.idea
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
*.kpt-pipeline
|
||||
|
@ -1,39 +1,9 @@
|
||||
# pull official base image
|
||||
FROM node AS builder
|
||||
FROM node:16-alpine
|
||||
|
||||
# set working directory
|
||||
WORKDIR /app
|
||||
EXPOSE 8080
|
||||
CMD ["npm", "run", "dev"]
|
||||
|
||||
|
||||
# install app dependencies
|
||||
#copies package.json and package-lock.json to Docker environment
|
||||
COPY package.json ./
|
||||
|
||||
# Installs all node packages
|
||||
COPY package* ./
|
||||
RUN npm install
|
||||
|
||||
|
||||
# Copies everything over to Docker environment
|
||||
COPY . ./
|
||||
RUN npm run build
|
||||
|
||||
#Stage 2
|
||||
#######################################
|
||||
#pull the official nginx:1.19.0 base image
|
||||
FROM nginx
|
||||
|
||||
#copies React to the container directory
|
||||
# Set working directory to nginx resources directory
|
||||
WORKDIR /usr/share/nginx/html
|
||||
# Remove default nginx static resources
|
||||
RUN rm -rf ./*
|
||||
RUN apt-get install bash
|
||||
|
||||
# Copies configuration files
|
||||
COPY ./default.conf /etc/nginx/conf.d/default.conf
|
||||
|
||||
# Copies static resources from builder stage
|
||||
COPY --from=builder /app/build .
|
||||
|
||||
# Containers run nginx with global directives and daemon off
|
||||
ENTRYPOINT ["nginx", "-g", "daemon off;"]
|
||||
COPY . .
|
||||
|
@ -1,16 +0,0 @@
|
||||
server {
|
||||
listen 3003;
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
root /usr/share/nginx/html;
|
||||
index index.html index.htm;
|
||||
}
|
||||
|
||||
location /events {
|
||||
proxy_buffering off;
|
||||
proxy_pass http://127.0.0.1:3002/events;
|
||||
}
|
||||
|
||||
|
||||
}
|
27217
frontend/package-lock.json
generated
27217
frontend/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -1,40 +1,25 @@
|
||||
{
|
||||
"name": "frontend",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@testing-library/jest-dom": "^5.16.1",
|
||||
"@testing-library/react": "^12.1.2",
|
||||
"@testing-library/user-event": "^13.5.0",
|
||||
"react": "^17.0.2",
|
||||
"react-dom": "^17.0.2",
|
||||
"react-hooks-sse": "^2.0.0",
|
||||
"react-scripts": "5.0.0",
|
||||
"web-vitals": "^2.1.3"
|
||||
},
|
||||
"name": "@k-space/log-viewer",
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
"serve": "vue-cli-service serve",
|
||||
"dev": "vite --port 8080 --host",
|
||||
"build": "vite build",
|
||||
"preview": "vite preview --port 3003"
|
||||
},
|
||||
"proxy": "http://localhost:3002",
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
"react-app",
|
||||
"react-app/jest"
|
||||
]
|
||||
"dependencies": {
|
||||
"@ag-grid-community/core": "^28.2.0",
|
||||
"@vue/cli-service": "^5.0.8",
|
||||
"ag-grid-vue3": "^28.2.0",
|
||||
"core-js": "^3.25.1",
|
||||
"event-hooks-webpack-plugin": "^2.2.0",
|
||||
"pinia": "^2.0.21",
|
||||
"single-spa-vue": "^2.5.1",
|
||||
"systemjs-webpack-interop": "^2.3.7",
|
||||
"vue": "^3.2.39"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
"last 1 safari version"
|
||||
]
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^3.0.3",
|
||||
"vite": "^3.0.9"
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 4.2 KiB |
@ -1,41 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<meta name="theme-color" content="#000000" />
|
||||
<meta
|
||||
name="Event logging"
|
||||
content="Web site created using create-react-app"
|
||||
/>
|
||||
<!--
|
||||
manifest.json provides metadata used when your web app is installed on a
|
||||
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
|
||||
-->
|
||||
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
|
||||
<!--
|
||||
Notice the use of %PUBLIC_URL% in the tags above.
|
||||
It will be replaced with the URL of the `public` folder during the build.
|
||||
Only files inside the `public` folder can be referenced from the HTML.
|
||||
|
||||
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
|
||||
work correctly both with client-side routing and a non-root public URL.
|
||||
Learn how to configure a non-root public URL by running `npm run build`.
|
||||
-->
|
||||
<title>Event log</title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<!--
|
||||
This HTML file is a template.
|
||||
If you open it directly in the browser, you will see an empty page.
|
||||
|
||||
You can add webfonts, meta tags, or analytics to this file.
|
||||
The build step will place the bundled scripts into the <body> tag.
|
||||
|
||||
To begin the development, run `npm start` or `yarn start`.
|
||||
To create a production bundle, use `npm run build` or `yarn build`.
|
||||
-->
|
||||
</body>
|
||||
</html>
|
Binary file not shown.
Before Width: | Height: | Size: 5.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 9.4 KiB |
@ -1,25 +0,0 @@
|
||||
{
|
||||
"short_name": "React App",
|
||||
"name": "Create React App Sample",
|
||||
"icons": [
|
||||
{
|
||||
"src": "favicon.ico",
|
||||
"sizes": "64x64 32x32 24x24 16x16",
|
||||
"type": "image/x-icon"
|
||||
},
|
||||
{
|
||||
"src": "logo192.png",
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
},
|
||||
{
|
||||
"src": "logo512.png",
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}
|
||||
],
|
||||
"start_url": ".",
|
||||
"display": "standalone",
|
||||
"theme_color": "#000000",
|
||||
"background_color": "#ffffff"
|
||||
}
|
@ -1,3 +0,0 @@
|
||||
# https://www.robotstxt.org/robotstxt.html
|
||||
User-agent: *
|
||||
Disallow:
|
@ -1,3 +0,0 @@
|
||||
body {
|
||||
background-color: #eafaf9;
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { useSSE, SSEProvider } from 'react-hooks-sse';
|
||||
import './App.css';
|
||||
import EventList from '../eventList/EventList.js';
|
||||
|
||||
|
||||
import './App.css';
|
||||
|
||||
|
||||
const Component = () => {
|
||||
const event = useSSE('log-entry')
|
||||
const [events, setEvents] = useState([])
|
||||
|
||||
useEffect(() =>{
|
||||
console.info(event);
|
||||
if (event) {
|
||||
for (var j = 0; j < events.length; j++) {
|
||||
if (events[j].timestamp <= event.timestamp) {
|
||||
if (events[j]._id == event._id) {
|
||||
setEvents([...events.slice(0, j), event, ...events.slice(j+1)]);
|
||||
return;
|
||||
} else {
|
||||
setEvents([...events.slice(0, j), event, ...events.slice(j)]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setEvents([event, ...events]);
|
||||
}
|
||||
}, [event])
|
||||
return <EventList data={events} />
|
||||
}
|
||||
|
||||
function App() {
|
||||
return (
|
||||
|
||||
<SSEProvider endpoint="/events" >
|
||||
<Component />
|
||||
|
||||
|
||||
</SSEProvider>
|
||||
|
||||
)
|
||||
}
|
||||
|
||||
export default App;
|
@ -1,18 +0,0 @@
|
||||
.eventDiv {
|
||||
background-color: aliceblue;
|
||||
border: 2px solid #26A69A;
|
||||
border-radius: 15px;
|
||||
text-align: left;
|
||||
padding: 5px;
|
||||
max-width: fit-content;
|
||||
font-family: apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
|
||||
color: #092a26;
|
||||
margin: 7px 0px;
|
||||
}
|
||||
|
||||
.eventPic {
|
||||
border-radius: 15px;
|
||||
border: 1px groove #d5f6f2;
|
||||
max-width:100%;
|
||||
max-height:100%;
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
import React from "react";
|
||||
import "./Event.css";
|
||||
|
||||
function Event(props) {
|
||||
|
||||
let imgArray = [];
|
||||
|
||||
if (props.data.hasOwnProperty('screenshots')) {
|
||||
props.data.screenshots.forEach(element => {
|
||||
imgArray = [...imgArray, (<a href={element.orig} target="_blank"><img src={element.url} className="eventPic"></img></a>)]
|
||||
});
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="eventDiv">
|
||||
{JSON.stringify(props.data.source)}
|
||||
<br></br>
|
||||
{[...imgArray]}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default Event;
|
@ -1,11 +0,0 @@
|
||||
.eventListUl {
|
||||
background-color: #c1f1ec;
|
||||
max-width: 75%;
|
||||
padding: 5px;
|
||||
border: 5px solid #26A69A;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.eventListLi {
|
||||
list-style: none;
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
import React from 'react';
|
||||
import Event from '../event/Event.js';
|
||||
import './EventList.css';
|
||||
|
||||
function EventList(props) {
|
||||
return (
|
||||
<ul className="eventListUl">
|
||||
{props.data.map((event) => {
|
||||
return <li className="eventListLi"><Event data={event} /></li>
|
||||
})}
|
||||
</ul>
|
||||
)
|
||||
}
|
||||
|
||||
export default EventList;
|
@ -1,3 +0,0 @@
|
||||
body {
|
||||
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import './index.css';
|
||||
import App from './components/app/App.js';
|
||||
import reportWebVitals from './reportWebVitals';
|
||||
|
||||
ReactDOM.render(
|
||||
<React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>,
|
||||
document.getElementById('root')
|
||||
);
|
||||
|
||||
// If you want to start measuring performance in your app, pass a function
|
||||
// to log results (for example: reportWebVitals(console.log))
|
||||
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
|
||||
reportWebVitals();
|
@ -1,13 +0,0 @@
|
||||
const reportWebVitals = onPerfEntry => {
|
||||
if (onPerfEntry && onPerfEntry instanceof Function) {
|
||||
import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
|
||||
getCLS(onPerfEntry);
|
||||
getFID(onPerfEntry);
|
||||
getFCP(onPerfEntry);
|
||||
getLCP(onPerfEntry);
|
||||
getTTFB(onPerfEntry);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default reportWebVitals;
|
@ -1,5 +0,0 @@
|
||||
// jest-dom adds custom jest matchers for asserting on DOM nodes.
|
||||
// allows you to do things like:
|
||||
// expect(element).toHaveTextContent(/react/i)
|
||||
// learn more: https://github.com/testing-library/jest-dom
|
||||
import '@testing-library/jest-dom';
|
Loading…
Reference in New Issue
Block a user