diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 22f68ba..4e2fb29 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: - uses: actions/upload-artifact@v4 with: name: dist - path: dist/${{ github.event.repository.name }} + path: dist/${{ github.event.repository.name }}/browser deploy: needs: build diff --git a/src/app/components/usage/actions/actions.component.html b/src/app/components/usage/actions/actions.component.html index e5373ac..d852053 100644 --- a/src/app/components/usage/actions/actions.component.html +++ b/src/app/components/usage/actions/actions.component.html @@ -1,4 +1,4 @@ - +
diff --git a/src/app/components/usage/actions/actions.component.ts b/src/app/components/usage/actions/actions.component.ts index 1ae1579..6857edf 100644 --- a/src/app/components/usage/actions/actions.component.ts +++ b/src/app/components/usage/actions/actions.component.ts @@ -1,5 +1,6 @@ import { Component, Input, OnInit } from '@angular/core'; -import { CustomUsageReportLine, UsageReportService } from 'src/app/usage-report.service'; +import { GroupBy, UsageReportItem, UsageReportService } from 'src/app/usage-report.service'; + @Component({ selector: 'app-actions', @@ -8,8 +9,9 @@ import { CustomUsageReportLine, UsageReportService } from 'src/app/usage-report. standalone: false }) export class ActionsComponent implements OnInit { - @Input() data!: CustomUsageReportLine[]; + @Input() data!: UsageReportItem[]; @Input() currency!: string; + @Input() groupBy!: GroupBy; totalMinutes: number = 0; totalCost: number = 0; diff --git a/src/app/components/usage/actions/charts/chart-bar-top-time/chart-bar-top-time.component.ts b/src/app/components/usage/actions/charts/chart-bar-top-time/chart-bar-top-time.component.ts index e78f1e1..f9fc44d 100644 --- a/src/app/components/usage/actions/charts/chart-bar-top-time/chart-bar-top-time.component.ts +++ b/src/app/components/usage/actions/charts/chart-bar-top-time/chart-bar-top-time.component.ts @@ -1,7 +1,7 @@ import { Component, Input, OnChanges } from '@angular/core'; import * as Highcharts from 'highcharts'; import { ThemingService } from 'src/app/theme.service'; -import { CustomUsageReportLine } from 'src/app/usage-report.service'; +import { UsageReportItem } from 'src/app/usage-report.service'; @Component({ selector: 'app-chart-bar-top-time', @@ -10,7 +10,7 @@ import { CustomUsageReportLine } from 'src/app/usage-report.service'; standalone: false }) export class ChartBarTopTimeComponent implements OnChanges { - @Input() data!: CustomUsageReportLine[]; + @Input() data!: UsageReportItem[]; @Input() currency!: string; Highcharts: typeof Highcharts = Highcharts; options: Highcharts.Options = { @@ -70,7 +70,7 @@ export class ChartBarTopTimeComponent implements OnChanges { acc.push({ name: line.repositoryName, y: line.value }); } return acc; - }, [] as { name: string, y: number }[]).sort((a, b) => b.y - a.y).slice(0, 10) + }, [] as { name: string, y: number }[]).sort((a: { name: string, y: number }, b: { name: string, y: number }) => b.y - a.y).slice(0, 10) }]; this.options.xAxis = { ...this.options.xAxis, diff --git a/src/app/components/usage/actions/charts/chart-line-usage-daily/chart-line-usage-daily.component.ts b/src/app/components/usage/actions/charts/chart-line-usage-daily/chart-line-usage-daily.component.ts index 3cc354b..46ab18e 100644 --- a/src/app/components/usage/actions/charts/chart-line-usage-daily/chart-line-usage-daily.component.ts +++ b/src/app/components/usage/actions/charts/chart-line-usage-daily/chart-line-usage-daily.component.ts @@ -1,7 +1,7 @@ import { Component, Input, OnChanges, ViewChild } from '@angular/core'; import * as Highcharts from 'highcharts'; import { ThemingService } from 'src/app/theme.service'; -import { CustomUsageReportLine, UsageReportService } from 'src/app/usage-report.service'; +import { UsageReportItem, UsageReportService } from 'src/app/usage-report.service'; @Component({ selector: 'app-chart-line-usage-daily', @@ -10,7 +10,7 @@ import { CustomUsageReportLine, UsageReportService } from 'src/app/usage-report. standalone: false }) export class ChartLineUsageDailyComponent implements OnChanges { - @Input() data!: CustomUsageReportLine[]; + @Input() data!: UsageReportItem[]; @Input() currency!: string; @ViewChild('chart') chartRef!: any; Highcharts: typeof Highcharts = Highcharts; @@ -124,16 +124,16 @@ export class ChartLineUsageDailyComponent implements OnChanges { ).sort((a: any, b: any) => { return b.total - a.total; }).slice(0, 50); - (this.options.series as { name: string; data: [number, number][] }[]) = seriesDays.map((series) => { + (this.options.series as { name: string; data: [number, number][] }[]) = seriesDays.map((series: { name: string; data: { [key: string]: [number, number][] }, total: number }) => { let data: [number, number][] = []; if (this.timeType === 'total') { data = series.data['total']; } else if (this.timeType.startsWith('rolling')) { const perDay = Object.keys(series.data).reduce((acc, timeKey) => { - acc.push({ - total: series.data[timeKey].reduce((acc, curr) => acc + curr[1], 0), + acc.push({ + total: series.data[timeKey].reduce((acc: number, curr: [number, number]) => acc + curr[1], 0), date: new Date(timeKey) - }); + }); return acc; }, [] as { total: number; @@ -151,7 +151,7 @@ export class ChartLineUsageDailyComponent implements OnChanges { data = Object.keys(series.data).reduce((acc, timeKey) => { acc.push([ new Date(series.data[timeKey][0][0]).getTime(), - series.data[timeKey].reduce((acc, curr) => acc + curr[1], 0) + series.data[timeKey].reduce((acc: number, curr: [number, number]) => acc + curr[1], 0) ]); return acc; }, [] as [number, number][]); diff --git a/src/app/components/usage/actions/charts/chart-pie-sku/chart-pie-sku.component.ts b/src/app/components/usage/actions/charts/chart-pie-sku/chart-pie-sku.component.ts index 99587aa..827c265 100644 --- a/src/app/components/usage/actions/charts/chart-pie-sku/chart-pie-sku.component.ts +++ b/src/app/components/usage/actions/charts/chart-pie-sku/chart-pie-sku.component.ts @@ -1,7 +1,7 @@ import { Component, Input, OnChanges } from '@angular/core'; import * as Highcharts from 'highcharts'; import { ThemingService } from 'src/app/theme.service'; -import { CustomUsageReportLine, UsageReportService } from 'src/app/usage-report.service'; +import { UsageReportItem, UsageReportService } from 'src/app/usage-report.service'; @Component({ selector: 'app-chart-pie-sku', @@ -10,7 +10,7 @@ import { CustomUsageReportLine, UsageReportService } from 'src/app/usage-report. standalone: false }) export class ChartPieSkuComponent implements OnChanges { - @Input() data!: CustomUsageReportLine[]; + @Input() data!: UsageReportItem[]; @Input() currency!: string; Highcharts: typeof Highcharts = Highcharts; options: Highcharts.Options = { @@ -52,14 +52,14 @@ export class ChartPieSkuComponent implements OnChanges { name: 'Usage', data: this.data.reduce((acc, line) => { const formattedSku = this.usageReportService.formatSku(line.sku); - const index = acc.findIndex((item) => item[0] === formattedSku); + const index = acc.findIndex((item: [string, number]) => item[0] === formattedSku); if (index === -1) { acc.push([formattedSku, line.value]); } else { acc[index][1] += line.value; } return acc; - }, [] as [string, number][]).sort((a, b) => b[1] - a[1]) + }, [] as [string, number][]).sort((a: [string, number], b: [string, number]) => b[1] - a[1]) }]; this.options.title = { text: `${this.currency === 'minutes' ? 'Usage' : 'Cost'} by runner type` diff --git a/src/app/components/usage/actions/charts/chart-pie-user/chart-pie-user.component.ts b/src/app/components/usage/actions/charts/chart-pie-user/chart-pie-user.component.ts index 57c3c04..f1dbb18 100644 --- a/src/app/components/usage/actions/charts/chart-pie-user/chart-pie-user.component.ts +++ b/src/app/components/usage/actions/charts/chart-pie-user/chart-pie-user.component.ts @@ -1,7 +1,7 @@ import { Component, Input, OnChanges } from '@angular/core'; import * as Highcharts from 'highcharts'; import { ThemingService } from 'src/app/theme.service'; -import { CustomUsageReportLine, UsageReportService } from 'src/app/usage-report.service'; +import { UsageReportItem, UsageReportService } from 'src/app/usage-report.service'; @Component({ selector: 'app-chart-pie-user', @@ -10,7 +10,7 @@ import { CustomUsageReportLine, UsageReportService } from 'src/app/usage-report. standalone: false }) export class ChartPieUserComponent implements OnChanges { - @Input() data!: CustomUsageReportLine[]; + @Input() data!: UsageReportItem[]; @Input() currency!: string; Highcharts: typeof Highcharts = Highcharts; options: Highcharts.Options = { diff --git a/src/app/components/usage/actions/table-workflow-usage/table-workflow-usage.component.html b/src/app/components/usage/actions/table-workflow-usage/table-workflow-usage.component.html index 7f7130d..aa60c8a 100644 --- a/src/app/components/usage/actions/table-workflow-usage/table-workflow-usage.component.html +++ b/src/app/components/usage/actions/table-workflow-usage/table-workflow-usage.component.html @@ -2,11 +2,14 @@
Grouping - + Runner Repo Workflow User + Cost Center + Organization + Date @@ -34,7 +37,12 @@ {{column.header}} - {{column.cell(row)}} + + {{column.cell(row)}} + + + {{column.cell(row)}} +
@@ -125,4 +143,4 @@