This commit is contained in:
2026-01-13 20:44:15 +01:00
commit 8659d58a57
29 changed files with 13509 additions and 0 deletions
+1
View File
@@ -0,0 +1 @@
/target
+10
View File
@@ -0,0 +1,10 @@
# Default ignored files
/shelf/
/workspace.xml
# Ignored default folder with query files
/queries/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/
+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="NodePackageJsonFileManager">
<packageJsonPaths />
</component>
<component name="ProjectRootManager" version="2">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
+8
View File
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/label_editor.iml" filepath="$PROJECT_DIR$/label_editor.iml" />
</modules>
</component>
</project>
Generated
+6
View File
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>
Generated
+2939
View File
File diff suppressed because it is too large Load Diff
+25
View File
@@ -0,0 +1,25 @@
[package]
name = "label_editor"
version = "0.1.0"
edition = "2024"
[dependencies]
axum = "0.8.8"
tokio = { version = "1.49.0", default-features = false, features = ["full"] }
http = "1.4.0"
tracing = "=0.1.44"
tracing-subscriber = "0.3.22"
serde = { version = "1.0.228", features = ["derive"] }
serde_json = "1.0.149"
# Logging
env_logger = "0.11.8"
# Database
sqlx = { version = "0.8.6", features = [ "runtime-async-std-native-tls", "postgres", "chrono" ] }
# Etc.
dotenv = "0.15.0"
chrono = { version = "0.4.42" }
+24
View File
@@ -0,0 +1,24 @@
# Nuxt dev/build outputs
.output
.data
.nuxt
.nitro
.cache
dist
# Node dependencies
node_modules
# Logs
logs
*.log
# Misc
.DS_Store
.fleet
.idea
# Local env files
.env
.env.*
!.env.example
+75
View File
@@ -0,0 +1,75 @@
# Nuxt Minimal Starter
Look at the [Nuxt documentation](https://nuxt.com/docs/getting-started/introduction) to learn more.
## Setup
Make sure to install dependencies:
```bash
# npm
npm install
# pnpm
pnpm install
# yarn
yarn install
# bun
bun install
```
## Development Server
Start the development server on `http://localhost:3000`:
```bash
# npm
npm run dev
# pnpm
pnpm dev
# yarn
yarn dev
# bun
bun run dev
```
## Production
Build the application for production:
```bash
# npm
npm run build
# pnpm
pnpm build
# yarn
yarn build
# bun
bun run build
```
Locally preview production build:
```bash
# npm
npm run preview
# pnpm
pnpm preview
# yarn
yarn preview
# bun
bun run preview
```
Check out the [deployment documentation](https://nuxt.com/docs/getting-started/deployment) for more information.
+23
View File
@@ -0,0 +1,23 @@
<script setup lang="ts">
import { createApp } from 'vue'
import { createPinia } from 'pinia'
import App from './app.vue'
const pinia = createPinia()
const app = createApp(App)
app.use(pinia)
app.mount('#app')
</script>
<template>
<v-app>
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
</v-app>
</template>
<style scoped>
</style>
@@ -0,0 +1,19 @@
<script setup lang="ts">
</script>
<template>
<v-footer
:app="true"
:rounded="true"
color="red"
>
<div class="px-4 py-2 bg-black text-center w-100">
{{ new Date().getFullYear() }} <strong>Vuetify</strong>
</div>
</v-footer>
</template>
<style scoped>
</style>
@@ -0,0 +1,23 @@
<script setup lang="ts">
import Notifications from "~/components/notification/notifications.vue";
</script>
<template>
<v-app-bar
density="compact"
:elevation="1"
>
<v-app-bar-title>Label Editor</v-app-bar-title>
<v-divider
:vertical="true"
/>
<Notifications/>
</v-app-bar>
</template>
<style scoped>
</style>
@@ -0,0 +1,47 @@
<script setup lang="ts">
import {useLabelEditorStore} from "~/store/labelEditorStore";
let store = useLabelEditorStore();
</script>
<template>
<div class="notificationContainer">
<v-slide-y-reverse-transition
:group="true"
>
<div
v-for="notificationMessage in store.notificationQueue"
:key="notificationMessage.id"
>
<v-alert
v-if="notificationMessage.error"
:closable="true"
type="error"
>
{{ notificationMessage.message }}
</v-alert>
<v-alert
v-else
:closable="true"
type="success"
>
{{ notificationMessage.message }}
</v-alert>
</div>
</v-slide-y-reverse-transition>
</div>
</template>
<style scoped>
.notificationContainer {
position: fixed;
bottom: 75px;
right: 10px;
display: grid;
grid-gap: 0.5em;
width: 300px;
z-index: 99;
}
</style>
@@ -0,0 +1,140 @@
<script setup lang="ts">
import type {Ref} from "vue";
import {useLabelEditorStore} from "~/store/labelEditorStore";
import type {NotificationMessage} from "~/types/notificationMessage";
let store = useLabelEditorStore();
let dialog: Ref<boolean> = ref<boolean>(false);
let pageCount: Ref<number> = ref<number>(1);
let page: Ref<number> = ref<number>(1);
let notifications: Ref<NotificationMessage[]> = ref<NotificationMessage[]>([]);
let notificationPages: Ref<NotificationMessage[][]> = ref<NotificationMessage[][]>([]);
const pageItemCount = 25;
watch(dialog, async (oldDialog) => {
loadNotifications();
})
function loadNotifications() {
notifications.value = store.getNotifications();
const length = notifications.value.length;
pageCount.value = Math.ceil(length / pageItemCount);
for (let i = 0; i < pageCount.value; i++) {
notificationPages.value[i] = notifications.value.slice((i * pageItemCount), ((i + 1) * pageItemCount));
}
}
function clear() {
store.clearNotifications();
loadNotifications();
}
</script>
<template>
<v-dialog
v-model="dialog"
:scrollable="true"
width="800"
max-height="750"
>
<template v-slot:activator="{ props }">
<v-btn
:flat="true"
v-bind="props"
>
<v-icon>mdi-bell</v-icon>
<v-tooltip
activator="parent"
location="bottom"
>
Benachrichtigungen
</v-tooltip>
</v-btn>
</template>
<v-card>
<v-card-title>
<v-icon size="small">
mdi-bell
</v-icon>
Benachrichtigungen
</v-card-title>
<v-divider/>
<v-card-text>
<div
v-for="notification in notificationPages[page - 1]"
:key="notification.id"
>
<v-row no-gutters>
<v-col cols="2">
<v-sheet>
<v-icon v-if="notification.error" color="red">mdi-alert-circle-outline</v-icon>
<v-icon v-else color="green">mdi-check</v-icon>
{{ notification.error ? 'Fehler' : 'Okay' }}
</v-sheet>
</v-col>
<v-col cols="3">
<v-sheet>
{{ notification.dateTime }}
</v-sheet>
</v-col>
<v-col>
<v-sheet>
{{ notification.message }}
</v-sheet>
</v-col>
</v-row>
</div>
</v-card-text>
<v-divider/>
<v-pagination
v-model="page"
:length="pageCount"
></v-pagination>
<v-divider/>
<v-card-actions>
<v-btn
variant="text"
@click="clear();"
>
<v-icon>mdi-delete</v-icon>
<v-tooltip
activator="parent"
location="right"
>
Benachrichtigungen löschen
</v-tooltip>
</v-btn>
<v-spacer/>
<v-divider :vertical="true"/>
<v-btn
variant="text"
@click="dialog = false"
>
Schließen
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</template>
<style scoped>
</style>
+32
View File
@@ -0,0 +1,32 @@
<script lang="ts">
import CustomHeader from "~/components/layout/customHeader.vue";
import CustomFooter from "~/components/layout/customFooter.vue";
export default {
name: 'DefaultLayout',
components: {CustomFooter, CustomHeader},
}
</script>
<template>
<v-layout>
<CustomHeader/>
<v-main>
<slot/>
</v-main>
<NotificationBaseComponent/>
<CustomFooter/>
</v-layout>
</template>
<style scoped>
</style>
+13
View File
@@ -0,0 +1,13 @@
<script setup lang="ts">
</script>
<template>
<v-card>
<v-card-title>Test Index</v-card-title>
</v-card>
</template>
<style scoped>
</style>
+12
View File
@@ -0,0 +1,12 @@
// import this after install `@mdi/font` package
import '@mdi/font/css/materialdesignicons.css'
import 'vuetify/styles'
import { createVuetify } from 'vuetify'
export default defineNuxtPlugin((app) => {
const vuetify = createVuetify({
// ... your configuration
})
app.vueApp.use(vuetify)
})
+128
View File
@@ -0,0 +1,128 @@
import {defineStore} from "pinia";
import type {Entity} from "~/types/entity";
import {NotificationMessage} from "~/types/notificationMessage";
import type {RuntimeConfig} from "nuxt/schema";
interface State {
config: RuntimeConfig,
// Notification
notifications: NotificationMessage[],
notificationQueue: NotificationMessage[],
// Entity
entity: Entity | null,
}
export const useLabelEditorStore = defineStore('label_editor_store', {
state: (): State => ({
config: useRuntimeConfig(),
// Notification
notifications: [],
notificationQueue: [],
// Entity
entity: null,
}),
actions: {
// Notification
addNotification(error: boolean, message: string) {
const notification: NotificationMessage = new NotificationMessage(error, message);
if (import.meta.client) {
const localStoreNotification = localStorage.getItem("label_editor_notifications");
if (localStoreNotification != null) {
this.notifications = JSON.parse(localStoreNotification);
}
}
this.notificationQueue.push(notification);
this.notifications.push(notification);
if (import.meta.client) {
localStorage.setItem('label_editor_notifications', JSON.stringify(this.notifications));
}
if (notification.error) {
setTimeout(() => this.removeNotification(notification.id), 5000);
} else {
setTimeout(() => this.removeNotification(notification.id), 2000);
}
},
removeNotification(id: string) {
const index = this.notificationQueue.findIndex(notification => notification.id == id);
if (index > -1) {
this.notificationQueue.splice(index, 1);
}
},
getNotifications(): NotificationMessage[] {
let oldNotifications: NotificationMessage[] = [];
if (import.meta.client) {
const localStoreNotification = localStorage.getItem("label_editor_notifications");
if (localStoreNotification != null) {
oldNotifications = JSON.parse(localStoreNotification);
oldNotifications.reverse();
return oldNotifications;
}
}
return [];
},
clearNotifications() {
this.notifications = [];
if (import.meta.client) {
localStorage.setItem('label_editor_notifications', JSON.stringify(this.notifications));
}
this.addNotification(false, "Benachrichtigungen gelöscht")
},
// Entity
async loadEntity(entityID: number) {
try {
const entity: Entity = await $fetch<Entity>(this.config.public.url + '/entity/' + entityID, {
method: 'GET',
});
this.entity = entity;
this.addNotification(false, 'Artikel geladen: ' + this.entity.name);
} catch {
this.entity = null;
this.addNotification(true, 'Fehler beim laden des Artikel. ID:' + entityID);
}
},
async updateEntity(entity: Entity) {
if (this.entity != null) {
try {
const entity: Entity = await $fetch<Entity>(this.config.public.url + '/entity/update', {
method: 'POST',
body: JSON.stringify(this.entity),
});
this.entity = entity;
this.addNotification(false, 'Artikel "' + this.entity.name + '" aktualisiert');
} catch {
this.addNotification(true, 'Fehler beim aktualisieren des Artikel: ' + this.entity.name);
}
} else {
this.addNotification(true, 'Es ist kein Artikel ausgewählt');
}
},
clearEntity() {
this.entity = null;
},
},
});
+26
View File
@@ -0,0 +1,26 @@
import type {Variant} from "~/types/variant";
export class Entity {
readonly id: number;
name: string;
bio: boolean;
origin: string;
description: string;
ingredients: string;
variants: Array<Variant>;
constructor(id: number, name: string, bio: boolean, origin: string, description: string, ingredients: string, variants: Array<Variant> | null) {
this.id = id;
this.name = name;
this.bio = bio;
this.origin = origin;
this.description = description;
this.ingredients = ingredients;
if (variants == null) {
this.variants = [];
} else {
this.variants = variants;
}
}
}
+15
View File
@@ -0,0 +1,15 @@
export class NotificationMessage {
id: string;
dateTime: string;
error: boolean;
message: string;
constructor(error: boolean, message: string) {
let dateTime = new Date();
this.id = crypto.randomUUID();
this.dateTime = dateTime.getUTCHours().toString().padStart(2, '0') + ':' + dateTime.getUTCMinutes().toString().padStart(2, '0') + " - " + dateTime.getUTCDate().toString().padStart(2, '0')+ '.' + dateTime.getUTCMonth().toString().padStart(2, '0') + '.' + dateTime.getFullYear();
this.error = error;
this.message = message;
}
}
+17
View File
@@ -0,0 +1,17 @@
export class Variant {
readonly id: number;
weight: string;
ean: string;
name: string | null;
description: string | null;
ingredients: string | null;
constructor(id: number, weight: string, ean: string, name: string|null, description:string|null, ingredients: string|null) {
this.id = id;
this.weight = weight;
this.ean = ean;
this.name = name;
this.description = description;
this.ingredients = ingredients;
}
}
+40
View File
@@ -0,0 +1,40 @@
// https://nuxt.com/docs/api/configuration/nuxt-config
import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'
export default defineNuxtConfig({
app: {
head: {
title: "Label Editor",
},
},
compatibilityDate: '2025-07-15',
devtools: { enabled: true },
ssr: false,
pages: true,
components: true,
plugins: ['~/plugins/vuetify.ts'],
css: [
'vuetify/styles',
'@mdi/font/css/materialdesignicons.min.css',
],
build: {
transpile: ['vuetify'],
},
vite: {
plugins: [
vuetify({ autoImport: true }),
],
vue: {
template: {
transformAssetUrls,
},
},
}
})
+9763
View File
File diff suppressed because it is too large Load Diff
+25
View File
@@ -0,0 +1,25 @@
{
"name": "frontend",
"type": "module",
"private": true,
"scripts": {
"build": "nuxt build",
"dev": "nuxt dev",
"generate": "nuxt generate",
"preview": "nuxt preview",
"postinstall": "nuxt prepare"
},
"dependencies": {
"@fontsource/roboto": "5.2.9",
"@mdi/font": "7.4.47",
"@pinia/nuxt": "0.11.3",
"nuxt": "4.2.2",
"pinia": "^3.0.4",
"vue": "3.5.26",
"vue-router": "4.6.4"
},
"devDependencies": {
"vite-plugin-vuetify": "2.1.2",
"vuetify": "3.11.6"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

+2
View File
@@ -0,0 +1,2 @@
User-Agent: *
Disallow:
+18
View File
@@ -0,0 +1,18 @@
{
// https://nuxt.com/docs/guide/concepts/typescript
"files": [],
"references": [
{
"path": "./.nuxt/tsconfig.app.json"
},
{
"path": "./.nuxt/tsconfig.server.json"
},
{
"path": "./.nuxt/tsconfig.shared.json"
},
{
"path": "./.nuxt/tsconfig.node.json"
}
]
}
+12
View File
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="RUST_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
+57
View File
@@ -0,0 +1,57 @@
use axum::{
routing::{get, post},
http::StatusCode,
Json, Router,
};
use serde::{Deserialize, Serialize};
#[tokio::main]
async fn main() {
// initialize tracing
tracing_subscriber::fmt::init();
// build our application with a route
let app = Router::new()
// `GET /` goes to `root`
.route("/", get(root))
// `POST /users` goes to `create_user`
.route("/users", post(create_user));
// run our app with hyper, listening globally on port 3000
let listener = tokio::net::TcpListener::bind("0.0.0.0:9090").await.unwrap();
axum::serve(listener, app).await.unwrap();
}
// basic handler that responds with a static string
async fn root() -> &'static str {
"Hello, World!"
}
async fn create_user(
// this argument tells axum to parse the request body
// as JSON into a `CreateUser` type
Json(payload): Json<CreateUser>,
) -> (StatusCode, Json<User>) {
// insert your application logic here
let user = User {
id: 1337,
username: payload.username,
};
// this will be converted into a JSON response
// with a status code of `201 Created`
(StatusCode::CREATED, Json(user))
}
// the input to our `create_user` handler
#[derive(Deserialize)]
struct CreateUser {
username: String,
}
// the output to our `create_user` handler
#[derive(Serialize)]
struct User {
id: u64,
username: String,
}