diff --git a/CHANGELOG.md b/CHANGELOG.md index 424fbc2f..c0211104 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## 0.6.28 (2020-05-09) +- added fetch count at the option menu (#692) - fixed a rate limit issue which was caused by requests not getting marked as finished (#695) ## 0.6.27 (2020-05-08) diff --git a/src/app/modules/evaluate/component/evaluate-dialog/evaluate-dialog.component.ts b/src/app/modules/evaluate/component/evaluate-dialog/evaluate-dialog.component.ts index 8dfb3120..eb4616ee 100644 --- a/src/app/modules/evaluate/component/evaluate-dialog/evaluate-dialog.component.ts +++ b/src/app/modules/evaluate/component/evaluate-dialog/evaluate-dialog.component.ts @@ -6,7 +6,7 @@ import { StashPriceTagType } from '@shared/module/poe/service'; import { CurrencyService } from '@shared/module/poe/service/currency/currency.service'; import { Currency, Item, ItemCategory, ItemRarity, Language } from '@shared/module/poe/type'; import { BehaviorSubject, forkJoin, Observable, Subject } from 'rxjs'; -import { buffer, debounceTime, shareReplay, delay } from 'rxjs/operators'; +import { buffer, debounceTime, delay, shareReplay } from 'rxjs/operators'; import { EvaluateOptions } from '../evaluate-options/evaluate-options.component'; import { EvaluateUserSettings } from '../evaluate-settings/evaluate-settings.component'; @@ -47,12 +47,14 @@ export class EvaluateDialogComponent implements OnInit, AfterViewInit, OnDestroy } public ngOnInit(): void { + const { settings, item } = this.data; this.options = { - indexed: this.data.settings.evaluateQueryIndexedRange, - online: this.data.settings.evaluateQueryOnline, - leagueId: this.data.settings.leagueId + indexed: settings.evaluateQueryIndexedRange, + online: settings.evaluateQueryOnline, + leagueId: settings.leagueId, + fetchCount: settings.evaluateQueryFetchCount }; - const { defaultItem, queryItem } = this.evaluateQueryItemProvider.provide(this.data.item, this.data.settings); + const { defaultItem, queryItem } = this.evaluateQueryItemProvider.provide(item, settings); this.defaultItem = defaultItem; this.queryItem = queryItem; this.currencies$ = this.getCurrencies(); diff --git a/src/app/modules/evaluate/component/evaluate-options/evaluate-options.component.html b/src/app/modules/evaluate/component/evaluate-options/evaluate-options.component.html index 7fb20dd9..faa975e5 100644 --- a/src/app/modules/evaluate/component/evaluate-options/evaluate-options.component.html +++ b/src/app/modules/evaluate/component/evaluate-options/evaluate-options.component.html @@ -9,25 +9,30 @@ {{ leagues[options.leagueId] }} + - - - - wifi - - - - - wifi_off - - + + + {{options.online ? 'wifi' : 'wifi_off'}} + {{ options.indexed }} + + + + + + + + {{ options.fetchCount }} + {{'evaluate.count' | translate}} + + diff --git a/src/app/modules/evaluate/component/evaluate-options/evaluate-options.component.scss b/src/app/modules/evaluate/component/evaluate-options/evaluate-options.component.scss index adf0d077..2b8a959e 100644 --- a/src/app/modules/evaluate/component/evaluate-options/evaluate-options.component.scss +++ b/src/app/modules/evaluate/component/evaluate-options/evaluate-options.component.scss @@ -23,5 +23,12 @@ outline-width: 1px; } } + + .divider{ + border-bottom: 1px solid $light-grey; + width: 50%; + padding-top: 5px; + margin-bottom: 5px; + } } } diff --git a/src/app/modules/evaluate/component/evaluate-options/evaluate-options.component.ts b/src/app/modules/evaluate/component/evaluate-options/evaluate-options.component.ts index 1bc879fe..2bad733b 100644 --- a/src/app/modules/evaluate/component/evaluate-options/evaluate-options.component.ts +++ b/src/app/modules/evaluate/component/evaluate-options/evaluate-options.component.ts @@ -9,6 +9,7 @@ export interface EvaluateOptions { online: boolean; indexed: ItemSearchIndexed; leagueId: string; + fetchCount: number; } type LeagueMap = { @@ -53,11 +54,11 @@ export class EvaluateOptionsComponent implements OnInit { this.optionsChange.emit(this.options); } - public onIndexedWheel(event: WheelEvent): void { + public onLeaguesWheel(event: WheelEvent, leagues: LeagueMap): void { const factor = event.deltaY > 0 ? -1 : 1; - const keys = Object.getOwnPropertyNames(ItemSearchIndexed); + const keys = Object.getOwnPropertyNames(leagues); - let index = keys.findIndex(x => ItemSearchIndexed[x] === this.options.indexed); + let index = keys.findIndex(id => id === this.options.leagueId); index += factor; if (index >= keys.length) { @@ -67,15 +68,15 @@ export class EvaluateOptionsComponent implements OnInit { } const key = keys[index]; - this.options.indexed = ItemSearchIndexed[key]; + this.options.leagueId = key; this.optionsChange.emit(this.options); } - public onLeaguesWheel(event: WheelEvent, leagues: LeagueMap): void { + public onIndexedWheel(event: WheelEvent): void { const factor = event.deltaY > 0 ? -1 : 1; - const keys = Object.getOwnPropertyNames(leagues); + const keys = Object.getOwnPropertyNames(ItemSearchIndexed); - let index = keys.findIndex(id => id === this.options.leagueId); + let index = keys.findIndex(x => ItemSearchIndexed[x] === this.options.indexed); index += factor; if (index >= keys.length) { @@ -85,10 +86,26 @@ export class EvaluateOptionsComponent implements OnInit { } const key = keys[index]; - this.options.leagueId = key; + this.options.indexed = ItemSearchIndexed[key]; this.optionsChange.emit(this.options); } + public onFetchCountWheel(event: WheelEvent): void { + const factor = event.deltaY > 0 ? -1 : 1; + + let fetchCount = this.options.fetchCount + factor * 10; + if (fetchCount > 100) { + fetchCount = 10; + } else if (fetchCount < 10) { + fetchCount = 100; + } + + if (fetchCount !== this.options.fetchCount) { + this.options.fetchCount = fetchCount; + this.optionsChange.emit(this.options); + } + } + public onResetClick(): void { this.resetTrigger.next(); } diff --git a/src/app/modules/evaluate/component/evaluate-search/evaluate-search.component.ts b/src/app/modules/evaluate/component/evaluate-search/evaluate-search.component.ts index f8dfe8cb..22d9589c 100644 --- a/src/app/modules/evaluate/component/evaluate-search/evaluate-search.component.ts +++ b/src/app/modules/evaluate/component/evaluate-search/evaluate-search.component.ts @@ -158,7 +158,7 @@ export class EvaluateSearchComponent implements OnInit, OnDestroy { ).subscribe(search => { this.search$.next(search); if (search.total > 0) { - const count = Math.min(this.settings.evaluateQueryFetchCount, search.total); + const count = Math.min(this.options.fetchCount, search.total); this.count$.next(count); this.list(search); } @@ -166,7 +166,7 @@ export class EvaluateSearchComponent implements OnInit, OnDestroy { } private list(search: ItemSearchResult): void { - this.listSubscription = this.itemSearchService.list(search, this.settings.evaluateQueryFetchCount).pipe( + this.listSubscription = this.itemSearchService.list(search, this.options.fetchCount).pipe( takeUntil(this.queryItemChange) ).subscribe(listings => { this.listings$.next(listings);