Commit Graph

9 Commits

Author SHA1 Message Date
22ec366535 feat: Redesign workspaces page (#1450)
* 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
2022-05-16 16:52:54 -05:00
b06ef0ae6e feat: Workspace StatusBar (#1362)
* Move component and prep

* Make WorkspaceSection more reusable

* Lay out elements

* Layout tweaks

* Add outdated to Workspace type

* Fill out status bar component

* Format

* Add transition to types

* Add api handlers for build toggle

* Format

* Parallelize machine

* Lay out basics of build submachine

* Pipe start and stop events through - needs status

* Attempt at a machine

It's so big, but collapsing start and stop made it hard to distinguish retry from toggle

* Update mock

* Render status and buttons

* Fix type error on template page

* Move Settings

* Format

* Keep refreshed workspace

* Make it switch workspaces

* Lint

* Fix relative api path

* Test

* Fix polling

* Add loading workspace state

* Format

* Add stub settings page

* Format

* Lint

* Get rid of let

* Add update

* Make start use version id

Important for update

* Fix imports

* Add polling for outdated

* Rely on context instead of finite state for status

* Handle canceling

* Fix tests

* Format

* Display errors so users know when button presses didn't work

* Fix api typo, remove logging

* Lint

* Simplify type

Co-authored-by: G r e y <grey@coder.com>

* Add type, extract helper

Co-authored-by: G r e y <grey@coder.com>
2022-05-16 16:34:22 +00:00
26b04cc96f chore: switch to generated types (#1394)
* Make column renderer use the same type as its key

That way the renderer only takes `string` for example when rendering the
name field instead of `string | number` when the interface has some
fields that are strings and some fields are numbers.

This will be necessary when switching to generated types since some of
the fields are numbers (like the owner count on a template).

* Switch fully to generated types

In some places the organization ID is part of the URL but not part of
the request so I separated out the ID into a separate argument in the
relevant API functions.

Otherwise this was a straightforward replacement where I mostly only
needed to change some of the interface names (User instead of
UserResponse for example) and add a few missing but required properties.

I kind of winged the template form; I am not sure what the difference
between a template and template version is or why the latter comes
before the former so the form just returns all the data required to
create both.

* Delete handwritten types

Except for UserAgent which seems to be purely frontend and
ReconnectingPTYRequest which is not in codersdk so I am just leaving it
for now.

* Remove implemented omitempty as a future idea

This was implemented in 2d3dc436a8.

* Add missing optionalities to generated request interfaces
2022-05-12 10:01:28 -05:00
3151befb38 chore: un-nest components (#1090)
Closes #936.
2022-04-19 14:16:11 -05:00
42e9956779 feat: workspace view for schedules (#991)
Summary:

This adds the client-side implementation to match the types introduced
in #879 and #844 as well as a card in the Workspaces page to present
workspace the data.

Details:

* Added a convenient line break in the example schedule.Weekly
* Added missing `json:""` annotations in codersdk/workspaces.go
* Installed cronstrue for displaying human-friendly cron strings
* Adjusted/Added client-side types to match codersdk/workspaces.go
* Added new component WorkspaceSchedule.tsx

Next Steps:

The WorkspaceSchedule.tsx card only presents data (on purpose). In order
to make it PUT/modify data, a few changes will be made:

- a form for updating workspace schedule will be created
- the form will wrapped in a dialog or modal
- the WorkspaceSchedule card will have a way of opening the modal which
will likely be generalized up to WorkspaceSection.tsx

Impact:

This is user-facing

This does not fully resolve either #274 or #275 (I may further decompose
that work to reflect reality and keep things in small deliverable
increments), but adds significant progress towards both.
2022-04-13 20:35:47 -04:00
02ad3f14f5 chore: Rename Projects to Templates (#880)
Customer feedback indicated projects was a confusing name.
After querying the team internally, it seemed unanimous
that it is indeed a confusing name.

Here's for a lil less confusion @ashmeer7 🥂
2022-04-06 12:42:40 -05:00
c0a9eaca56 chore(site): organize imports (#876) 2022-04-05 10:27:41 -04:00
22f820c69b refactor(site): replace UserContext with userXService (#465)
* Install and configure XState

* userXService - typegen not working yet

* Lint, fix error transitions

* Lint

* Change initial state to handle loss of state

* Fix gitignore

* Fix types by hook or by crook

* Use xservice in all pages

* Glue/visual component separation

* Fix dependency merge

* Lint

* Remove UserContext

* Remove inspector

* Add typegen command to site/out

* Fix index page redirects

* DRY up nav and redirects

* Moves based on merge

* Moving Page helpers into Page dir

* Move xservice into src, update script

* Move and storybook navbarview

* Update docs

* Install MSW

* Reorganization, with apologies

* Missed spots

* Add mock handlers

* Configure jest for msw

* Fix typos

* Shift unit test to NavbarView

* Fix test types

* Rename NavbarView test

* Attempt at test, wip

* Fix config

* Be logged out, only warn

* Conditionally show text to help test

* Use a Context for MSW's sake

* mocks -> test_helpers

* Enable dev tools

* Format

* Fix import

* Fixes

* Lint

* run typegen postinstall

Co-authored-by: Bryan Phelps <bryan@coder.com>
2022-03-18 14:07:08 -04:00
d8e530e1ec refactor: Add 'src' folder in 'site' (#445)
This refactoring re-organizes the `site` folder to have a nested `src` folder.

Originally, [we wanted to keep the directory structure shallow](https://github.com/coder/coder/pull/8#issuecomment-1009578910) - but there were two points that motivated this change to introduce the `src` level.

1. We have several non-`src` folders now (`e2e`, `static`, `html_templates`, `.storybook`)
2. Having a `src` folder makes it easier to run XState Typegen

So given those two data points - I believe it makes sense to revisit that and introduce a `src` folder.
2022-03-16 04:06:03 +00:00