Skip to content

Commit

Permalink
refactor(editor-components): replace constructors with inject() (azer…
Browse files Browse the repository at this point in the history
  • Loading branch information
FrancescoBorzi authored Apr 12, 2024
1 parent ee11a16 commit 086224d
Show file tree
Hide file tree
Showing 52 changed files with 169 additions and 418 deletions.
4 changes: 2 additions & 2 deletions apps/keira/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ export class AppComponent extends SubscriptionHandler implements OnInit {
sqliteResult: { id: number; name: string };

constructor(
public readonly mysqlService: MysqlService,
public readonly toastrService: ToastrService,
readonly mysqlService: MysqlService,
readonly toastrService: ToastrService,
private readonly sqliteQueryService: SqliteQueryService,
private readonly electronService: ElectronService,
private readonly http: HttpClient,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { SingleRowEditorComponent } from '@keira/shared/base-abstract-classes';
import {
CONDITION_DISTANCE_TO_CV3,
Expand Down Expand Up @@ -145,11 +145,6 @@ export class ConditionsComponent extends SingleRowEditorComponent<Conditions> {
return this.conditionType === CONDITION_TYPES.CONDITION_STAND_STATE;
}

/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
public editorService: ConditionsService,
public handlerService: ConditionsHandlerService,
) {
super(editorService, handlerService);
}
readonly editorService = inject(ConditionsService);
readonly handlerService = inject(ConditionsHandlerService);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { SingleRowEditorComponent } from '@keira/shared/base-abstract-classes';
import { CreatureEquipTemplate } from '@keira/shared/acore-world-model';
import { CreatureHandlerService } from '../creature-handler.service';
Expand Down Expand Up @@ -28,11 +28,6 @@ import { TopBarComponent } from '@keira/shared/base-editor-components';
],
})
export class CreatureEquipTemplateComponent extends SingleRowEditorComponent<CreatureEquipTemplate> {
/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
public editorService: CreatureEquipTemplateService,
public handlerService: CreatureHandlerService,
) {
super(editorService, handlerService);
}
readonly editorService = inject(CreatureEquipTemplateService);
readonly handlerService = inject(CreatureHandlerService);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { LootTemplateIdComponent } from '@keira/shared/base-abstract-classes';
import { CreatureLootTemplate } from '@keira/shared/acore-world-model';
import { CreatureHandlerService } from '../creature-handler.service';
Expand All @@ -15,11 +15,6 @@ import { TopBarComponent } from '@keira/shared/base-editor-components';
imports: [TopBarComponent, LootEditorComponent],
})
export class CreatureLootTemplateComponent extends LootTemplateIdComponent<CreatureLootTemplate> {
/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
public editorService: CreatureLootTemplateService,
public handlerService: CreatureHandlerService,
) {
super(editorService, handlerService);
}
readonly editorService = inject(CreatureLootTemplateService);
readonly handlerService = inject(CreatureHandlerService);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { SingleRowEditorComponent } from '@keira/shared/base-abstract-classes';
import { CreatureOnkillReputation, FACTION_RANK } from '@keira/shared/acore-world-model';
import { CreatureHandlerService } from '../creature-handler.service';
Expand Down Expand Up @@ -32,11 +32,6 @@ import { TopBarComponent } from '@keira/shared/base-editor-components';
export class CreatureOnkillReputationComponent extends SingleRowEditorComponent<CreatureOnkillReputation> {
readonly FACTION_RANK = FACTION_RANK;

/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
public editorService: CreatureOnkillReputationService,
public handlerService: CreatureHandlerService,
) {
super(editorService, handlerService);
}
readonly editorService = inject(CreatureOnkillReputationService);
readonly handlerService = inject(CreatureHandlerService);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { MultiRowEditorComponent } from '@keira/shared/base-abstract-classes';
import { CreatureQuestitem } from '@keira/shared/acore-world-model';
import { CreatureHandlerService } from '../creature-handler.service';
Expand Down Expand Up @@ -33,11 +33,6 @@ import { TopBarComponent } from '@keira/shared/base-editor-components';
],
})
export class CreatureQuestitemComponent extends MultiRowEditorComponent<CreatureQuestitem> {
/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
public editorService: CreatureQuestitemService,
public handlerService: CreatureHandlerService,
) {
super(editorService, handlerService);
}
readonly editorService = inject(CreatureQuestitemService);
readonly handlerService = inject(CreatureHandlerService);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { MultiRowEditorComponent } from '@keira/shared/base-abstract-classes';
import { CREATURE_ADDON_BYTES_1, CREATURE_ADDON_BYTES_2, CreatureSpawnAddon, EMOTE } from '@keira/shared/acore-world-model';
import { CreatureHandlerService } from '../creature-handler.service';
Expand Down Expand Up @@ -34,11 +34,6 @@ export class CreatureSpawnAddonComponent extends MultiRowEditorComponent<Creatur
readonly CREATURE_ADDON_BYTES_1 = CREATURE_ADDON_BYTES_1;
readonly CREATURE_ADDON_BYTES_2 = CREATURE_ADDON_BYTES_2;

/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
public editorService: CreatureSpawnAddonService,
public handlerService: CreatureHandlerService,
) {
super(editorService, handlerService);
}
readonly editorService = inject(CreatureSpawnAddonService);
readonly handlerService = inject(CreatureHandlerService);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { MultiRowEditorComponent } from '@keira/shared/base-abstract-classes';
import {
CreatureSpawn,
Expand Down Expand Up @@ -51,11 +51,6 @@ export class CreatureSpawnComponent extends MultiRowEditorComponent<CreatureSpaw
readonly SPAWN_MASK = SPAWN_MASK;
readonly PHASE_MASK = PHASE_MASK;

/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
public editorService: CreatureSpawnService,
public handlerService: CreatureHandlerService,
) {
super(editorService, handlerService);
}
readonly editorService = inject(CreatureSpawnService);
readonly handlerService = inject(CreatureHandlerService);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { SingleRowEditorComponent } from '@keira/shared/base-abstract-classes';
import {
CREATURE_ADDON_BYTES_1,
Expand Down Expand Up @@ -42,11 +42,6 @@ export class CreatureTemplateAddonComponent extends SingleRowEditorComponent<Cre
readonly CREATURE_ADDON_BYTES_1 = CREATURE_ADDON_BYTES_1;
readonly CREATURE_ADDON_BYTES_2 = CREATURE_ADDON_BYTES_2;

/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
public editorService: CreatureTemplateAddonService,
public handlerService: CreatureHandlerService,
) {
super(editorService, handlerService);
}
readonly editorService = inject(CreatureTemplateAddonService);
readonly handlerService = inject(CreatureHandlerService);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { SingleRowEditorComponent } from '@keira/shared/base-abstract-classes';
import { CREATURE_TEMPLATE_MOVEMENT_TABLE, CreatureTemplateMovement } from '@keira/shared/acore-world-model';
import { CreatureHandlerService } from '../creature-handler.service';
Expand All @@ -22,11 +22,6 @@ export class CreatureTemplateMovementComponent extends SingleRowEditorComponent<
return this.WIKI_BASE_URL + CREATURE_TEMPLATE_MOVEMENT_TABLE;
}

/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
public editorService: CreatureTemplateMovementService,
public handlerService: CreatureHandlerService,
) {
super(editorService, handlerService);
}
readonly editorService = inject(CreatureTemplateMovementService);
readonly handlerService = inject(CreatureHandlerService);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import {
CREATURE_TEMPLATE_RESISTANCE_SCHOOL,
CREATURE_TEMPLATE_RESISTANCE_TABLE,
Expand Down Expand Up @@ -39,11 +39,6 @@ export class CreatureTemplateResistanceComponent extends MultiRowEditorComponent

readonly CREATURE_TEMPLATE_RESISTANCE_SCHOOL = CREATURE_TEMPLATE_RESISTANCE_SCHOOL;

/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
public editorService: CreatureTemplateResistanceService,
public handlerService: CreatureHandlerService,
) {
super(editorService, handlerService);
}
readonly editorService = inject(CreatureTemplateResistanceService);
readonly handlerService = inject(CreatureHandlerService);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { MultiRowEditorComponent } from '@keira/shared/base-abstract-classes';
import { CREATURE_TEMPLATE_SPELL_TABLE, CreatureTemplateSpell } from '@keira/shared/acore-world-model';
import { CreatureHandlerService } from '../creature-handler.service';
Expand Down Expand Up @@ -33,11 +33,6 @@ export class CreatureTemplateSpellComponent extends MultiRowEditorComponent<Crea
return this.WIKI_BASE_URL + CREATURE_TEMPLATE_SPELL_TABLE;
}

/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
public editorService: CreatureTemplateSpellService,
public handlerService: CreatureHandlerService,
) {
super(editorService, handlerService);
}
readonly editorService = inject(CreatureTemplateSpellService);
readonly handlerService = inject(CreatureHandlerService);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { SingleRowEditorComponent } from '@keira/shared/base-abstract-classes';
import {
CREATURE_AI_NAME,
Expand Down Expand Up @@ -85,11 +85,6 @@ export class CreatureTemplateComponent extends SingleRowEditorComponent<Creature

showItemPreview = true;

/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
public editorService: CreatureTemplateService,
public handlerService: CreatureHandlerService,
) {
super(editorService, handlerService);
}
readonly editorService = inject(CreatureTemplateService);
readonly handlerService = inject(CreatureHandlerService);
}
13 changes: 4 additions & 9 deletions libs/features/creature/src/npc-trainer/npc-trainer.component.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { MultiRowEditorComponent } from '@keira/shared/base-abstract-classes';
import { NpcTrainer } from '@keira/shared/acore-world-model';
import { CreatureHandlerService } from '../creature-handler.service';
Expand Down Expand Up @@ -36,12 +36,7 @@ import { SqliteQueryService } from '@keira/shared/db-layer';
],
})
export class NpcTrainerComponent extends MultiRowEditorComponent<NpcTrainer> {
/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
public editorService: NpcTrainerService,
public handlerService: CreatureHandlerService,
readonly sqliteQueryService: SqliteQueryService,
) {
super(editorService, handlerService);
}
readonly editorService = inject(NpcTrainerService);
readonly handlerService = inject(CreatureHandlerService);
readonly sqliteQueryService = inject(SqliteQueryService);
}
11 changes: 3 additions & 8 deletions libs/features/creature/src/npc-vendor/npc-vendor.component.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { LootTemplateIdComponent } from '@keira/shared/base-abstract-classes';
import { PickpocketingLootTemplate } from '@keira/shared/acore-world-model';
import { CreatureHandlerService } from '../creature-handler.service';
Expand All @@ -15,11 +15,6 @@ import { TopBarComponent } from '@keira/shared/base-editor-components';
imports: [TopBarComponent, NgIf, LootEditorComponent],
})
export class PickpocketingLootTemplateComponent extends LootTemplateIdComponent<PickpocketingLootTemplate> {
/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
public editorService: PickpocketingLootTemplateService,
public handlerService: CreatureHandlerService,
) {
super(editorService, handlerService);
}
readonly editorService = inject(PickpocketingLootTemplateService);
readonly handlerService = inject(CreatureHandlerService);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { SaiEditorComponent } from '@keira/shared/sai-editor';
import { SaiCreatureHandlerService } from '../sai-creature-handler.service';
import { SaiCreatureEditorService } from './sai-creature-editor.service';
Expand Down Expand Up @@ -33,11 +33,6 @@ import { SaiTopBarComponent } from '@keira/shared/sai-editor';
],
})
export class SaiCreatureComponent extends SaiEditorComponent {
/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
public editorService: SaiCreatureEditorService,
protected handlerService: SaiCreatureHandlerService,
) {
super(editorService, handlerService);
}
readonly editorService = inject(SaiCreatureEditorService);
protected readonly handlerService = inject(SaiCreatureHandlerService);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { LootTemplateIdComponent } from '@keira/shared/base-abstract-classes';
import { SkinningLootTemplate } from '@keira/shared/acore-world-model';
import { CreatureHandlerService } from '../creature-handler.service';
Expand All @@ -15,11 +15,6 @@ import { TopBarComponent } from '@keira/shared/base-editor-components';
imports: [TopBarComponent, NgIf, LootEditorComponent],
})
export class SkinningLootTemplateComponent extends LootTemplateIdComponent<SkinningLootTemplate> {
/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
public editorService: SkinningLootTemplateService,
public handlerService: CreatureHandlerService,
) {
super(editorService, handlerService);
}
readonly editorService = inject(SkinningLootTemplateService);
readonly handlerService = inject(CreatureHandlerService);
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject, OnInit } from '@angular/core';
import { LootTemplateIdComponent } from '@keira/shared/base-abstract-classes';
import { GameobjectLootTemplate } from '@keira/shared/acore-world-model';
import { QueryError } from 'mysql2';
Expand Down Expand Up @@ -36,13 +36,8 @@ export class GameobjectLootTemplateComponent extends LootTemplateIdComponent<Gam
);
}

/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
public editorService: GameobjectLootTemplateService,
public handlerService: GameobjectHandlerService,
) {
super(editorService, handlerService);
}
readonly editorService = inject(GameobjectLootTemplateService);
readonly handlerService = inject(GameobjectHandlerService);

ngOnInit() {
this.editorService.clearCache();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { ChangeDetectionStrategy, Component, inject } from '@angular/core';
import { MultiRowEditorComponent } from '@keira/shared/base-abstract-classes';
import { GameobjectQuestitem } from '@keira/shared/acore-world-model';
import { GameobjectHandlerService } from '../gameobject-handler.service';
Expand Down Expand Up @@ -33,11 +33,6 @@ import { TopBarComponent } from '@keira/shared/base-editor-components';
],
})
export class GameobjectQuestitemComponent extends MultiRowEditorComponent<GameobjectQuestitem> {
/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(
public editorService: GameobjectQuestitemService,
public handlerService: GameobjectHandlerService,
) {
super(editorService, handlerService);
}
readonly editorService = inject(GameobjectQuestitemService);
readonly handlerService = inject(GameobjectHandlerService);
}
Loading

0 comments on commit 086224d

Please sign in to comment.