From 2a492b70083d7ad00f664fef16bcc89d3e8ea317 Mon Sep 17 00:00:00 2001 From: Kyle Carberry Date: Wed, 21 Jun 2023 18:23:59 -0500 Subject: [PATCH] chore: improve the setup experience with various fixes (#8130) * Move updatecheck logs to debug mode This was causing logs to be emitted immediately after initial setup, which seemed odd for the user. * Fix setup page text to say "Create" instead of "Setup" account * Improve copy on the empty workspaces page - This view can be seen after the user creates their first workspace, so saying first is bad. - It should describe what a workspace is, so I modified the description. - The create from template button wasn't helpful! * Improve the copy for the empty templates view - This didn't describe what a template actually is. - The title had the same problem as workspaces, where first makes no sense. * Improve text consistency on the Create Template page * Fix "View activity" displaying for non-Enterprise users This was causing an exception to be thrown. * Improve messaging of empty groups view * Appropriately capitalize Workspace and Template * Improve Docker template taglines * Fix types --- coderd/updatecheck/updatecheck.go | 10 ++++---- docs/platforms/docker.md | 2 +- .../kubernetes/additional-clusters.md | 2 +- docs/templates/open-in-coder.md | 2 +- .../templates/docker-with-dotfiles/README.md | 2 +- examples/templates/docker/README.md | 2 +- site/e2e/helpers.ts | 10 ++++---- .../components/TableRowMenu/TableRowMenu.tsx | 6 ++--- .../TemplateLayout/TemplatePageHeader.tsx | 2 +- .../Tooltips/WorkspaceHelpTooltip.tsx | 2 +- .../UsersTable/UsersTable.stories.tsx | 1 + site/src/components/UsersTable/UsersTable.tsx | 3 +++ .../components/UsersTable/UsersTableBody.tsx | 20 ++++++++++++---- site/src/i18n/en/createTemplatePage.json | 8 +++---- site/src/i18n/en/createWorkspacePage.json | 2 +- site/src/i18n/en/starterTemplatePage.json | 2 +- site/src/i18n/en/starterTemplatesPage.json | 2 +- site/src/i18n/en/templateForm.json | 6 ++--- site/src/i18n/en/templateSettingsPage.json | 4 ++-- site/src/i18n/en/templatesPage.json | 2 +- site/src/i18n/en/workspacesPage.json | 6 ++--- .../CreateTemplatePage/CreateTemplateForm.tsx | 10 ++++---- .../CreateWorkspacePage.test.tsx | 2 +- .../CreateWorkspacePageView.tsx | 6 ++--- site/src/pages/GroupsPage/GroupsPageView.tsx | 6 ++--- site/src/pages/SetupPage/SetupPageView.tsx | 2 +- .../TemplateScheduleForm.tsx | 2 +- .../pages/TemplatesPage/EmptyTemplates.tsx | 10 ++++---- .../pages/TemplatesPage/TemplatesPageView.tsx | 23 ++++--------------- site/src/pages/UsersPage/UsersPage.tsx | 3 +++ site/src/pages/UsersPage/UsersPageView.tsx | 3 +++ 31 files changed, 84 insertions(+), 79 deletions(-) diff --git a/coderd/updatecheck/updatecheck.go b/coderd/updatecheck/updatecheck.go index e18bc5e5cc..5f180dd196 100644 --- a/coderd/updatecheck/updatecheck.go +++ b/coderd/updatecheck/updatecheck.go @@ -145,10 +145,10 @@ func (c *Checker) start() { diff := time.Until(r.Checked.Add(c.opts.Interval)) if diff > 0 { - c.log.Info(c.ctx, "time until next update check", slog.F("duration", diff)) + c.log.Debug(c.ctx, "time until next update check", slog.F("duration", diff)) t.Reset(diff) } else { - c.log.Info(c.ctx, "time until next update check", slog.F("duration", c.opts.Interval)) + c.log.Debug(c.ctx, "time until next update check", slog.F("duration", c.opts.Interval)) } for { @@ -164,7 +164,7 @@ func (c *Checker) start() { c.notifyIfNewer(r, rr) r = rr } - c.log.Info(c.ctx, "time until next update check", slog.F("duration", c.opts.Interval)) + c.log.Debug(c.ctx, "time until next update check", slog.F("duration", c.opts.Interval)) t.Reset(c.opts.Interval) case <-c.ctx.Done(): return @@ -176,7 +176,7 @@ func (c *Checker) update() (r Result, err error) { ctx, cancel := context.WithTimeout(c.ctx, c.opts.UpdateTimeout) defer cancel() - c.log.Info(c.ctx, "checking for update") + c.log.Debug(c.ctx, "checking for update") req, err := http.NewRequestWithContext(ctx, http.MethodGet, c.opts.URL, nil) if err != nil { return r, xerrors.Errorf("new request: %w", err) @@ -203,7 +203,7 @@ func (c *Checker) update() (r Result, err error) { Version: rr.GetTagName(), URL: rr.GetHTMLURL(), } - c.log.Info(ctx, "update check result", slog.F("latest_version", r.Version)) + c.log.Debug(ctx, "update check result", slog.F("latest_version", r.Version)) b, err := json.Marshal(r) if err != nil { diff --git a/docs/platforms/docker.md b/docs/platforms/docker.md index 0ab0397957..78a9db0b2f 100644 --- a/docs/platforms/docker.md +++ b/docs/platforms/docker.md @@ -54,7 +54,7 @@ Coder with Docker has the following advantages: - Then navigate to `Templates > docker > Create workspace` + Then navigate to `Templates > docker > Create Workspace` diff --git a/docs/platforms/kubernetes/additional-clusters.md b/docs/platforms/kubernetes/additional-clusters.md index af05efc912..2ae0d5c3db 100644 --- a/docs/platforms/kubernetes/additional-clusters.md +++ b/docs/platforms/kubernetes/additional-clusters.md @@ -2,7 +2,7 @@ With Coder, you can deploy workspaces in additional Kubernetes clusters using different [authentication methods](https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs#authentication) in the Terraform provider. -![Region picker in "Create workspace" screen](../../images/platforms/kubernetes/region-picker.png) +![Region picker in "Create Workspace" screen](../../images/platforms/kubernetes/region-picker.png) ## Option 1) Kubernetes contexts and kubeconfig diff --git a/docs/templates/open-in-coder.md b/docs/templates/open-in-coder.md index 5df13fa3f7..d179fabd36 100644 --- a/docs/templates/open-in-coder.md +++ b/docs/templates/open-in-coder.md @@ -88,7 +88,7 @@ To support any infrastructure and software stack, Coder provides a generic appro > Be sure to replace `YOUR_ACCESS_URL` with your Coder access url (e.g. https://coder.example.com) and `YOUR_TEMPLATE` with the name of your template. -1. Optional: pre-fill parameter values in the "Create workspace" page +1. Optional: pre-fill parameter values in the "Create Workspace" page This can be used to pre-fill the git repo URL, disk size, image, etc. diff --git a/examples/templates/docker-with-dotfiles/README.md b/examples/templates/docker-with-dotfiles/README.md index ba1e2d9e31..735416f1f5 100644 --- a/examples/templates/docker-with-dotfiles/README.md +++ b/examples/templates/docker-with-dotfiles/README.md @@ -1,6 +1,6 @@ --- name: Develop in Docker with a dotfiles URL -description: Run workspaces on a Docker host using registry images +description: Develop inside Docker containers using your local daemon tags: [local, docker] icon: /icon/docker.png --- diff --git a/examples/templates/docker/README.md b/examples/templates/docker/README.md index eabdb9272c..052be54cd4 100644 --- a/examples/templates/docker/README.md +++ b/examples/templates/docker/README.md @@ -1,6 +1,6 @@ --- name: Develop in Docker -description: Run workspaces on a Docker host using registry images +description: Develop inside Docker containers using your local daemon tags: [local, docker] icon: /icon/docker.png --- diff --git a/site/e2e/helpers.ts b/site/e2e/helpers.ts index 1b8defa88c..3c5ef2ad8e 100644 --- a/site/e2e/helpers.ts +++ b/site/e2e/helpers.ts @@ -2,12 +2,12 @@ import { Page } from "@playwright/test" import path from "path" export const buttons = { - starterTemplates: "Starter templates", + starterTemplates: "Starter Templates", dockerTemplate: "Develop in Docker", - useTemplate: "Use template", - createTemplate: "Create template", - createWorkspace: "Create workspace", - submitCreateWorkspace: "Create workspace", + useTemplate: "Create Workspace", + createTemplate: "Create Template", + createWorkspace: "Create Workspace", + submitCreateWorkspace: "Create Workspace", stopWorkspace: "Stop", startWorkspace: "Start", } diff --git a/site/src/components/TableRowMenu/TableRowMenu.tsx b/site/src/components/TableRowMenu/TableRowMenu.tsx index d9bf45fca0..15a4bae33d 100644 --- a/site/src/components/TableRowMenu/TableRowMenu.tsx +++ b/site/src/components/TableRowMenu/TableRowMenu.tsx @@ -7,7 +7,7 @@ import { MouseEvent, useState } from "react" export interface TableRowMenuProps { data: TData menuItems: Array<{ - label: string + label: React.ReactNode disabled: boolean onClick: (data: TData) => void }> @@ -45,9 +45,9 @@ export const TableRowMenu = ({ open={Boolean(anchorEl)} onClose={handleClose} > - {menuItems.map((item) => ( + {menuItems.map((item, index) => ( { handleClose() diff --git a/site/src/components/TemplateLayout/TemplatePageHeader.tsx b/site/src/components/TemplateLayout/TemplatePageHeader.tsx index 8db6d317b9..bf737da78e 100644 --- a/site/src/components/TemplateLayout/TemplatePageHeader.tsx +++ b/site/src/components/TemplateLayout/TemplatePageHeader.tsx @@ -106,7 +106,7 @@ const CreateWorkspaceButton: FC<{ component={RouterLink} to={`/templates/${templateName}/workspace`} > - Create workspace + Create Workspace ) diff --git a/site/src/components/Tooltips/WorkspaceHelpTooltip.tsx b/site/src/components/Tooltips/WorkspaceHelpTooltip.tsx index 81c33f5f16..23524cd88f 100644 --- a/site/src/components/Tooltips/WorkspaceHelpTooltip.tsx +++ b/site/src/components/Tooltips/WorkspaceHelpTooltip.tsx @@ -11,7 +11,7 @@ const Language = { workspaceTooltipTitle: "What is a workspace?", workspaceTooltipText: "A workspace is your development environment in the cloud. It includes the infrastructure and tools you need to work on your project.", - workspaceTooltipLink1: "Create workspaces", + workspaceTooltipLink1: "Create Workspaces", workspaceTooltipLink2: "Connect with SSH", workspaceTooltipLink3: "Editors and IDEs", } diff --git a/site/src/components/UsersTable/UsersTable.stories.tsx b/site/src/components/UsersTable/UsersTable.stories.tsx index 82ae636446..965ca67126 100644 --- a/site/src/components/UsersTable/UsersTable.stories.tsx +++ b/site/src/components/UsersTable/UsersTable.stories.tsx @@ -28,6 +28,7 @@ Editable.args = { users: [MockUser, MockUser2], roles: MockAssignableSiteRoles, canEditUsers: true, + canViewActivity: true, } export const Empty = Template.bind({}) diff --git a/site/src/components/UsersTable/UsersTable.tsx b/site/src/components/UsersTable/UsersTable.tsx index 8163884a18..456f9199e2 100644 --- a/site/src/components/UsersTable/UsersTable.tsx +++ b/site/src/components/UsersTable/UsersTable.tsx @@ -22,6 +22,7 @@ export interface UsersTableProps { roles?: TypesGen.AssignableRoles[] isUpdatingUserRoles?: boolean canEditUsers?: boolean + canViewActivity?: boolean isLoading?: boolean onSuspendUser: (user: TypesGen.User) => void onActivateUser: (user: TypesGen.User) => void @@ -49,6 +50,7 @@ export const UsersTable: FC> = ({ onUpdateUserRoles, isUpdatingUserRoles, canEditUsers, + canViewActivity, isLoading, isNonInitialPage, actorID, @@ -78,6 +80,7 @@ export const UsersTable: FC> = ({ roles={roles} isLoading={isLoading} canEditUsers={canEditUsers} + canViewActivity={canViewActivity} isUpdatingUserRoles={isUpdatingUserRoles} onActivateUser={onActivateUser} onDeleteUser={onDeleteUser} diff --git a/site/src/components/UsersTable/UsersTableBody.tsx b/site/src/components/UsersTable/UsersTableBody.tsx index aa297a52ad..8548323ce0 100644 --- a/site/src/components/UsersTable/UsersTableBody.tsx +++ b/site/src/components/UsersTable/UsersTableBody.tsx @@ -15,6 +15,7 @@ import { TableLoaderSkeleton } from "../TableLoader/TableLoader" import { TableRowMenu } from "../TableRowMenu/TableRowMenu" import { EditRolesButton } from "components/EditRolesButton/EditRolesButton" import { Stack } from "components/Stack/Stack" +import { EnterpriseBadge } from "components/DeploySettingsLayout/Badges" const isOwnerRole = (role: TypesGen.Role): boolean => { return role.name === "owner" @@ -34,6 +35,7 @@ interface UsersTableBodyProps { isUpdatingUserRoles?: boolean canEditUsers?: boolean isLoading?: boolean + canViewActivity?: boolean onSuspendUser: (user: TypesGen.User) => void onDeleteUser: (user: TypesGen.User) => void onListWorkspaces: (user: TypesGen.User) => void @@ -62,6 +64,7 @@ export const UsersTableBody: FC< onUpdateUserRoles, isUpdatingUserRoles, canEditUsers, + canViewActivity, isLoading, isNonInitialPage, actorID, @@ -167,14 +170,18 @@ export const UsersTableBody: FC< (user.status === "active" ? [ { - label: t("suspendMenuItem"), + label: t( + "suspendMenuItem", + ) as React.ReactNode, onClick: onSuspendUser, disabled: false, }, ] : [ { - label: t("activateMenuItem"), + label: t( + "activateMenuItem", + ) as React.ReactNode, onClick: onActivateUser, disabled: false, }, @@ -196,9 +203,14 @@ export const UsersTableBody: FC< disabled: false, }, { - label: "View activity", + label: ( + <> + View activity + {!canViewActivity && } + + ), onClick: onViewActivity, - disabled: false, + disabled: !canViewActivity, }, ) } diff --git a/site/src/i18n/en/createTemplatePage.json b/site/src/i18n/en/createTemplatePage.json index e210df9c5b..a94cf1c8b7 100644 --- a/site/src/i18n/en/createTemplatePage.json +++ b/site/src/i18n/en/createTemplatePage.json @@ -2,12 +2,12 @@ "title": "Create Template", "form": { "generalInfo": { - "title": "General info", - "description": "The name is used to identify the template in URLs and the API. It must be unique within your organization." + "title": "General", + "description": "The name is used to identify the template in URLs and the API." }, "displayInfo": { - "title": "Display info", - "description": "Give your template a friendly name, description, and icon." + "title": "Display", + "description": "A friendly name, description, and icon to help developers identify your template." }, "schedule": { "title": "Schedule", diff --git a/site/src/i18n/en/createWorkspacePage.json b/site/src/i18n/en/createWorkspacePage.json index 83a50fe97a..a4e55d6122 100644 --- a/site/src/i18n/en/createWorkspacePage.json +++ b/site/src/i18n/en/createWorkspacePage.json @@ -2,7 +2,7 @@ "templateLabel": "Template", "nameLabel": "Workspace Name", "ownerLabel": "Owner", - "createWorkspace": "Create workspace", + "createWorkspace": "Create Workspace", "validationNumberLesserThan": "Value must be greater than {{min}}.", "validationNumberGreaterThan": "Value must be lesser than {{max}}.", "validationNumberNotInRange": "Value must be between {{min}} and {{max}}.", diff --git a/site/src/i18n/en/starterTemplatePage.json b/site/src/i18n/en/starterTemplatePage.json index b1a5a89439..0252d0f80d 100644 --- a/site/src/i18n/en/starterTemplatePage.json +++ b/site/src/i18n/en/starterTemplatePage.json @@ -1,6 +1,6 @@ { "actions": { "viewSourceCode": "View source code", - "useTemplate": "Use template" + "useTemplate": "Use Template" } } diff --git a/site/src/i18n/en/starterTemplatesPage.json b/site/src/i18n/en/starterTemplatesPage.json index f9abcbae94..e9a8cd4b61 100644 --- a/site/src/i18n/en/starterTemplatesPage.json +++ b/site/src/i18n/en/starterTemplatesPage.json @@ -1,6 +1,6 @@ { "title": "Starter Templates", - "subtitle": "Pick one of the built-in templates to start using Coder", + "subtitle": "Import a built-in template to start developing in the cloud", "filterCaption": "Filter", "tags": { "all": "All templates", diff --git a/site/src/i18n/en/templateForm.json b/site/src/i18n/en/templateForm.json index 8dfe8531ef..59530be19b 100644 --- a/site/src/i18n/en/templateForm.json +++ b/site/src/i18n/en/templateForm.json @@ -1,11 +1,11 @@ { "generalInfo": { - "title": "General info", + "title": "General", "description": "The name is used to identify the template in URLs and the API. It must be unique." }, "displayInfo": { - "title": "Display info", - "description": "Give your template a friendly name, description, and icon." + "title": "Display", + "description": "A friendly name, description, and icon to help developers identify your template." }, "schedule": { "title": "Schedule", diff --git a/site/src/i18n/en/templateSettingsPage.json b/site/src/i18n/en/templateSettingsPage.json index 669afa7b60..853a55c059 100644 --- a/site/src/i18n/en/templateSettingsPage.json +++ b/site/src/i18n/en/templateSettingsPage.json @@ -33,11 +33,11 @@ "allowUsersCancelHelperText": "If checked, users may be able to corrupt their workspace.", "generalInfo": { "title": "General info", - "description": "The name is used to identify the template in URLs and the API. It must be unique within your organization." + "description": "The name is used to identify the template in URLs and the API." }, "displayInfo": { "title": "Display info", - "description": "Give your template a friendly name, description, and icon." + "description": "A friendly name, description, and icon to help developers identify your template." }, "schedule": { "title": "Schedule", diff --git a/site/src/i18n/en/templatesPage.json b/site/src/i18n/en/templatesPage.json index 44e14723ec..365cb3a53d 100644 --- a/site/src/i18n/en/templatesPage.json +++ b/site/src/i18n/en/templatesPage.json @@ -4,7 +4,7 @@ "getTemplatesError": "Something went wrong fetching templates." }, "empty": { - "message": "Create your first template", + "message": "Create a Template", "descriptionWithoutPermissions": "Contact your Coder administrator to create a template. You can share the code below." } } diff --git a/site/src/i18n/en/workspacesPage.json b/site/src/i18n/en/workspacesPage.json index cd9a698bf3..6cdb3406d2 100644 --- a/site/src/i18n/en/workspacesPage.json +++ b/site/src/i18n/en/workspacesPage.json @@ -1,7 +1,7 @@ { - "emptyCreateWorkspaceMessage": "Create your first workspace", - "emptyCreateWorkspaceDescription": "Start editing your source code and building your software", - "createFromTemplateButton": "Create from template", + "emptyCreateWorkspaceMessage": "Create a Workspace", + "emptyCreateWorkspaceDescription": "A workspace is your personal, customizable development environment in the cloud", + "createFromTemplateButton": "Select a Template", "emptyResultsMessage": "No results matched your search", "emptyPageMessage": "No results on this page", "updateVersionError": "Error on update workspace version" diff --git a/site/src/pages/CreateTemplatePage/CreateTemplateForm.tsx b/site/src/pages/CreateTemplatePage/CreateTemplateForm.tsx index 4b83316447..901b18c833 100644 --- a/site/src/pages/CreateTemplatePage/CreateTemplateForm.tsx +++ b/site/src/pages/CreateTemplatePage/CreateTemplateForm.tsx @@ -223,8 +223,8 @@ export const CreateTemplateForm: FC = ({ {/* General info */} {starterTemplate ? ( @@ -255,8 +255,8 @@ export const CreateTemplateForm: FC = ({ {/* Display info */} = ({ /> - Allow users to autostart workspaces on a schedule. + Allow users to automatically start workspaces on a schedule. diff --git a/site/src/pages/CreateWorkspacePage/CreateWorkspacePage.test.tsx b/site/src/pages/CreateWorkspacePage/CreateWorkspacePage.test.tsx index c4e1732619..6aa5fe32b8 100644 --- a/site/src/pages/CreateWorkspacePage/CreateWorkspacePage.test.tsx +++ b/site/src/pages/CreateWorkspacePage/CreateWorkspacePage.test.tsx @@ -141,7 +141,7 @@ describe("CreateWorkspacePage", () => { renderCreateWorkspacePage() await waitForLoaderToBeRemoved() - const element = await screen.findByText("Create workspace") + const element = await screen.findByText("Create Workspace") expect(element).toBeDefined() const secondParameter = await screen.findByText( MockTemplateVersionParameter2.description, diff --git a/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx b/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx index d38f8779b9..7ee750b14c 100644 --- a/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx +++ b/site/src/pages/CreateWorkspacePage/CreateWorkspacePageView.tsx @@ -184,7 +184,7 @@ export const CreateWorkspacePageView: FC< {/* General info */} @@ -206,8 +206,8 @@ export const CreateWorkspacePageView: FC< {/* Workspace owner */} {props.canCreateForUser && ( = ({ Welcome to Coder, } diff --git a/site/src/pages/TemplateSettingsPage/TemplateSchedulePage/TemplateScheduleForm/TemplateScheduleForm.tsx b/site/src/pages/TemplateSettingsPage/TemplateSchedulePage/TemplateScheduleForm/TemplateScheduleForm.tsx index e21d8776bc..5a0a4f819e 100644 --- a/site/src/pages/TemplateSettingsPage/TemplateSchedulePage/TemplateScheduleForm/TemplateScheduleForm.tsx +++ b/site/src/pages/TemplateSettingsPage/TemplateSchedulePage/TemplateScheduleForm/TemplateScheduleForm.tsx @@ -259,7 +259,7 @@ export const TemplateScheduleForm: FC = ({ /> - Allow users to autostart workspaces on a schedule. + Allow users to automatically start workspaces on a schedule. diff --git a/site/src/pages/TemplatesPage/EmptyTemplates.tsx b/site/src/pages/TemplatesPage/EmptyTemplates.tsx index 98c50818b5..2e4deb6949 100644 --- a/site/src/pages/TemplatesPage/EmptyTemplates.tsx +++ b/site/src/pages/TemplatesPage/EmptyTemplates.tsx @@ -50,17 +50,15 @@ export const EmptyTemplates: FC<{ message={t("empty.message")} description={ <> - You can create a template using our starter templates or{" "} - - uploading a template - - . You can also{" "} + Templates are written in Terraform and describe the infrastructure + for workspaces (e.g., docker_container, aws_instance, + kubernetes_pod). Select a starter template below or - use the CLI + create your own . diff --git a/site/src/pages/TemplatesPage/TemplatesPageView.tsx b/site/src/pages/TemplatesPage/TemplatesPageView.tsx index 118ee51409..90957ddbcb 100644 --- a/site/src/pages/TemplatesPage/TemplatesPageView.tsx +++ b/site/src/pages/TemplatesPage/TemplatesPageView.tsx @@ -1,5 +1,4 @@ import Button from "@mui/material/Button" -import Link from "@mui/material/Link" import { makeStyles } from "@mui/styles" import Table from "@mui/material/Table" import TableBody from "@mui/material/TableBody" @@ -127,7 +126,7 @@ const TemplateRow: FC<{ template: Template }> = ({ template }) => { navigate(`/templates/${template.name}/workspace`) }} > - Use template + Create Workspace @@ -151,7 +150,7 @@ export const TemplatesPageView: FC< actions={ } @@ -172,21 +171,7 @@ export const TemplatesPageView: FC< 0)}> - Choose a template to create a new workspace - {permissions.createTemplates ? ( - <> - , or{" "} - - manage templates - {" "} - from the CLI. - - ) : ( - "." - )} + Select a template to create a workspace. diff --git a/site/src/pages/UsersPage/UsersPage.tsx b/site/src/pages/UsersPage/UsersPage.tsx index 8150da4e2e..95c0f5670b 100644 --- a/site/src/pages/UsersPage/UsersPage.tsx +++ b/site/src/pages/UsersPage/UsersPage.tsx @@ -19,6 +19,7 @@ import { pageTitle } from "../../utils/page" import { UsersPageView } from "./UsersPageView" import { useStatusFilterMenu } from "./UsersFilter" import { useFilter } from "components/Filter/filter" +import { useDashboard } from "components/Dashboard/DashboardProvider" export const Language = { suspendDialogTitle: "Suspend user", @@ -35,6 +36,7 @@ const getSelectedUser = (id: string, users?: User[]) => export const UsersPage: FC<{ children?: ReactNode }> = () => { const navigate = useNavigate() const searchParamsResult = useSearchParams() + const { entitlements } = useDashboard() const [searchParams, setSearchParams] = searchParamsResult const filter = searchParams.get("filter") ?? "" const [usersState, usersSend] = useMachine(usersMachine, { @@ -148,6 +150,7 @@ export const UsersPage: FC<{ children?: ReactNode }> = () => { isUpdatingUserRoles={usersState.matches("updatingUserRoles")} isLoading={isLoading} canEditUsers={canEditUsers} + canViewActivity={entitlements.features.audit_log.enabled} paginationRef={paginationRef} isNonInitialPage={nonInitialPage(searchParams)} actorID={me.id} diff --git a/site/src/pages/UsersPage/UsersPageView.tsx b/site/src/pages/UsersPage/UsersPageView.tsx index 8dd13581a1..25ff553938 100644 --- a/site/src/pages/UsersPage/UsersPageView.tsx +++ b/site/src/pages/UsersPage/UsersPageView.tsx @@ -16,6 +16,7 @@ export interface UsersPageViewProps { roles?: TypesGen.AssignableRoles[] isUpdatingUserRoles?: boolean canEditUsers?: boolean + canViewActivity?: boolean isLoading?: boolean onSuspendUser: (user: TypesGen.User) => void onDeleteUser: (user: TypesGen.User) => void @@ -46,6 +47,7 @@ export const UsersPageView: FC> = ({ onUpdateUserRoles, isUpdatingUserRoles, canEditUsers, + canViewActivity, isLoading, filterProps, paginationRef, @@ -75,6 +77,7 @@ export const UsersPageView: FC> = ({ onUpdateUserRoles={onUpdateUserRoles} isUpdatingUserRoles={isUpdatingUserRoles} canEditUsers={canEditUsers} + canViewActivity={canViewActivity} isLoading={isLoading} isNonInitialPage={isNonInitialPage} actorID={actorID}