From dc8f60f23a7e12740927d2c4eb4e45f4fd213f7a Mon Sep 17 00:00:00 2001 From: James Tanner Date: Sun, 23 Jul 2023 09:48:03 -0700 Subject: [PATCH] Add row for pet resources (e.g. focus) to results timeline --- .../components/detailed_results/timeline.ts | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/ui/core/components/detailed_results/timeline.ts b/ui/core/components/detailed_results/timeline.ts index 1132a09daf..3511b7a19f 100644 --- a/ui/core/components/detailed_results/timeline.ts +++ b/ui/core/components/detailed_results/timeline.ts @@ -1,16 +1,15 @@ import { ResourceType } from '../../proto/api.js'; import { OtherAction } from '../../proto/common.js'; -import { UnitMetrics, SimResult, SimResultFilter } from '../../proto_utils/sim_result.js'; +import { UnitMetrics } from '../../proto_utils/sim_result.js'; import { ActionId, resourceTypeToIcon } from '../../proto_utils/action_id.js'; -import { resourceColors, resourceNames } from '../../proto_utils/names.js'; +import { resourceNames } from '../../proto_utils/names.js'; import { orderedResourceTypes } from '../../proto_utils/utils.js'; -import { EventID, TypedEvent } from '../../typed_event.js'; -import { bucket, distinct, getEnumValues, maxIndex, stringComparator, sum } from '../../utils.js'; +import { TypedEvent } from '../../typed_event.js'; +import { bucket, distinct, maxIndex, stringComparator } from '../../utils.js'; import { AuraUptimeLog, CastLog, - DamageDealtLog, ResourceChangedLogGroup, DpsLog, SimLog, @@ -20,7 +19,6 @@ import { import { actionColors } from './color_settings.js'; import { ResultComponent, ResultComponentConfig, SimResultData } from './result_component.js'; -declare var $: any; declare var tippy: any; declare var ApexCharts: any; @@ -81,12 +79,12 @@ export class Timeline extends ResultComponent { `; const runAgainButton = this.rootElem.getElementsByClassName('timeline-run-again-button')[0] as HTMLElement; - runAgainButton.addEventListener('click', event => { + runAgainButton.addEventListener('click', () => { (window.opener || window.parent)!.postMessage('runOnce', '*'); }); this.chartPicker = this.rootElem.getElementsByClassName('timeline-chart-picker')[0] as HTMLSelectElement; - this.chartPicker.addEventListener('change', event => { + this.chartPicker.addEventListener('change', () => { if (this.chartPicker.value == 'rotation') { this.dpsResourcesPlotElem.classList.add('hide'); this.rotationPlotElem.classList.remove('hide'); @@ -488,7 +486,7 @@ export class Timeline extends ResultComponent { playerCastsByAbility.forEach(castLogs => this.addCastRow(castLogs, buffsAndDebuffsById, duration)); if (player.pets.length > 0) { - let playerPets = new Map(); + let playerPets = new Map(); player.pets.forEach(petsLog => { const petCastsByAbility = this.getSortedCastsByAbility(petsLog); if (petCastsByAbility.length > 0) { @@ -497,15 +495,17 @@ export class Timeline extends ResultComponent { // with the same name. Because of this we can just grab the first pet // of each name and visualize only that. if (!playerPets.has(petsLog.name)) { - playerPets.set(petsLog.name, petCastsByAbility); + playerPets.set(petsLog.name, petsLog); } } }); - playerPets.forEach(petLogs => { + playerPets.forEach(pet => { this.addSeparatorRow(duration); - this.addPetRow(petLogs[0][0].source!.name, duration); - petLogs.forEach(castLogs => this.addCastRow(castLogs, buffsAndDebuffsById, duration)); + this.addPetRow(pet.name, duration); + orderedResourceTypes.forEach(resourceType => this.addResourceRow(resourceType, pet.groupedResourceLogs[resourceType], duration)); + const petCastsByAbility = this.getSortedCastsByAbility(pet); + petCastsByAbility.forEach(castLogs => this.addCastRow(castLogs, buffsAndDebuffsById, duration)); }); } @@ -582,7 +582,7 @@ export class Timeline extends ResultComponent { ${labelText} `; const hideElem = labelElem.getElementsByClassName('fas')[0] as HTMLElement; - hideElem.addEventListener('click', event => { + hideElem.addEventListener('click', () => { if (isHiddenLabel) { const index = this.hiddenIds.findIndex(hiddenId => hiddenId.equals(actionId)); if (index != -1) {