Граф коммитов

95 Коммитов

Автор SHA1 Сообщение Дата
Cameron Dawson c3bf24ca12
Fix linting errors on lint.js (#3850) 2018-07-31 14:41:58 -07:00
Cameron Dawson 135615d308
Bug 1450038 - Stop using dangerouslySetInnerHTML (#3785)
Using components based on react-linkify, we can replace all
usages of dangerouslySetInnerHtml.  This also allowed us
to remove a few related helper functions.

enable no-danger eslint rule
2018-07-16 08:09:17 -07:00
Ed Morley 8b11478b28 Bug 1468658 - Enable eslint 'prefer-rest-params'
https://eslint.org/docs/rules/prefer-rest-params
2018-06-13 22:43:15 -07:00
Ed Morley 3e31201ae8 Bug 1468658 - Fix/enable eslint 'comma-dangle'
https://eslint.org/docs/rules/comma-dangle

Changes performed by `--fix`.
2018-06-13 22:43:15 -07:00
Ed Morley 9ac0d2b8f9 Bug 1468658 - Fix/enable eslint 'space-infix-ops'
https://eslint.org/docs/rules/space-infix-ops

Changes performed by `--fix`.
2018-06-13 22:43:15 -07:00
Ed Morley 3420c1685b Bug 1468658 - Fix/enable eslint 'spaced-comment'
https://eslint.org/docs/rules/spaced-comment

Changes performed by `--fix`.
2018-06-13 22:43:15 -07:00
Ed Morley fe4f377d31 Bug 1468658 - Fix/enable eslint 'quotes'
https://eslint.org/docs/rules/quotes

Changes performed by `--fix`.
2018-06-13 22:43:15 -07:00
Ed Morley 75d7dfbded Bug 1465041 - Restore default webpack module resolution config
Neutrino 4 removes the webpack default module resolution of looking
in a relative `node_modules` directory (and then the parent of that
directory, and so on), in favour of hardcoding the repo root's
`node_modules` and those of the Neutrino preset directories.

This is both unnecessary and causes incorrect module resolution,
which has bitten us multiple times.
2018-05-29 14:06:52 +01:00
Ed Morley a574f02161
Bug 1461649 - Enable dev-server's polling watch mode in Vagrant (#3552)
This allows the webpack-dev-server filesystem watching to work even
inside Vagrant (such as when using `yarn start:local`), where the
Virtualbox shared folders mean that standard inotify watching does
not work:
https://webpack.js.org/configuration/dev-server/#devserver-watchoptions-
2018-05-15 16:34:08 +01:00
Ed Morley 55654a1195
Bug 1363722 - Allow login to work in all development workflows (#3534)
Previously it was not possible to test features that required an
authenticated user when:
* using `yarn start` with Vagrant (bug 1363722), which meant slower
  watch builds
* pointing the UI at the prod/stage API (bug 1317752), which was
  extremely limiting

Now login works in all environments, since the frontend no longer uses a
URL prefix, but instead webpack-dev-server proxies non-webpack URLs to
the chosen `BACKEND_DOMAIN` - avoiding cross-domain issues. Cookies are
rewritten to remove any `secure` directive (which is set on production),
so that they can still be read from HTTP localhost. The `Referer` has to
also be changed to stop Django's CSRF checks from rejecting request.

The slower "build into `dist` and watch" mode is therefore no longer
necessary, so `yarn start:local` instead invokes webpack-dev-server just
like `yarn start` - and the `local-watch.js` workaround has been
removed.

Support for the "publish to GitHub with hardcoded `SERVICE_DOMAIN`"
workflow has been dropped, since it was already rarely used and there is
no way to make it support login.

The API domain environment variable was renamed to `BACKEND_DOMAIN` to
avoid potential confusion given it no longer behaves the same as
`SERVICE_DOMAIN` used to.

NB: For full stack Vagrant workflows users must now connect to port
*5000* on localhost, not 8000.
2018-05-10 17:58:04 +01:00
Hassan Ali 85766e2787
Bug 1415868 - Use hooks for actions (#3502)
* Add hooks for actions

* Remove task from context for kind == hook

Also display hookGroupId/hookId for kind=hook
in the modal.

* Move taskcluster-lib-scopes to the vendor chunk
2018-05-09 15:03:23 -04:00
Cameron Dawson 7663ae2b67 Bug 1450020 - Convert Perf Details tab to ReactJS 2018-04-26 09:22:45 -07:00
Ed Morley 47ac771a84 Bug 1456894 - Import jQuery explicitly
The last remaining `ProvidePlugin` definition cannot be removed since
AngularJS and Flot both expect `window.jQuery` to be defined (and
whilst AngularJS falls back to jqLite, it's buggy). It's not possible
to set `window.jQuery` manually in the entrypoints, since ES6 imports
are hoisted, thereby giving no opportunity to modify window first.
2018-04-25 19:48:41 +01:00
Ed Morley f522727087 Bug 1456894 - Import React explicitly
Rather than relying on `ProvidePlugin`.
2018-04-25 19:48:41 +01:00
Ed Morley cc64c07802 Bug 1456894 - Import lodash explicitly
Rather than relying on `ProvidePlugin`.
2018-04-25 19:48:41 +01:00
Cameron Dawson 5d23735359
Bug 1446427 - Convert Autoclassify panel to ReactJS (#3414) 2018-04-24 12:39:06 -07:00
Cameron Dawson c7b050942d
Bug 1443129 - Add prop types to all JSX components (#3379)
* enable react/prop-types eslint rule
While enabling this, I set all the PropTypes as ``isRequired`` then ran the app
and wherever I hit issues where the value was undefined, then I removed ``isRequired``.

* Enable react/require-default-props eslint rule
In some cases "null" was the best default.  I think this is OK.  But having empty arrays
for others meant less checking in the actual code, so bonus!  :)
2018-04-04 10:23:48 -07:00
Sarah Clements 30df0aae6c Bug 1367362 - Add an intermittent failures view (#3296)
Adds a new view to display intermittent test failure occurrences,
to replace the functionality currently provided by the legacy
OrangeFactor tool.

Includes the new API endpoints originally reviewed in #3271.
2018-03-13 13:52:17 +00:00
Ed Morley d5e3436e45
Bug 1444644 - Update Bootstrap from v4.0.0-beta.2 to v4.0.0 (#3327)
Notably:
* the `popper.js` `DefinePlugin` entry is no longer required
* the JS/CSS imports have been adjusted to match the install docs:
  https://getbootstrap.com/docs/4.0/getting-started/webpack/
  ...which shaves 23KB off the bundle size of most pages.

Release announcements:
https://blog.getbootstrap.com/2017/12/28/bootstrap-4-beta-3/
https://blog.getbootstrap.com/2018/01/18/bootstrap-4/

Release notes:
https://github.com/twbs/bootstrap/releases/tag/v4.0.0-beta.3
https://github.com/twbs/bootstrap/releases/tag/v4.0.0

Changelog:
https://github.com/twbs/bootstrap/compare/v4.0.0-beta.3...v4.0.0
2018-03-12 17:52:01 +00:00
Cameron Dawson b221b8ca1e Bug 1437818 - Enable ESLint rule react/no-array-index-key 2018-03-08 14:14:43 -08:00
Ed Morley 101724445a Bug 1443698 - Fix/enable eslint 'no-var' and related
https://eslint.org/docs/rules/no-var
https://eslint.org/docs/rules/one-var-declaration-per-line
https://eslint.org/docs/rules/one-var
https://eslint.org/docs/rules/vars-on-top
https://eslint.org/docs/rules/block-scoped-var

Bulk of the changes performed by `--fix`, with rest by hand.
2018-03-07 19:26:18 +00:00
Ed Morley b152fc04f8 Bug 1443698 - Fix/enable eslint 'no-use-before-define'
https://eslint.org/docs/rules/no-use-before-define

Three files have been excluded from this rule entirely, since they
would require significant changes that might as well wait until they
are rewritten in React. It's likely these files may also need to be
excluded from future `var` to `let`/`const` conversions as a result.

From the AirBnb style guide GitHub issue comments:
> Some enjoy using hoisting to define helper methods at the bottom of
> the file. This guide discourages relying on hoisting; instead
> suggesting importing the helpers from another file when possible.
2018-03-07 19:26:18 +00:00
Ed Morley c26056dc23 Bug 1443698 - Fix/enable eslint 'prefer-const'
https://eslint.org/docs/rules/prefer-const

Changes performed by `--fix`.
2018-03-07 19:26:18 +00:00
Ed Morley 9b55b0cfd7 Bug 1443698 - Fix/enable eslint 'no-redeclare'
https://eslint.org/docs/rules/no-redeclare
2018-03-07 19:26:18 +00:00
Ed Morley 5f9abbf340 Bug 1443698 - Fix/enable eslint 'no-multi-assign'
https://eslint.org/docs/rules/no-multi-assign
2018-03-07 19:26:18 +00:00
Ed Morley b51909d45a Bug 1442485 - Enable already-passing eslint 'lines-around-directive'
https://eslint.org/docs/rules/object-property-newline

This was fixed as part of #3198.
2018-03-02 21:28:44 +00:00
Ed Morley 1053a8d5ee Bug 1442485 - Fix/enable eslint 'object-property-newline'
https://eslint.org/docs/rules/object-property-newline

Not a React-specific rule, but the react-codemod rulesets were
constantly trying to alter it when making changes in other files,
so would rather fix it now.
2018-03-02 21:28:44 +00:00
Ed Morley e1e8199785 Bug 1442485 - Fix/enable eslint 'react/jsx-max-props-per-line'
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-max-props-per-line.md

Changes made via eslint's `--fix` feature.
2018-03-02 21:28:44 +00:00
Ed Morley 3964dac1b6 Bug 1442485 - Fix/enable eslint 'react/jsx-first-prop-new-line'
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-first-prop-new-line.md

Changes made via eslint's `--fix` feature.
2018-03-02 21:28:44 +00:00
Ed Morley f268d9e721 Bug 1442485 - Fix/enable eslint 'react/jsx-indent{,-props}'
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent.md
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-indent-props.md

Changes made via eslint's `--fix` feature. I also included fixes to
the JS content within JSX files (by enabling the generic `indent`
rule locally when running `--fix`), to reduce the churn that will be
seen in these files when we fix JS indentation for the whole codebase.
2018-03-02 21:28:44 +00:00
Ed Morley d0fd089073 Bug 1442485 - Fix/enable eslint 'react/prefer-stateless-function'
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/prefer-stateless-function.md
2018-03-02 21:28:44 +00:00
Ed Morley 038e60a833
Bug 1441614 - Use imports for templates instead of cache-template.js (#3286)
Previously all templates were being included on every page, regardless
of whether they were being used, bloating the bundles. In addition,
`templateUrl` has a number of issues compared to `template`:
https://medium.com/@frosty/angularjs-template-vs-templateurl-cdde055b7907

There are now no more instances of non-global `require()`s (or any
require()s for that matter), so we can enable that eslint rule:
https://eslint.org/docs/rules/global-require

Improves the bundle sizes as follows:
* index: -60KB
* logviewer: -138KB
* perf: -84KB
2018-03-01 17:05:35 +00:00
Ed Morley ebe97fa18e Bug 1441617 - Always import mousetrap explicitly
...rather than relying on `window.Mousetrap`.

And also switch to ES6 imports.
2018-03-01 01:42:49 +00:00
Ed Morley 800b31b719 Bug 1441617 - Always import angular explicitly
...rather than relying on `window.angular`.

And also switch to ES6 imports.
2018-03-01 01:42:49 +00:00
Ed Morley 3e2e22e132 Bug 1441617 - Switch the treeherder module to ES6 exports
This is the shared module that is a dependency of the `treeherder.app`,
`perf` and `logviewer` modules.
2018-03-01 01:42:49 +00:00
Ed Morley 7bab404d40 Bug 1441617 - Switch the perf module to ES6 exports 2018-03-01 01:42:49 +00:00
Ed Morley 588947856a Bug 1441617 - Switch the treeherder.app module to ES6 exports
This module is for use by the `index` entrypoint, and inherits from
the shared `treeherder` module.
2018-03-01 01:42:49 +00:00
Ed Morley 6053d8110a Bug 1441617 - Switch the logviewer module to ES6 exports 2018-03-01 01:42:49 +00:00
Ed Morley ce7ad5cc0e Bug 1441617 - Switch the userguide module to ES6 exports
And whilst we're there, use explicit imports instead of relying on
the webpack `ProvidePlugin` to import it for us - which lets us also
remove the eslint global exemption plus unit test workaround.
2018-03-01 01:42:49 +00:00
Cameron Dawson f984acf9a8
Bug 1434677 - Convert rendering list of pushes from angular to ReactJS (#3206)
This adds some new components and removes the AngularJS ng-repeat for
pushes.  In the course of this work, some of the AngularJS providers were
converted to helper functions.

In a couple cases, I had to add new code to the AngularJS areas so that it
would continue to interact well between Angular and React.

Also:
* Rename some functions and CSS classes from resultset to push
* Add unlistening for events during unmount of components
2018-02-20 10:31:11 -08:00
Ed Morley dc8db57b03
Bug 1438501 - Remove failureviewer.html (#3232)
Since it's not being used. This will save us having to convert it to
React for now, and also means one less thing slowing down our builds.
Should it be needed in the future, it can be resurrected using the
Git log.
2018-02-16 10:45:17 +00:00
Ed Morley 0397e82f0e
Bug 1435998 - Fix/enable eslint 'strict' (#3198)
With ES6, the `'use strict'` directives are unnecessary:
https://eslint.org/docs/rules/strict

The directives have been left in the Neutrino configs, since they
are used by node directly, which doesn't yet support ES6 modules.
2018-02-12 16:51:36 +00:00
Hassan Ali e1b0168127
Bug 1395356 - Use auth0 instead of login.taskcluster.net for SSO (#3144)
## Rough summary of the changes

### Front end
The auth callback is written in React and lives under the /login.html endpoint. It communicates with Treeherder using the localStorage.

### Credential expiration
The Django user session expiration is set to expire when the client access token or the id token expires (whichever one expires first). These values are controlled by the IAM team. Presently, the access token expires after 1 day and the id token expires after a week. That being said, the session will therefore expire after 1 day. If you want this value change, we simply need to send a request to the IAM team.

### Credential renewal
Renewals are set to happen every 15 minutes or so. The renewal is skewed slightly so that different open tabs don't renew at the same time. Once renewal happens, both tokens are renewed and the Django session is updated.

### Migration
If the userSession localStorage key is not set, then the user will be logged out including logging out from the Django session. In other words, all users will be automatically logged out when the merge to production happens.
2018-02-07 12:59:30 -05:00
Ed Morley 3327985173 Bug 1432840 - Fix/enable eslint 'array-bracket-spacing'
https://eslint.org/docs/rules/array-bracket-spacing
2018-01-25 19:15:57 +00:00
Ed Morley 820c6cf47c Bug 1432840 - Fix/enable eslint 'no-extra-semi'
https://eslint.org/docs/rules/no-extra-semi
2018-01-25 19:15:57 +00:00
Ed Morley 0ebe066b17 Bug 1432840 - Fix/enable eslint 'prefer-spread'
https://eslint.org/docs/rules/prefer-spread
2018-01-25 19:15:57 +00:00
Ed Morley 2bd61a8da5 Bug 1432840 - Fix/enable eslint 'import/first'
https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/first.md
2018-01-25 19:15:57 +00:00
Ed Morley 710b08b53a Bug 1432840 - Fix/enable eslint 'import/prefer-default-export'
The rule has been disabled in `constants.js`, since there will soon
be other exports in that file, so we don't want a default export.

https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/prefer-default-export.md
2018-01-25 19:15:57 +00:00
Ed Morley 6318a89b91 Bug 1432840 - Fix/enable eslint 'import/no-named-as-default'
In `configureStore.js` the same object was being exported twice, once
as the default export and once as a named export. Since default exports
are preferred if there is only one export in a file, I've removed the
named import and left the default one.

In `Groups.jsx` the `Groups` class was exported but unused, so has
been adjusted to no longer be exported, so the `App.jsx` import
doesn't trigger the warning:
`import Groups from './Groups';`

See:
https://github.com/benmosher/eslint-plugin-import/blob/master/docs/rules/no-named-as-default.md
2018-01-25 19:15:57 +00:00
Ed Morley 0cbdc69c08 Bug 1432840 - Fix/enable eslint 'no-restricted-properties'
https://eslint.org/docs/rules/no-restricted-properties

The AirBnB preset has configured `Math.pow` as restricted:
https://github.com/airbnb/javascript/blob/eslint-config-airbnb-v15.1.0/README.md#es2016-properties--exponentiation-operator

Also rewrites the `ui/services/perf/math.js` to use arrow notation.
2018-01-25 19:15:57 +00:00