Feature/move list to client (#50)

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-09-01 15:02:12 +02:00
committed by GitHub
parent c2abdaadf2
commit 668434d246
181 changed files with 2922 additions and 1959 deletions

View File

@@ -27,6 +27,7 @@ import {
sum,
} from '@openpanel/common';
import type { ISerieDataItem } from '@openpanel/common';
import { alphabetIds } from '@openpanel/constants';
import {
chQuery,
createSqlBuilder,
@@ -523,7 +524,11 @@ export async function getChart(input: IChartInput) {
uniq(pluck('name', input.events)).length !==
pluck('name', input.events).length && series.length > 1;
const final: FinalChart = {
series: series.map((serie) => {
series: series.map((serie, index) => {
const eventIndex = input.events.findIndex(
(event) => event.id === serie.event.id
);
const alphaId = alphabetIds[eventIndex];
const previousSerie = previousSeries?.find(
(prevSerie) => getSerieId(prevSerie) === getSerieId(serie)
);
@@ -541,10 +546,7 @@ export async function getChart(input: IChartInput) {
return {
id: getSerieId(serie),
names: includeEventName
? [
`(${event.id || event.name}) ${serie.name[0]}`,
...serie.name.slice(1),
]
? [`(${alphaId}) ${serie.name[0]}`, ...serie.name.slice(1)]
: serie.name,
event,
metrics: {