diff --git a/README.md b/README.md index f94ebec..5fc7a97 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Homepage +# mytube This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 15.2.6. diff --git a/angular.json b/angular.json index e12ea14..213f72b 100644 --- a/angular.json +++ b/angular.json @@ -3,7 +3,7 @@ "version": 1, "newProjectRoot": "projects", "projects": { - "homepage": { + "mytube": { "projectType": "application", "schematics": { "@schematics/angular:component": { @@ -36,7 +36,7 @@ "build": { "builder": "@angular-devkit/build-angular:browser", "options": { - "outputPath": "dist/homepage", + "outputPath": "dist/mytube", "index": "src/index.html", "main": "src/main.ts", "polyfills": [ @@ -84,10 +84,10 @@ "builder": "@angular-devkit/build-angular:dev-server", "configurations": { "production": { - "browserTarget": "homepage:build:production" + "browserTarget": "mytube:build:production" }, "development": { - "browserTarget": "homepage:build:development" + "browserTarget": "mytube:build:development" } }, "defaultConfiguration": "development" @@ -95,7 +95,7 @@ "extract-i18n": { "builder": "@angular-devkit/build-angular:extract-i18n", "options": { - "browserTarget": "homepage:build" + "browserTarget": "mytube:build" } }, "test": { diff --git a/bin/script/init b/bin/script/init index 3bed973..24a6c31 100755 --- a/bin/script/init +++ b/bin/script/init @@ -12,8 +12,8 @@ $SCRIPT_DIR/exec up -d source $ENV_DIR/bin/script/drun # Install node Packages -drun homepage-frontend npm install -drun homepage-frontend npm install -g @angular/cli +drun mytube-frontend npm install +drun mytube-frontend npm install -g @angular/cli # Initial build of website -drun homepage-frontend npm run build \ No newline at end of file +drun mytube-frontend npm run build \ No newline at end of file diff --git a/docker/docker-compose-mac.yml b/docker/docker-compose-mac.yml index 446cd6a..706d8b3 100644 --- a/docker/docker-compose-mac.yml +++ b/docker/docker-compose-mac.yml @@ -1,31 +1,31 @@ version: '3' networks: - homepage: + mytube: external: true services: - homepage-frontend-app: - image: homepage-frontend-app + mytube-frontend-app: + image: mytube-frontend-app networks: - - homepage + - mytube volumes: - - /Users/flo/dev/frontend/homepage/:/var/www/ + - /Users/flo/dev/frontend/mytube/:/var/www/ build: context: ./../ dockerfile: ./docker/npm/dockerfile tty: true - homepage-frontend-nginx: - image: homepage-frontend-nginx + mytube-frontend-nginx: + image: mytube-frontend-nginx networks: - - homepage + - mytube volumes: - - /Users/flo/dev/frontend/homepage/:/var/www/html:z + - /Users/flo/dev/frontend/mytube/:/var/www/html:z build: context: ./../ dockerfile: ./docker/nginx/dockerfile ports: - 80:80 depends_on: - - homepage-frontend-app \ No newline at end of file + - mytube-frontend-app \ No newline at end of file diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 5bbdfe0..dce82e9 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,14 +1,14 @@ version: '3' networks: - homepage: + mytube: external: true services: - homepage-frontend-app: - image: homepage-frontend-app + mytube-frontend-app: + image: mytube-frontend-app networks: - - homepage + - mytube volumes: - ./../:/var/www/ build: @@ -16,10 +16,10 @@ services: dockerfile: ./docker/npm/dockerfile tty: true - homepage-frontend-nginx: - image: homepage-frontend-nginx + mytube-frontend-nginx: + image: mytube-frontend-nginx networks: - - homepage + - mytube volumes: - ./../:/var/www/html:z build: @@ -28,4 +28,4 @@ services: ports: - 80:80 depends_on: - - homepage-frontend-app \ No newline at end of file + - mytube-frontend-app \ No newline at end of file diff --git a/docker/nginx/config/nginx.conf b/docker/nginx/config/nginx.conf index 510c048..1400616 100644 --- a/docker/nginx/config/nginx.conf +++ b/docker/nginx/config/nginx.conf @@ -1,12 +1,12 @@ upstream host-backend-nginx { - server homepage-backend-nginx:80; + server mytube-backend-nginx:80; } server{ listen 80 default_server; - root /var/www/html/dist/homepage; + root /var/www/html/dist/mytube; index index.html; location / { diff --git a/package-lock.json b/package-lock.json index 3187f19..cade670 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "homepage", + "name": "mytube", "version": "0.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "homepage", + "name": "mytube", "version": "0.0.0", "dependencies": { "@angular/animations": "^15.2.0", diff --git a/package.json b/package.json index bbdb1cb..2ad42e3 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "homepage", + "name": "mytube", "version": "0.0.0", "scripts": { "ng": "ng", diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts deleted file mode 100644 index bb3ece4..0000000 --- a/src/app/app-routing.module.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { NgModule } from '@angular/core'; -import { RouterModule, Routes } from '@angular/router'; -import { LoginComponent } from './auth/login/login.component'; -import { HomeComponent } from './home/home.component'; -import { RegistrationComponent } from './auth/registration/registration.component'; -import { RegistrationConfirmationComponent } from './auth/registration-confirmation/registration-confirmation.component'; - -const routes: Routes = [ - { path: 'auth', component: LoginComponent }, - { path: 'auth/registration', component: RegistrationComponent }, - { path: 'auth/registration/:id', component: RegistrationConfirmationComponent }, - { path: 'home', component: HomeComponent }, - { path: '', redirectTo: '/auth', pathMatch: 'full' }, -]; - -@NgModule({ - imports: [RouterModule.forRoot(routes)], - exports: [RouterModule] -}) -export class AppRoutingModule { } \ No newline at end of file diff --git a/src/app/app.component.html b/src/app/app.component.html index 90c6b64..27cb800 100644 --- a/src/app/app.component.html +++ b/src/app/app.component.html @@ -1 +1,3 @@ - \ No newline at end of file + + + \ No newline at end of file diff --git a/src/app/app.module.ts b/src/app/app.module.ts index a288bc7..7bdef99 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -21,35 +21,16 @@ import { MatDividerModule } from '@angular/material/divider'; import {MatDialogModule} from '@angular/material/dialog'; import {MatSnackBarModule} from '@angular/material/snack-bar'; -import { AppRoutingModule } from './app-routing.module'; import { AppComponent } from './app.component'; -import { ProductListComponent } from './product/product-list/product-list.component'; -import { BrowserAnimationsModule } from '@angular/platform-browser/animations'; -import { HomeComponent } from './home/home.component'; -import { ProductDetailsComponent } from './product/product-details/product-details.component'; -import { LoginComponent } from './auth/login/login.component'; -import { CreateProductComponent } from './product/create-product/create-product.component'; -import { RegistrationComponent } from './auth/registration/registration.component'; -import { RegistrationConfirmationComponent } from './auth/registration-confirmation/registration-confirmation.component'; -import { ProductComponent } from './product/product/product.component'; + @NgModule({ declarations: [ AppComponent, - ProductListComponent, - ProductDetailsComponent, - LoginComponent, - HomeComponent, - CreateProductComponent, - RegistrationComponent, - RegistrationConfirmationComponent, - ProductComponent, ], imports: [ BrowserModule, HttpClientModule, - AppRoutingModule, - BrowserAnimationsModule, MatSlideToggleModule, MatCardModule, MatButtonModule, diff --git a/src/app/auth/login/login.component.html b/src/app/auth/login/login.component.html deleted file mode 100644 index 16f75d0..0000000 --- a/src/app/auth/login/login.component.html +++ /dev/null @@ -1,41 +0,0 @@ - - - Login - Bitte melde Dich an - - - - - - - Identifier - - - - - - Password - - - - - - - Registrieren - - - - - Login - - - - - - \ No newline at end of file diff --git a/src/app/auth/login/login.component.scss b/src/app/auth/login/login.component.scss deleted file mode 100644 index 279070e..0000000 --- a/src/app/auth/login/login.component.scss +++ /dev/null @@ -1,23 +0,0 @@ -mat-card { - margin-left: auto; - margin-right: auto; -} - - -button { - width: 100%; -} - -/* For tablet: */ -@media only screen and (min-width: 600px) { - mat-card { - width: 70%; - } - } - - /* For desktop: */ - @media only screen and (min-width: 768px) { - mat-card { - width: 40%; - } -} \ No newline at end of file diff --git a/src/app/auth/login/login.component.ts b/src/app/auth/login/login.component.ts deleted file mode 100644 index 4aa63b2..0000000 --- a/src/app/auth/login/login.component.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { RequestService } from '../../request.service'; -import { Router } from "@angular/router" -import { AppService } from '../../app.service'; - - -@Component({ - selector: 'app-login', - templateUrl: './login.component.html', - styleUrls: ['./login.component.scss'] -}) -export class LoginComponent implements OnInit { - identifier: string|null = null; - password: string|null = null; - - constructor( - public appService : AppService, - public requestService : RequestService, - private router: Router - ) { - } - - ngOnInit(): void { - this.stateRequest(); - } - - login() { - this.requestService.post( - 'auth/login-user', - { - identifier: this.identifier, - password: this.password - }, - (response:any) => { - if(response.hasOwnProperty('sessionId')) { - this.router.navigate(['/home']); - } - } - ); - } - - register() { - console.log('goto registration'); - this.router.navigate(['/auth/registration']); - } - - private stateRequest() { - this.requestService.get( - 'user/state', - {}, - (response:any) => { - if (response.hasOwnProperty('sessionId')) { - this.appService.setUsername(response.username); - this.router.navigate(['/home']); - } - } - ); - } - -} diff --git a/src/app/auth/registration-confirmation/registration-confirmation.component.html b/src/app/auth/registration-confirmation/registration-confirmation.component.html deleted file mode 100644 index 271afda..0000000 --- a/src/app/auth/registration-confirmation/registration-confirmation.component.html +++ /dev/null @@ -1,33 +0,0 @@ - - - Registrierung bestätigen - Bitte gib dein Passwort ein - - - - - - - Passwort - - - - - - Passwort wiederholen - - - - - - - Bestätigen - - - - - - \ No newline at end of file diff --git a/src/app/auth/registration-confirmation/registration-confirmation.component.scss b/src/app/auth/registration-confirmation/registration-confirmation.component.scss deleted file mode 100644 index 279070e..0000000 --- a/src/app/auth/registration-confirmation/registration-confirmation.component.scss +++ /dev/null @@ -1,23 +0,0 @@ -mat-card { - margin-left: auto; - margin-right: auto; -} - - -button { - width: 100%; -} - -/* For tablet: */ -@media only screen and (min-width: 600px) { - mat-card { - width: 70%; - } - } - - /* For desktop: */ - @media only screen and (min-width: 768px) { - mat-card { - width: 40%; - } -} \ No newline at end of file diff --git a/src/app/auth/registration-confirmation/registration-confirmation.component.ts b/src/app/auth/registration-confirmation/registration-confirmation.component.ts deleted file mode 100644 index f0fd3ea..0000000 --- a/src/app/auth/registration-confirmation/registration-confirmation.component.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Component, OnInit } from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; -import { RequestService } from '../../request.service'; - -@Component({ - selector: 'app-registration-confirmation', - templateUrl: './registration-confirmation.component.html', - styleUrls: ['./registration-confirmation.component.scss'] -}) -export class RegistrationConfirmationComponent implements OnInit { - public id: string; - public password: string|null = null; - public passwordConfirmation: string|null = null; - - constructor( - private route: ActivatedRoute, - public requestService : RequestService, - private router: Router - ) { - this.id = ''; - } - - ngOnInit() { - this.id = this.route.snapshot.paramMap.get('id') ?? ''; - } - - confirm() { - this.requestService.post( - 'auth/confirm-registration', - { - id: this.id, - password: this.password, - passwordConfirmation: this.passwordConfirmation, - }, - (response:any) => { - this.router.navigate(['/auth']); - } - ) - } -} diff --git a/src/app/auth/registration/registration.component.html b/src/app/auth/registration/registration.component.html deleted file mode 100644 index 5e07b3c..0000000 --- a/src/app/auth/registration/registration.component.html +++ /dev/null @@ -1,33 +0,0 @@ - - - Registrieren - Bitte gib deine Benutzerdaten an: - - - - - - - Benutzername - - - - - - E-Mail - - - - - - - Registrieren - - - - - - \ No newline at end of file diff --git a/src/app/auth/registration/registration.component.scss b/src/app/auth/registration/registration.component.scss deleted file mode 100644 index 279070e..0000000 --- a/src/app/auth/registration/registration.component.scss +++ /dev/null @@ -1,23 +0,0 @@ -mat-card { - margin-left: auto; - margin-right: auto; -} - - -button { - width: 100%; -} - -/* For tablet: */ -@media only screen and (min-width: 600px) { - mat-card { - width: 70%; - } - } - - /* For desktop: */ - @media only screen and (min-width: 768px) { - mat-card { - width: 40%; - } -} \ No newline at end of file diff --git a/src/app/auth/registration/registration.component.ts b/src/app/auth/registration/registration.component.ts deleted file mode 100644 index fe7f5e5..0000000 --- a/src/app/auth/registration/registration.component.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { Component } from '@angular/core'; -import { AppService } from '../../app.service'; -import { RequestService } from '../../request.service'; -import { Router } from '@angular/router'; - -@Component({ - selector: 'app-registration', - templateUrl: './registration.component.html', - styleUrls: ['./registration.component.scss'] -}) -export class RegistrationComponent { - username: string|null = null; - mail: string|null = null; - - constructor( - public appService : AppService, - public requestService : RequestService, - private router: Router - ) { - } - - ngOnInit(): void { - this.username = ""; - this.mail = ""; - } - - register(): void { - this.requestService.post( - 'auth/register-user', - { - username: this.username, - mail: this.mail - }, - (response:any) => { - this.router.navigate(['/auth']); - } - ); - } -} diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html deleted file mode 100644 index 879a52c..0000000 --- a/src/app/home/home.component.html +++ /dev/null @@ -1,26 +0,0 @@ - - - menu - - - - - {{title}} - - - {{username}} - - Logout - - - - - - - - - - - - - diff --git a/src/app/home/home.component.scss b/src/app/home/home.component.scss deleted file mode 100644 index a28ce92..0000000 --- a/src/app/home/home.component.scss +++ /dev/null @@ -1,13 +0,0 @@ -span { - margin-left: auto; - margin-right: auto; - } - - .content { - height: 100%; - } - - .example-sidenav-content { - margin: 1em; - height: 100%; - } \ No newline at end of file diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts deleted file mode 100644 index 56c6929..0000000 --- a/src/app/home/home.component.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { Component } from '@angular/core'; -import { Product } from '../product/product-list/product-list.component'; -import { RequestService } from '../request.service'; -import { Router } from "@angular/router" -import { AppService } from '../app.service'; - - -@Component({ - selector: 'app-home', - templateUrl: './home.component.html', - styleUrls: ['./home.component.scss'] -}) -export class HomeComponent { - title = 'Homepage'; - username: string = "(null)"; - selectedProduct: Product|null = null; - - constructor( - public appService : AppService, - public requestService : RequestService, - private router: Router - ) { - } - - ngOnInit(): void { - this.requestService.get( - 'user/state', - {}, - (response:any) => { - if (response.status == 401) { - this.router.navigate(['/auth']); - } else { - this.username = response.username; - } - } - ); - } - - logout() { - this.requestService.post( - 'auth/logout-user', - {}, - (response:any) => { - this.router.navigate(['/auth']); - } - ); - } - - selectProduct(product: any) { - this.selectedProduct = product; - } -} diff --git a/src/app/product/create-product/create-product.component.html b/src/app/product/create-product/create-product.component.html deleted file mode 100644 index 6fad936..0000000 --- a/src/app/product/create-product/create-product.component.html +++ /dev/null @@ -1,28 +0,0 @@ - - - Neues Produkt - Bitte gebe die Daten des neuen Produkts an - - - - - - - Identifier - - - - - - Name - - - - - - - - Abbrechen - Ok - - \ No newline at end of file diff --git a/src/app/product/create-product/create-product.component.scss b/src/app/product/create-product/create-product.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/product/create-product/create-product.component.ts b/src/app/product/create-product/create-product.component.ts deleted file mode 100644 index 3c01991..0000000 --- a/src/app/product/create-product/create-product.component.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { Component } from '@angular/core'; -import { MatDialogRef } from '@angular/material/dialog'; - -@Component({ - selector: 'app-create-product', - templateUrl: './create-product.component.html', - styleUrls: ['./create-product.component.scss'] -}) -export class CreateProductComponent { - name: string - identifier: string - - constructor( - private dialogRef: MatDialogRef - ) { - this.name = ''; - this.identifier = ''; - } - - cancel(){ - this.dialogRef.close(); - } - -} diff --git a/src/app/product/product-details/product-details.component.html b/src/app/product/product-details/product-details.component.html deleted file mode 100644 index 0b8b7b4..0000000 --- a/src/app/product/product-details/product-details.component.html +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - {{product.name}} - {{product.identifier}} - {{product.id}} - - - - - - - - - Identifier - - - - - - Name - - - - - - Url - - - - - - - Erstellt am - - - - - - Zuletzt geändert am - - - - - - - - - - save - - - \ No newline at end of file diff --git a/src/app/product/product-details/product-details.component.scss b/src/app/product/product-details/product-details.component.scss deleted file mode 100644 index 19f3d6b..0000000 --- a/src/app/product/product-details/product-details.component.scss +++ /dev/null @@ -1,36 +0,0 @@ -app-login { - margin: auto; -} - -mat-form-field { - width: 100%; - } - -mat-divider { - margin-top: 0.5em; - margin-bottom: 1em; -} - -mat-card { - margin-right: auto; - margin-left: auto; -} - -iframe { - width: 100%; - height: 100%; -} - -/* For tablet: */ -@media only screen and (min-width: 600px) { - mat-card { - max-width: 85%; - } -} - -/* For desktop: */ -@media only screen and (min-width: 768px) { - mat-card { - max-width: 85%; - } -} \ No newline at end of file diff --git a/src/app/product/product-details/product-details.component.ts b/src/app/product/product-details/product-details.component.ts deleted file mode 100644 index 7bcd941..0000000 --- a/src/app/product/product-details/product-details.component.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { Component, Input, OnChanges, SimpleChanges } from '@angular/core'; -import { RequestService } from '../../request.service'; -import { Product } from '../product-list/product-list.component'; -import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'; - -@Component({ - selector: 'app-product-details', - templateUrl: './product-details.component.html', - styleUrls: ['./product-details.component.scss'] -}) -export class ProductDetailsComponent implements OnChanges { - @Input() product: Product|null = null - url: SafeResourceUrl|null = null; - - - constructor( - public requestService : RequestService, - private domSanitizer: DomSanitizer - ) { - } - - ngOnChanges(changes: SimpleChanges) { - if (this.product != null && this.product.url != null) { - this.url = this.domSanitizer.bypassSecurityTrustResourceUrl(this.product.url); - } - else { - this.url = null; - } - } - - updateProduct(product: Product) { - this.requestService.post( - 'product/update-product', - product, - (response:any) => { - this.product = response - } - ); - } -} diff --git a/src/app/product/product-list/product-list.component.html b/src/app/product/product-list/product-list.component.html deleted file mode 100644 index b808806..0000000 --- a/src/app/product/product-list/product-list.component.html +++ /dev/null @@ -1,17 +0,0 @@ - - - delete - {{product.name}} - {{product.identifier}} - - - - - - - add - Add - diff --git a/src/app/product/product-list/product-list.component.scss b/src/app/product/product-list/product-list.component.scss deleted file mode 100644 index ceccad6..0000000 --- a/src/app/product/product-list/product-list.component.scss +++ /dev/null @@ -1,18 +0,0 @@ -mat-divider { - margin-top: 0.5em; - margin-bottom: 1em; -} - -.listItem { - margin-right: 1em; -} - -.listItem:hover { - background-color: lightgray; -} - -button { - margin-left: 1em; - margin-right: 1em; - width: 90%; -} \ No newline at end of file diff --git a/src/app/product/product-list/product-list.component.ts b/src/app/product/product-list/product-list.component.ts deleted file mode 100644 index 3d5d74b..0000000 --- a/src/app/product/product-list/product-list.component.ts +++ /dev/null @@ -1,82 +0,0 @@ -import { Component, EventEmitter, Output } from '@angular/core'; -import { RequestService } from '../../request.service'; -import {MatDialog, MAT_DIALOG_DATA, MatDialogRef} from '@angular/material/dialog'; -import { CreateProductComponent } from '../create-product/create-product.component'; - -export interface Product { - id: string, - identifier: string, - name: string|null, - url: string|null, - created: string, - updated: string -} - -@Component({ - selector: 'app-product-list', - templateUrl: './product-list.component.html', - styleUrls: ['./product-list.component.scss'] -}) -export class ProductListComponent { - @Output() productSelected = new EventEmitter(); - products: Product[] = [] - - constructor( - public requestService : RequestService, - public dialog: MatDialog - ) { - } - - onGetProductList(): void { - this.requestService.get( - 'product/product-list', - {}, - (answer:any) => this.products = answer - ); - } - - selectProduct(product: Product|null) { - this.productSelected.emit(product); - } - - createProduct() { - - const createProductDialogRef = this.dialog.open( - CreateProductComponent - ) - - createProductDialogRef.afterClosed().subscribe( - result => { - if(result != undefined) { - this.requestService.post( - 'product/create-product', - { - identifier: result.identifier, - name: result.name - }, - (answer:any) => { - this.onGetProductList(); - this.selectProduct(answer); - } - ); - } - } - ) - - return; - } - - removeProduct(product: Product) { - this.selectProduct(null); - this.requestService.post( - 'product/delete-product', - { - id: product.id - }, - (answer:any) => { - this.selectProduct(null); - this.onGetProductList(); - } - ); - } -} diff --git a/src/app/product/product/product.component.html b/src/app/product/product/product.component.html deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/product/product/product.component.scss b/src/app/product/product/product.component.scss deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/product/product/product.component.ts b/src/app/product/product/product.component.ts deleted file mode 100644 index 362e382..0000000 --- a/src/app/product/product/product.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-product', - templateUrl: './product.component.html', - styleUrls: ['./product.component.scss'] -}) -export class ProductComponent { - -} diff --git a/src/index.html b/src/index.html index ade66b6..d9531f3 100644 --- a/src/index.html +++ b/src/index.html @@ -2,7 +2,7 @@ - Homepage + mytube