From 5ce06769cdd1fdc9966cb5a93ac868bd86cd53f9 Mon Sep 17 00:00:00 2001 From: G r e y Date: Tue, 19 Apr 2022 12:16:57 -0400 Subject: [PATCH] chore: replace todos with issues (#1066) --- Makefile | 1 - agent/usershell/usershell_darwin.go | 2 -- cli/workspaceautostart.go | 2 +- cli/workspaceautostop.go | 2 +- coderd/rbac/role.go | 3 --- peer/channel.go | 6 +++--- site/e2e/util.ts | 7 +++++-- site/embed.go | 2 -- site/src/components/Form/FormTextField.tsx | 11 +++-------- .../templates/[organization]/[template]/index.tsx | 5 ++--- 10 files changed, 15 insertions(+), 26 deletions(-) diff --git a/Makefile b/Makefile index 74cb5073ef..a4b8de5242 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,6 @@ endif .PHONY: fmt/prettier fmt/sql: $(wildcard coderd/database/queries/*.sql) - # TODO: this is slightly slow for fi in coderd/database/queries/*.sql; do \ npx sql-formatter \ --language postgresql \ diff --git a/agent/usershell/usershell_darwin.go b/agent/usershell/usershell_darwin.go index d2b9a454e0..ea0fbedfdb 100644 --- a/agent/usershell/usershell_darwin.go +++ b/agent/usershell/usershell_darwin.go @@ -3,8 +3,6 @@ package usershell import "os" // Get returns the $SHELL environment variable. -// TODO: This should use "dscl" to fetch the proper value. See: -// https://stackoverflow.com/questions/16375519/how-to-get-the-default-shell func Get(username string) (string, error) { return os.Getenv("SHELL"), nil } diff --git a/cli/workspaceautostart.go b/cli/workspaceautostart.go index b55340f0d3..df23084fd5 100644 --- a/cli/workspaceautostart.go +++ b/cli/workspaceautostart.go @@ -22,7 +22,7 @@ func workspaceAutostart() *cobra.Command { Short: "schedule a workspace to automatically start at a regular time", Long: autostartDescriptionLong, Example: "coder workspaces autostart enable my-workspace --minute 30 --hour 9 --days 1-5 --tz Europe/Dublin", - Hidden: true, // TODO(cian): un-hide when autostart scheduling implemented + Hidden: true, } autostartCmd.AddCommand(workspaceAutostartEnable()) diff --git a/cli/workspaceautostop.go b/cli/workspaceautostop.go index 3b28af0a5e..086c283d0b 100644 --- a/cli/workspaceautostop.go +++ b/cli/workspaceautostop.go @@ -22,7 +22,7 @@ func workspaceAutostop() *cobra.Command { Short: "schedule a workspace to automatically stop at a regular time", Long: autostopDescriptionLong, Example: "coder workspaces autostop enable my-workspace --minute 0 --hour 18 --days 1-5 -tz Europe/Dublin", - Hidden: true, // TODO(cian): un-hide when autostop scheduling implemented + Hidden: true, } autostopCmd.AddCommand(workspaceAutostopEnable()) diff --git a/coderd/rbac/role.go b/coderd/rbac/role.go index c25140aaf2..4788a189e6 100644 --- a/coderd/rbac/role.go +++ b/coderd/rbac/role.go @@ -20,8 +20,6 @@ type Role struct { Name string `json:"name"` Site []Permission `json:"site"` // Org is a map of orgid to permissions. We represent orgid as a string. - // TODO: Maybe switch to uuid, but tokens might need to support a "wildcard" org - // which could be a special uuid (like all 0s?) Org map[string][]Permission `json:"org"` User []Permission `json:"user"` } @@ -49,7 +47,6 @@ var ( RoleAuditor = Role{ Name: "auditor", Site: permissions(map[Object][]Action{ - // TODO: @emyrk when audit logs are added, add back a read perm //ResourceAuditLogs: {ActionRead}, // Should be able to read user details to associate with logs. // Without this the user-id in logs is not very helpful diff --git a/peer/channel.go b/peer/channel.go index ca82887f2f..10acd7f4db 100644 --- a/peer/channel.go +++ b/peer/channel.go @@ -245,9 +245,9 @@ func (c *Channel) Write(bytes []byte) (n int, err error) { if c.dc.BufferedAmount()+uint64(len(bytes)) >= maxBufferedAmount { <-c.sendMore } - // TODO (@kyle): There's an obvious race-condition here. - // This is an edge-case, as most-frequently data won't - // be pooled so synchronously, but is definitely possible. + // REMARK: There's an obvious race-condition here. This is an edge-case, as + // most-frequently data won't be pooled so synchronously, but is + // definitely possible. // // See: https://github.com/pion/sctp/issues/181 time.Sleep(time.Microsecond) diff --git a/site/e2e/util.ts b/site/e2e/util.ts index c51455db84..c9905ab10d 100644 --- a/site/e2e/util.ts +++ b/site/e2e/util.ts @@ -57,10 +57,10 @@ interface WaitForClientSideNavigationOpts { * @remark This is necessary in a client-side SPA world since playwright * waitForNavigation waits for load events on the DOM (ex: after a page load * from the server). - * - * @todo Better logging for this. */ export const waitForClientSideNavigation = async (page: Page, opts: WaitForClientSideNavigationOpts): Promise => { + console.info(`--- waitForClientSideNavigation: start`) + await Promise.all([ waitFor(() => { const conditions: boolean[] = [] @@ -74,9 +74,12 @@ export const waitForClientSideNavigation = async (page: Page, opts: WaitForClien } const unmetConditions = conditions.filter((condition) => !condition) + console.info(`--- waitForClientSideNavigation: ${unmetConditions.length} conditions not met`) return Promise.resolve(unmetConditions.length === 0) }), page.waitForLoadState("networkidle"), ]) + + console.info(`--- waitForClientSideNavigation: done`) } diff --git a/site/embed.go b/site/embed.go index 9e9fcd5cca..22e5585e25 100644 --- a/site/embed.go +++ b/site/embed.go @@ -270,8 +270,6 @@ func secureHeaders(next http.Handler) http.Handler { // Only scripts can manipulate the dom. This prevents someone from // naming themselves something like ''. - // TODO: @emyrk we need to make FE changes to enable this. We get 'TrustedHTML' and 'TrustedURL' errors - // that require FE changes to work. // "require-trusted-types-for" : []string{"'script'"}, } diff --git a/site/src/components/Form/FormTextField.tsx b/site/src/components/Form/FormTextField.tsx index d59fe203da..2356398fdc 100644 --- a/site/src/components/Form/FormTextField.tsx +++ b/site/src/components/Form/FormTextField.tsx @@ -62,7 +62,7 @@ export interface FormTextFieldProps * }} * /> */ - eventTransform?: (value: string) => unknown + eventTransform?: (value: string) => string /** * isPassword uses a PasswordField component when `true`; otherwise a * TextField component is used. @@ -145,13 +145,8 @@ export const FormTextField = ({ } const event = e - if (typeof eventTransform !== "undefined") { - // TODO(Grey): Asserting the type as a string here is not quite - // right in that when an input is of type="number", the value will - // be a number. Type asserting is better than conversion for this - // reason, but perhaps there's a better way to do this without any - // assertions. - event.target.value = eventTransform(e.target.value) as string + if (typeof eventTransform !== "undefined" && typeof event.target.value === "string") { + event.target.value = eventTransform(e.target.value) } form.handleChange(event) }} diff --git a/site/src/pages/templates/[organization]/[template]/index.tsx b/site/src/pages/templates/[organization]/[template]/index.tsx index 295275e14b..0ebde0d161 100644 --- a/site/src/pages/templates/[organization]/[template]/index.tsx +++ b/site/src/pages/templates/[organization]/[template]/index.tsx @@ -25,9 +25,8 @@ export const TemplatePage: React.FC = () => { () => `/api/v2/organizations/${unsafeSWRArgument(organizationInfo).id}/templates/${templateName}`, ) - // TODO: The workspaces endpoint was recently changed, so that we can't get - // workspaces per-template. This just grabs all workspaces... and then - // later filters them to match the current template. + // This just grabs all workspaces... and then later filters them to match the + // current template. const { data: workspaces, error: workspacesError } = useSWR(() => `/api/v2/users/me/workspaces`) if (organizationError) {