Compare commits

..

No commits in common. "db4806b7d2dae3b0e829f1631c124a1194f8086c" and "eb97abee7fb22976598666a3a397140de2b47c2a" have entirely different histories.

26 changed files with 43555 additions and 3927 deletions

23
.gitignore vendored
View File

@ -186,26 +186,3 @@ cython_debug/
# and can be added to the global gitignore or merged into this file. For a more nuclear # and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder. # option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/ #.idea/
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

View File

@ -1,20 +1,10 @@
from fastapi import FastAPI from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from ..months import retreive_months
from ..config import config from ..config import config
app = FastAPI() app = FastAPI()
app.add_middleware(
CORSMiddleware,
allow_origins=["http://localhost:8080"],
allow_credentials=True,
allow_methods=["*"],
allow_headers=["*"],
)
@app.get("/months") @app.get("/months")
async def get_months(): async def get_months():
return retreive_months(config["datapath"]) print(config)
return {"message": "plop"}

View File

@ -1,28 +0,0 @@
from pathlib import Path
import csv
CSV_STYLE = {
"delimiter": ",",
"quotechar": '"',
}
def list_month_files(path:str, file_schema:str="*_months.csv") -> list[Path]:
print(list(Path(path).glob("*")))
return list(Path(path).glob(file_schema))
def extract_month(filename:Path) -> list[dict[str,str]]:
months = []
with open(filename, 'r', newline='') as csvfile:
month_reader = csv.DictReader(csvfile, **CSV_STYLE)
for month in month_reader:
months.append(month)
return months
def retreive_months(path:str):
month_files = list_month_files(path)
months = []
for file in month_files:
months += extract_month(file)
return months

View File

@ -9,10 +9,3 @@ services:
volumes: volumes:
- ./backend/src:/app/src - ./backend/src:/app/src
- ./datas:/datas - ./datas:/datas
frontend:
build: ./front
volumes:
- './front:/app'
ports:
- 8080:8080

View File

@ -1,15 +0,0 @@
FROM node:lts-alpine3.18 as node-base
WORKDIR /app
ENV PATH /app/node_modules/.bin:$PATH
FROM node-base as node-prepared
RUN npm install @vue/cli@5.0.8 -g
COPY package.json .
COPY yarn.lock .
RUN yarn install
FROM node-prepared as vue-set
CMD ["yarn", "serve"]

View File

@ -1,4 +1,4 @@
# front # sousmargot
## Project setup ## Project setup
``` ```

1905
front/dist_electron/index.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,54 @@
{
"name": "sousmargot",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"electron:build": "vue-cli-service electron:build",
"electron:serve": "vue-cli-service electron:serve",
"postinstall": "electron-builder install-app-deps",
"postuninstall": "electron-builder install-app-deps"
},
"main": "background.js",
"dependencies": {
"core-js": "^3.6.5",
"vue": "^3.0.0",
"vue-router": "^4.0.8"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"babel-eslint": "^10.1.0",
"electron": "^13.1.1",
"electron-devtools-installer": "^3.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0",
"vue-cli-plugin-electron-builder": "~2.0.0"
},
"engines": {
"node": ">=16.0.0 <17.0.0"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}

View File

@ -1,19 +0,0 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}

33781
front/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +1,36 @@
{ {
"name": "front", "name": "sousmargot",
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
"build": "vue-cli-service build", "build": "vue-cli-service build",
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint",
"electron:build": "vue-cli-service electron:build",
"electron:serve": "vue-cli-service electron:serve",
"postinstall": "electron-builder install-app-deps",
"postuninstall": "electron-builder install-app-deps"
}, },
"main": "background.js",
"dependencies": { "dependencies": {
"axios": "^1.4.0", "core-js": "^3.6.5",
"core-js": "^3.8.3", "vue": "^3.0.0",
"vue": "^3.2.13", "vue-router": "^4.0.8"
"vue-router": "^4.0.3",
"vuex": "^4.1.0"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.12.16", "@vue/cli-plugin-babel": "~4.5.0",
"@babel/eslint-parser": "^7.12.16", "@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-plugin-babel": "~5.0.0", "@vue/cli-service": "~4.5.0",
"@vue/cli-plugin-eslint": "~5.0.0", "@vue/compiler-sfc": "^3.0.0",
"@vue/cli-plugin-router": "~5.0.0", "babel-eslint": "^10.1.0",
"@vue/cli-service": "~5.0.0", "electron": "^13.1.1",
"eslint": "^7.32.0", "electron-devtools-installer": "^3.1.0",
"eslint-plugin-vue": "^8.0.3" "eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0",
"vue-cli-plugin-electron-builder": "~2.0.0"
},
"engines": {
"node": ">=16.0.0 <17.0.0"
}, },
"eslintConfig": { "eslintConfig": {
"root": true, "root": true,
@ -34,14 +42,13 @@
"eslint:recommended" "eslint:recommended"
], ],
"parserOptions": { "parserOptions": {
"parser": "@babel/eslint-parser" "parser": "babel-eslint"
}, },
"rules": {} "rules": {}
}, },
"browserslist": [ "browserslist": [
"> 1%", "> 1%",
"last 2 versions", "last 2 versions",
"not dead", "not dead"
"not ie 11"
] ]
} }

View File

@ -1,15 +1,17 @@
<template> <template>
<div id="app"> <Nav></Nav>
<router-view/> <router-view></router-view>
</div>
</template> </template>
<style> <script>
#app { import Nav from './components/nav.vue'
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased; export default {
-moz-osx-font-smoothing: grayscale; name: 'App',
text-align: center; components: {
color: #2c3e50; Nav
}
} }
</style> </script>
<style></style>

83
front/src/background.js Normal file
View File

@ -0,0 +1,83 @@
'use strict'
import { app, protocol, BrowserWindow } from 'electron'
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib'
import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer'
const isDevelopment = process.env.NODE_ENV !== 'production'
// Scheme must be registered before the app is ready
protocol.registerSchemesAsPrivileged([
{ scheme: 'app', privileges: { secure: true, standard: true } }
])
async function createWindow() {
// Create the browser window.
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
// Use pluginOptions.nodeIntegration, leave this alone
// See nklayman.github.io/vue-cli-plugin-electron-builder/guide/security.html#node-integration for more info
nodeIntegration: process.env.ELECTRON_NODE_INTEGRATION,
contextIsolation: !process.env.ELECTRON_NODE_INTEGRATION
}
})
if (process.env.WEBPACK_DEV_SERVER_URL) {
// Load the url of the dev server if in development mode
await win.loadURL(process.env.WEBPACK_DEV_SERVER_URL)
if (!process.env.IS_TEST) win.webContents.openDevTools()
} else {
createProtocol('app')
// Load the index.html when not in development
win.loadURL('app://./index.html')
}
}
// Quit when all windows are closed.
app.on('window-all-closed', () => {
// On macOS it is common for applications and their menu bar
// to stay active until the user quits explicitly with Cmd + Q
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', async () => {
if (isDevelopment && !process.env.IS_TEST) {
// Install Vue Devtools
try {
//await installExtension(VUEJS_DEVTOOLS)
// vuedev tools for vue3
await installExtension('ljjemllljcmogpfapbkkighbhhppjdbg')
} catch (e) {
console.error('Vue Devtools failed to install:', e.toString())
}
}
createWindow()
})
// Exit cleanly on request from parent process in development mode.
if (isDevelopment) {
if (process.platform === 'win32') {
process.on('message', (data) => {
if (data === 'graceful-exit') {
app.quit()
}
})
} else {
process.on('SIGTERM', () => {
app.quit()
})
}
}

View File

@ -1,33 +0,0 @@
<template>
<div>
<p>{{ msg }}</p>
</div>
</template>
<script>
import axios from 'axios';
export default {
name: 'HelloWolrd',
data() {
return {
msg: '',
};
},
methods: {
getMessage() {
axios.get('/months')
.then((res) => {
this.msg = res.data;
})
.catch((error) => {
console.error(error);
});
},
},
created() {
this.getMessage();
},
};
</script>

View File

@ -0,0 +1,21 @@
<template>
<div class="content">
Content
</div>
</template>
<script>
export default {
name: 'Content',
props: {
msg: String
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
.content {
background-color: red;
}
</style>

View File

@ -0,0 +1,21 @@
<template>
<nav>
<router-link to="/"> Home </router-link>
<router-link to="/config"> Config </router-link>
</nav>
</template>
<script>
export default {
name: 'Nav',
props: {
}
}
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
nav {
background-color: green;
}
</style>

View File

@ -1,14 +1,8 @@
import { createApp } from 'vue' import { createApp } from 'vue'
import axios from 'axios'; import App from '@/App.vue'
import router from '@/router'
import App from './App.vue' const app = createApp(App)
import router from './router' app.use(router)
app.mount('#app')
const app = createApp(App);
axios.defaults.withCredentials = true;
axios.defaults.baseURL = 'http://localhost:8000/';
app.use(router);
app.mount('#app');

20
front/src/router.js Normal file
View File

@ -0,0 +1,20 @@
import { createRouter, createWebHistory } from 'vue-router'
import Home from "@/views/home.vue"
import Config from "@/views/config.vue"
const routes = [
{
path: '/',
name: 'home',
component: Home
},
{
path: '/config',
name: 'config',
component: Config
}
]
const router = createRouter({ history: createWebHistory(), routes })
export default router

View File

@ -1,25 +0,0 @@
import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
const routes = [
{
path: '/',
name: 'home',
component: HomeView
},
{
path: '/about',
name: 'about',
// route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route
// which is lazy-loaded when the route is visited.
component: () => import(/* webpackChunkName: "about" */ '../views/AboutView.vue')
}
]
const router = createRouter({
history: createWebHistory(process.env.BASE_URL),
routes
})
export default router

View File

@ -1,5 +0,0 @@
<template>
<div class="about">
<h1>This is an about page</h1>
</div>
</template>

View File

@ -1,18 +0,0 @@
<template>
<div class="home">
<img alt="Vue logo" src="../assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
</div>
</template>
<script>
// @ is an alias to /src
import HelloWorld from '@/components/HelloWorld.vue'
export default {
name: 'HomeView',
components: {
HelloWorld
}
}
</script>

View File

@ -0,0 +1,3 @@
<template>
<h1>Config</h1>
</template>

3
front/src/views/home.vue Normal file
View File

@ -0,0 +1,3 @@
<template>
<h1>Home</h1>
</template>

View File

@ -1,4 +0,0 @@
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
transpileDependencies: true
})

File diff suppressed because it is too large Load Diff