Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sai-editor): make the timed-actionlist linkable #3115

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -14,7 +14,8 @@ export abstract class SelectComplexKeyComponent<T extends TableRow> {

private readonly changeDetectorRef = inject(ChangeDetectorRef);

onSelect(event: { selected: Array<Partial<T>> }) {
onSelect(event: { selected: Array<Partial<T>> }): void {
console.log('### event', event);
this.handlerService.select(false, event.selected[0]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log('### event', event);

}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<ngx-datatable
class="bootstrap table table-striped text-center"
class="bootstrap table table-striped text-center datatable-select"
[rows]="timedActionlists$ | async"
[headerHeight]="DTCFG.headerHeight"
[footerHeight]="DTCFG.footerHeight"
[columnMode]="DTCFG.columnMode"
[rowHeight]="DTCFG.rowHeight"
[selectionType]="DTCFG.selectionType"
(select)="onSelect($event)"
>
<ngx-datatable-column [minWidth]="100" [maxWidth]="100" name="entryorguid" prop="entryorguid"></ngx-datatable-column>
<ngx-datatable-column [minWidth]="50" [maxWidth]="60" name="id" prop="id"></ngx-datatable-column>
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -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<SmartScripts> 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<SmartScripts[]>;
get timedActionlists$(): Observable<SmartScripts[]> {
return this._timedActionLists$;
}

ngOnChanges() {
ngOnChanges(): void {
this._timedActionLists$ = this.queryService.getTimedActionlists(this.creatureId);
}

override onSelect(event: { selected: SmartScripts[] }): void {
console.log('### event 2', event);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
console.log('### event 2', event);

this.handlerService.select(false, event.selected[0], `Timed Actionlist ID ${event.selected[0].entryorguid}`);
}
}
Loading