mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
e53bc247e9
In this pull request we're adding an optional `tooltip` field. The `tooltip` field is a string field (with markdown support) that will be used to display tooltips on hover over app buttons in a workspace dashboard. Tooltip screenshot <img width="816" height="275" alt="Screenshot 2025-08-29 at 4 11 56 PM" src="https://github.com/user-attachments/assets/52c736a1-f632-465b-89a0-35ca99bd367b" /> Tooltip video https://github.com/user-attachments/assets/21806337-accc-4acf-b8c6-450c031d98f1 Issue: https://github.com/coder/coder/issues/18431 Related provider PR: https://github.com/coder/terraform-provider-coder/pull/435 ### Changes - Added migration to add `tooltip` column to `workspace_apps` table - Updated queries to get/set the new `tooltip` column - Updated frontend to render tooltip as markdown (primary tool tip takes precedence over template tooltip) ### Testing - Added storybook test for `Applink` markdown rendering
82 lines
2.3 KiB
SQL
82 lines
2.3 KiB
SQL
-- name: GetWorkspaceAppsByAgentID :many
|
|
SELECT * FROM workspace_apps WHERE agent_id = $1 ORDER BY slug ASC;
|
|
|
|
-- name: GetWorkspaceAppsByAgentIDs :many
|
|
SELECT * FROM workspace_apps WHERE agent_id = ANY(@ids :: uuid [ ]) ORDER BY slug ASC;
|
|
|
|
-- name: GetWorkspaceAppByAgentIDAndSlug :one
|
|
SELECT * FROM workspace_apps WHERE agent_id = $1 AND slug = $2;
|
|
|
|
-- name: GetWorkspaceAppsCreatedAfter :many
|
|
SELECT * FROM workspace_apps WHERE created_at > $1 ORDER BY slug ASC;
|
|
|
|
-- name: UpsertWorkspaceApp :one
|
|
INSERT INTO
|
|
workspace_apps (
|
|
id,
|
|
created_at,
|
|
agent_id,
|
|
slug,
|
|
display_name,
|
|
icon,
|
|
command,
|
|
url,
|
|
external,
|
|
subdomain,
|
|
sharing_level,
|
|
healthcheck_url,
|
|
healthcheck_interval,
|
|
healthcheck_threshold,
|
|
health,
|
|
display_order,
|
|
hidden,
|
|
open_in,
|
|
display_group,
|
|
tooltip
|
|
)
|
|
VALUES
|
|
($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,
|
|
command = EXCLUDED.command,
|
|
url = EXCLUDED.url,
|
|
external = EXCLUDED.external,
|
|
subdomain = EXCLUDED.subdomain,
|
|
sharing_level = EXCLUDED.sharing_level,
|
|
healthcheck_url = EXCLUDED.healthcheck_url,
|
|
healthcheck_interval = EXCLUDED.healthcheck_interval,
|
|
healthcheck_threshold = EXCLUDED.healthcheck_threshold,
|
|
health = EXCLUDED.health,
|
|
display_order = EXCLUDED.display_order,
|
|
hidden = EXCLUDED.hidden,
|
|
open_in = EXCLUDED.open_in,
|
|
display_group = EXCLUDED.display_group,
|
|
agent_id = EXCLUDED.agent_id,
|
|
slug = EXCLUDED.slug,
|
|
tooltip = EXCLUDED.tooltip
|
|
RETURNING *;
|
|
|
|
-- name: UpdateWorkspaceAppHealthByID :exec
|
|
UPDATE
|
|
workspace_apps
|
|
SET
|
|
health = $2
|
|
WHERE
|
|
id = $1;
|
|
|
|
-- name: InsertWorkspaceAppStatus :one
|
|
INSERT INTO workspace_app_statuses (id, created_at, workspace_id, agent_id, app_id, state, message, uri)
|
|
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
|
|
RETURNING *;
|
|
|
|
-- name: GetWorkspaceAppStatusesByAppIDs :many
|
|
SELECT * FROM workspace_app_statuses WHERE app_id = ANY(@ids :: uuid [ ]);
|
|
|
|
-- name: GetLatestWorkspaceAppStatusesByWorkspaceIDs :many
|
|
SELECT DISTINCT ON (workspace_id)
|
|
*
|
|
FROM workspace_app_statuses
|
|
WHERE workspace_id = ANY(@ids :: uuid[])
|
|
ORDER BY workspace_id, created_at DESC;
|