Skip to content

Commit eb01ba5

Browse files
committed
feat(coderd): WIP: add sftp to apps
1 parent 11d9293 commit eb01ba5

15 files changed

+113
-0
lines changed

coderd/insights.go

+8
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,14 @@ func convertTemplateInsightsApps(usage database.GetTemplateInsightsRow, appUsage
460460
Icon: "/icon/terminal.svg",
461461
Seconds: usage.UsageSshSeconds,
462462
},
463+
{
464+
TemplateIDs: usage.SftpTemplateIds,
465+
Type: codersdk.TemplateAppsTypeBuiltin,
466+
DisplayName: codersdk.TemplateBuiltinAppDisplayNameSFTP,
467+
Slug: "sftp",
468+
Icon: "/icon/terminal.svg",
469+
Seconds: usage.UsageSftpSeconds,
470+
},
463471
}
464472

465473
// Use a stable sort, similarly to how we would sort in the query, note that

coderd/testdata/insights/template/multiple_users_and_workspaces_three_weeks_second_template.json.golden

+8
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@
4545
"icon": "/icon/terminal.svg",
4646
"seconds": 10800
4747
},
48+
{
49+
"template_ids": [],
50+
"type": "builtin",
51+
"display_name": "SFTP",
52+
"slug": "sftp",
53+
"icon": "/icon/terminal.svg",
54+
"seconds": 0
55+
},
4856
{
4957
"template_ids": [
5058
"00000000-0000-0000-0000-000000000002"

coderd/testdata/insights/template/multiple_users_and_workspaces_three_weeks_second_template_only_report.json.golden

+8
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@
4545
"icon": "/icon/terminal.svg",
4646
"seconds": 10800
4747
},
48+
{
49+
"template_ids": [],
50+
"type": "builtin",
51+
"display_name": "SFTP",
52+
"slug": "sftp",
53+
"icon": "/icon/terminal.svg",
54+
"seconds": 0
55+
},
4856
{
4957
"template_ids": [
5058
"00000000-0000-0000-0000-000000000002"

coderd/testdata/insights/template/multiple_users_and_workspaces_week_all_templates.json.golden

+8
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@
5252
"icon": "/icon/terminal.svg",
5353
"seconds": 11520
5454
},
55+
{
56+
"template_ids": [],
57+
"type": "builtin",
58+
"display_name": "SFTP",
59+
"slug": "sftp",
60+
"icon": "/icon/terminal.svg",
61+
"seconds": 0
62+
},
5563
{
5664
"template_ids": [
5765
"00000000-0000-0000-0000-000000000001",

coderd/testdata/insights/template/multiple_users_and_workspaces_week_deployment_wide.json.golden

+8
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@
5252
"icon": "/icon/terminal.svg",
5353
"seconds": 11520
5454
},
55+
{
56+
"template_ids": [],
57+
"type": "builtin",
58+
"display_name": "SFTP",
59+
"slug": "sftp",
60+
"icon": "/icon/terminal.svg",
61+
"seconds": 0
62+
},
5563
{
5664
"template_ids": [
5765
"00000000-0000-0000-0000-000000000001",

coderd/testdata/insights/template/multiple_users_and_workspaces_week_first_template.json.golden

+8
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@
4545
"icon": "/icon/terminal.svg",
4646
"seconds": 7920
4747
},
48+
{
49+
"template_ids": [],
50+
"type": "builtin",
51+
"display_name": "SFTP",
52+
"slug": "sftp",
53+
"icon": "/icon/terminal.svg",
54+
"seconds": 0
55+
},
4856
{
4957
"template_ids": [
5058
"00000000-0000-0000-0000-000000000001"

coderd/testdata/insights/template/multiple_users_and_workspaces_week_other_timezone_(São_Paulo).json.golden

+8
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,14 @@
4747
"icon": "/icon/terminal.svg",
4848
"seconds": 4320
4949
},
50+
{
51+
"template_ids": [],
52+
"type": "builtin",
53+
"display_name": "SFTP",
54+
"slug": "sftp",
55+
"icon": "/icon/terminal.svg",
56+
"seconds": 0
57+
},
5058
{
5159
"template_ids": [
5260
"00000000-0000-0000-0000-000000000001",

coderd/testdata/insights/template/multiple_users_and_workspaces_week_second_template.json.golden

+8
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@
4343
"icon": "/icon/terminal.svg",
4444
"seconds": 3600
4545
},
46+
{
47+
"template_ids": [],
48+
"type": "builtin",
49+
"display_name": "SFTP",
50+
"slug": "sftp",
51+
"icon": "/icon/terminal.svg",
52+
"seconds": 0
53+
},
4654
{
4755
"template_ids": [
4856
"00000000-0000-0000-0000-000000000002"

coderd/testdata/insights/template/multiple_users_and_workspaces_week_third_template.json.golden

+8
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@
4343
"icon": "/icon/terminal.svg",
4444
"seconds": 3600
4545
},
46+
{
47+
"template_ids": [],
48+
"type": "builtin",
49+
"display_name": "SFTP",
50+
"slug": "sftp",
51+
"icon": "/icon/terminal.svg",
52+
"seconds": 0
53+
},
4654
{
4755
"template_ids": [
4856
"00000000-0000-0000-0000-000000000003"

coderd/testdata/insights/template/multiple_users_and_workspaces_weekly_aggregated_deployment_wide.json.golden

+8
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@
5252
"icon": "/icon/terminal.svg",
5353
"seconds": 15120
5454
},
55+
{
56+
"template_ids": [],
57+
"type": "builtin",
58+
"display_name": "SFTP",
59+
"slug": "sftp",
60+
"icon": "/icon/terminal.svg",
61+
"seconds": 0
62+
},
5563
{
5664
"template_ids": [
5765
"00000000-0000-0000-0000-000000000001",

coderd/testdata/insights/template/multiple_users_and_workspaces_weekly_aggregated_first_template.json.golden

+8
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,14 @@
4545
"icon": "/icon/terminal.svg",
4646
"seconds": 7920
4747
},
48+
{
49+
"template_ids": [],
50+
"type": "builtin",
51+
"display_name": "SFTP",
52+
"slug": "sftp",
53+
"icon": "/icon/terminal.svg",
54+
"seconds": 0
55+
},
4856
{
4957
"template_ids": [
5058
"00000000-0000-0000-0000-000000000001"

coderd/testdata/insights/template/multiple_users_and_workspaces_weekly_aggregated_templates.json.golden

+8
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@
5252
"icon": "/icon/terminal.svg",
5353
"seconds": 15120
5454
},
55+
{
56+
"template_ids": [],
57+
"type": "builtin",
58+
"display_name": "SFTP",
59+
"slug": "sftp",
60+
"icon": "/icon/terminal.svg",
61+
"seconds": 0
62+
},
5563
{
5664
"template_ids": [
5765
"00000000-0000-0000-0000-000000000001",

coderd/testdata/insights/template/parameters_two_days_ago,_no_data.json.golden

+8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@
3636
"slug": "ssh",
3737
"icon": "/icon/terminal.svg",
3838
"seconds": 0
39+
},
40+
{
41+
"template_ids": [],
42+
"type": "builtin",
43+
"display_name": "SFTP",
44+
"slug": "sftp",
45+
"icon": "/icon/terminal.svg",
46+
"seconds": 0
3947
}
4048
],
4149
"parameters_usage": []

coderd/testdata/insights/template/parameters_yesterday_and_today_deployment_wide.json.golden

+8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,14 @@
3636
"slug": "ssh",
3737
"icon": "/icon/terminal.svg",
3838
"seconds": 0
39+
},
40+
{
41+
"template_ids": [],
42+
"type": "builtin",
43+
"display_name": "SFTP",
44+
"slug": "sftp",
45+
"icon": "/icon/terminal.svg",
46+
"seconds": 0
3947
}
4048
],
4149
"parameters_usage": [

codersdk/insights.go

+1
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ const (
206206
TemplateBuiltinAppDisplayNameJetBrains string = "JetBrains"
207207
TemplateBuiltinAppDisplayNameWebTerminal string = "Web Terminal"
208208
TemplateBuiltinAppDisplayNameSSH string = "SSH"
209+
TemplateBuiltinAppDisplayNameSFTP string = "SFTP"
209210
)
210211

211212
// TemplateAppUsage shows the usage of an app for one or more templates.

0 commit comments

Comments
 (0)