Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fa86607af3 | |||
| be813ffbf0 | |||
| 96bf262884 | |||
| b479bdefa4 | |||
| 0112b35eee | |||
| 7b90cac1d1 | |||
| 894a6f01c2 |
@@ -5,6 +5,10 @@ WORKDIR /app
|
|||||||
|
|
||||||
# Copy go.mod and go.sum files to download dependencies
|
# Copy go.mod and go.sum files to download dependencies
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
|
|
||||||
|
# Install the C compiler (gcc) and other build tools needed for CGO
|
||||||
|
RUN apk add --no-cache build-base
|
||||||
|
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
||||||
# Copy the rest of the application source code
|
# Copy the rest of the application source code
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ COPY nginx.conf /etc/nginx/conf.d/default.conf
|
|||||||
|
|
||||||
# Copy the built application from the builder stage to Nginx's web root directory
|
# Copy the built application from the builder stage to Nginx's web root directory
|
||||||
# I am assuming the project name is 'dashboard'. If not, you may need to change the path 'dist/dashboard/browser'.
|
# I am assuming the project name is 'dashboard'. If not, you may need to change the path 'dist/dashboard/browser'.
|
||||||
COPY --from=builder /app/dist/frontend /usr/share/nginx/html
|
COPY --from=builder /app/dist/frontend/browser/. /usr/share/nginx/html
|
||||||
|
|
||||||
# Expose port 80 for the web server
|
# Expose port 80 for the web server
|
||||||
EXPOSE 80
|
EXPOSE 80
|
||||||
|
|||||||
@@ -1,17 +1,25 @@
|
|||||||
<div class="card-container">
|
<div class="card-container" *ngIf="items$ | async as items">
|
||||||
<div *ngIf="items$ | async as items">
|
<a *ngFor="let item of items" [href]="item.target" target="_blank" rel="noopener noreferrer" class="card-link">
|
||||||
<a *ngFor="let item of items" [href]="item.target" target="_blank" rel="noopener noreferrer" class="card-link">
|
<mat-card class="item-card">
|
||||||
<mat-card class="item-card">
|
<mat-card-content>
|
||||||
<mat-card-header>
|
<div class="card-content">
|
||||||
<div class="card-header-content">
|
<!-- Material Icon wenn iconUrl ein Material Icon Name ist -->
|
||||||
<img *ngIf="item.iconUrl && !imgErrorMap.get(item.id); else defaultIcon" mat-card-avatar [src]="item.iconUrl" (error)="onImgError(item.id)">
|
<mat-icon *ngIf="isMaterialIcon(item.iconUrl)" class="card-icon material-icon">{{ item.iconUrl }}</mat-icon>
|
||||||
|
|
||||||
|
<!-- Custom Image URL wenn nicht Material Icon -->
|
||||||
|
<ng-container *ngIf="!isMaterialIcon(item.iconUrl)">
|
||||||
|
<img *ngIf="item.iconUrl && !imgErrorMap.get(item.id); else defaultIcon"
|
||||||
|
class="card-icon"
|
||||||
|
[src]="item.iconUrl"
|
||||||
|
(error)="onImgError(item.id)">
|
||||||
<ng-template #defaultIcon>
|
<ng-template #defaultIcon>
|
||||||
<mat-icon mat-card-avatar class="default-avatar-icon">dashboard</mat-icon>
|
<mat-icon class="card-icon default-avatar-icon">dashboard</mat-icon>
|
||||||
</ng-template>
|
</ng-template>
|
||||||
<mat-card-title>{{ item.displayName }}</mat-card-title>
|
</ng-container>
|
||||||
</div>
|
|
||||||
</mat-card-header>
|
<span class="card-title">{{ item.displayName }}</span>
|
||||||
</mat-card>
|
</div>
|
||||||
</a>
|
</mat-card-content>
|
||||||
</div>
|
</mat-card>
|
||||||
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,45 +1,60 @@
|
|||||||
.card-container {
|
.card-container {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
|
||||||
gap: 20px;
|
gap: 32px;
|
||||||
padding: 20px;
|
padding: 32px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.card-link {
|
.card-link {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: inherit;
|
color: inherit;
|
||||||
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-card {
|
.item-card {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
||||||
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.item-card:hover {
|
.item-card:hover {
|
||||||
transform: translateY(-5px);
|
transform: translateY(-5px);
|
||||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
|
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Custom flex container inside the header
|
.card-content {
|
||||||
.card-header-content {
|
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center; // Revert to center alignment
|
align-items: center;
|
||||||
width: 100%;
|
gap: 16px;
|
||||||
height: 64px; // Give the container a fixed height
|
padding: 8px 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove margin from the title and add padding for spacing
|
.card-icon {
|
||||||
.card-header-content .mat-card-title {
|
width: 48px;
|
||||||
margin: 0;
|
height: 48px;
|
||||||
padding-left: 16px;
|
border-radius: 8px;
|
||||||
|
object-fit: cover;
|
||||||
|
flex-shrink: 0;
|
||||||
|
|
||||||
|
&.material-icon {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
font-size: 48px;
|
||||||
|
color: #1976d2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.card-title {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
font-weight: 500;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
.default-avatar-icon {
|
.default-avatar-icon {
|
||||||
// Vertically align the icon in the avatar space
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
width: 40px;
|
font-size: 32px;
|
||||||
height: 40px;
|
color: #666;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { Home } from './home';
|
import { HomeComponent } from './home';
|
||||||
|
|
||||||
describe('Home', () => {
|
describe('HomeComponent', () => {
|
||||||
let component: Home;
|
let component: HomeComponent;
|
||||||
let fixture: ComponentFixture<Home>;
|
let fixture: ComponentFixture<HomeComponent>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [Home]
|
imports: [HomeComponent]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
fixture = TestBed.createComponent(Home);
|
fixture = TestBed.createComponent(HomeComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
import { MaterialModule } from '../../material.module';
|
import { MaterialModule } from '../../material.module';
|
||||||
import { ApiService } from '../../services/api';
|
import { Api } from '../../services/api';
|
||||||
import { Item } from '../../models/item';
|
import { Item } from '../../models/item';
|
||||||
|
import { IconService } from '../../services/icon.service';
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -16,7 +17,10 @@ export class HomeComponent implements OnInit {
|
|||||||
items$!: Observable<Item[]>;
|
items$!: Observable<Item[]>;
|
||||||
imgErrorMap = new Map<number, boolean>();
|
imgErrorMap = new Map<number, boolean>();
|
||||||
|
|
||||||
constructor(private apiService: ApiService) {}
|
constructor(
|
||||||
|
private apiService: Api,
|
||||||
|
private iconService: IconService
|
||||||
|
) {}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.items$ = this.apiService.getItems();
|
this.items$ = this.apiService.getItems();
|
||||||
@@ -25,4 +29,8 @@ export class HomeComponent implements OnInit {
|
|||||||
onImgError(itemId: number) {
|
onImgError(itemId: number) {
|
||||||
this.imgErrorMap.set(itemId, true);
|
this.imgErrorMap.set(itemId, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isMaterialIcon(iconUrl: string): boolean {
|
||||||
|
return this.iconService.isValidIcon(iconUrl);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,13 @@
|
|||||||
<mat-card>
|
<mat-card>
|
||||||
<mat-card-title>{{ isEditMode ? 'Edit Item' : 'Create Item' }}</mat-card-title>
|
<mat-card-title>{{ isEditMode ? 'Edit Item' : 'Create Item' }}</mat-card-title>
|
||||||
<mat-card-content>
|
<mat-card-content>
|
||||||
|
<!-- Icon Auswahl Toggle (außerhalb des Forms) -->
|
||||||
|
<div class="icon-mode-toggle">
|
||||||
|
<mat-slide-toggle [checked]="useCustomUrl" (change)="onToggleChange($event)">
|
||||||
|
Custom Icon URL verwenden
|
||||||
|
</mat-slide-toggle>
|
||||||
|
</div>
|
||||||
|
|
||||||
<form [formGroup]="itemForm" (ngSubmit)="onSubmit()">
|
<form [formGroup]="itemForm" (ngSubmit)="onSubmit()">
|
||||||
<mat-form-field appearance="fill">
|
<mat-form-field appearance="fill">
|
||||||
<mat-label>Name</mat-label>
|
<mat-label>Name</mat-label>
|
||||||
@@ -18,7 +25,34 @@
|
|||||||
<input matInput formControlName="target">
|
<input matInput formControlName="target">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|
||||||
<mat-form-field appearance="fill">
|
<!-- Material Icon Picker (Standard) -->
|
||||||
|
<div *ngIf="!useCustomUrl" class="icon-picker-section">
|
||||||
|
<mat-form-field appearance="fill">
|
||||||
|
<mat-label>Icon auswählen</mat-label>
|
||||||
|
<input type="text"
|
||||||
|
matInput
|
||||||
|
formControlName="iconName"
|
||||||
|
[matAutocomplete]="auto"
|
||||||
|
placeholder="Icon suchen...">
|
||||||
|
<mat-icon matPrefix>search</mat-icon>
|
||||||
|
<mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFn">
|
||||||
|
<mat-option *ngFor="let icon of filteredIcons$ | async" [value]="icon.name">
|
||||||
|
<mat-icon>{{ icon.name }}</mat-icon>
|
||||||
|
<span class="icon-option-text">{{ icon.name }}</span>
|
||||||
|
<span class="icon-category">{{ icon.category }}</span>
|
||||||
|
</mat-option>
|
||||||
|
</mat-autocomplete>
|
||||||
|
</mat-form-field>
|
||||||
|
|
||||||
|
<!-- Icon Vorschau -->
|
||||||
|
<div class="icon-preview" *ngIf="itemForm.get('iconName')?.value">
|
||||||
|
<span class="preview-label">Vorschau:</span>
|
||||||
|
<mat-icon class="preview-icon">{{ getSelectedIconName() }}</mat-icon>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Custom Icon URL Feld -->
|
||||||
|
<mat-form-field appearance="fill" *ngIf="useCustomUrl">
|
||||||
<mat-label>Icon URL</mat-label>
|
<mat-label>Icon URL</mat-label>
|
||||||
<input matInput formControlName="iconUrl">
|
<input matInput formControlName="iconUrl">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
|||||||
@@ -19,3 +19,46 @@ mat-form-field {
|
|||||||
gap: 10px;
|
gap: 10px;
|
||||||
margin-top: 20px;
|
margin-top: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon-mode-toggle {
|
||||||
|
margin: 16px 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-picker-section {
|
||||||
|
.icon-preview {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
gap: 12px;
|
||||||
|
padding: 16px;
|
||||||
|
background-color: #f5f5f5;
|
||||||
|
border-radius: 4px;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
|
||||||
|
.preview-label {
|
||||||
|
font-weight: 500;
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.preview-icon {
|
||||||
|
font-size: 48px;
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
color: #1976d2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
::ng-deep {
|
||||||
|
.mat-mdc-option {
|
||||||
|
.icon-option-text {
|
||||||
|
margin-left: 12px;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon-category {
|
||||||
|
font-size: 12px;
|
||||||
|
color: #666;
|
||||||
|
margin-left: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { ItemForm } from './item-form';
|
import { ItemFormComponent } from './item-form';
|
||||||
|
|
||||||
describe('ItemForm', () => {
|
describe('ItemFormComponent', () => {
|
||||||
let component: ItemForm;
|
let component: ItemFormComponent;
|
||||||
let fixture: ComponentFixture<ItemForm>;
|
let fixture: ComponentFixture<ItemFormComponent>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [ItemForm]
|
imports: [ItemFormComponent]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
fixture = TestBed.createComponent(ItemForm);
|
fixture = TestBed.createComponent(ItemFormComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,58 +1,128 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { FormBuilder, FormGroup, Validators, ReactiveFormsModule } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators, ReactiveFormsModule, FormsModule } from '@angular/forms';
|
||||||
import { ApiService } from '../../services/api';
|
import { Api } from '../../services/api';
|
||||||
import { Item } from '../../models/item';
|
import { Item } from '../../models/item';
|
||||||
import { MaterialModule } from '../../material.module';
|
import { MaterialModule } from '../../material.module';
|
||||||
import { CommonModule } from '@angular/common';
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { IconService, MaterialIcon } from '../../services/icon.service';
|
||||||
|
import { Observable } from 'rxjs';
|
||||||
|
import { map, startWith } from 'rxjs/operators';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-item-form',
|
selector: 'app-item-form',
|
||||||
templateUrl: './item-form.html',
|
templateUrl: './item-form.html',
|
||||||
styleUrls: ['./item-form.scss'],
|
styleUrls: ['./item-form.scss'],
|
||||||
standalone: true,
|
standalone: true,
|
||||||
imports: [MaterialModule, CommonModule, ReactiveFormsModule],
|
imports: [MaterialModule, CommonModule, ReactiveFormsModule, FormsModule],
|
||||||
})
|
})
|
||||||
export class ItemFormComponent implements OnInit {
|
export class ItemFormComponent implements OnInit {
|
||||||
itemForm: FormGroup;
|
itemForm: FormGroup;
|
||||||
isEditMode = false;
|
isEditMode = false;
|
||||||
itemId: number | null = null;
|
itemId: number | null = null;
|
||||||
|
|
||||||
|
// Icon-Auswahl Eigenschaften
|
||||||
|
filteredIcons$!: Observable<MaterialIcon[]>;
|
||||||
|
allIcons: MaterialIcon[] = [];
|
||||||
|
useCustomUrl = false;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private fb: FormBuilder,
|
private fb: FormBuilder,
|
||||||
private apiService: ApiService,
|
private apiService: Api,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private route: ActivatedRoute
|
private route: ActivatedRoute,
|
||||||
|
private iconService: IconService
|
||||||
) {
|
) {
|
||||||
this.itemForm = this.fb.group({
|
this.itemForm = this.fb.group({
|
||||||
name: ['', Validators.required],
|
name: ['', Validators.required],
|
||||||
displayName: ['', Validators.required],
|
displayName: ['', Validators.required],
|
||||||
target: ['', Validators.required],
|
target: ['', Validators.required],
|
||||||
iconUrl: ['']
|
iconUrl: [''],
|
||||||
|
iconName: ['']
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
|
// Icons laden
|
||||||
|
this.allIcons = this.iconService.getAllIcons();
|
||||||
|
|
||||||
|
// Autocomplete für Icons einrichten
|
||||||
|
this.filteredIcons$ = this.itemForm.get('iconName')!.valueChanges.pipe(
|
||||||
|
startWith(''),
|
||||||
|
map(value => this._filterIcons(value || ''))
|
||||||
|
);
|
||||||
|
|
||||||
const idParam = this.route.snapshot.params['id'];
|
const idParam = this.route.snapshot.params['id'];
|
||||||
if (idParam) {
|
if (idParam) {
|
||||||
this.isEditMode = true;
|
this.isEditMode = true;
|
||||||
this.itemId = +idParam; // Convert string to number
|
this.itemId = +idParam; // Convert string to number
|
||||||
this.apiService.getItem(this.itemId).subscribe(item => {
|
this.apiService.getItem(this.itemId).subscribe(item => {
|
||||||
this.itemForm.patchValue(item);
|
this.itemForm.patchValue(item);
|
||||||
|
|
||||||
|
// Prüfen ob Custom URL oder Material Icon verwendet wird
|
||||||
|
if (item.iconUrl) {
|
||||||
|
if (this.iconService.isValidIcon(item.iconUrl)) {
|
||||||
|
// Es ist ein Material Icon Name
|
||||||
|
this.itemForm.patchValue({ iconName: item.iconUrl, iconUrl: '' });
|
||||||
|
this.useCustomUrl = false;
|
||||||
|
} else {
|
||||||
|
// Es ist eine Custom URL
|
||||||
|
this.useCustomUrl = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private _filterIcons(value: string): MaterialIcon[] {
|
||||||
|
const filterValue = value.toLowerCase();
|
||||||
|
return this.allIcons.filter(icon =>
|
||||||
|
icon.name.toLowerCase().includes(filterValue) ||
|
||||||
|
icon.category.toLowerCase().includes(filterValue)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
onToggleChange(event: any): void {
|
||||||
|
this.useCustomUrl = event.checked;
|
||||||
|
if (this.useCustomUrl) {
|
||||||
|
this.itemForm.patchValue({ iconName: '' });
|
||||||
|
} else {
|
||||||
|
this.itemForm.patchValue({ iconUrl: '' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
getSelectedIconName(): string {
|
||||||
|
return this.itemForm.get('iconName')?.value || 'dashboard';
|
||||||
|
}
|
||||||
|
|
||||||
|
displayFn(iconName: string): string {
|
||||||
|
return iconName;
|
||||||
|
}
|
||||||
|
|
||||||
onSubmit(): void {
|
onSubmit(): void {
|
||||||
if (this.itemForm.valid) {
|
if (this.itemForm.valid) {
|
||||||
const itemData: Item = { id: this.itemId, ...this.itemForm.value };
|
// Bestimme welches Icon-Feld verwendet werden soll
|
||||||
|
let finalIconUrl = this.itemForm.value.iconUrl;
|
||||||
|
if (!this.useCustomUrl && this.itemForm.value.iconName) {
|
||||||
|
// Verwende Material Icon Namen als iconUrl
|
||||||
|
finalIconUrl = this.itemForm.value.iconName;
|
||||||
|
}
|
||||||
|
|
||||||
|
const itemData: Item = {
|
||||||
|
id: this.itemId ?? 0,
|
||||||
|
name: this.itemForm.value.name,
|
||||||
|
displayName: this.itemForm.value.displayName,
|
||||||
|
target: this.itemForm.value.target,
|
||||||
|
iconUrl: finalIconUrl
|
||||||
|
};
|
||||||
|
|
||||||
if (this.isEditMode) {
|
if (this.isEditMode) {
|
||||||
this.apiService.updateItem(this.itemId!, itemData).subscribe(() => {
|
this.apiService.updateItem(this.itemId!, itemData).subscribe(() => {
|
||||||
this.router.navigate(['/']);
|
this.router.navigate(['/']);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
this.apiService.createItem(itemData).subscribe(() => {
|
this.apiService.createItem(itemData).subscribe(() => {
|
||||||
this.router.navigate(['/']);
|
this.router.navigate(['/admin']);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,18 +1,18 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
import { ItemList } from './item-list';
|
import { ItemListComponent } from './item-list';
|
||||||
|
|
||||||
describe('ItemList', () => {
|
describe('ItemListComponent', () => {
|
||||||
let component: ItemList;
|
let component: ItemListComponent;
|
||||||
let fixture: ComponentFixture<ItemList>;
|
let fixture: ComponentFixture<ItemListComponent>;
|
||||||
|
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await TestBed.configureTestingModule({
|
await TestBed.configureTestingModule({
|
||||||
imports: [ItemList]
|
imports: [ItemListComponent]
|
||||||
})
|
})
|
||||||
.compileComponents();
|
.compileComponents();
|
||||||
|
|
||||||
fixture = TestBed.createComponent(ItemList);
|
fixture = TestBed.createComponent(ItemListComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
await fixture.whenStable();
|
await fixture.whenStable();
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { ApiService } from '../../services/api';
|
import { Api } from '../../services/api';
|
||||||
import { Item } from '../../models/item';
|
import { Item } from '../../models/item';
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
import { MaterialModule } from '../../material.module';
|
import { MaterialModule } from '../../material.module';
|
||||||
@@ -17,7 +17,7 @@ export class ItemListComponent implements OnInit {
|
|||||||
displayedColumns: string[] = ['id', 'name', 'displayName', 'target', 'actions'];
|
displayedColumns: string[] = ['id', 'name', 'displayName', 'target', 'actions'];
|
||||||
dataSource = new MatTableDataSource<Item>();
|
dataSource = new MatTableDataSource<Item>();
|
||||||
|
|
||||||
constructor(private apiService: ApiService, private router: Router) { }
|
constructor(private apiService: Api, private router: Router) { }
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.loadItems();
|
this.loadItems();
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import { MatTableModule } from '@angular/material/table';
|
|||||||
import { MatToolbarModule } from '@angular/material/toolbar';
|
import { MatToolbarModule } from '@angular/material/toolbar';
|
||||||
import { MatIconModule } from '@angular/material/icon';
|
import { MatIconModule } from '@angular/material/icon';
|
||||||
import { MatTooltipModule } from '@angular/material/tooltip';
|
import { MatTooltipModule } from '@angular/material/tooltip';
|
||||||
|
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
|
||||||
|
import { MatAutocompleteModule } from '@angular/material/autocomplete';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
exports: [
|
exports: [
|
||||||
@@ -18,6 +20,8 @@ import { MatTooltipModule } from '@angular/material/tooltip';
|
|||||||
MatToolbarModule,
|
MatToolbarModule,
|
||||||
MatIconModule,
|
MatIconModule,
|
||||||
MatTooltipModule,
|
MatTooltipModule,
|
||||||
|
MatSlideToggleModule,
|
||||||
|
MatAutocompleteModule,
|
||||||
]
|
]
|
||||||
})
|
})
|
||||||
export class MaterialModule { }
|
export class MaterialModule { }
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import { Item } from '../models/item';
|
|||||||
@Injectable({
|
@Injectable({
|
||||||
providedIn: 'root'
|
providedIn: 'root'
|
||||||
})
|
})
|
||||||
export class ApiService {
|
export class Api {
|
||||||
private apiUrl = '/api/items';
|
private apiUrl = '/api/items';
|
||||||
|
|
||||||
constructor(private http: HttpClient) { }
|
constructor(private http: HttpClient) { }
|
||||||
|
|||||||
161
frontend/src/app/services/icon.service.ts
Normal file
161
frontend/src/app/services/icon.service.ts
Normal file
@@ -0,0 +1,161 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
|
||||||
|
export interface MaterialIcon {
|
||||||
|
name: string;
|
||||||
|
category: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Injectable({
|
||||||
|
providedIn: 'root'
|
||||||
|
})
|
||||||
|
export class IconService {
|
||||||
|
// Häufig verwendete Material Icons, gruppiert nach Kategorien
|
||||||
|
private icons: MaterialIcon[] = [
|
||||||
|
// Navigation
|
||||||
|
{ name: 'home', category: 'Navigation' },
|
||||||
|
{ name: 'dashboard', category: 'Navigation' },
|
||||||
|
{ name: 'menu', category: 'Navigation' },
|
||||||
|
{ name: 'apps', category: 'Navigation' },
|
||||||
|
{ name: 'arrow_back', category: 'Navigation' },
|
||||||
|
{ name: 'arrow_forward', category: 'Navigation' },
|
||||||
|
{ name: 'expand_more', category: 'Navigation' },
|
||||||
|
{ name: 'expand_less', category: 'Navigation' },
|
||||||
|
|
||||||
|
// Web & Browser
|
||||||
|
{ name: 'web', category: 'Web' },
|
||||||
|
{ name: 'language', category: 'Web' },
|
||||||
|
{ name: 'public', category: 'Web' },
|
||||||
|
{ name: 'link', category: 'Web' },
|
||||||
|
{ name: 'http', category: 'Web' },
|
||||||
|
{ name: 'https', category: 'Web' },
|
||||||
|
{ name: 'vpn_lock', category: 'Web' },
|
||||||
|
|
||||||
|
// Kommunikation
|
||||||
|
{ name: 'email', category: 'Kommunikation' },
|
||||||
|
{ name: 'mail', category: 'Kommunikation' },
|
||||||
|
{ name: 'chat', category: 'Kommunikation' },
|
||||||
|
{ name: 'message', category: 'Kommunikation' },
|
||||||
|
{ name: 'forum', category: 'Kommunikation' },
|
||||||
|
{ name: 'phone', category: 'Kommunikation' },
|
||||||
|
|
||||||
|
// Content
|
||||||
|
{ name: 'create', category: 'Content' },
|
||||||
|
{ name: 'edit', category: 'Content' },
|
||||||
|
{ name: 'add', category: 'Content' },
|
||||||
|
{ name: 'delete', category: 'Content' },
|
||||||
|
{ name: 'content_copy', category: 'Content' },
|
||||||
|
{ name: 'save', category: 'Content' },
|
||||||
|
|
||||||
|
// Dateien & Ordner
|
||||||
|
{ name: 'folder', category: 'Dateien' },
|
||||||
|
{ name: 'folder_open', category: 'Dateien' },
|
||||||
|
{ name: 'description', category: 'Dateien' },
|
||||||
|
{ name: 'insert_drive_file', category: 'Dateien' },
|
||||||
|
{ name: 'cloud', category: 'Dateien' },
|
||||||
|
{ name: 'cloud_upload', category: 'Dateien' },
|
||||||
|
{ name: 'cloud_download', category: 'Dateien' },
|
||||||
|
|
||||||
|
// Medien
|
||||||
|
{ name: 'image', category: 'Medien' },
|
||||||
|
{ name: 'photo', category: 'Medien' },
|
||||||
|
{ name: 'video_library', category: 'Medien' },
|
||||||
|
{ name: 'movie', category: 'Medien' },
|
||||||
|
{ name: 'music_note', category: 'Medien' },
|
||||||
|
{ name: 'audiotrack', category: 'Medien' },
|
||||||
|
|
||||||
|
// Business
|
||||||
|
{ name: 'work', category: 'Business' },
|
||||||
|
{ name: 'business', category: 'Business' },
|
||||||
|
{ name: 'store', category: 'Business' },
|
||||||
|
{ name: 'shopping_cart', category: 'Business' },
|
||||||
|
{ name: 'payment', category: 'Business' },
|
||||||
|
{ name: 'account_balance', category: 'Business' },
|
||||||
|
|
||||||
|
// Sozial
|
||||||
|
{ name: 'person', category: 'Sozial' },
|
||||||
|
{ name: 'people', category: 'Sozial' },
|
||||||
|
{ name: 'group', category: 'Sozial' },
|
||||||
|
{ name: 'account_circle', category: 'Sozial' },
|
||||||
|
{ name: 'favorite', category: 'Sozial' },
|
||||||
|
{ name: 'share', category: 'Sozial' },
|
||||||
|
|
||||||
|
// System
|
||||||
|
{ name: 'settings', category: 'System' },
|
||||||
|
{ name: 'build', category: 'System' },
|
||||||
|
{ name: 'search', category: 'System' },
|
||||||
|
{ name: 'info', category: 'System' },
|
||||||
|
{ name: 'help', category: 'System' },
|
||||||
|
{ name: 'warning', category: 'System' },
|
||||||
|
{ name: 'error', category: 'System' },
|
||||||
|
{ name: 'check_circle', category: 'System' },
|
||||||
|
{ name: 'notifications', category: 'System' },
|
||||||
|
|
||||||
|
// Geräte
|
||||||
|
{ name: 'computer', category: 'Geräte' },
|
||||||
|
{ name: 'phone_android', category: 'Geräte' },
|
||||||
|
{ name: 'tablet', category: 'Geräte' },
|
||||||
|
{ name: 'laptop', category: 'Geräte' },
|
||||||
|
{ name: 'tv', category: 'Geräte' },
|
||||||
|
{ name: 'watch', category: 'Geräte' },
|
||||||
|
|
||||||
|
// Entwicklung
|
||||||
|
{ name: 'code', category: 'Entwicklung' },
|
||||||
|
{ name: 'developer_mode', category: 'Entwicklung' },
|
||||||
|
{ name: 'bug_report', category: 'Entwicklung' },
|
||||||
|
{ name: 'terminal', category: 'Entwicklung' },
|
||||||
|
{ name: 'api', category: 'Entwicklung' },
|
||||||
|
|
||||||
|
// Sicherheit
|
||||||
|
{ name: 'lock', category: 'Sicherheit' },
|
||||||
|
{ name: 'lock_open', category: 'Sicherheit' },
|
||||||
|
{ name: 'security', category: 'Sicherheit' },
|
||||||
|
{ name: 'verified_user', category: 'Sicherheit' },
|
||||||
|
{ name: 'vpn_key', category: 'Sicherheit' },
|
||||||
|
|
||||||
|
// Verschiedenes
|
||||||
|
{ name: 'star', category: 'Verschiedenes' },
|
||||||
|
{ name: 'bookmark', category: 'Verschiedenes' },
|
||||||
|
{ name: 'label', category: 'Verschiedenes' },
|
||||||
|
{ name: 'lightbulb', category: 'Verschiedenes' },
|
||||||
|
{ name: 'extension', category: 'Verschiedenes' },
|
||||||
|
{ name: 'widgets', category: 'Verschiedenes' },
|
||||||
|
];
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gibt alle verfügbaren Icons zurück
|
||||||
|
*/
|
||||||
|
getAllIcons(): MaterialIcon[] {
|
||||||
|
return this.icons;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Filtert Icons nach Suchbegriff
|
||||||
|
*/
|
||||||
|
filterIcons(searchTerm: string): MaterialIcon[] {
|
||||||
|
if (!searchTerm) {
|
||||||
|
return this.icons;
|
||||||
|
}
|
||||||
|
|
||||||
|
const term = searchTerm.toLowerCase();
|
||||||
|
return this.icons.filter(icon =>
|
||||||
|
icon.name.toLowerCase().includes(term) ||
|
||||||
|
icon.category.toLowerCase().includes(term)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gibt Icon-Namen zurück (für Autocomplete-Display)
|
||||||
|
*/
|
||||||
|
getIconNames(): string[] {
|
||||||
|
return this.icons.map(icon => icon.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prüft, ob ein Icon-Name in der Liste existiert
|
||||||
|
*/
|
||||||
|
isValidIcon(iconName: string): boolean {
|
||||||
|
return this.icons.some(icon => icon.name === iconName);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user