Skip to content

Commit cc62235

Browse files
committed
line chat by run
1 parent 16ea41c commit cc62235

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/app/components/usage/actions/charts/chart-line-usage-daily/chart-line-usage-daily.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
</mat-button-toggle-group>
99
<mat-button-toggle-group name="timeType" aria-label="Toggle Time" [value]="timeType" (change)="timeType = $event.value; redrawChart()">
1010
<mat-button-toggle value="total">Total</mat-button-toggle>
11+
<mat-button-toggle value="run">Run</mat-button-toggle>
1112
<mat-button-toggle value="daily">Day</mat-button-toggle>
1213
<mat-button-toggle value="weekly">Week</mat-button-toggle>
1314
<mat-button-toggle value="monthly">Month</mat-button-toggle>

src/app/components/usage/actions/charts/chart-line-usage-daily/chart-line-usage-daily.component.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export class ChartLineUsageDailyComponent implements OnChanges {
5151
};
5252
updateFromInput: boolean = false;
5353
chartType: 'repo' | 'total' | 'sku' | 'user' | 'workflow' = 'sku';
54-
timeType: 'total' | 'daily' | 'weekly' | 'monthly' | 'rolling20' | 'rolling7' = 'rolling20';
54+
timeType: 'total' | 'run' | 'daily' | 'weekly' | 'monthly' | 'rolling20' | 'rolling7' = 'rolling20';
5555
rollingDays = 20;
5656

5757
constructor(
@@ -67,10 +67,12 @@ export class ChartLineUsageDailyComponent implements OnChanges {
6767
ngOnChanges() {
6868
this.rollingDays = Number(this.timeType.split('rolling')[1]);
6969
const seriesDays = this.data.reduce(
70-
(acc, line) => {
70+
(acc, line, index) => {
7171
let name = 'Total';
7272
let timeKey = 'total';
73-
if (this.timeType === 'daily') {
73+
if (this.timeType === 'run') {
74+
timeKey = `${line.actionsWorkflow}${line.date}${index}`;
75+
} else if (this.timeType === 'daily') {
7476
timeKey = line.date.toISOString().split('T')[0];
7577
} else if (this.timeType === 'weekly') {
7678
timeKey = this.getWeekOfYear(line.date).toString();

0 commit comments

Comments
 (0)