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 }}
-
-
+
-
-
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 {}