Added docker support + fixed button bug

This commit is contained in:
2024-08-31 13:10:25 +02:00
parent 70e3818170
commit f712291bdd
7 changed files with 68 additions and 10 deletions

17
.dockerignore Normal file
View File

@@ -0,0 +1,17 @@
# Ignore the node_modules directory
node_modules
# Ignore the dist directory
www
# Ignore the .git directory
.git
# Ignore the .gitignore file
.gitignore
# Ignore the .dockerignore file
.dockerignore
Dockerfile
.vscode/*

11
Dockerfile Normal file
View File

@@ -0,0 +1,11 @@
FROM node:18-slim as node
WORKDIR /app
COPY . .
RUN npm install
RUN npm install -g @ionic/cli
RUN ionic build --prod
FROM nginx:latest AS ngi
COPY --from=node /app/www /usr/share/nginx/html
COPY /nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80

20
nginx.conf Normal file
View File

@@ -0,0 +1,20 @@
server {
listen 80;
sendfile on;
default_type application/octet-stream;
gzip on;
gzip_http_version 1.1;
gzip_disable "MSIE [1-6]\.";
gzip_min_length 256;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
gzip_comp_level 9;
root /usr/share/nginx/html;
location / {
try_files $uri $uri/ /index.html =404;
}
}

View File

@@ -5,12 +5,12 @@
<ion-label>Erfassen</ion-label>
</ion-tab-button>
<ion-tab-button tab="analysis" href="/analysis">
<ion-tab-button tab="analysis" href="/analysis" disabled>
<ion-icon aria-hidden="true" name="pie-chart"></ion-icon>
<ion-label>Analyse</ion-label>
</ion-tab-button>
<ion-tab-button tab="settings" href="/settings">
<ion-tab-button tab="settings" href="/settings" disabled>
<ion-icon aria-hidden="true" name="settings"></ion-icon>
<ion-label>Einstellungen</ion-label>
</ion-tab-button>

View File

@@ -35,23 +35,23 @@
</ion-item>
</section>
<div class="button-container">
<div class="button-container" *ngIf="isToday()">
<ion-button (click)="addEntry()">{{currentAction === 'login' ? "Einstempeln" : "Ausstempeln"}}</ion-button>
<ion-button shape="round" id="open-modal" class="icon-button">
<ion-button shape="round" class="icon-button" (click)="openModal()">
<ion-icon slot="icon-only" name="add"></ion-icon>
</ion-button>
</div>
<ion-modal trigger="open-modal" (willDismiss)="modal?.dismiss(null, 'cancel')" #createModal>
<ion-modal (willDismiss)="modal?.dismiss(null, 'cancel')" #createModal>
<ng-template>
<ion-header>
<ion-toolbar>
<ion-buttons slot="start">
<ion-button (click)="modal?.dismiss(null, 'cancel')">Cancel</ion-button>
<ion-button (click)="modal?.dismiss(null, 'cancel')">Abbrechen</ion-button>
</ion-buttons>
<ion-title>Welcome</ion-title>
<ion-buttons slot="end">
<ion-button [strong]="true" (click)="addModalEntry()">Confirm</ion-button>
<ion-button [strong]="true" (click)="addModalEntry()">Speichern</ion-button>
</ion-buttons>
</ion-toolbar>
</ion-header>
@@ -67,7 +67,7 @@
</ion-modal>
</ion-item>
<ion-item>
<ion-select label="Stempeltyp" value="login" [(ngModel)]="modalMode">
<ion-select label="Stempeltyp" value="login" cancel-text="Abbrechen" [(ngModel)]="modalMode">
<ion-select-option value="login">Einstempeln</ion-select-option>
<ion-select-option value="logout">Ausstempeln</ion-select-option>
<ion-select-option value="start-drive">Dienstreise starten</ion-select-option>

View File

@@ -53,8 +53,8 @@ export class TimePage {
}
public getEntriesOfToday(): TimeEntry[] {
const today = new Date(this.currentDate || Date.now()).getDay();
return this.data.filter(entry => entry.registeredAt.getDay() === today);
const today = new Date(this.currentDate || Date.now()).toLocaleDateString();
return this.data.filter(entry => entry.registeredAt.toLocaleDateString() === today);
}
public getTypeText(type: TimeType): string {
@@ -117,6 +117,10 @@ export class TimePage {
localStorage.setItem("time-data", JSON.stringify(this.data));
}
public openModal(): void {
this.modal?.present();
}
public addModalEntry(): void {
const date = new Date(this.modalDate);
date.setSeconds(0);
@@ -137,4 +141,10 @@ export class TimePage {
this.saveData();
this.modal?.dismiss(null, 'submit');
}
public isToday(): boolean {
return new Date(this.currentDate || Date.now()).toLocaleDateString() === new Date(Date.now()).toLocaleDateString();
}
protected readonly open = open;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 24 KiB