Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: support icon and description in preset#18977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
ssncferreira merged 7 commits intomainfromssncferreira/feat-preset-icon-description
Jul 28, 2025
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
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
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,7 @@
"last_seen_at": "====[timestamp]=====",
"name": "test-daemon",
"version": "v0.0.0-devel",
"api_version": "1.7",
"api_version": "1.8",
"provisioners": [
"echo"
],
Expand Down
6 changes: 6 additions & 0 deletionscoderd/apidoc/docs.go
View file
Open in desktop

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

6 changes: 6 additions & 0 deletionscoderd/apidoc/swagger.json
View file
Open in desktop

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

2 changes: 2 additions & 0 deletionscoderd/database/dbfake/dbfake.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -417,6 +417,8 @@ func (t TemplateVersionBuilder) Do() TemplateVersionResponse {
InvalidateAfterSecs: preset.InvalidateAfterSecs,
SchedulingTimezone: preset.SchedulingTimezone,
IsDefault: false,
Description: preset.Description,
Icon: preset.Icon,
})
}

Expand Down
2 changes: 2 additions & 0 deletionscoderd/database/dbgen/dbgen.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1392,6 +1392,8 @@ func Preset(t testing.TB, db database.Store, seed database.InsertPresetParams) d
InvalidateAfterSecs: seed.InvalidateAfterSecs,
SchedulingTimezone: seed.SchedulingTimezone,
IsDefault: seed.IsDefault,
Description: seed.Description,
Icon: seed.Icon,
})
require.NoError(t, err, "insert preset")
return preset
Expand Down
8 changes: 7 additions & 1 deletioncoderd/database/dump.sql
View file
Open in desktop

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

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
ALTER TABLE template_version_presets
DROP COLUMN IF EXISTS description,
DROP COLUMN IF EXISTS icon;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Obligatory reminder to check migration number before merging!

ssncferreira reacted with thumbs up emoji
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
ALTER TABLE template_version_presets
ADD COLUMN IF NOT EXISTS description VARCHAR(128) NOT NULL DEFAULT '',
ADD COLUMN IF NOT EXISTS icon VARCHAR(256) NOT NULL DEFAULT '';
Comment on lines +2 to +3
Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Please add a comment on these fields.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Addressed in:dcc6619


COMMENT ON COLUMN template_version_presets.description IS 'Short text describing the preset (max 128 characters).';
COMMENT ON COLUMN template_version_presets.icon IS 'URL or path to an icon representing the preset (max 256 characters).';
4 changes: 4 additions & 0 deletionscoderd/database/models.go
View file
Open in desktop

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

30 changes: 24 additions & 6 deletionscoderd/database/queries.sql.go
View file
Open in desktop

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

8 changes: 6 additions & 2 deletionscoderd/database/queries/presets.sql
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,7 +7,9 @@ INSERT INTO template_version_presets (
desired_instances,
invalidate_after_secs,
scheduling_timezone,
is_default
is_default,
description,
icon
)
VALUES (
@id,
Expand All@@ -17,7 +19,9 @@ VALUES (
@desired_instances,
@invalidate_after_secs,
@scheduling_timezone,
@is_default
@is_default,
@description,
@icon
) RETURNING*;

-- name: InsertPresetParameters :many
Expand Down
2 changes: 2 additions & 0 deletionscoderd/presets.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -54,6 +54,8 @@ func (api *API) templateVersionPresets(rw http.ResponseWriter, r *http.Request)
Name:preset.Name,
Default:preset.IsDefault,
DesiredPrebuildInstances:convertPrebuildInstances(preset.DesiredInstances),
Description:preset.Description,
Icon:preset.Icon,
}
for_,presetParam:=rangepresetParams {
ifpresetParam.TemplateVersionPresetID!=preset.ID {
Expand Down
3 changes: 3 additions & 0 deletionscoderd/provisionerdserver/provisionerdserver.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2264,6 +2264,7 @@ func InsertWorkspacePresetAndParameters(ctx context.Context, db database.Store,
prebuildSchedules=protoPreset.Prebuild.Scheduling.Schedule
}
}

dbPreset,err:=tx.InsertPreset(ctx, database.InsertPresetParams{
ID:uuid.New(),
TemplateVersionID:templateVersionID,
Expand All@@ -2273,6 +2274,8 @@ func InsertWorkspacePresetAndParameters(ctx context.Context, db database.Store,
InvalidateAfterSecs:ttl,
SchedulingTimezone:schedulingTimezone,
IsDefault:protoPreset.GetDefault(),
Description:protoPreset.Description,
Icon:protoPreset.Icon,
})
iferr!=nil {
returnxerrors.Errorf("insert preset: %w",err)
Expand Down
2 changes: 2 additions & 0 deletionscodersdk/presets.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -16,6 +16,8 @@ type Preset struct {
Parameters []PresetParameter
Defaultbool
DesiredPrebuildInstances*int
Descriptionstring
Iconstring
}

typePresetParameterstruct {
Expand Down
4 changes: 4 additions & 0 deletionsdocs/reference/api/schemas.md
View file
Open in desktop

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

4 changes: 4 additions & 0 deletionsdocs/reference/api/templates.md
View file
Open in desktop

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

4 changes: 3 additions & 1 deletionprovisioner/terraform/resources.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -965,7 +965,9 @@ func ConvertState(ctx context.Context, modules []*tfjson.StateModule, rawGraph s
ExpirationPolicy: expirationPolicy,
Scheduling: scheduling,
},
Default: preset.Default,
Default: preset.Default,
Description: preset.Description,
Icon: preset.Icon,
}

if slice.Contains(duplicatedPresetNames, preset.Name) {
Expand Down
5 changes: 4 additions & 1 deletionprovisionerd/proto/version.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -44,9 +44,12 @@ import "github.com/coder/coder/v2/apiversion"
// -> `has_ai_tasks` in `CompleteJob.TemplateImport`
// -> `has_ai_tasks` and `ai_tasks` in `PlanComplete`
// -> new message types `AITaskSidebarApp` and `AITask`
//
// API v1.8:
// - Add new fields `description` and `icon` to `Preset`.
const (
CurrentMajor = 1
CurrentMinor =7
CurrentMinor =8
)

// CurrentVersion is the current provisionerd API version.
Expand Down
Loading
Loading

[8]ページ先頭

©2009-2025 Movatter.jp