From bb46f8c7eec7757723cf6829fe05872c5cdaaee7 Mon Sep 17 00:00:00 2001 From: Helias Date: Mon, 28 Oct 2024 00:05:00 +0100 Subject: [PATCH] feat(sai-editor): make linkable the timed-actionlist --- .../editors/select-complex-key.component.ts | 9 +++---- .../timed-actionlist.component.html | 4 +++- .../timed-actionlist.component.scss | 0 .../timed-actionlist.component.ts | 24 ++++++++++++------- 4 files changed, 23 insertions(+), 14 deletions(-) delete mode 100644 libs/shared/sai-editor/src/timed-actionlist/timed-actionlist.component.scss diff --git a/libs/shared/base-abstract-classes/src/components/editors/select-complex-key.component.ts b/libs/shared/base-abstract-classes/src/components/editors/select-complex-key.component.ts index 066816364f..60cfdcbeca 100644 --- a/libs/shared/base-abstract-classes/src/components/editors/select-complex-key.component.ts +++ b/libs/shared/base-abstract-classes/src/components/editors/select-complex-key.component.ts @@ -1,7 +1,7 @@ -import { ComplexKeyHandlerService } from '../../service/handlers/complex-key.handler.service'; -import { TableRow, WIKI_BASE_URL } from '@keira/shared/constants'; -import { DTCFG } from '@keira/shared/config'; import { ChangeDetectorRef, inject } from '@angular/core'; +import { DTCFG } from '@keira/shared/config'; +import { TableRow, WIKI_BASE_URL } from '@keira/shared/constants'; +import { ComplexKeyHandlerService } from '../../service/handlers/complex-key.handler.service'; import { SearchService } from '../../service/select/search.service'; /* istanbul ignore next */ // TODO: fix coverage @@ -14,7 +14,8 @@ export abstract class SelectComplexKeyComponent { private readonly changeDetectorRef = inject(ChangeDetectorRef); - onSelect(event: { selected: Array> }) { + onSelect(event: { selected: Array> }): void { + console.log('### event', event); this.handlerService.select(false, event.selected[0]); } diff --git a/libs/shared/sai-editor/src/timed-actionlist/timed-actionlist.component.html b/libs/shared/sai-editor/src/timed-actionlist/timed-actionlist.component.html index 308eca5924..5b9d058dc6 100644 --- a/libs/shared/sai-editor/src/timed-actionlist/timed-actionlist.component.html +++ b/libs/shared/sai-editor/src/timed-actionlist/timed-actionlist.component.html @@ -1,10 +1,12 @@ diff --git a/libs/shared/sai-editor/src/timed-actionlist/timed-actionlist.component.scss b/libs/shared/sai-editor/src/timed-actionlist/timed-actionlist.component.scss deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/libs/shared/sai-editor/src/timed-actionlist/timed-actionlist.component.ts b/libs/shared/sai-editor/src/timed-actionlist/timed-actionlist.component.ts index 436c243fa9..96f97b14da 100644 --- a/libs/shared/sai-editor/src/timed-actionlist/timed-actionlist.component.ts +++ b/libs/shared/sai-editor/src/timed-actionlist/timed-actionlist.component.ts @@ -1,33 +1,39 @@ import { ChangeDetectionStrategy, Component, inject, Input, OnChanges } from '@angular/core'; -import { DTCFG } from '@keira/shared/config'; -import { SmartScripts } from '@keira/shared/acore-world-model'; -import { Observable } from 'rxjs'; import { AsyncPipe } from '@angular/common'; -import { NgxDatatableModule } from '@siemens/ngx-datatable'; +import { SmartScripts } from '@keira/shared/acore-world-model'; +import { SelectComplexKeyComponent } from '@keira/shared/base-abstract-classes'; import { MysqlQueryService } from '@keira/shared/db-layer'; +import { SaiSearchService } from '@keira/shared/selectors'; +import { NgxDatatableModule } from '@siemens/ngx-datatable'; +import { Observable } from 'rxjs'; +import { SaiHandlerService } from '../sai-handler.service'; @Component({ selector: 'keira-timed-actionlist', templateUrl: './timed-actionlist.component.html', - styleUrls: ['./timed-actionlist.component.scss'], changeDetection: ChangeDetectionStrategy.OnPush, standalone: true, imports: [NgxDatatableModule, AsyncPipe], }) -export class TimedActionlistComponent implements OnChanges { +export class TimedActionlistComponent extends SelectComplexKeyComponent implements OnChanges { @Input({ required: true }) creatureId!: string | number; private readonly queryService = inject(MysqlQueryService); - - readonly DTCFG = DTCFG; + protected override readonly handlerService = inject(SaiHandlerService); + readonly selectService = inject(SaiSearchService); private _timedActionLists$!: Observable; get timedActionlists$(): Observable { return this._timedActionLists$; } - ngOnChanges() { + ngOnChanges(): void { this._timedActionLists$ = this.queryService.getTimedActionlists(this.creatureId); } + + override onSelect(event: { selected: SmartScripts[] }): void { + console.log('### event 2', event); + this.handlerService.select(false, event.selected[0], `Timed Actionlist ID ${event.selected[0].entryorguid}`); + } }