Commit Graph

18 Commits

Author SHA1 Message Date
828f33ac7b hotfix(.github): remove legacy title validator (#7743)
* hotfix(.github): remove legacy title validator

`cdr-bot` centralizes the behavior and can enforce stricter
standards.

* Increase jest timeout
2023-05-31 19:39:41 +00:00
813b54942f chore(site): Make FE tests faster (#6543) 2023-03-13 13:35:09 -03:00
8ee3e2c541 chore: bump chartjs-adapter-date-fns from 2.0.0 to 3.0.0 in /site (#5528)
* chore: bump chartjs-adapter-date-fns from 2.0.0 to 3.0.0 in /site

Bumps [chartjs-adapter-date-fns](https://github.com/chartjs/chartjs-adapter-date-fns) from 2.0.0 to 3.0.0.
- [Release notes](https://github.com/chartjs/chartjs-adapter-date-fns/releases)
- [Commits](https://github.com/chartjs/chartjs-adapter-date-fns/compare/v2.0.0...v3.0.0)

---
updated-dependencies:
- dependency-name: chartjs-adapter-date-fns
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* added transformer for esm

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Kira Pilot <kira.pilot23@gmail.com>
2023-01-05 15:58:04 -05:00
13a4cfa670 chore: Remove unused test files and code (#5130) 2022-11-18 18:03:15 +00:00
85c679597c site: reduce printWidth to 80 (#4437)
Resolves #4435
2022-10-10 10:33:35 -07:00
1755e97748 chore: Remove webpack (#4270) 2022-09-29 18:28:44 -03:00
c0d19ebea2 chore: configure absolute paths with webpack (#3011)
* coonfigure absolute paths with webpack

resolves #1855

* fixed jest config
2022-07-18 10:43:11 -04:00
81577f120a feat: Add web terminal with reconnecting TTYs (#1186)
* feat: Add web terminal with reconnecting TTYs

This adds a web terminal that can reconnect to resume sessions!
No more disconnects, and no more bad bufferring!

* Add xstate service

* Add the webpage for accessing a web terminal

* Add terminal page tests

* Use Ticker instead of Timer

* Active Windows mode on Windows
2022-04-29 17:30:10 -05:00
30877bb71f ci: reduce maxWorkers in jest tests (#1006)
Summary:

When `maxWorkers` is high, there's a bug in `jest` that causes OOM kills.
Unfortunately, CI is experiencing this as well as local. For now, the best solution
is just reducing `maxWorkers`.

Resolves: #1004
2022-04-14 12:23:16 -04:00
8fde3ed52f chore: improve eslint, sb, tsc configs (#483)
Summary:

This commit is a bit of a shotgun fix for various project settings.
Realistically, they could've been separate commits, but this is
convenience for just getting things into a green state to unblock
further work.

Details:

- Use our version of TS in vscode plugins
- organize vscode/settings.json
- fix tsconfig.test and tsconfig.prod (removes errors in test files)
- only use prod tsconfig in webpack
- point .eslintrc to both test and prod configs
- cleanup storybook
- running eslint in my workspace was OOMing. I configured
  maxWorkers like we had in v1 to fix this.
- remove .storybook from code coverage
- remove .js files from code coverage --> after moving away
  from Next.js, we don't allowJS in our tsconfig anymore. We only
  use JS for configurations, it's not allowed in src code!
2022-03-18 10:26:13 -04:00
edd8345658 fix: UX - Error logs in development from Empty state component (#466)
Fixes #452 

When the empty state is rendered with a non-textual element (which it turns out all our current empty states are, because they have a `<button />` component as a call to action), this noisy error log was showing up in the `console`:

```
Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>.
    at div
    at div
    at p
    at Typography (webpack-internal:///./node_modules/@material-ui/core/esm/Typography/Typography.js:166:28)
    at WithStyles (webpack-internal:///./node_modules/@material-ui/styles/esm/withStyles/withStyles.js:64:31)
    at div
    at StyledComponent (webpack-internal:///./node_modules/@material-ui/styles/esm/styled/styled.js:95:28)
    at EmptyState (webpack-internal:///./src/components/EmptyState/index.tsx:47:25)
...
    at ProjectsPage (webpack-internal:///./src/pages/projects/index.tsx:37:18)
    at Routes (webpack-internal:///./node_modules/react-router/index.js:275:5)
    at ThemeProvider (webpack-internal:///./node_modules/@material-ui/styles/esm/ThemeProvider/ThemeProvider.js:44:24)
    at UserProvider (webpack-internal:///./src/contexts/UserContext.tsx💯55)
    at SWRConfig$1 (webpack-internal:///./node_modules/swr/dist/index.esm.js:501:23)
    at Router (webpack-internal:///./node_modules/react-router/index.js:209:15)
    at BrowserRouter (webpack-internal:///./node_modules/react-router-dom/index.js:118:5)
    at App
 ```

The issue was that the `description` prop could either be a `string` or an actual `React` component, but was always rendered as a child of a `<Typography />` component. The `<Typography>` component internally renders as a `<p>`, which is not valid to nest `<div>`s inside.

The fix is to not nest inside a `<Typography />` block, but an actual `<div />`.
2022-03-16 20:17:41 -07:00
ec077c6191 refactor: Migrate from Next.js to pure webpack config (#360)
Fix for #348 - migrate our NextJS project to a pure webpack project w/ a single bundle

- [x] Switch from `next/link` to `react-router-dom`'s link 

> This part was easy - just change the import to `import { Link } from "react-router-dom"` and `<Link href={...} />` to `<Link to={...} />`

- [x] Switch from `next/router` to `react-router-dom`'s paradigms (`useNavigation`, `useLocation`, and `useParams`)

> `router.push` can be converted to `navigate(...)` (provided by the `useNavigate` hook)
> `router.replace` can be converted `navigate(..., {replace: true})` 
>  Query parameters (`const { query } = useRouter`) can be converted to `const query = useParams()`)

- [x] Implement client-side routing with `react-router-dom`

> Parameterized routes in NextJS like `projects/[organization]/[project]` would look like:
> ```
>               <Route path="projects">
>                    <Route path=":organization/:project">
>                    <Route index element={<ProjectPage />} />
>                  </Route>
>               </Route>
> ```

I've hooked up a `build:analyze` command that spins up a server to show the bundle size:
<img width="1303" alt="image" src="https://user-images.githubusercontent.com/88213859/157496889-87c5fdcd-fad1-4f2e-b7b6-437aebf99641.png">

The bundle looks OK, but there are some opportunities for improvement - the heavy-weight dependencies, like React, ReactDOM, Material-UI, and lodash could be brought in via a CDN: https://stackoverflow.com/questions/50645796/how-to-import-reactjs-material-ui-using-a-cdn-through-webpacks-externals
2022-03-12 12:51:05 -08:00
86994dacb1 feat: Initial E2E test framework for v2 (#288)
This brings an initial E2E test (really, an integration test - it's only running the server locally, as opposed to against a deployment - but it'd be easy to point playwright to a deployment).

Demo gif:
![test2](https://user-images.githubusercontent.com/88213859/156078517-6cb4ef84-337b-4e16-a8bc-aea7d06dcbcb.gif)

This test exercises a minimal flow for login:
- Run the `coderd` binary to start a server on 3000
- Create an initial user as part of setup
- Go through the login flow and verify we land on the projects page

It will be useful to have to ensure that #360 doesn't introduce a regression in the login flow

Future E2E tests that would be useful:
- Create a project & verify it shows in the UI
- Create a workspace and verify it shows in the UI
2022-03-02 09:26:53 -08:00
707016a3c5 refactor: Fix front-end lint issues (#347)
Noticed while running through the build steps (`make build`) that we were getting some lint warnings that weren't blocking build:
```sh
./pages/workspaces/[user]/[workspace].tsx
32:58  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any
32:96  Warning: Unexpected any. Specify a different type.  @typescript-eslint/no-explicit-any

./components/Form/FormCloseButton.tsx
26:6  Warning: React Hook useEffect has a missing dependency: 'onClose'. Either include it or remove the dependency array. If 'onClose' changes too often, find the parent component that defines it and wrap that definition in useCallback.  react-hooks/exhaustive-deps

./components/Navbar/UserDropdown.tsx
38:14  Warning: Unnecessary conditional, value is always truthy.  @typescript-eslint/no-unnecessary-condition
68:10  Warning: Unnecessary conditional, value is always truthy.  @typescript-eslint/no-unnecessary-condition

./components/Redirect.tsx
20:6  Warning: React Hook useEffect has missing dependencies: 'router' and 'to'. Either include them or remove the dependency array.  react-hooks/exhaustive-deps

./components/SignIn/SignInForm.tsx
126:19  Warning: Unnecessary optional chain on a non-nullish value.  @typescript-eslint/no-unnecessary-condition
```

It turns out our ESLint config wasn't being picked up, so I fixed that (it wasn't properly named). This PR turns warnings-as-errors on, fixes the issues, and also removes the "Project Create" page, because it isn't used at this time.

Wanted to clean this up before on-boarding more FE developers
2022-02-22 20:10:02 -08:00
64c14de7fe fix: Integrate front-end jest tests with datadog reporting (#286)
Fixes #244 

- Adds `jest-junit` 
- Configures `jest-junit` to output `junit.xml` in `site/test_results`
- Uploads the emitted `junit.xml` to datadog as part of the `test/js` workflow
2022-02-14 10:45:50 -08:00
94f71feeba refactor: Add storybook + initial story (#118)
This hooks up `storybook`, which the front-end team has enjoyed using in the v1 codebase - it makes it quick and easy to view and test components in isolation.

The `<LoadingButton />` has a simple story added now, so if you run `yarn storybook`, you can preview it in various states:

![2022-01-31 19 24 24](https://user-images.githubusercontent.com/88213859/151908656-27dac0a8-9c6e-4353-ad25-3eafee979bd4.gif)

This will be helpful as we bring more front-end devs to help build v2 out.
2022-02-04 08:36:58 -08:00
859407fd10 refactor: Update coverage ignore paths after moving files into /site (#139)
Unfortunately along with #133 I missed one other item in moving files to `/site` in #128 - ignoring new configuration files (and other folders) in our `jest.config.js`.

This caused our coverage numbers in front-end code to dip, because files that shouldn't be included (and previously weren't included) were now being tracked for coverage.
2022-02-01 15:26:48 -08:00
78e652a268 refactor: Move package.json and other front-end collateral into 'site' (#128)
This refactors the front-end collateral to all live within `site` - so no `package.json` at the root.

The reason we had this initially is that the jest test run and NextJS actually require having _two_ different `tsconfig`s - Next needs `jsx:"preserve"`, while jest needs `jsx:"react"` - we were using `tsconfig`s at different levels at the hierarchy to manage this.

I changed this behavior to still use two different `tsconfig.json`s, which is mandatory - but just side-by-side in `site`.

Once that's fixed, it was easy to move everything into `site`

Follow up from: https://github.com/coder/coder/pull/118#discussion_r796244577
2022-02-01 13:34:43 -08:00