Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,408 changes: 714 additions & 694 deletions agent/proto/agent.pb.go

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions agent/proto/agent.proto
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ message WorkspaceApp {
}
Health health = 12;
bool hidden = 13;
string tooltip = 14;
}

message WorkspaceAgentScript {
Expand Down Expand Up @@ -422,6 +423,7 @@ message CreateSubAgentRequest {
optional SharingLevel share = 11;
optional bool subdomain = 12;
optional string url = 13;
optional string tooltip = 14;
}

repeated App apps = 5;
Expand Down
2 changes: 1 addition & 1 deletion cli/testdata/coder_provisioner_list_--output_json.golden
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"last_seen_at": "====[timestamp]=====",
"name": "test-daemon",
"version": "v0.0.0-devel",
"api_version": "1.9",
"api_version": "1.10",
"provisioners": [
"echo"
],
Expand Down
1 change: 1 addition & 0 deletions coderd/agentapi/subagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ func (a *SubAgentAPI) CreateSubAgent(ctx context.Context, req *agentproto.Create
Valid: app.GetGroup() != "",
String: app.GetGroup(),
},
Tooltip: app.GetTooltip(),
})
if err != nil {
return xerrors.Errorf("insert workspace app: %w", err)
Expand Down
3 changes: 3 additions & 0 deletions coderd/agentapi/subagent_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ func TestSubAgentAPI(t *testing.T) {
Threshold: 6,
Url: "http://localhost:13337/healthz",
},
Tooltip: ptr.Ref("Test **Tooltip**"),
},
{
Slug: "vim",
Expand All @@ -232,6 +233,7 @@ func TestSubAgentAPI(t *testing.T) {
Hidden: false,
OpenIn: database.WorkspaceAppOpenInSlimWindow,
DisplayGroup: sql.NullString{},
Tooltip: "Test **Tooltip**",
},
{
Slug: "547knu0f-vim",
Expand Down Expand Up @@ -650,6 +652,7 @@ func TestSubAgentAPI(t *testing.T) {
assert.Equal(t, tt.expectApps[idx].SharingLevel, app.SharingLevel)
assert.Equal(t, tt.expectApps[idx].Subdomain, app.Subdomain)
assert.Equal(t, tt.expectApps[idx].Url, app.Url)
assert.Equal(t, tt.expectApps[idx].Tooltip, app.Tooltip)
}

// Verify expected app creation errors
Expand Down
4 changes: 4 additions & 0 deletions coderd/apidoc/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions coderd/apidoc/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions coderd/database/db2sdk/db2sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ func Apps(dbApps []database.WorkspaceApp, statuses []database.WorkspaceAppStatus
Group: dbApp.DisplayGroup.String,
Hidden: dbApp.Hidden,
OpenIn: codersdk.WorkspaceAppOpenIn(dbApp.OpenIn),
Tooltip: dbApp.Tooltip,
Statuses: WorkspaceAppStatuses(statuses),
})
}
Expand Down
1 change: 1 addition & 0 deletions coderd/database/dbgen/dbgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -866,6 +866,7 @@ func WorkspaceApp(t testing.TB, db database.Store, orig database.WorkspaceApp) d
DisplayGroup: orig.DisplayGroup,
Hidden: orig.Hidden,
OpenIn: takeFirst(orig.OpenIn, database.WorkspaceAppOpenInSlimWindow),
Tooltip: takeFirst(orig.Tooltip, testutil.GetRandomName(t)),
})
require.NoError(t, err, "insert app")
return resource
Expand Down
5 changes: 4 additions & 1 deletion coderd/database/dump.sql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE workspace_apps
DROP COLUMN IF EXISTS tooltip;
4 changes: 4 additions & 0 deletions coderd/database/migrations/000363_workspaceapp_tooltip.up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
ALTER TABLE workspace_apps
ADD COLUMN IF NOT EXISTS tooltip VARCHAR(512) NOT NULL DEFAULT '';

COMMENT ON COLUMN workspace_apps.tooltip IS 'Markdown-supported text that is displayed when hovering over app icons in the workspace dashboard (max 512 characters).';
2 changes: 2 additions & 0 deletions coderd/database/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 17 additions & 8 deletions coderd/database/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions coderd/database/queries/workspaceapps.sql
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ INSERT INTO
display_order,
hidden,
open_in,
display_group
display_group,
tooltip
)
VALUES
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19)
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20)
ON CONFLICT (id) DO UPDATE SET
display_name = EXCLUDED.display_name,
icon = EXCLUDED.icon,
Expand All @@ -52,7 +53,8 @@ ON CONFLICT (id) DO UPDATE SET
open_in = EXCLUDED.open_in,
display_group = EXCLUDED.display_group,
agent_id = EXCLUDED.agent_id,
slug = EXCLUDED.slug
slug = EXCLUDED.slug,
tooltip = EXCLUDED.tooltip
RETURNING *;

-- name: UpdateWorkspaceAppHealthByID :exec
Expand Down
1 change: 1 addition & 0 deletions coderd/provisionerdserver/provisionerdserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2925,6 +2925,7 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
DisplayGroup: displayGroup,
Hidden: app.Hidden,
OpenIn: openIn,
Tooltip: app.Tooltip,
})
if err != nil {
return xerrors.Errorf("upsert app: %w", err)
Expand Down
3 changes: 3 additions & 0 deletions codersdk/workspaceapps.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,9 @@ type WorkspaceApp struct {
Group string `json:"group,omitempty"`
Hidden bool `json:"hidden"`
OpenIn WorkspaceAppOpenIn `json:"open_in"`
// Tooltip is an optional markdown supported field that is displayed when
// hovering over app buttons in the workspace dashboard.
Tooltip string `json:"tooltip,omitempty"`

// Statuses is a list of statuses for the app.
Statuses []WorkspaceAppStatus `json:"statuses"`
Expand Down
1 change: 1 addition & 0 deletions docs/reference/api/agents.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading