Skip to content

Commit

Permalink
Merge branch 'master' into improve-search-gossip
Browse files Browse the repository at this point in the history
  • Loading branch information
Helias authored Aug 24, 2023
2 parents 438a738 + 61c36f7 commit 9dce31d
Show file tree
Hide file tree
Showing 55 changed files with 3,622 additions and 1,380 deletions.
4,080 changes: 2,856 additions & 1,224 deletions package-lock.json

Large diffs are not rendered by default.

77 changes: 39 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,76 +40,77 @@
},
"dependencies": {
"@ngx-translate/core": "15.0.0",
"@ngx-translate/http-loader": "7.0.0",
"@ngx-translate/http-loader": "8.0.0",
"@types/electron-settings": "4.0.0",
"acorn": "8.8.2",
"acorn": "8.10.0",
"electron-settings": "4.0.2",
"jquery": "3.6.4",
"karma-coverage": "2.2.1",
"mysql2": "3.3.0",
"jquery": "3.7.0",
"mysql2": "3.6.0",
"ngx-toastr": "17.0.2",
"ngx-ui-switch": "14.0.3",
"serialize-javascript": "6.0.1",
"sqlite3": "5.1.6",
"tslib": "2.5.3",
"tslib": "2.6.2",
"webpack-sources": "3.2.3"
},
"devDependencies": {
"@angular-builders/custom-webpack": "16.0.0",
"@angular-devkit/build-angular": "16.1.6",
"@angular-eslint/builder": "16.1.0",
"@angular-eslint/eslint-plugin": "16.1.0",
"@angular-eslint/eslint-plugin-template": "16.1.0",
"@angular-eslint/schematics": "16.1.0",
"@angular-eslint/template-parser": "16.1.0",
"@angular/animations": "16.1.7",
"@angular/cli": "16.1.6",
"@angular/common": "16.1.7",
"@angular/compiler": "16.1.7",
"@angular/compiler-cli": "16.1.7",
"@angular/core": "16.1.7",
"@angular/forms": "16.1.7",
"@angular/platform-browser": "16.1.7",
"@angular/platform-browser-dynamic": "16.1.7",
"@angular/router": "16.1.7",
"@fortawesome/fontawesome-free": "6.4.0",
"@playwright/test": "1.36.2",
"@angular-builders/custom-webpack": "16.0.1",
"@angular-devkit/build-angular": "16.2.0",
"@angular-eslint/builder": "16.1.1",
"@angular-eslint/eslint-plugin": "16.1.1",
"@angular-eslint/eslint-plugin-template": "16.1.1",
"@angular-eslint/schematics": "16.1.1",
"@angular-eslint/template-parser": "16.1.1",
"@angular/animations": "16.2.2",
"@angular/cli": "16.2.0",
"@angular/common": "16.2.2",
"@angular/compiler": "16.2.2",
"@angular/compiler-cli": "16.2.2",
"@angular/core": "16.2.2",
"@angular/forms": "16.2.2",
"@angular/platform-browser": "16.2.2",
"@angular/platform-browser-dynamic": "16.2.2",
"@angular/router": "16.2.2",
"@fortawesome/fontawesome-free": "6.4.2",
"@playwright/test": "1.37.1",
"@swimlane/ngx-datatable": "20.1.0",
"@types/jasmine": "4.3.5",
"@types/jasminewd2": "2.0.10",
"@types/jquery": "3.5.16",
"@types/jquery": "3.5.17",
"@types/mysql": "2.15.21",
"@types/node": "18.17.1",
"@types/node": "18.17.9",
"@types/sqlite3": "3.1.8",
"@types/sqlstring": "2.3.0",
"@typescript-eslint/eslint-plugin": "5.59.2",
"@typescript-eslint/parser": "5.59.2",
"@typescript-eslint/eslint-plugin": "6.4.1",
"@typescript-eslint/parser": "6.4.1",
"bootstrap": "5.3.1",
"codelyzer": "6.0.2",
"conventional-changelog-cli": "2.2.2",
"conventional-changelog-cli": "3.0.0",
"coveralls": "3.1.1",
"cross-env": "7.0.3",
"electron": "24.6.5",
"electron": "26.1.0",
"electron-builder": "24.6.3",
"electron-reload": "1.5.0",
"eslint": "8.46.0",
"eslint": "8.47.0",
"highlight.js": "11.8.0",
"husky": "8.0.3",
"jasmine-core": "4.6.0",
"jasmine-core": "5.1.0",
"jasmine-spec-reporter": "7.0.0",
"karma": "6.4.2",
"karma-chrome-launcher": "3.2.0",
"karma-coverage": "2.2.1",
"karma-coverage-istanbul-reporter": "3.0.3",
"karma-jasmine": "5.1.0",
"karma-jasmine-html-reporter": "2.1.0",
"lint-staged": "13.2.3",
"lint-staged": "14.0.1",
"ngx-bootstrap": "11.0.2",
"ngx-clipboard": "16.0.0",
"ngx-highlightjs": "8.0.0",
"ngx-highlightjs": "10.0.0",
"npm-run-all": "4.1.5",
"playwright": "1.36.2",
"prettier": "2.8.8",
"playwright": "1.37.1",
"prettier": "3.0.2",
"pretty-quick": "3.1.3",
"puppeteer": "21.1.0",
"rxjs": "7.8.1",
"sqlstring": "2.3.3",
"squel": "5.13.0",
Expand All @@ -118,7 +119,7 @@
"typescript": "4.9.5",
"wait-on": "7.0.1",
"webdriver-manager": "13.0.2",
"webpack": "5.84.1",
"webpack": "5.88.2",
"zone.js": "0.13.1"
},
"husky": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@
<div class="row">
<ng-container [formGroup]="selectService.fields">
<div class="form-group col-sm-6 col-md-4 col-lg-3 col-xl-2">
<input [formControlName]="'entry'" type="number" class="form-control form-control-sm" id="search-id" placeholder="Entry" />
<input formControlName="entry" type="number" class="form-control form-control-sm" id="search-id" placeholder="Entry" />
</div>
<div class="form-group col-sm-6 col-md-4 col-lg-3 col-xl-3">
<input [formControlName]="'name'" class="form-control form-control-sm" id="name" placeholder="Name" />
<div class="form-group col-sm-6 col-md-4 col-lg-2 col-xl-2">
<input formControlName="name" class="form-control form-control-sm" id="name" placeholder="Name" />
</div>
<div class="form-group col-sm-6 col-md-4 col-lg-3 col-xl-3">
<input [formControlName]="'subname'" class="form-control form-control-sm" id="subname" placeholder="Subname" />
<div class="form-group col-sm-6 col-md-4 col-lg-2 col-xl-2">
<input formControlName="subname" class="form-control form-control-sm" id="subname" placeholder="Subname" />
</div>
<div class="form-group col-sm-6 col-md-4 col-lg-2 col-xl-2">
<input formControlName="ScriptName" class="form-control form-control-sm" id="ScriptName" placeholder="ScriptName" />
</div>
</ng-container>
<div class="form-group col-sm-6 col-md-4 col-lg-3 col-xl-2">
<input [formControlName]="'limit'" class="form-control form-control-sm" id="limit" placeholder="Limit" />
<input formControlName="limit" class="form-control form-control-sm" id="limit" placeholder="Limit" />
</div>
<div class="mb-2 col-sm-6 col-md-4 col-lg-3 col-xl-2">
<keira-search-button [searchService]="selectService"></keira-search-button>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
import { TestBed, waitForAsync } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { Router } from '@angular/router';
import { of } from 'rxjs';
import { ToastrModule } from 'ngx-toastr';
import { RouterTestingModule } from '@angular/router/testing';
import { ModalModule } from 'ngx-bootstrap/modal';
import { ToastrModule } from 'ngx-toastr';
import { of } from 'rxjs';

import { MysqlQueryService } from '@keira-shared/services/mysql-query.service';
import { SelectCreatureComponent } from './select-creature.component';
import { SelectCreatureService } from './select-creature.service';
import { SelectCreatureModule } from './select-creature.module';
import { CreatureTemplate } from '@keira-types/creature-template.type';
import { TranslateTestingModule } from '@keira-shared/testing/translate-module';
import { SelectPageObject } from '@keira-testing/select-page-object';
import { CreatureTemplate } from '@keira-types/creature-template.type';
import { CreatureHandlerService } from '../creature-handler.service';
import { SaiCreatureHandlerService } from '../sai-creature-handler.service';
import { TranslateTestingModule } from '@keira-shared/testing/translate-module';
import { SelectCreatureComponent } from './select-creature.component';
import { SelectCreatureModule } from './select-creature.module';
import { SelectCreatureService } from './select-creature.service';
import Spy = jasmine.Spy;

class SelectCreatureComponentPage extends SelectPageObject<SelectCreatureComponent> {
ID_FIELD = 'entry';
get searchSubnameInput(): HTMLInputElement {
return this.query<HTMLInputElement>('#subname');
}
get searchScriptNameInput(): HTMLInputElement {
return this.query<HTMLInputElement>('#ScriptName');
}
}

describe('SelectCreature integration tests', () => {
Expand Down Expand Up @@ -90,12 +93,13 @@ describe('SelectCreature integration tests', () => {
page.expectEntityAlreadyInUse();
}));

for (const { id, entry, name, subname, limit, expectedQuery } of [
for (const { id, entry, name, subname, scriptName, limit, expectedQuery } of [
{
id: 1,
entry: 1200,
name: 'Helias',
subname: 'Dev',
scriptName: '',
limit: '100',
expectedQuery:
'SELECT * FROM `creature_template` ' +
Expand All @@ -106,6 +110,7 @@ describe('SelectCreature integration tests', () => {
entry: '',
name: 'Helias',
subname: 'Dev',
scriptName: '',
limit: '100',
expectedQuery: "SELECT * FROM `creature_template` WHERE (`name` LIKE '%Helias%') AND (`subname` LIKE '%Dev%') LIMIT 100",
},
Expand All @@ -114,6 +119,7 @@ describe('SelectCreature integration tests', () => {
entry: '',
name: 'Helias',
subname: '',
scriptName: '',
limit: '100',
expectedQuery: "SELECT * FROM `creature_template` WHERE (`name` LIKE '%Helias%') LIMIT 100",
},
Expand All @@ -122,9 +128,19 @@ describe('SelectCreature integration tests', () => {
entry: '',
name: '',
subname: `it's a cool dev!`,
scriptName: '',
limit: '',
expectedQuery: "SELECT * FROM `creature_template` WHERE (`subname` LIKE '%it\\'s a cool dev!%')",
},
{
id: 5,
entry: '',
name: '',
subname: '',
scriptName: 'npc_tyrion',
limit: '',
expectedQuery: "SELECT * FROM `creature_template` WHERE (`ScriptName` LIKE '%npc_tyrion%')",
},
]) {
it(`searching an existing entity should correctly work [${id}]`, () => {
const { querySpy, page } = setup();
Expand All @@ -138,6 +154,9 @@ describe('SelectCreature integration tests', () => {
if (subname) {
page.setInputValue(page.searchSubnameInput, subname);
}
if (scriptName) {
page.setInputValue(page.searchScriptNameInput, scriptName);
}
page.setInputValue(page.searchLimitInput, limit);

expect(page.queryWrapper.innerText).toContain(expectedQuery);
Expand Down
7 changes: 6 additions & 1 deletion src/app/features/dashboard/dashboard.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ export class DashboardComponent extends SubscriptionHandler implements OnInit {
return this.mysqlService.config.database;
}

constructor(private queryService: MysqlQueryService, public configService: ConfigService, private readonly mysqlService: MysqlService) {
constructor(
private readonly queryService: MysqlQueryService,
public readonly configService: ConfigService,
private readonly mysqlService: MysqlService,
) {
super();
}

Expand All @@ -46,6 +50,7 @@ export class DashboardComponent extends SubscriptionHandler implements OnInit {
if (data && data.length > 0) {
this.coreVersions = data[0];

/* istanbul ignore next */
if (!this.coreVersions.db_version.startsWith('ACDB') || !this.coreVersions.core_version.startsWith('AzerothCore')) {
this.error = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@
<form [formGroup]="selectService.queryForm">
<div class="row">
<ng-container [formGroup]="selectService.fields">
<div class="form-group col-sm-6 col-md-4 col-lg-3 col-xl-2">
<input [formControlName]="'entry'" type="number" class="form-control form-control-sm" id="search-id" placeholder="entry" />
<div class="form-group col-sm-6 col-md-4 col-lg-2 col-xl-2">
<input formControlName="entry" type="number" class="form-control form-control-sm" id="search-id" placeholder="entry" />
</div>
<div class="form-group col-sm-6 col-md-4 col-lg-3 col-xl-3">
<input [formControlName]="'name'" class="form-control form-control-sm" id="name" placeholder="Name" />
<div class="form-group col-sm-6 col-md-4 col-lg-2 col-xl-2">
<input formControlName="name" class="form-control form-control-sm" id="name" placeholder="Name" />
</div>
<div class="form-group col-sm-6 col-md-4 col-lg-2 col-xl-2">
<input formControlName="ScriptName" class="form-control form-control-sm" id="ScriptName" placeholder="ScriptName" />
</div>
</ng-container>
<div class="form-group col-sm-6 col-md-4 col-lg-3 col-xl-2">
<input [formControlName]="'limit'" class="form-control form-control-sm" id="limit" placeholder="Limit" />
<input formControlName="limit" class="form-control form-control-sm" id="limit" placeholder="Limit" />
</div>
<div class="mb-2 col-sm-6 col-md-4 col-lg-3 col-xl-2">
<keira-search-button [searchService]="selectService"></keira-search-button>
Expand Down Expand Up @@ -54,6 +57,7 @@
<ngx-datatable-column name="Display Id" prop="displayId" [minWidth]="75" [maxWidth]="100"></ngx-datatable-column>
<ngx-datatable-column name="Type" prop="type" [minWidth]="75" [maxWidth]="100"></ngx-datatable-column>
<ngx-datatable-column name="AIName" prop="AIName" [minWidth]="75" [maxWidth]="130"></ngx-datatable-column>
<ngx-datatable-column name="ScriptName" prop="ScriptName" [minWidth]="75" [maxWidth]="130"></ngx-datatable-column>
</ngx-datatable>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,35 +85,47 @@ describe('SelectGameobject integration tests', () => {
page.expectEntityAlreadyInUse();
}));

for (const { testId, id, name, limit, expectedQuery } of [
for (const { testId, id, name, scriptName, limit, expectedQuery } of [
{
testId: 1,
id: 1200,
name: `Solid Chest`,
scriptName: '',
limit: '100',
expectedQuery: "SELECT * FROM `gameobject_template` WHERE (`entry` LIKE '%1200%') AND (`name` LIKE '%Solid Chest%') LIMIT 100",
},
{
testId: 2,
id: '',
name: `Solid Chest`,
scriptName: '',
limit: '100',
expectedQuery: "SELECT * FROM `gameobject_template` WHERE (`name` LIKE '%Solid Chest%') LIMIT 100",
},
{
testId: 3,
id: '',
name: `Solid Chest`,
scriptName: '',
limit: '100',
expectedQuery: "SELECT * FROM `gameobject_template` WHERE (`name` LIKE '%Solid Chest%') LIMIT 100",
},
{
testId: 4,
id: 1200,
name: '',
scriptName: '',
limit: '',
expectedQuery: "SELECT * FROM `gameobject_template` WHERE (`entry` LIKE '%1200%')",
},
{
testId: 5,
id: '',
name: '',
scriptName: 'go_f',
limit: '',
expectedQuery: "SELECT * FROM `gameobject_template` WHERE (`ScriptName` LIKE '%go_f%')",
},
]) {
it(`searching an existing entity should correctly work [${testId}]`, () => {
querySpy.calls.reset();
Expand All @@ -123,6 +135,9 @@ describe('SelectGameobject integration tests', () => {
if (name) {
page.setInputValue(page.searchNameInput, name);
}
if (scriptName) {
page.setInputValue(page.searchScriptNameInput, scriptName);
}
page.setInputValue(page.searchLimitInput, limit);

expect(page.queryWrapper.innerText).toContain(expectedQuery);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ export class Model3DViewerComponent implements OnInit, OnDestroy, OnChanges {
private readonly models3D = [];

/* istanbul ignore next */ // because of: https://github.com/gotwarlost/istanbul/issues/690
constructor(private readonly sanitizer: DomSanitizer, private readonly queryService: MysqlQueryService, private http: HttpClient) {}
constructor(
private readonly sanitizer: DomSanitizer,
private readonly queryService: MysqlQueryService,
private readonly http: HttpClient,
) {}

public itemPreview: SafeHtml = this.sanitizer.bypassSecurityTrustHtml('loading...');

Expand Down Expand Up @@ -110,6 +114,7 @@ export class Model3DViewerComponent implements OnInit, OnDestroy, OnChanges {
},
contentPath,
).then((WoWModel) => {
/* istanbul ignore next */
this.models3D.push(WoWModel);
});
}
Expand Down Expand Up @@ -172,6 +177,7 @@ export class Model3DViewerComponent implements OnInit, OnDestroy, OnChanges {
private viewerDynamic(): void {
this.subscriptions.add(
this.loadedViewer$.pipe(filter((loadedViewr) => loadedViewr)).subscribe(() => {
/* istanbul ignore next */
this.show3Dmodel();
}),
);
Expand Down
Loading

0 comments on commit 9dce31d

Please sign in to comment.