Skip to content

Commit c19df1e

Browse files
committed
rename to outdated
1 parent 32ce4c2 commit c19df1e

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

coderd/searchquery/search.go

+5-3
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

+11-2
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

+1-1
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)