Skip to content

Commit 9642cf8

Browse files
committed
rename to outdated
1 parent 28ff1e7 commit 9642cf8

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

coderd/searchquery/search.go

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,12 @@ func Workspaces(query string, page codersdk.Pagination, agentInactiveDisconnectT
112112
filter.LastUsedAfter = parser.Time3339Nano(values, time.Time{}, "last_used_after")
113113
filter.LastUsedBefore = parser.Time3339Nano(values, time.Time{}, "last_used_before")
114114
filter.UsingActive = sql.NullBool{
115+
// Invert the value of the query parameter to get the correct value.
115116
// UsingActive returns if the workspace is on the latest template active version.
116-
// This means the workspace is "up to date".
117-
Bool: parser.Boolean(values, false, "updated"),
118-
Valid: values.Has("updated"),
117+
Bool: !parser.Boolean(values, true, "outdated"),
118+
// Only include this search term if it was provided. Otherwise default to omitting it
119+
// which will return all workspaces.
120+
Valid: values.Has("outdated"),
119121
}
120122

121123
parser.ErrorExcessParams(values)

coderd/searchquery/search_test.go

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,17 +117,26 @@ func TestSearchWorkspace(t *testing.T) {
117117
OwnerUsername: "foo",
118118
},
119119
},
120+
{
121+
Name: "Outdated",
122+
Query: `outdated:true`,
123+
Expected: database.GetWorkspacesParams{
124+
UsingActive: sql.NullBool{
125+
Bool: false,
126+
Valid: true,
127+
},
128+
},
129+
},
120130
{
121131
Name: "Updated",
122-
Query: `updated:true`,
132+
Query: `outdated:false`,
123133
Expected: database.GetWorkspacesParams{
124134
UsingActive: sql.NullBool{
125135
Bool: true,
126136
Valid: true,
127137
},
128138
},
129139
},
130-
131140
// Failures
132141
{
133142
Name: "NoPrefix",

site/src/pages/WorkspacesPage/filter/filter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const workspaceFilterQuery = {
2222
running: "status:running",
2323
failed: "status:failed",
2424
dormant: "dormant:true",
25-
outdated: "updated:false",
25+
outdated: "outdated:true",
2626
};
2727

2828
type FilterPreset = {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy