+1246
-812
lines changedFilter options
+1246
-812
lines changed Original file line number Diff line number Diff line change
@@ -101,4 +101,7 @@ Read [cursor rules](.cursorrules).
101
101
102
102
## Frontend
103
103
104
+
The frontend is contained in the site folder.
105
+
106
+
For building Frontend refer to [this document](docs/contributing/frontend.md)
104
107
For building Frontend refer to [this document](docs/about/contributing/frontend.md)
Original file line number Diff line number Diff line change
@@ -24,6 +24,7 @@ message WorkspaceApp {
24
24
OWNER = 1;
25
25
AUTHENTICATED = 2;
26
26
PUBLIC = 3;
27
+
ORGANIZATION = 4;
27
28
}
28
29
SharingLevel sharing_level = 10;
29
30
@@ -401,10 +402,11 @@ message CreateSubAgentRequest {
401
402
TAB = 1;
402
403
}
403
404
404
-
enum Share {
405
+
enum SharingLevel {
405
406
OWNER = 0;
406
407
AUTHENTICATED = 1;
407
408
PUBLIC = 2;
409
+
ORGANIZATION = 3;
408
410
}
409
411
410
412
string slug = 1;
@@ -417,7 +419,7 @@ message CreateSubAgentRequest {
417
419
optional string icon = 8;
418
420
optional OpenIn open_in = 9;
419
421
optional int32 order = 10;
420
-
optional Share share = 11;
422
+
optional SharingLevel share = 11;
421
423
optional bool subdomain = 12;
422
424
optional string url = 13;
423
425
}
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ import (
5
5
"database/sql"
6
6
"errors"
7
7
"fmt"
8
+
"strings"
8
9
9
10
"github.com/google/uuid"
10
11
"github.com/sqlc-dev/pqtype"
@@ -140,20 +141,15 @@ func (a *SubAgentAPI) CreateSubAgent(ctx context.Context, req *agentproto.Create
140
141
health = database.WorkspaceAppHealthInitializing
141
142
}
142
143
143
-
var sharingLevel database.AppSharingLevel
144
-
switch app.GetShare() {
145
-
case agentproto.CreateSubAgentRequest_App_OWNER:
146
-
sharingLevel = database.AppSharingLevelOwner
147
-
case agentproto.CreateSubAgentRequest_App_AUTHENTICATED:
148
-
sharingLevel = database.AppSharingLevelAuthenticated
149
-
case agentproto.CreateSubAgentRequest_App_PUBLIC:
150
-
sharingLevel = database.AppSharingLevelPublic
151
-
default:
144
+
share := app.GetShare()
145
+
protoSharingLevel, ok := agentproto.CreateSubAgentRequest_App_SharingLevel_name[int32(share)]
146
+
if !ok {
152
147
return codersdk.ValidationError{
153
148
Field: "share",
154
-
Detail: fmt.Sprintf("%q is not a valid app sharing level", app.GetShare()),
149
+
Detail: fmt.Sprintf("%q is not a valid app sharing level", share.String()),
155
150
}
156
151
}
152
+
sharingLevel := database.AppSharingLevel(strings.ToLower(protoSharingLevel))
157
153
158
154
var openIn database.WorkspaceAppOpenIn
159
155
switch app.GetOpenIn() {
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
1
+
2
+
-- Drop the view that depends on the templates table
3
+
DROP VIEW template_with_names;
4
+
5
+
-- Remove 'organization' from the app_sharing_level enum
6
+
CREATE TYPE new_app_sharing_level AS ENUM (
7
+
'owner',
8
+
'authenticated',
9
+
'public'
10
+
);
11
+
12
+
-- Update workspace_agent_port_share table to use old enum
13
+
-- Convert any 'organization' values to 'authenticated' during downgrade
14
+
ALTER TABLE workspace_agent_port_share
15
+
ALTER COLUMN share_level TYPE new_app_sharing_level USING (
16
+
CASE
17
+
WHEN share_level = 'organization' THEN 'authenticated'::new_app_sharing_level
18
+
ELSE share_level::text::new_app_sharing_level
19
+
END
20
+
);
21
+
22
+
-- Update workspace_apps table to use old enum
23
+
-- Convert any 'organization' values to 'authenticated' during downgrade
24
+
ALTER TABLE workspace_apps
25
+
ALTER COLUMN sharing_level DROP DEFAULT,
26
+
ALTER COLUMN sharing_level TYPE new_app_sharing_level USING (
27
+
CASE
28
+
WHEN sharing_level = 'organization' THEN 'authenticated'::new_app_sharing_level
29
+
ELSE sharing_level::text::new_app_sharing_level
30
+
END
31
+
),
32
+
ALTER COLUMN sharing_level SET DEFAULT 'owner'::new_app_sharing_level;
33
+
34
+
-- Update templates table to use old enum
35
+
-- Convert any 'organization' values to 'authenticated' during downgrade
36
+
ALTER TABLE templates
37
+
ALTER COLUMN max_port_sharing_level DROP DEFAULT,
38
+
ALTER COLUMN max_port_sharing_level TYPE new_app_sharing_level USING (
39
+
CASE
40
+
WHEN max_port_sharing_level = 'organization' THEN 'owner'::new_app_sharing_level
41
+
ELSE max_port_sharing_level::text::new_app_sharing_level
42
+
END
43
+
),
44
+
ALTER COLUMN max_port_sharing_level SET DEFAULT 'owner'::new_app_sharing_level;
45
+
46
+
-- Drop old enum and rename new one
47
+
DROP TYPE app_sharing_level;
48
+
ALTER TYPE new_app_sharing_level RENAME TO app_sharing_level;
49
+
50
+
-- Recreate the template_with_names view
51
+
52
+
CREATE VIEW template_with_names AS
53
+
SELECT templates.id,
54
+
templates.created_at,
55
+
templates.updated_at,
56
+
templates.organization_id,
57
+
templates.deleted,
58
+
templates.name,
59
+
templates.provisioner,
60
+
templates.active_version_id,
61
+
templates.description,
62
+
templates.default_ttl,
63
+
templates.created_by,
64
+
templates.icon,
65
+
templates.user_acl,
66
+
templates.group_acl,
67
+
templates.display_name,
68
+
templates.allow_user_cancel_workspace_jobs,
69
+
templates.allow_user_autostart,
70
+
templates.allow_user_autostop,
71
+
templates.failure_ttl,
72
+
templates.time_til_dormant,
73
+
templates.time_til_dormant_autodelete,
74
+
templates.autostop_requirement_days_of_week,
75
+
templates.autostop_requirement_weeks,
76
+
templates.autostart_block_days_of_week,
77
+
templates.require_active_version,
78
+
templates.deprecated,
79
+
templates.activity_bump,
80
+
templates.max_port_sharing_level,
81
+
templates.use_classic_parameter_flow,
82
+
COALESCE(visible_users.avatar_url, ''::text) AS created_by_avatar_url,
83
+
COALESCE(visible_users.username, ''::text) AS created_by_username,
84
+
COALESCE(visible_users.name, ''::text) AS created_by_name,
85
+
COALESCE(organizations.name, ''::text) AS organization_name,
86
+
COALESCE(organizations.display_name, ''::text) AS organization_display_name,
87
+
COALESCE(organizations.icon, ''::text) AS organization_icon
88
+
FROM ((templates
89
+
LEFT JOIN visible_users ON ((templates.created_by = visible_users.id)))
90
+
LEFT JOIN organizations ON ((templates.organization_id = organizations.id)));
91
+
92
+
COMMENT ON VIEW template_with_names IS 'Joins in the display name information such as username, avatar, and organization name.';
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
1
+
-- Drop the view that depends on the templates table
2
+
DROP VIEW template_with_names;
3
+
4
+
-- Add 'organization' to the app_sharing_level enum
5
+
CREATE TYPE new_app_sharing_level AS ENUM (
6
+
'owner',
7
+
'authenticated',
8
+
'organization',
9
+
'public'
10
+
);
11
+
12
+
-- Update workspace_agent_port_share table to use new enum
13
+
ALTER TABLE workspace_agent_port_share
14
+
ALTER COLUMN share_level TYPE new_app_sharing_level USING (share_level::text::new_app_sharing_level);
15
+
16
+
-- Update workspace_apps table to use new enum
17
+
ALTER TABLE workspace_apps
18
+
ALTER COLUMN sharing_level DROP DEFAULT,
19
+
ALTER COLUMN sharing_level TYPE new_app_sharing_level USING (sharing_level::text::new_app_sharing_level),
20
+
ALTER COLUMN sharing_level SET DEFAULT 'owner'::new_app_sharing_level;
21
+
22
+
-- Update templates table to use new enum
23
+
ALTER TABLE templates
24
+
ALTER COLUMN max_port_sharing_level DROP DEFAULT,
25
+
ALTER COLUMN max_port_sharing_level TYPE new_app_sharing_level USING (max_port_sharing_level::text::new_app_sharing_level),
26
+
ALTER COLUMN max_port_sharing_level SET DEFAULT 'owner'::new_app_sharing_level;
27
+
28
+
-- Drop old enum and rename new one
29
+
DROP TYPE app_sharing_level;
30
+
ALTER TYPE new_app_sharing_level RENAME TO app_sharing_level;
31
+
32
+
-- Recreate the template_with_names view
33
+
CREATE VIEW template_with_names AS
34
+
SELECT templates.id,
35
+
templates.created_at,
36
+
templates.updated_at,
37
+
templates.organization_id,
38
+
templates.deleted,
39
+
templates.name,
40
+
templates.provisioner,
41
+
templates.active_version_id,
42
+
templates.description,
43
+
templates.default_ttl,
44
+
templates.created_by,
45
+
templates.icon,
46
+
templates.user_acl,
47
+
templates.group_acl,
48
+
templates.display_name,
49
+
templates.allow_user_cancel_workspace_jobs,
50
+
templates.allow_user_autostart,
51
+
templates.allow_user_autostop,
52
+
templates.failure_ttl,
53
+
templates.time_til_dormant,
54
+
templates.time_til_dormant_autodelete,
55
+
templates.autostop_requirement_days_of_week,
56
+
templates.autostop_requirement_weeks,
57
+
templates.autostart_block_days_of_week,
58
+
templates.require_active_version,
59
+
templates.deprecated,
60
+
templates.activity_bump,
61
+
templates.max_port_sharing_level,
62
+
templates.use_classic_parameter_flow,
63
+
COALESCE(visible_users.avatar_url, ''::text) AS created_by_avatar_url,
64
+
COALESCE(visible_users.username, ''::text) AS created_by_username,
65
+
COALESCE(visible_users.name, ''::text) AS created_by_name,
66
+
COALESCE(organizations.name, ''::text) AS organization_name,
67
+
COALESCE(organizations.display_name, ''::text) AS organization_display_name,
68
+
COALESCE(organizations.icon, ''::text) AS organization_icon
69
+
FROM ((templates
70
+
LEFT JOIN visible_users ON ((templates.created_by = visible_users.id)))
71
+
LEFT JOIN organizations ON ((templates.organization_id = organizations.id)));
72
+
73
+
COMMENT ON VIEW template_with_names IS 'Joins in the display name information such as username, avatar, and organization name.';
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4