mirror of
https://github.com/lucaspalomodevelop/monitoring-server.git
synced 2026-03-12 22:57:21 +00:00
add vue
This commit is contained in:
parent
4d96a9b23b
commit
8ca8e2439e
12
.editorconfig
Normal file
12
.editorconfig
Normal file
@ -0,0 +1,12 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.md]
|
||||
trim_trailing_whitespace = false
|
||||
7
.gitignore
vendored
7
.gitignore
vendored
@ -1,3 +1,10 @@
|
||||
node_modules
|
||||
*.log
|
||||
.DS_Store
|
||||
|
||||
# poi dist
|
||||
dist
|
||||
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
|
||||
21
package.json
21
package.json
@ -1,5 +1,6 @@
|
||||
{
|
||||
"name": "monitoring_backend",
|
||||
"productName": "monitoring",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"author": "Lucas Manuel Palomo Lauterbach <lucas.palomo@t-online.de>",
|
||||
@ -8,13 +9,29 @@
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"start": "node ./bin/app",
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"test": "echo \"Error: no test specified\" && exit 1",
|
||||
"vue:dev": "cd ./views && poi",
|
||||
"vue:build": "cd ./views && poi build",
|
||||
"vue:report": "cd ./views && poi build --bundle-report",
|
||||
"vue:serve": "cd ./views && serve dist --single",
|
||||
"vue:test": "cd ./views && tyu"
|
||||
},
|
||||
"dependencies": {
|
||||
"express": "^4.18.2",
|
||||
"http-errors": "^2.0.0",
|
||||
"pino": "^8.7.0",
|
||||
"pino-http": "^8.2.1",
|
||||
"pino-pretty": "^9.1.1"
|
||||
"pino-pretty": "^9.1.1",
|
||||
"offline-plugin": "^4.8.0",
|
||||
"normalize.css": "^7.0.0",
|
||||
"object-assign": "^4.1.1",
|
||||
"promise-polyfill": "^6.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"poi": "^9.0.0",
|
||||
"poi-preset-bundle-report": "^2.0.0",
|
||||
"serve": "^6.1.0",
|
||||
"tyu": "^1.0.4",
|
||||
"poi-preset-offline": "^9.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
16
routes.js
16
routes.js
@ -1,9 +1,13 @@
|
||||
'use strict'
|
||||
const simple = require('./handlers/simple')
|
||||
const configured = require('./handlers/configured')
|
||||
"use strict";
|
||||
const api = require("./handlers/api");
|
||||
const configured = require("./handlers/configured");
|
||||
const staticVuePath = __dirname + "\\views\\dist";
|
||||
const express = require("express");
|
||||
|
||||
module.exports = function(app, opts) {
|
||||
// Setup routes, middleware, and handlers
|
||||
app.get('/', simple)
|
||||
app.get('/configured', configured(opts))
|
||||
}
|
||||
|
||||
app.get("/configured", configured(opts));
|
||||
app.get("/api", api);
|
||||
app.get("*", express.static(staticVuePath));
|
||||
};
|
||||
|
||||
47
views/README.md
Normal file
47
views/README.md
Normal file
@ -0,0 +1,47 @@
|
||||
# monitoring
|
||||
|
||||
> My ace Vue project
|
||||
|
||||
## Commands
|
||||
|
||||
You can replace `yarn` with `npm run` here.
|
||||
|
||||
```bash
|
||||
# build for production
|
||||
yarn build
|
||||
|
||||
# development mode
|
||||
yarn dev
|
||||
|
||||
# run unit tests
|
||||
yarn test
|
||||
|
||||
# serve the bundled dist folder in production mode
|
||||
yarn serve
|
||||
```
|
||||
|
||||
## Polyfills
|
||||
|
||||
By default we only polyfill `window.Promise` and `Object.assign`. You can add more polyfills in `./src/polyfills.js`.
|
||||
|
||||
## Analyze bundle size
|
||||
|
||||
Run `yarn report` to get a report of bundle size which helps you:
|
||||
|
||||
- Realize what's really inside your bundle
|
||||
- Find out what modules make up the most of it's size
|
||||
- Find modules that got there by mistake
|
||||
- Optimize it!
|
||||
|
||||
## Progress Web App
|
||||
|
||||
Your app is now offline-ready (only in production bundle), which means you can visit it without network.
|
||||
|
||||
Here we use a default [manifest.json](./static/manifest.json) to configurure your pwa, for example, to enable *Add to Home Screen* feature on Android. It will be copied directly to `./dist/manifest.json`.
|
||||
|
||||
|
||||
For all the available options, please head to [poi-preset-offline](https://github.com/egoist/poi/tree/master/packages/poi-preset-offline#api).
|
||||
|
||||
---
|
||||
|
||||
This project is generated by [create-vue-app](https://github.com/vue-land/create-vue-app).
|
||||
29
views/index.ejs
Normal file
29
views/index.ejs
Normal file
@ -0,0 +1,29 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
|
||||
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
<meta name="theme-color" content="#4DBA87">
|
||||
|
||||
|
||||
<% if (htmlWebpackPlugin.options.description) { %>
|
||||
<meta name="description" content="<%= htmlWebpackPlugin.options.description %>"/>
|
||||
<% } %>
|
||||
|
||||
<% for (var chunk of webpack.chunks) {
|
||||
for (var file of chunk.files) {
|
||||
if (file.match(/\.(js|css)$/)) { %>
|
||||
<link rel="<%= chunk.initial?'preload':'prefetch' %>" href="<%= htmlWebpackPlugin.files.publicPath + file %>" as="<%= file.match(/\.css$/)?'style':'script' %>"><% }}} %>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
You need to enable JavaScript to run this app.
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
</body>
|
||||
</html>
|
||||
24
views/poi.config.js
Normal file
24
views/poi.config.js
Normal file
@ -0,0 +1,24 @@
|
||||
const path = require("path");
|
||||
const pkg = require("../package");
|
||||
|
||||
module.exports = {
|
||||
transformModules: ["asn1.js"],
|
||||
entry: ["src/polyfills.js", "src/index.js"],
|
||||
html: {
|
||||
title: pkg.productName,
|
||||
description: pkg.description,
|
||||
template: path.join(__dirname, "index.ejs")
|
||||
},
|
||||
postcss: {
|
||||
plugins: [
|
||||
// Your postcss plugins
|
||||
]
|
||||
},
|
||||
presets: [
|
||||
require("poi-preset-bundle-report")(),
|
||||
require("poi-preset-offline")({
|
||||
pwa: "./src/pwa.js", // Path to pwa runtime entry
|
||||
pluginOptions: {} // Additional options for offline-plugin
|
||||
})
|
||||
]
|
||||
};
|
||||
10
views/src/components/App.test.js
Normal file
10
views/src/components/App.test.js
Normal file
@ -0,0 +1,10 @@
|
||||
import Vue from 'vue'
|
||||
import App from './App.vue'
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
it('does not crash', () => {
|
||||
const Ctor = Vue.extend(App)
|
||||
const vm = new Ctor().$mount()
|
||||
expect(vm.$el.textContent).toMatch(/Welcome to Vue\.js/)
|
||||
})
|
||||
81
views/src/components/App.vue
Normal file
81
views/src/components/App.vue
Normal file
@ -0,0 +1,81 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<div class="banner">
|
||||
<img
|
||||
src="https://vuejs.org/images/logo.png"
|
||||
width="100"
|
||||
alt="vue"
|
||||
class="logo"
|
||||
/>
|
||||
<h1>Welcome to Monitoring</h1>
|
||||
</div>
|
||||
<!-- <div class="bottom">
|
||||
To get started, edit <code>./src/components/App.vue</code> and save to reload.<br/>
|
||||
<span class="fade">
|
||||
Checkout <code>./README.md</code> for more usages.
|
||||
</span>
|
||||
</div> -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'app'
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- CSS libraries -->
|
||||
<style src="normalize.css/normalize.css"></style>
|
||||
|
||||
<!-- Global CSS -->
|
||||
<style>
|
||||
code {
|
||||
font-family: Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;
|
||||
font-size: 0.9em;
|
||||
white-space: pre-wrap;
|
||||
color: #2c3e50;
|
||||
}
|
||||
|
||||
code::before, code::after {
|
||||
content: '`';
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- Scoped component css -->
|
||||
<!-- It only affect current component -->
|
||||
<style scoped>
|
||||
#app {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
#app h1 {
|
||||
color: #2c3e50;
|
||||
font-weight: 300;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.banner {
|
||||
height: 200px;
|
||||
background-color: #f6f6f6;
|
||||
padding: 50px 10px;
|
||||
}
|
||||
|
||||
.bottom {
|
||||
padding: 80px 10px;
|
||||
font-size: 24px;
|
||||
font-weight: 300;
|
||||
}
|
||||
|
||||
.fade {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.logo {
|
||||
animation: spin 4s 1s infinite linear
|
||||
}
|
||||
|
||||
@keyframes spin {
|
||||
from {transform:rotate(0deg);}
|
||||
to {transform:rotate(360deg);}
|
||||
}
|
||||
</style>
|
||||
9
views/src/index.js
Normal file
9
views/src/index.js
Normal file
@ -0,0 +1,9 @@
|
||||
import Vue from 'vue'
|
||||
import App from './components/App.vue'
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
new Vue({
|
||||
el: '#app',
|
||||
render: h => h(App)
|
||||
})
|
||||
5
views/src/polyfills.js
Normal file
5
views/src/polyfills.js
Normal file
@ -0,0 +1,5 @@
|
||||
if (!window.Promise) {
|
||||
window.Promise = require('promise-polyfill')
|
||||
}
|
||||
|
||||
Object.assign = require('object-assign')
|
||||
7
views/src/pwa.js
Normal file
7
views/src/pwa.js
Normal file
@ -0,0 +1,7 @@
|
||||
import runtime from 'offline-plugin/runtime'
|
||||
|
||||
runtime.install({
|
||||
onUpdateReady() {
|
||||
runtime.applyUpdate()
|
||||
}
|
||||
})
|
||||
BIN
views/static/favicon.ico
Normal file
BIN
views/static/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 27 KiB |
BIN
views/static/icons/android-chrome-192x192.png
Normal file
BIN
views/static/icons/android-chrome-192x192.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.2 KiB |
BIN
views/static/icons/android-chrome-512x512.png
Normal file
BIN
views/static/icons/android-chrome-512x512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
20
views/static/manifest.json
Normal file
20
views/static/manifest.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "monitoring",
|
||||
"short_name": "monitoring",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/icons/android-chrome-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png"
|
||||
},
|
||||
{
|
||||
"src": "/icons/android-chrome-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png"
|
||||
}
|
||||
],
|
||||
"start_url": "/",
|
||||
"display": "standalone",
|
||||
"background_color": "#000000",
|
||||
"theme_color": "#4DBA87"
|
||||
}
|
||||
9498
views/yarn.lock
Normal file
9498
views/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user