Skip to content

Commit 89f7d05

Browse files
committed
Update dependencies and refactor usage report handling for consistency
1 parent a706763 commit 89f7d05

File tree

13 files changed

+50
-95
lines changed

13 files changed

+50
-95
lines changed

package-lock.json

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"@angular/platform-browser": "^17.2.4",
2222
"@angular/platform-browser-dynamic": "^17.2.4",
2323
"@angular/router": "^17.2.4",
24-
"github-usage-report": "^1.5.0",
24+
"github-usage-report": "3.0",
2525
"highcharts": "^11.2.0",
2626
"highcharts-angular": "^4.0.0",
2727
"jspdf": "^2.5.1",
@@ -50,4 +50,4 @@
5050
"karma-jasmine-html-reporter": "~2.0.0",
5151
"typescript": "~5.3.3"
5252
}
53-
}
53+
}

src/app/components/usage/actions/charts/chart-bar-top-time/chart-bar-top-time.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,16 +57,16 @@ export class ChartBarTopTimeComponent implements OnChanges {
5757
}
5858

5959
ngOnChanges() {
60-
this.data = this.data.filter((line) => line.unitType === 'minute');
60+
this.data = this.data.filter((line) => line.unitType === 'minutes');
6161
this.options.series = [{
6262
type: 'bar',
6363
name: 'Usage',
6464
data: this.data.reduce((acc, line) => {
65-
const existingItem = acc.find((a) => a.name === line.repositorySlug);
65+
const existingItem = acc.find((a) => a.name === line.repositoryName);
6666
if (existingItem) {
6767
existingItem.y += line.value;
6868
} else {
69-
acc.push({ name: line.repositorySlug, y: line.value });
69+
acc.push({ name: line.repositoryName, y: line.value });
7070
}
7171
return acc;
7272
}, [] as { name: string, y: number }[]).sort((a, b) => b.y - a.y).slice(0, 10)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class ChartLineUsageDailyComponent implements OnChanges {
7171
let name = 'Total';
7272
let timeKey = 'total';
7373
if (this.timeType === 'run') {
74-
timeKey = `${line.actionsWorkflow}${line.date}${index}`;
74+
timeKey = `${line.workflowName}${line.date}${index}`;
7575
} else if (this.timeType === 'daily') {
7676
timeKey = line.date.toISOString().split('T')[0];
7777
} else if (this.timeType === 'weekly') {
@@ -90,9 +90,9 @@ export class ChartLineUsageDailyComponent implements OnChanges {
9090
} else if (this.chartType === 'user') {
9191
name = line.username;
9292
} else if (this.chartType === 'repo') {
93-
name = line.repositorySlug;
93+
name = line.repositoryName;
9494
} else if (this.chartType === 'workflow') {
95-
name = line.actionsWorkflow;
95+
name = line.workflowName;
9696
} else if (this.chartType === 'total') {
9797
name = 'total';
9898
}

src/app/components/usage/actions/charts/chart-pie-sku/chart-pie-sku.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class ChartPieSkuComponent implements OnChanges {
4545
}
4646

4747
ngOnChanges() {
48-
this.data = this.data.filter((line) => line.unitType === 'minute');
48+
this.data = this.data.filter((line) => line.unitType === 'minutes');
4949
this.options.series = [{
5050
type: 'pie', // Add the type property
5151
name: 'Usage',

src/app/components/usage/actions/charts/chart-pie-user/chart-pie-user.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class ChartPieUserComponent implements OnChanges {
4141
}
4242

4343
ngOnChanges() {
44-
this.data = this.data.filter((line) => line.unitType === 'minute');
44+
this.data = this.data.filter((line) => line.unitType === 'minutes');
4545
this.options.series = [{
4646
type: 'pie',
4747
name: 'Usage',

src/app/components/usage/actions/table-workflow-usage/table-workflow-usage.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,9 @@ export class TableWorkflowUsageComponent implements OnChanges, AfterViewInit {
7575
usageItems = this.data.reduce((acc, line) => {
7676
const item = acc.find(a => {
7777
if (this.tableType === 'workflow') {
78-
return a.workflow === line.actionsWorkflow
78+
return a.workflow === line.workflowName
7979
} else if (this.tableType === 'repo') {
80-
return a.repo === line.repositorySlug;
80+
return a.repo === line.repositoryName;
8181
} else if (this.tableType === 'sku') {
8282
return a.sku === this.usageReportService.formatSku(line.sku);
8383
} else if (this.tableType === 'user') {
@@ -128,8 +128,8 @@ export class TableWorkflowUsageComponent implements OnChanges, AfterViewInit {
128128
item.runs++;
129129
} else {
130130
acc.push({
131-
workflow: line.actionsWorkflow,
132-
repo: line.repositorySlug,
131+
workflow: line.workflowName,
132+
repo: line.repositoryName,
133133
total: line.quantity,
134134
cost: line.quantity * line.pricePerUnit,
135135
runs: 1,

src/app/components/usage/codespaces/table-codespaces-usage/table-codespaces-usage.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ export class TableCodespacesUsageComponent implements OnChanges, AfterViewInit {
5454
if (this.tableType === 'sku') {
5555
return a.sku === line.sku;
5656
} else if (this.tableType === 'repo') {
57-
return a.repositorySlug === line.repositorySlug;
57+
return a.repositorySlug === line.repositoryName;
5858
} else if (this.tableType === 'user') {
5959
return a.username === line.username;
6060
}
@@ -84,15 +84,15 @@ export class TableCodespacesUsageComponent implements OnChanges, AfterViewInit {
8484
item.runs++;
8585
} else {
8686
acc.push({
87-
owner: line.owner,
87+
owner: line.organization,
8888
total: line.quantity,
8989
cost: line.quantity * line.pricePerUnit,
9090
runs: 1,
9191
pricePerUnit: line.pricePerUnit || 0,
9292
[month]: line.value,
9393
sku: line.sku,
9494
unitType: line.unitType,
95-
repositorySlug: line.repositorySlug,
95+
repositorySlug: line.repositoryName,
9696
username: line.username
9797
});
9898
}

src/app/components/usage/copilot/table-workflow-usage/table-copilot-usage.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export class TableCopilotUsageComponent implements OnChanges, AfterViewInit {
4848
usageItems = this.data.reduce((acc, line) => {
4949
const item = acc.find(a => {
5050
if (this.tableType === 'owner') {
51-
return a.owner === line.owner;
51+
return a.owner === line.organization;
5252
}
5353
return false;
5454
});
@@ -76,7 +76,7 @@ export class TableCopilotUsageComponent implements OnChanges, AfterViewInit {
7676
item.runs++;
7777
} else {
7878
acc.push({
79-
owner: line.owner,
79+
owner: line.organization,
8080
total: line.quantity,
8181
cost: line.quantity * line.pricePerUnit,
8282
runs: 1,

src/app/components/usage/shared-storage/charts/line-usage-time/line-usage-time.component.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,14 @@ export class LineUsageTimeComponent implements OnChanges {
7979
(this.options.series as any) = this.data.reduce(
8080
(acc, line) => {
8181
gbs += line.value;
82-
if (acc.find(a => a.name === line.repositorySlug)) {
83-
const existing = acc.find(a => a.name === line.repositorySlug);
82+
if (acc.find(a => a.name === line.repositoryName)) {
83+
const existing = acc.find(a => a.name === line.repositoryName);
8484
if (existing && line.value !== 0) {
8585
existing.data.push([line.date.getTime(), line.value]);
8686
}
8787
} else {
8888
acc.push({
89-
name: line.repositorySlug,
89+
name: line.repositoryName,
9090
data: [
9191
[line.date.getTime(), line.value]
9292
]

0 commit comments

Comments
 (0)