mirror of
https://github.com/WowUp/WowUp.git
synced 2026-04-23 07:17:00 -04:00
more lint fixes
This commit is contained in:
@@ -51,8 +51,7 @@
|
||||
<button mat-button (click)="onClose()">
|
||||
{{ "DIALOGS.INSTALL_FROM_URL.CLOSE_BUTTON" | translate }}
|
||||
</button>
|
||||
<button mat-flat-button color="primary" cdkFocusInitial (click)="onImportUrl()" appUserActionTracker
|
||||
category="InstallFromUrl" action="ImportUrl" [label]="query">
|
||||
<button mat-flat-button color="primary" cdkFocusInitial (click)="onImportUrl()">
|
||||
{{ "DIALOGS.INSTALL_FROM_URL.IMPORT_BUTTON" | translate }}
|
||||
</button>
|
||||
</div>
|
||||
@@ -1,9 +1,8 @@
|
||||
import { NgModule } from "@angular/core";
|
||||
import { ExternalLinkDirective } from "./directives/external-link.directive";
|
||||
import { UserActionTrackerDirective } from "./directives/user-action-tracker.directive";
|
||||
|
||||
@NgModule({
|
||||
declarations: [ExternalLinkDirective, UserActionTrackerDirective],
|
||||
exports: [ExternalLinkDirective, UserActionTrackerDirective],
|
||||
declarations: [ExternalLinkDirective],
|
||||
exports: [ExternalLinkDirective],
|
||||
})
|
||||
export class DirectiveModule {}
|
||||
|
||||
@@ -5,14 +5,14 @@ import { ElectronService } from "../services";
|
||||
selector: "[appExternalLink]",
|
||||
})
|
||||
export class ExternalLinkDirective {
|
||||
@HostListener("click", ["$event"]) onClick($event) {
|
||||
@HostListener("click", ["$event"]) public async onClick($event: any): Promise<void> {
|
||||
$event.preventDefault();
|
||||
$event.stopPropagation();
|
||||
|
||||
const target = $event.path.find((t) => t.tagName === "A");
|
||||
|
||||
this._electronService.openExternal(target.href);
|
||||
await this._electronService.openExternal(target.href);
|
||||
}
|
||||
|
||||
constructor(private _electronService: ElectronService) {}
|
||||
public constructor(private _electronService: ElectronService) {}
|
||||
}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
import { inject } from "@angular/core/testing";
|
||||
import { AnalyticsService } from "../services/analytics/analytics.service";
|
||||
import { UserActionTrackerDirective } from "./user-action-tracker.directive";
|
||||
|
||||
describe("UserActionTrackerDirective", () => {
|
||||
it("should create an instance", () => {
|
||||
inject([AnalyticsService], (analyticsService: AnalyticsService) => {
|
||||
const instance = new UserActionTrackerDirective(analyticsService);
|
||||
expect(instance).toBeTruthy();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,16 +0,0 @@
|
||||
import { Directive, HostListener, Input } from "@angular/core";
|
||||
import { AnalyticsService } from "../services/analytics/analytics.service";
|
||||
|
||||
@Directive({
|
||||
selector: "[appUserActionTracker]",
|
||||
})
|
||||
export class UserActionTrackerDirective {
|
||||
@Input() appUserActionTracker: string;
|
||||
@Input() category: string;
|
||||
@Input() action: string;
|
||||
@Input() label: string;
|
||||
|
||||
@HostListener("click", ["$event"]) onClick($event) {}
|
||||
|
||||
constructor(private _analyticsService: AnalyticsService) {}
|
||||
}
|
||||
@@ -4,7 +4,7 @@ import { CustomError } from "ts-custom-error";
|
||||
export class ErrorContainer extends CustomError {
|
||||
public readonly innerError?: Error;
|
||||
|
||||
constructor(innerError?: Error, message?: string) {
|
||||
public constructor(innerError?: Error, message?: string) {
|
||||
super(message);
|
||||
this.innerError = innerError;
|
||||
}
|
||||
@@ -28,7 +28,7 @@ export class AddonScanError extends CustomError {
|
||||
public readonly providerName: string;
|
||||
public readonly addonName?: string;
|
||||
|
||||
constructor(config: AddonScanErrorConfig) {
|
||||
public constructor(config: AddonScanErrorConfig) {
|
||||
super(config.message);
|
||||
|
||||
this.providerName = config.providerName;
|
||||
@@ -49,7 +49,7 @@ export class AddonSyncError extends CustomError {
|
||||
public readonly providerName: string;
|
||||
public readonly addonName?: string;
|
||||
|
||||
constructor(config: AddonSyncErrorConfig) {
|
||||
public constructor(config: AddonSyncErrorConfig) {
|
||||
super(config.message);
|
||||
|
||||
this.providerName = config.providerName;
|
||||
@@ -61,7 +61,7 @@ export class AddonSyncError extends CustomError {
|
||||
export class GenericProviderError extends ErrorContainer {}
|
||||
|
||||
export class SourceRemovedAddonError extends ErrorContainer {
|
||||
constructor(public addonId: string, innerError: Error) {
|
||||
public constructor(public addonId: string, innerError: Error) {
|
||||
super(innerError);
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ export class GitHubLimitError extends GitHubError {
|
||||
public readonly rateLimitRemaining: number;
|
||||
public readonly rateLimitReset: number;
|
||||
|
||||
constructor(max: number, used: number, remaining: number, reset: number, message?: string) {
|
||||
public constructor(max: number, used: number, remaining: number, reset: number, message?: string) {
|
||||
super(undefined, message);
|
||||
|
||||
this.rateLimitMax = max;
|
||||
@@ -87,7 +87,7 @@ export class GitHubLimitError extends GitHubError {
|
||||
export class GitHubFetchReleasesError extends GitHubError {
|
||||
public readonly addonId: string;
|
||||
|
||||
constructor(addonId: string, error?: Error) {
|
||||
public constructor(addonId: string, error?: Error) {
|
||||
super(error);
|
||||
|
||||
this.addonId = addonId;
|
||||
@@ -97,7 +97,7 @@ export class GitHubFetchReleasesError extends GitHubError {
|
||||
export class GitHubFetchRepositoryError extends GitHubError {
|
||||
public readonly addonId: string;
|
||||
|
||||
constructor(addonId: string, error?: Error) {
|
||||
public constructor(addonId: string, error?: Error) {
|
||||
super(error);
|
||||
|
||||
this.addonId = addonId;
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
import { HttpHandler, HttpInterceptor, HttpRequest } from "@angular/common/http";
|
||||
import { HttpEvent, HttpHandler, HttpInterceptor, HttpRequest } from "@angular/common/http";
|
||||
import { Injectable } from "@angular/core";
|
||||
import { Observable } from "rxjs";
|
||||
|
||||
@Injectable()
|
||||
@Injectable({
|
||||
providedIn: "root",
|
||||
})
|
||||
export class DefaultHeadersInterceptor implements HttpInterceptor {
|
||||
intercept(req: HttpRequest<any>, next: HttpHandler) {
|
||||
public intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
|
||||
// Get the auth token from the service.
|
||||
|
||||
console.debug("INTERCEPT");
|
||||
// Clone the request and replace the original headers with
|
||||
// cloned headers, updated with the authorization.
|
||||
const authReq = req.clone({
|
||||
|
||||
@@ -12,8 +12,7 @@
|
||||
<h2>{{ "PAGES.ABOUT.TITLE" | translate }}</h2>
|
||||
<div class="version text-2">v{{ versionNumber | async }}</div>
|
||||
<div class="link-container">
|
||||
<a appExternalLink mat-stroked-button href="https://wowup.io" appUserActionTracker category="About"
|
||||
action="ViewWebsite">
|
||||
<a appExternalLink mat-stroked-button href="https://wowup.io">
|
||||
{{ "PAGES.ABOUT.WEBSITE_LINK_LABEL" | translate }}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -11,17 +11,15 @@ import { WowUpService } from "../../services/wowup/wowup.service";
|
||||
styleUrls: ["./about.component.scss"],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class AboutComponent implements OnInit {
|
||||
@Input("tabIndex") tabIndex: number;
|
||||
export class AboutComponent {
|
||||
@Input("tabIndex") public tabIndex: number;
|
||||
|
||||
public changeLogs: ChangeLog[] = ChangeLogJson.ChangeLogs;
|
||||
public versionNumber = from(this.electronService.getVersionNumber());
|
||||
|
||||
constructor(public wowUpService: WowUpService, public electronService: ElectronService) {}
|
||||
public constructor(public wowUpService: WowUpService, public electronService: ElectronService) {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
formatChanges(changeLog: ChangeLog): string {
|
||||
public formatChanges(changeLog: ChangeLog): string {
|
||||
return changeLog.changes.join("\n");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +27,10 @@
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<div class="button-container">
|
||||
<button mat-flat-button color="primary" (click)="onRefresh()" appUserActionTracker category="GetAddons"
|
||||
action="Refresh">
|
||||
<button mat-flat-button color="primary" (click)="onRefresh()">
|
||||
{{ "PAGES.GET_ADDONS.REFRESH_BUTTON" | translate }}
|
||||
</button>
|
||||
<button mat-flat-button color="primary" (click)="onInstallFromUrl()" appUserActionTracker category="GetAddons"
|
||||
action="InstallFromUrl">
|
||||
<button mat-flat-button color="primary" (click)="onInstallFromUrl()">
|
||||
{{ "PAGES.GET_ADDONS.INSTALL_FROM_URL_BUTTON" | translate }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
@@ -66,7 +66,7 @@ class AddonListItemDataSource extends MatTableDataSource<GetAddonListItem> {
|
||||
// Notify any listeners when the offset changes
|
||||
public offsetChange$ = this._offsetChangeSrc.asObservable();
|
||||
|
||||
constructor(private subject: BehaviorSubject<GetAddonListItem[]>, private viewport: CdkVirtualScrollViewport) {
|
||||
public constructor(private subject: BehaviorSubject<GetAddonListItem[]>, private viewport: CdkVirtualScrollViewport) {
|
||||
super();
|
||||
|
||||
subject.subscribe((data) => {
|
||||
@@ -85,12 +85,12 @@ class AddonListItemDataSource extends MatTableDataSource<GetAddonListItem> {
|
||||
});
|
||||
}
|
||||
|
||||
resume() {
|
||||
public resume() {
|
||||
this.viewport.getElementRef().nativeElement.scrollTop = this.lastTop;
|
||||
this.viewport.getElementRef().nativeElement.dispatchEvent(new CustomEvent("scroll"));
|
||||
}
|
||||
|
||||
handleNewData(start: number) {
|
||||
public handleNewData(start: number) {
|
||||
const end = start + PAGESIZE;
|
||||
const data = [...this.subject.value];
|
||||
const slicedData = _.slice(data, start, end);
|
||||
@@ -106,11 +106,11 @@ class AddonListItemDataSource extends MatTableDataSource<GetAddonListItem> {
|
||||
* Virtual Scroll Strategy
|
||||
*/
|
||||
export class CustomVirtualScrollStrategy extends FixedSizeVirtualScrollStrategy {
|
||||
constructor() {
|
||||
public constructor() {
|
||||
super(ROW_HEIGHT, 1000, 2000);
|
||||
}
|
||||
|
||||
attach(viewport: CdkVirtualScrollViewport): void {
|
||||
public attach(viewport: CdkVirtualScrollViewport): void {
|
||||
this.onDataLengthChanged();
|
||||
}
|
||||
}
|
||||
@@ -123,12 +123,12 @@ export class CustomVirtualScrollStrategy extends FixedSizeVirtualScrollStrategy
|
||||
providers: [{ provide: VIRTUAL_SCROLL_STRATEGY, useClass: CustomVirtualScrollStrategy }],
|
||||
})
|
||||
export class GetAddonsComponent implements OnInit, AfterViewInit, OnDestroy, AfterViewChecked {
|
||||
@Input("tabIndex") tabIndex: number;
|
||||
@Input("tabIndex") public tabIndex: number;
|
||||
|
||||
@ViewChild(MatSort) sort: MatSort;
|
||||
@ViewChild("table", { read: ElementRef }) table: ElementRef;
|
||||
@ViewChild("columnContextMenuTrigger") columnContextMenu: MatMenuTrigger;
|
||||
@ViewChild("viewport") viewport: CdkVirtualScrollViewport;
|
||||
@ViewChild(MatSort) public sort: MatSort;
|
||||
@ViewChild("table", { read: ElementRef }) public table: ElementRef;
|
||||
@ViewChild("columnContextMenuTrigger") public columnContextMenu: MatMenuTrigger;
|
||||
@ViewChild("viewport") public viewport: CdkVirtualScrollViewport;
|
||||
|
||||
private _subscriptions: Subscription[] = [];
|
||||
private _isSelectedTab = false;
|
||||
@@ -143,7 +143,7 @@ export class GetAddonsComponent implements OnInit, AfterViewInit, OnDestroy, Aft
|
||||
public activeSortDirection = "desc";
|
||||
public placeholderHeight = 0;
|
||||
|
||||
columns: ColumnState[] = [
|
||||
public columns: ColumnState[] = [
|
||||
{ name: "name", display: "PAGES.GET_ADDONS.TABLE.ADDON_COLUMN_HEADER", visible: true },
|
||||
{
|
||||
name: "downloadCount",
|
||||
@@ -197,7 +197,7 @@ export class GetAddonsComponent implements OnInit, AfterViewInit, OnDestroy, Aft
|
||||
})
|
||||
);
|
||||
|
||||
constructor(
|
||||
public constructor(
|
||||
private _dialog: MatDialog,
|
||||
private _cdRef: ChangeDetectorRef,
|
||||
private _addonService: AddonService,
|
||||
@@ -225,7 +225,7 @@ export class GetAddonsComponent implements OnInit, AfterViewInit, OnDestroy, Aft
|
||||
});
|
||||
}
|
||||
|
||||
ngAfterViewChecked(): void {
|
||||
public ngAfterViewChecked(): void {
|
||||
// Wait for the tab to have a height, then if we need to resume the table do so
|
||||
if (this._resumeTable && this.viewport.elementRef.nativeElement.scrollHeight > 0) {
|
||||
this._resumeTable = false;
|
||||
@@ -233,7 +233,7 @@ export class GetAddonsComponent implements OnInit, AfterViewInit, OnDestroy, Aft
|
||||
}
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
public ngOnInit(): void {
|
||||
this._subscriptions.push(
|
||||
this._addonService.searchError$.subscribe((error) => {
|
||||
this.displayError(error);
|
||||
@@ -253,23 +253,23 @@ export class GetAddonsComponent implements OnInit, AfterViewInit, OnDestroy, Aft
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
public ngOnDestroy(): void {
|
||||
this._subscriptions.forEach((sub) => sub.unsubscribe());
|
||||
this._subscriptions = [];
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
public ngAfterViewInit(): void {
|
||||
this.dataSource = new AddonListItemDataSource(this._dataSubject, this.viewport);
|
||||
this.dataSource.offsetChange$.subscribe((offset) => {
|
||||
this.placeholderHeight = offset;
|
||||
});
|
||||
}
|
||||
|
||||
placeholderWhen(index: number, _: any): boolean {
|
||||
public placeholderWhen(index: number, _: any): boolean {
|
||||
return index == 0;
|
||||
}
|
||||
|
||||
onSortChange(sort: Sort): void {
|
||||
public onSortChange(sort: Sort): void {
|
||||
const sortedData = this.sortAddons(this._dataSubject.value.slice(), sort);
|
||||
this._wowUpService.getAddonsSortOrder = {
|
||||
name: this.sort.active,
|
||||
@@ -279,7 +279,7 @@ export class GetAddonsComponent implements OnInit, AfterViewInit, OnDestroy, Aft
|
||||
this._dataSubject.next(sortedData);
|
||||
}
|
||||
|
||||
onStatusColumnUpdated(): void {
|
||||
public onStatusColumnUpdated(): void {
|
||||
this._cdRef.detectChanges();
|
||||
}
|
||||
|
||||
@@ -336,27 +336,27 @@ export class GetAddonsComponent implements OnInit, AfterViewInit, OnDestroy, Aft
|
||||
this._subscriptions = [selectedInstallationSub, addonRemovedSubscription, channelTypeSubscription, dataSourceSub];
|
||||
}
|
||||
|
||||
onInstallFromUrl(): void {
|
||||
public onInstallFromUrl(): void {
|
||||
const dialogRef = this._dialog.open(InstallFromUrlDialogComponent);
|
||||
dialogRef.afterClosed().subscribe(() => {
|
||||
console.log("The dialog was closed");
|
||||
});
|
||||
}
|
||||
|
||||
onClientChange(): void {
|
||||
public onClientChange(): void {
|
||||
this._sessionService.setSelectedWowInstallation(this.selectedInstallationId);
|
||||
}
|
||||
|
||||
onRefresh(): void {
|
||||
public onRefresh(): void {
|
||||
this.loadPopularAddons(this.selectedInstallation);
|
||||
}
|
||||
|
||||
onClearSearch(): void {
|
||||
public onClearSearch(): void {
|
||||
this.query = "";
|
||||
this.onSearch();
|
||||
}
|
||||
|
||||
onSearch(): void {
|
||||
public onSearch(): void {
|
||||
this._isBusySubject.next(true);
|
||||
|
||||
if (!this.query) {
|
||||
@@ -383,15 +383,15 @@ export class GetAddonsComponent implements OnInit, AfterViewInit, OnDestroy, Aft
|
||||
.subscribe();
|
||||
}
|
||||
|
||||
onDoubleClickRow(listItem: GetAddonListItem): void {
|
||||
public onDoubleClickRow(listItem: GetAddonListItem): void {
|
||||
this.openDetailDialog(listItem.searchResult, this.defaultAddonChannel);
|
||||
}
|
||||
|
||||
onAddonColumnDetailDialog(event: PotentialAddonViewDetailsEvent): void {
|
||||
public onAddonColumnDetailDialog(event: PotentialAddonViewDetailsEvent): void {
|
||||
this.openDetailDialog(event.searchResult, event.channelType);
|
||||
}
|
||||
|
||||
openDetailDialog(searchResult: AddonSearchResult, channelType: AddonChannelType): void {
|
||||
public openDetailDialog(searchResult: AddonSearchResult, channelType: AddonChannelType): void {
|
||||
const data: AddonDetailModel = {
|
||||
searchResult: searchResult,
|
||||
channelType: channelType,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { from, interval, Subscription } from "rxjs";
|
||||
import { filter, first, switchMap, tap } from "rxjs/operators";
|
||||
import { interval, Subscription } from "rxjs";
|
||||
import { filter, first, tap } from "rxjs/operators";
|
||||
|
||||
import { AfterViewInit, ChangeDetectionStrategy, ChangeDetectorRef, Component, NgZone, OnDestroy } from "@angular/core";
|
||||
import { MatSnackBar } from "@angular/material/snack-bar";
|
||||
@@ -13,7 +13,6 @@ import { ElectronService } from "../../services";
|
||||
import { AddonService, ScanUpdate, ScanUpdateType } from "../../services/addons/addon.service";
|
||||
import { SessionService } from "../../services/session/session.service";
|
||||
import { WarcraftInstallationService } from "../../services/warcraft/warcraft-installation.service";
|
||||
import { WarcraftService } from "../../services/warcraft/warcraft.service";
|
||||
import { WowUpService } from "../../services/wowup/wowup.service";
|
||||
|
||||
@Component({
|
||||
@@ -30,7 +29,7 @@ export class HomeComponent implements AfterViewInit, OnDestroy {
|
||||
public appReady = false;
|
||||
public preloadSpinnerKey = "COMMON.PROGRESS_SPINNER.LOADING";
|
||||
|
||||
constructor(
|
||||
public constructor(
|
||||
public electronService: ElectronService,
|
||||
private _sessionService: SessionService,
|
||||
private _translateService: TranslateService,
|
||||
@@ -52,7 +51,7 @@ export class HomeComponent implements AfterViewInit, OnDestroy {
|
||||
.subscribe(this.onScanUpdate);
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
public ngAfterViewInit(): void {
|
||||
this.electronService.powerMonitor$.pipe(filter((evt) => !!evt)).subscribe((evt) => {
|
||||
console.log("Stopping app update check...");
|
||||
this.destroyAppUpdateCheck();
|
||||
@@ -72,7 +71,7 @@ export class HomeComponent implements AfterViewInit, OnDestroy {
|
||||
});
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
public ngOnDestroy(): void {
|
||||
this._appUpdateInterval?.unsubscribe();
|
||||
}
|
||||
|
||||
@@ -126,7 +125,7 @@ export class HomeComponent implements AfterViewInit, OnDestroy {
|
||||
}
|
||||
};
|
||||
|
||||
onSelectedIndexChange(index: number): void {
|
||||
public onSelectedIndexChange(index: number): void {
|
||||
this._sessionService.selectedHomeTab = index;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ChangeDetectionStrategy, Component, Input, OnInit } from "@angular/core";
|
||||
import { ChangeDetectionStrategy, Component, Input } from "@angular/core";
|
||||
import { ElectronService } from "../../services";
|
||||
import { WowUpService } from "../../services/wowup/wowup.service";
|
||||
|
||||
@@ -8,13 +8,10 @@ import { WowUpService } from "../../services/wowup/wowup.service";
|
||||
styleUrls: ["./options.component.scss"],
|
||||
changeDetection: ChangeDetectionStrategy.OnPush,
|
||||
})
|
||||
export class OptionsComponent implements OnInit {
|
||||
@Input("tabIndex") tabIndex: number;
|
||||
export class OptionsComponent {
|
||||
@Input("tabIndex") public tabIndex: number;
|
||||
|
||||
public optionTabIndex = 0;
|
||||
|
||||
constructor(public wowUpService: WowUpService, public electronService: ElectronService) {}
|
||||
|
||||
ngOnInit(): void {}
|
||||
|
||||
public constructor(public wowUpService: WowUpService, public electronService: ElectronService) {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user