Skip to content

feat: Redesign workspaces page - #1450

Merged
kylecarbs merged 24 commits into
mainfrom
workspacepage
May 16, 2022
Merged

feat: Redesign workspaces page#1450
kylecarbs merged 24 commits into
mainfrom
workspacepage

Conversation

@kylecarbs

@kylecarbs kylecarbs commented May 14, 2022

Copy link
Copy Markdown
Member

image

As part of redesigning the workspaces page, I updated the theme to dark mode and removed overrides resolving #1449. There's a lot of work that can be done here to improve, but this is a good start!

I've checked all pages to ensure nothing is bugged/broken, and it all looks good!

A text input will be added in the future to allow for filtering. This will work similarly to GitHub's issue filters: owner:kylecarbs, status:running, is:outdated, etc.

I proposed initially that workspaces be nested under templates, but that provided a restrictive view for admins. Admins and managers should get a full view of their Coder deployment from the workspaces page, which they now can!

Todo

  • Write some tests
  • Remove the old flow via templates
  • Empty view 🔍
  • Get some feedback on the UI
  • Maybe pagination? Might do that in another PR

@kylecarbs
kylecarbs requested review from a team and presleyp as code owners May 14, 2022 03:07

@code-asher code-asher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me so far! All the pages look great but I think something needs to be updated for the stories since they are all throwing errors.

content: `" "`,
bottom: 0,
left: theme.spacing(3),
background: "#C16800",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a good theme color that could go here in place of the hardcoded color? Like secondary or something maybe.

Comment thread site/src/util/time.ts Outdated
Comment thread site/webpack.dev.ts Outdated
proxy: {
"/api": {
target: "http://localhost:3000",
target: "https://dev.coder.com",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be an environment variable or something so we can still develop locally?

@greyscaled

Copy link
Copy Markdown
Contributor

@code-asher @kylecarbs

I think something needs to be updated for the stories since they are all throwing errors.

The theme provider for storybook needs to be set in .storybook/preview.js --> we can modify the below to only accept dark theme. I didn't test that locally, but it's a start as to where to look.

import { dark, light } from "../src/theme"
import "../src/theme/globalFonts"
const providerFn = ({ children, theme }) => (
<ThemeProvider theme={theme}>
<CssBaseline />
{children}
</ThemeProvider>
)
addDecorator(withThemes(null, [light, dark], { providerFn }))

@greyscaled
greyscaled requested a review from Kira-Pilot May 14, 2022 17:35
Comment thread site/package.json Outdated
},
"dependencies": {
"@fontsource/fira-code": "4.5.9",
"@fontsource/ibm-plex-mono": "^4.5.9",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Can you pin this dependency to 4.5.9? You run the upgrade command to do it:

cd site
yarn upgrade @fontsource/ibm-plex-mono@4.5.9

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vapurrmaid I notice we have yarn.lock - what's the thought process behind pinning dependencies?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll answer those two questions separately:

  • Why do we want them pinned

vs

  • Why pin in package.json

For the former: We have a RFC and guide covering, but the TL:DR is more incremental upgrades w depend-a-bot
For the latter: I don't know if having them unpinned interferes with depend-a-bot or any other tool, but simply for precision. I shouldn't have to hunt down the actual version in yarn.lock to answer what version of X we're on.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, will look at the guide!

Comment thread site/src/api/api.ts
Comment thread site/src/components/ConfirmDialog/ConfirmDialog.test.tsx Outdated
Comment thread site/src/components/Margins/Margins.tsx
Comment thread site/src/components/NavbarView/NavbarView.tsx
Comment thread site/src/components/UserAvatar/UserAvatar.tsx Outdated
Comment on lines +39 to +43
<TableCell>Name</TableCell>
<TableCell>Template</TableCell>
<TableCell>Version</TableCell>
<TableCell>Last Built</TableCell>
<TableCell>Status</TableCell>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: All of these should be defined in Language, including the <Button> text above

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where did the Language convention come from? Have we thought about using react-i18next?

@greyscaled greyscaled May 16, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great question!

i18n was not implemented in v1, and will be an eventual need for v2. We haven't yet planned for when but we know it will be an effort that we will eventually take on. In the meantime, Language is a simple way of using primitives to begin resourcing strings for what's next. The idea wasn't to commit to a framework or have to solve that problem, but ensure that we're organized and ready to for when we do.

As a bonus, we can share Language in test like this:

it("renders the sign-in form", async () => {
// When
render(<LoginPage />)
// Then
await screen.findByText(Language.passwordSignIn)
})

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, make sense to me! Thanks for explaining.

Comment thread site/src/pages/WorkspacesPage/WorkspacesPage.tsx Outdated
@greyscaled

Copy link
Copy Markdown
Contributor

Praise I really like the Status column, it's very nice 🎨

Comment thread site/src/app.tsx
@BrunoQuaresma BrunoQuaresma mentioned this pull request May 16, 2022
7 tasks
@BrunoQuaresma

Copy link
Copy Markdown
Contributor

@kylecarbs I assigned this ticket #766 to you since this work looks to be related to it.

@Kira-Pilot

Copy link
Copy Markdown
Member

I noticed we're keeping some overrides in theme/overrides.ts - is removing these work leftover that should be completed at a later time, or do we need to keep this stuff?

@kylecarbs

Copy link
Copy Markdown
Member Author

@Kira-Pilot those are things I added specifically in this PR to adjust some stylistic things. material-ui mostly worked for our needs, but I just tweaked a few smaller visual items.

Comment thread site/src/util/time.ts Outdated
@@ -0,0 +1,32 @@
export const getTimeSince = (date: Date): string => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use a library for this time stuff instead? I've used moment.js and day.js in the past

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, I implemented @vapurrmaid's suggestion of using day.js!

@greyscaled greyscaled May 16, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made this suggestion above: #1450 (comment) which is prior art from v1. I'm quite happy with dayjs from that experience, and I know it's a small library.

@Kira-Pilot

Copy link
Copy Markdown
Member

@kylecarbs I am having a hard time running this locally using ./develop.sh. @presleyp was struggling as well. Any idea what we might be missing?

@BrunoQuaresma

Copy link
Copy Markdown
Contributor

Doing some QA I was not able to create a new workspace from the UI:
Screen Shot 2022-05-16 at 14 36 40

Is it expected?

@kylecarbs

Copy link
Copy Markdown
Member Author

Yup! The create workspace page is included in #801

@code-asher code-asher left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the default look of the field input labels. The dialogs looked a bit better before IMO but definitely still usable (I like the reset password dialog though).

The margins component might need a background color removed or something, right now it has white text on a gray background https://www.chromatic.com/test?appId=624de63c6aacee003aa84340&id=62828332ad84ca004a3e0e03

Very handy we can see all the different workspace states in Chromatic!

Edit: this one seemed a bit strange to me as well, is that a disabled button? https://www.chromatic.com/test?appId=624de63c6aacee003aa84340&id=62828332ad84ca004a3e0ded
Not sure if this matters but should this be white? https://www.chromatic.com/test?appId=624de63c6aacee003aa84340&id=62828332ad84ca004a3e0dfd

Comment thread site/src/util/time.test.ts Outdated
Comment thread site/src/pages/WorkspacesPage/WorkspacesPageView.tsx Outdated

@greyscaled greyscaled left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One quick question I thought I'd submit review for right away since it's simple.

Following up with other items shortly.

@@ -1,20 +1,17 @@
import CssBaseline from "@material-ui/core/CssBaseline"
import ThemeProvider from "@material-ui/styles/ThemeProvider"
import { withThemes } from "@react-theming/storybook-addon"

@greyscaled greyscaled May 16, 2022

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question(if-minor): Are we able to remove this dependency now "@react-theming/storybook-addon": "1.1.5", ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch.


export const Language = {
createButton: "Create Workspace",
emptyView: "so you can check out your repositories, edit your source code, and build and test your software.",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kylecarbs

Copy link
Copy Markdown
Member Author

@code-asher all have been fixed! That weird button is actually a loading button, and looked weird before!

const Template: Story = (args) => (
<Margins {...args}>
<div style={{ width: "100%", background: "lightgrey" }}>Here is some content that will not get too wide!</div>
<div style={{ width: "100%" }}>Here is some content that will not get too wide!</div>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still needs a background color - it proves that the margins are working

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh good catch! I'll make it black.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed!

Comment thread site/src/pages/WorkspacesPage/WorkspacesPageView.tsx Outdated
import { WorkspacesPageView } from "./WorkspacesPageView"

const WorkspacesPage: React.FC = () => {
const [workspacesState] = useMachine(workspacesMachine)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This reminds me that now that I'm doing a bunch of polling on the workspace page, I can and should useMachine for that too.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh interesting. I never thought of that, but I suppose it makes sense.

@presleyp presleyp left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I have a couple important but small comments about the status bar and then some stylistic things you can decide on

Comment thread site/src/components/WorkspaceStatusBar/WorkspaceStatusBar.tsx
Comment thread site/src/pages/WorkspacesPage/WorkspacesPageView.tsx Outdated
Comment thread site/src/xServices/workspaces/workspacesXService.ts
@kylecarbs

Copy link
Copy Markdown
Member Author

Thank you for the reviews everyone 🥳🥳🥳🥳🥳

@vapurrmaid I see you're pending on UI for Storybook. I'm going to merge this in, but I'm extremely happy to make any changes post!

@kylecarbs
kylecarbs merged commit 22ec366 into main May 16, 2022
@kylecarbs
kylecarbs deleted the workspacepage branch May 16, 2022 21:52
@misskniss

misskniss commented May 17, 2022

Copy link
Copy Markdown

fixes #699
fixes #766

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants