Skip to content

Commit 102eae3

Browse files
committed
rename frontend
1 parent 4853445 commit 102eae3

File tree

30 files changed

+296
-381
lines changed

30 files changed

+296
-381
lines changed

coderd/apidoc/docs.go

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/apidoc/swagger.json

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/dbfake/dbfake.go

Lines changed: 77 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -664,83 +664,6 @@ func (q *FakeQuerier) isEveryoneGroup(id uuid.UUID) bool {
664664
return false
665665
}
666666

667-
func (q *FakeQuerier) UpdateWorkspaceDormantDeletingAt(_ context.Context, arg database.UpdateWorkspaceDormantDeletingAtParams) (database.Workspace, error) {
668-
if err := validateDatabaseType(arg); err != nil {
669-
return database.Workspace{}, err
670-
}
671-
q.mutex.Lock()
672-
defer q.mutex.Unlock()
673-
for index, workspace := range q.workspaces {
674-
if workspace.ID != arg.ID {
675-
continue
676-
}
677-
workspace.DormantAt = arg.DormantAt
678-
if workspace.DormantAt.Time.IsZero() {
679-
workspace.LastUsedAt = database.Now()
680-
workspace.DeletingAt = sql.NullTime{}
681-
}
682-
if !workspace.DormantAt.Time.IsZero() {
683-
var template database.TemplateTable
684-
for _, t := range q.templates {
685-
if t.ID == workspace.TemplateID {
686-
template = t
687-
break
688-
}
689-
}
690-
if template.ID == uuid.Nil {
691-
return database.Workspace{}, xerrors.Errorf("unable to find workspace template")
692-
}
693-
if template.TimeTilDormantAutoDelete > 0 {
694-
workspace.DeletingAt = sql.NullTime{
695-
Valid: true,
696-
Time: workspace.DormantAt.Time.Add(time.Duration(template.TimeTilDormantAutoDelete)),
697-
}
698-
}
699-
}
700-
q.workspaces[index] = workspace
701-
return workspace, nil
702-
}
703-
return database.Workspace{}, sql.ErrNoRows
704-
}
705-
706-
func (q *FakeQuerier) UpdateWorkspacesDormantDeletingAtByTemplateID(_ context.Context, arg database.UpdateWorkspacesDormantDeletingAtByTemplateIDParams) error {
707-
q.mutex.Lock()
708-
defer q.mutex.Unlock()
709-
710-
err := validateDatabaseType(arg)
711-
if err != nil {
712-
return err
713-
}
714-
715-
for i, ws := range q.workspaces {
716-
if ws.TemplateID != arg.TemplateID {
717-
continue
718-
}
719-
720-
if ws.DormantAt.Time.IsZero() {
721-
continue
722-
}
723-
724-
if !arg.DormantAt.IsZero() {
725-
ws.DormantAt = sql.NullTime{
726-
Valid: true,
727-
Time: arg.DormantAt,
728-
}
729-
}
730-
731-
deletingAt := sql.NullTime{
732-
Valid: arg.TimeTilDormantAutodeleteMs > 0,
733-
}
734-
if arg.TimeTilDormantAutodeleteMs > 0 {
735-
deletingAt.Time = ws.DormantAt.Time.Add(time.Duration(arg.TimeTilDormantAutodeleteMs) * time.Millisecond)
736-
}
737-
ws.DeletingAt = deletingAt
738-
q.workspaces[i] = ws
739-
}
740-
741-
return nil
742-
}
743-
744667
func (*FakeQuerier) AcquireLock(_ context.Context, _ int64) error {
745668
return xerrors.New("AcquireLock must only be called within a transaction")
746669
}
@@ -5774,6 +5697,45 @@ func (q *FakeQuerier) UpdateWorkspaceDeletedByID(_ context.Context, arg database
57745697
return sql.ErrNoRows
57755698
}
57765699

5700+
func (q *FakeQuerier) UpdateWorkspaceDormantDeletingAt(_ context.Context, arg database.UpdateWorkspaceDormantDeletingAtParams) (database.Workspace, error) {
5701+
if err := validateDatabaseType(arg); err != nil {
5702+
return database.Workspace{}, err
5703+
}
5704+
q.mutex.Lock()
5705+
defer q.mutex.Unlock()
5706+
for index, workspace := range q.workspaces {
5707+
if workspace.ID != arg.ID {
5708+
continue
5709+
}
5710+
workspace.DormantAt = arg.DormantAt
5711+
if workspace.DormantAt.Time.IsZero() {
5712+
workspace.LastUsedAt = database.Now()
5713+
workspace.DeletingAt = sql.NullTime{}
5714+
}
5715+
if !workspace.DormantAt.Time.IsZero() {
5716+
var template database.TemplateTable
5717+
for _, t := range q.templates {
5718+
if t.ID == workspace.TemplateID {
5719+
template = t
5720+
break
5721+
}
5722+
}
5723+
if template.ID == uuid.Nil {
5724+
return database.Workspace{}, xerrors.Errorf("unable to find workspace template")
5725+
}
5726+
if template.TimeTilDormantAutoDelete > 0 {
5727+
workspace.DeletingAt = sql.NullTime{
5728+
Valid: true,
5729+
Time: workspace.DormantAt.Time.Add(time.Duration(template.TimeTilDormantAutoDelete)),
5730+
}
5731+
}
5732+
}
5733+
q.workspaces[index] = workspace
5734+
return workspace, nil
5735+
}
5736+
return database.Workspace{}, sql.ErrNoRows
5737+
}
5738+
57775739
func (q *FakeQuerier) UpdateWorkspaceLastUsedAt(_ context.Context, arg database.UpdateWorkspaceLastUsedAtParams) error {
57785740
if err := validateDatabaseType(arg); err != nil {
57795741
return err
@@ -5854,6 +5816,44 @@ func (q *FakeQuerier) UpdateWorkspaceTTL(_ context.Context, arg database.UpdateW
58545816
return sql.ErrNoRows
58555817
}
58565818

5819+
func (q *FakeQuerier) UpdateWorkspacesDormantDeletingAtByTemplateID(_ context.Context, arg database.UpdateWorkspacesDormantDeletingAtByTemplateIDParams) error {
5820+
q.mutex.Lock()
5821+
defer q.mutex.Unlock()
5822+
5823+
err := validateDatabaseType(arg)
5824+
if err != nil {
5825+
return err
5826+
}
5827+
5828+
for i, ws := range q.workspaces {
5829+
if ws.TemplateID != arg.TemplateID {
5830+
continue
5831+
}
5832+
5833+
if ws.DormantAt.Time.IsZero() {
5834+
continue
5835+
}
5836+
5837+
if !arg.DormantAt.IsZero() {
5838+
ws.DormantAt = sql.NullTime{
5839+
Valid: true,
5840+
Time: arg.DormantAt,
5841+
}
5842+
}
5843+
5844+
deletingAt := sql.NullTime{
5845+
Valid: arg.TimeTilDormantAutodeleteMs > 0,
5846+
}
5847+
if arg.TimeTilDormantAutodeleteMs > 0 {
5848+
deletingAt.Time = ws.DormantAt.Time.Add(time.Duration(arg.TimeTilDormantAutodeleteMs) * time.Millisecond)
5849+
}
5850+
ws.DeletingAt = deletingAt
5851+
q.workspaces[i] = ws
5852+
}
5853+
5854+
return nil
5855+
}
5856+
58575857
func (q *FakeQuerier) UpsertAppSecurityKey(_ context.Context, data string) error {
58585858
q.mutex.Lock()
58595859
defer q.mutex.Unlock()

coderd/database/dbmetrics/dbmetrics.go

Lines changed: 14 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/workspaces.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -481,14 +481,14 @@ WHERE
481481
-- If the workspace's template has an inactivity_ttl set
482482
-- it may be eligible for locking.
483483
(
484-
templates.inactivity_ttl > 0 AND
484+
templates.time_til_dormant > 0 AND
485485
workspaces.dormant_at IS NULL
486486
) OR
487487

488488
-- If the workspace's template has a locked_ttl set
489489
-- and the workspace is already locked
490490
(
491-
templates.locked_ttl > 0 AND
491+
templates.time_til_dormant_autodelete > 0 AND
492492
workspaces.dormant_at IS NOT NULL
493493
)
494494
) AND workspaces.deleted = 'false';

codersdk/templates.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ type Template struct {
4848
// values are used if your license is entitled to use the advanced
4949
// template scheduling feature.
5050
FailureTTLMillis int64 `json:"failure_ttl_ms"`
51-
TimeTilDormantMillis int64 `json:"dormant_ttl_ms"`
52-
TimeTilDormantAutoDeleteMillis int64 `json:"delete_ttl_ms"`
51+
TimeTilDormantMillis int64 `json:"time_til_dormant_ms"`
52+
TimeTilDormantAutoDeleteMillis int64 `json:"time_til_dormant_autodelete_ms"`
5353
}
5454

5555
// WeekdaysToBitmap converts a list of weekdays to a bitmap in accordance with
@@ -190,8 +190,8 @@ type UpdateTemplateMeta struct {
190190
AllowUserAutostop bool `json:"allow_user_autostop,omitempty"`
191191
AllowUserCancelWorkspaceJobs bool `json:"allow_user_cancel_workspace_jobs,omitempty"`
192192
FailureTTLMillis int64 `json:"failure_ttl_ms,omitempty"`
193-
TimeTilDormantMillis int64 `json:"dormant_ttl_ms,omitempty"`
194-
TimeTilDormantAutoDeleteMillis int64 `json:"delete_ttl_ms,omitempty"`
193+
TimeTilDormantMillis int64 `json:"time_til_dormant_ms,omitempty"`
194+
TimeTilDormantAutoDeleteMillis int64 `json:"time_til_dormant_autodelete_ms,omitempty"`
195195
// UpdateWorkspaceLastUsedAt updates the last_used_at field of workspaces
196196
// spawned from the template. This is useful for preventing workspaces being
197197
// immediately locked when updating the inactivity_ttl field to a new, shorter

0 commit comments

Comments
 (0)