diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml deleted file mode 100644 index 84675ea..0000000 --- a/.github/workflows/node.js.yml +++ /dev/null @@ -1,31 +0,0 @@ -# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs - -name: Node.js CI - -on: - push: - branches: [ "prod" ] - pull_request: - branches: [ "prod" ] - -jobs: - build: - - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [20.x] - - steps: - - uses: actions/checkout@v3 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - cache: 'npm' - - run: npm install - - run: npm install -g @angular/cli - - run: npm run build - - run: npm test diff --git a/src/app/feature/tag/create/create.component.html b/src/app/feature/tag/create/create.component.html new file mode 100644 index 0000000..528c8ad --- /dev/null +++ b/src/app/feature/tag/create/create.component.html @@ -0,0 +1,17 @@ +
+
+ +
+ + +
diff --git a/src/app/feature/tag/create/create.component.scss b/src/app/feature/tag/create/create.component.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/feature/tag/create/create.component.ts b/src/app/feature/tag/create/create.component.ts new file mode 100644 index 0000000..66fa773 --- /dev/null +++ b/src/app/feature/tag/create/create.component.ts @@ -0,0 +1,21 @@ +import { Component } from '@angular/core'; +import { MatDialogRef } from '@angular/material/dialog'; + +@Component({ + selector: 'app-create', + templateUrl: './create.component.html', + styleUrls: ['./create.component.scss'], +}) +export class CreateComponent { + description: string = ''; + + constructor(public dialogRef: MatDialogRef) {} + + confirm(): void { + this.dialogRef.close(this.description); + } + + onClose(): void { + this.dialogRef.close(undefined); + } +} diff --git a/src/app/feature/tag/list/list.component.html b/src/app/feature/tag/list/list.component.html index 12449ad..09a3fc5 100644 --- a/src/app/feature/tag/list/list.component.html +++ b/src/app/feature/tag/list/list.component.html @@ -1,10 +1,24 @@
- +
+
+ + > +
+
+ +
+
diff --git a/src/app/feature/tag/list/list.component.ts b/src/app/feature/tag/list/list.component.ts index 741572e..84e7889 100644 --- a/src/app/feature/tag/list/list.component.ts +++ b/src/app/feature/tag/list/list.component.ts @@ -1,8 +1,10 @@ import { Component } from '@angular/core'; +import { MatDialog } from '@angular/material/dialog'; import { Subject, debounceTime } from 'rxjs'; import { TagListEntry } from 'src/app/model/TagListEntry'; import { RequestService } from 'src/app/request.service'; import { ColumnDefinition } from 'src/app/shared/components/table/table.component'; +import { CreateComponent } from '../create/create.component'; @Component({ selector: 'app-list', @@ -32,7 +34,7 @@ export class ListComponent { }, ]; - constructor(public requestService: RequestService) { + constructor(public requestService: RequestService, public dialog: MatDialog) { this.query$.pipe(debounceTime(300)).subscribe((query) => { this.query = query; this.readList(); @@ -47,6 +49,28 @@ export class ListComponent { this.query$.next((event.target as HTMLTextAreaElement).value); } + createTag(): void { + let dialogRef = this.dialog.open(CreateComponent, { + panelClass: 'bg-zinc-900', + maxHeight: '400px', + width: '600px', + }); + + dialogRef.afterClosed().subscribe((result) => { + if (result === undefined) return; + + this.requestService.post( + 'tag/create', + { + description: result, + }, + (response: any) => { + this.readList(); + } + ); + }); + } + readList(): void { this.requestService.post( 'tag-list/read-list', diff --git a/src/app/feature/tag/tag.component.html b/src/app/feature/tag/tag.component.html index 3a55343..8a78ad8 100644 --- a/src/app/feature/tag/tag.component.html +++ b/src/app/feature/tag/tag.component.html @@ -1,17 +1,85 @@ -
-

- {{ tagDetails.description }} -

+

+ {{ tagDetails.description }} +

-
    -
  • - {{ alias.description }} -
  • -
+
+
+ +
+ +
+ +
+
+
Titel:
+
+ +
+
+
+
Alias:
+
+
+
+ {{ alias.description }} +
+
+ +
+
+
+
+ +
+
+
- - diff --git a/src/app/feature/tag/tag.component.ts b/src/app/feature/tag/tag.component.ts index d684199..09eb7af 100644 --- a/src/app/feature/tag/tag.component.ts +++ b/src/app/feature/tag/tag.component.ts @@ -4,6 +4,8 @@ import { TagDetails } from 'src/app/model/TagDetails'; import { VideoListEntry } from 'src/app/model/VideoListEntry'; import { RequestService } from 'src/app/request.service'; import { OnReadListModel } from 'src/app/shared/components/video-list/video-list.component'; +import { CreateComponent } from './create/create.component'; +import { MatDialog } from '@angular/material/dialog'; @Component({ selector: 'app-tag', @@ -18,7 +20,8 @@ export class TagComponent { constructor( private route: ActivatedRoute, - public requestService: RequestService + public requestService: RequestService, + public dialog: MatDialog ) { this.route.params.subscribe((params) => this.updateTagId(params['id'])); } @@ -60,4 +63,27 @@ export class TagComponent { } ); } + + addAlias(): void { + let dialogRef = this.dialog.open(CreateComponent, { + panelClass: 'bg-zinc-900', + maxHeight: '400px', + width: '600px', + }); + + dialogRef.afterClosed().subscribe((result) => { + if (result === undefined) return; + + this.requestService.post( + 'tag/add-alias', + { + tagId: this.tagId, + description: result, + }, + (response: any) => { + this.readDetails(); + } + ); + }); + } } diff --git a/src/app/feature/tag/tag.module.ts b/src/app/feature/tag/tag.module.ts index 62f29d7..c636472 100644 --- a/src/app/feature/tag/tag.module.ts +++ b/src/app/feature/tag/tag.module.ts @@ -4,6 +4,7 @@ import { TagComponent } from './tag.component'; import { ListComponent } from './list/list.component'; import { SharedModule } from 'src/app/shared/shared.module'; import { RouterModule, Routes } from '@angular/router'; +import { CreateComponent } from './create/create.component'; const routes: Routes = [ { path: 'list', component: ListComponent }, @@ -11,7 +12,7 @@ const routes: Routes = [ ]; @NgModule({ - declarations: [TagComponent, ListComponent], + declarations: [TagComponent, ListComponent, CreateComponent], imports: [CommonModule, SharedModule, RouterModule.forChild(routes)], }) export class TagModule {}