Skip to content

feat: Redesign workspaces page #1450

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 24 commits into from
May 16, 2022
Merged

feat: Redesign workspaces page #1450

merged 24 commits into from
May 16, 2022

Conversation

kylecarbs
Copy link
Member

@kylecarbs kylecarbs commented May 14, 2022

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 presleyp and a team as code owners May 14, 2022 03:07
Copy link
Member

@code-asher code-asher left a comment

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
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.

@@ -61,8 +61,9 @@ const config: Configuration = {
port: process.env.PORT || 8080,
proxy: {
"/api": {
target: "http://localhost:3000",
target: "https://dev.coder.com",
Copy link
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
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
@@ -25,7 +25,7 @@
"typegen": "xstate typegen 'src/**/*.ts'"
},
"dependencies": {
"@fontsource/fira-code": "4.5.9",
"@fontsource/ibm-plex-mono": "^4.5.9",
Copy link
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
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
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
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 on lines 39 to 43
<TableCell>Name</TableCell>
<TableCell>Template</TableCell>
<TableCell>Version</TableCell>
<TableCell>Last Built</TableCell>
<TableCell>Status</TableCell>
Copy link
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
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?

Copy link
Contributor

@greyscaled greyscaled May 16, 2022

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
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.

@greyscaled
Copy link
Contributor

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

@BrunoQuaresma BrunoQuaresma mentioned this pull request May 16, 2022
7 tasks
@BrunoQuaresma
Copy link
Collaborator

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

@Kira-Pilot
Copy link
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
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.

@@ -0,0 +1,32 @@
export const getTimeSince = (date: Date): string => {
Copy link
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
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!

Copy link
Contributor

@greyscaled greyscaled May 16, 2022

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
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
Collaborator

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
Member Author

Yup! The create workspace page is included in #801

Copy link
Member

@code-asher code-asher left a comment

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

Copy link
Contributor

@greyscaled greyscaled left a comment

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"
Copy link
Contributor

@greyscaled greyscaled May 16, 2022

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
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
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
Contributor

Choose a reason for hiding this comment

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

@kylecarbs
Copy link
Member Author

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

@@ -9,7 +9,7 @@ export default {

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
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
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
Member Author

Choose a reason for hiding this comment

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

Fixed!

import { WorkspacesPageView } from "./WorkspacesPageView"

const WorkspacesPage: React.FC = () => {
const [workspacesState] = useMachine(workspacesMachine)
Copy link
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
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.

Copy link
Contributor

@presleyp presleyp left a comment

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

@kylecarbs
Copy link
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
Copy link

misskniss commented May 17, 2022

fixes #699
fixes #766

kylecarbs added a commit that referenced this pull request Jun 10, 2022
* feat: Improve navbar to be more compact

The navbar was unnecessarily large before, which made
the UI feel a bit bloaty from my perspective.

* Attempt to remove overrides

* Update theme

* Add text field

* Update theme to dark!

* Fix import ordering

* Fix page location

* Fix requested changes

* Add storybook for workspaces page view

* Add empty view

* Add tests for empty view

* Remove templates page

* Fix local port

* Remove templates from nav

* Fix e2e test

* Remove time.ts

* Remove dep

* Add background color to margins

* Merge status checking from workspace page

* Fix requested changes

* Fix workspace status tests
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