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

64 Коммитов

Автор SHA1 Сообщение Дата
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
Ed Morley c58710501e Bug 1432840 - Fix/enable eslint 'no-useless-constructor'
https://eslint.org/docs/rules/no-useless-constructor
2018-01-25 19:15:57 +00:00
Ed Morley bc3b957953 Bug 1432840 - Fix/enable eslint 'no-useless-return'
https://eslint.org/docs/rules/no-useless-return
2018-01-25 19:15:57 +00:00
Ed Morley 6f8d1bcf3f Bug 1432840 - Fix/enable eslint 'react/jsx-closing-bracket-location'
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-closing-bracket-location.md
2018-01-25 19:15:57 +00:00
Ed Morley 1ad475fdc8 Bug 1432840 - Fix/enable eslint 'react/jsx-tag-spacing'
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-tag-spacing.md
2018-01-25 19:15:57 +00:00
Ed Morley 50bca843a9 Bug 1432840 - Fix/enable eslint 'react/self-closing-comp'
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/self-closing-comp.md
2018-01-25 19:15:57 +00:00
Ed Morley d85f504839 Bug 1432840 - Fix/enable eslint 'react/jsx-wrap-multilines'
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-wrap-multilines.md
2018-01-25 19:15:57 +00:00
Ed Morley 35ae7d6017 Bug 1432840 - Fix/enable eslint 'react/jsx-curly-spacing'
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-curly-spacing.md
2018-01-25 19:15:57 +00:00
Ed Morley c6fd3a6aa6 Bug 1432840 - Fix/enable eslint 'react/sort-comp'
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/sort-comp.md
2018-01-25 19:15:57 +00:00
Ed Morley 40c4ff5b29 Bug 1432840 - Fix/enable eslint 'react/jsx-boolean-value'
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-boolean-value.md
2018-01-25 19:15:57 +00:00
Ed Morley 704a84655f Bug 1432840 - Fix/enable eslint 'jsx-a11y/alt-text'
https://github.com/evcohen/eslint-plugin-jsx-a11y/blob/master/docs/rules/alt-text.md
2018-01-25 19:15:57 +00:00
Ed Morley 87a7f7373f Bug 1432840 - Fix/enable eslint 'jsx-quotes'
https://eslint.org/docs/rules/jsx-quotes
2018-01-25 19:15:57 +00:00
Ed Morley 3ad9264308 Bug 1432840 - Fix/enable eslint 'react/jsx-filename-extension'
https://github.com/yannickcr/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md
2018-01-25 19:15:57 +00:00
Ed Morley 13627f006b Bug 1432840 - Use the AirBnb React ESLint preset
Previously only 65 rules were enabled, since the `eslint:recommended`
and `plugin:react/recommended` entries in `extends` had no effect,
since when using ESLint's API rather than CLI, the options must be
passed inside the `baseConfig` property instead.

This commit corrects the usage of `extends` and switches us to AirBnb's
React ESLint preset rather than manually opting into rules:
https://github.com/airbnb/javascript

Even with the temporarily disabled rules (which can be gradually fixed
in the future), there are now over 200 ESLint rules enabled, giving
a significant increase in coverage.

Note: We're having to use v15 of `eslint-config-airbnb` rather than v16
until we update to newer Neutrino, since the latest preset has dropped
support for the ESLint v3 that comes with Neutrino 4.
2018-01-25 19:15:57 +00:00
Ed Morley a60bab5e78 Bug 1364894 - Whitelist rather than blacklist files copied to dist/
With the changes in previous commits, all of the assets that were
originally manually copied to `dist/img/` are now correctly handled
by webpack as dependencies (and so emitted to `dist/` automatically).

As such, this leaves only three files that need copying from `src/`,
so they are now listed explicitly to avoid having to continually
update `ignore` to prevent extra files from sneaking in:
https://webpack.js.org/plugins/copy-webpack-plugin/

As a result of this change, the following assets are no longer
needlessly created under `dist/` as part of `yarn build`:
```
img/dancing_cat.gif
img/line_chart.png
img/logviewerIcon.png
img/logviewerIcon.svg
img/logviewerIconHelp.svg
img/tip.png
img/tip-locked.png
img/tree.xcf
img/tree_closed.png
img/tree_open.png
img/treeherder-logo.png
```

To confirm that this would not break anything, the JS and HTML files
under `dist/` were grepped for the string `img/`, and there are no
references remaining.
2018-01-24 23:43:58 +00:00
Ed Morley bf5ce96e23 Bug 1364894 - Make html-loader treat favicons as dependencies too
Previously `html-loader` only parsed `<img src="...">` tags when
looking for assets/dependencies. Now the `<link href="...">` tags
for favicons are processed too, which means `img/tree_open.png`
and friends will be included in the webpack build and not need to
be manually copied into `dist/img/`:
https://webpack.js.org/loaders/html-loader/

This does not visible change the number of hashed images output to
`dist/`, since the favicons are small enough that `url-loader` inlines
them in the HTML as base64 encoded data URIs (this is adjustable if
not desired later):
https://webpack.js.org/loaders/url-loader/
2018-01-24 23:43:58 +00:00
Ed Morley 49339088f6 Bug 1364894 - Load HTML with html-loader not raw-loader
Neutrino 4 configures `file-loader` as the loader for HTML (rather than
the more usual `html-loader`), which means the HTML is not parsed to
look for further dependencies such as `<img src="...">` tags. Our
custom Neutrino config overrode that to `raw-loader` (presumably to
work around bugs caused by the use of `file-loader`), which doesn't
parse HTML either.

Instead, these assets were being manually copied to `dist/img/` by
`neutrino-custom/production.js`'s `CopyPlugin` rule, effectively
circumventing the webpack build process.

Newer Neutrino correctly uses `html-loader`, causing our HTML to be
parsed during the webpack build for the first time. However now that
the images are being resolved at build time rather than runtime, the
relative paths need to be updated to account for the directory layout
differences between `src/` and `dist/`, to prevent build errors.

A significant benefit of this change is that images referenced from
HTML will now be output with hashed filenames, meaning they get given
long-lived `Cache-Control` headers by WhiteNoise.

See:
https://webpack.js.org/loaders/file-loader/
https://webpack.js.org/loaders/raw-loader/
https://webpack.js.org/loaders/html-loader/
2018-01-24 23:43:58 +00:00
Ed Morley ab3b767ba4 Bug 1364894 - Override Neutrino 4's broken SVG mimetype
Neutrino 4 configured the SVG mimetype as `application/svg+xml`, which
Firefox doesn't appear to like. Neutrino 8 instead doesn't specify a
mimetype directly, allowing `url-loader` to autodetect via the NPM
`mime` package (which returns `image/svg+xml` for SVGs).

This switches to the Neutrino 8 approach, to prevent the job detail
panel's log viewer icon breaking in later commits when we start
parsing HTML properly (which causes url-loader to embed the icon as
a base64 encoded data URI rather than a URL to a file).
2018-01-24 23:43:58 +00:00
Ed Morley 3aba4223a0 Bug 1364894 - Add missing image file extensions to url-loader
Neutrino 4 only configured `url-loader` for use with `.png` and `.jpg`.
This means that once we start parsing HTML properly in later commits,
we would otherwise get the following error:

```
ERROR in ./ui/img/dancing_cat.gif
Module parse failed: C:\Users\Ed\src\treeherder\ui\img\dancing_cat.gif Unexpected character '�' (1:6)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
 @ ./ui/partials/perf/comparectrl.html 1:214-250
 @ ./ui/partials \.html$
 @ ./ui/js/cache-templates.js
 @ ./ui/js/perfapp.js
 @ ./ui/entry-perf.js
 @ multi ./ui/entry-perf.js
```
2018-01-24 23:43:58 +00:00
Ed Morley 1379746345 Bug 1364894 - Remove unused support for .tmpl partials
The last `.tmpl` file was removed in #2786. The `test` regex in
`neutrino-custom/base.js` has been removed entirely, since without
the `.tmpl` extension it would be no different from the default:
https://github.com/mozilla-neutrino/neutrino-dev/blob/v4.2.0/packages/neutrino-preset-web/src/index.js#L66
2018-01-24 23:43:58 +00:00
Ed Morley a83ee853c7
Bug 1427295 - Remove unused angular-cookies (#3076)
Since we don't use any of the functionality provided by it:
https://docs.angularjs.org/api/ngCookies#module-components
2018-01-04 00:25:32 +00:00
Ed Morley 96eef0f86f
Bug 1426902 - Upgrade to React 16 (#3067)
https://reactjs.org/blog/2017/09/26/react-v16.0.html
https://reactjs.org/blog/2017/11/28/react-v16.2.0-fragment-support.html

Replaces #3048/#3068/#3069, since additional changes were required.

Also adjusts the Babili minification settings to work around a bug
in the minification of react-dom (that will hopefully be fixed in
newer versions of `babel-plugin-minify-mangle-names`, that we'll get
as part of Neutrino upgrade):
https://github.com/babel/minify/tree/babel-preset-babili@0.0.11/packages/babel-preset-babili#options

Closes #3069.
2018-01-03 19:49:25 +00:00
Ed Morley 88e7b2b6b9 Bug 1364894 - Remove unnecessary eslint global exemptions
Since the instances that required these exemptions no longer exist.
2017-12-28 18:40:21 +00:00
Ed Morley fde10ef863 Bug 1364894 - List eslint globals alphabetically and one per line
To improve readability and reduce conflicts between PRs.
2017-12-28 18:40:21 +00:00
Ed Morley cecdcb1bca Bug 1364894 - List vendor deps alphabetically and one per line
To improve readability and reduce conflicts between PRs.
2017-12-28 18:40:21 +00:00
Cameron Dawson a7e4848aad
Bug 1366909 - Merge Test view app into Treeherder repository (#3001)
Modify the code to:
* share assets and global settings wherever possible
* update links going both directions
* other small UI tweaks for uniformity with Treeherder
* Fixed a few routing dead-ends on the react side
* Removed the dead TestDetail file we weren't using anyway
* fix production domain urls
2017-12-14 08:03:32 -08:00
Cameron Dawson 97076b338d Bug 1364891 - Update from React 15.3 to 15.6
Also upgrade Enzyme from 2.7.1 to 3.1.1

Most notable change here is that React.PropTypes is now
moved to a separate package and referenced just by
PropTypes.  So this needed some import and linting changes.
2017-11-14 09:59:24 -08:00
Cameron Dawson 51dc3cc938 Bug 1408100 - Upgrade to Bootstrap 4
This adds the upgrade to Bootstrap 4, and some basic changes and
some CSS tweaks we needed to keep out UI consistent.

The simpler changes are things like:

* Classes that were renamed
* Adding classes that are now needed (dropdown-item, etc)
* Change an item from a button to a span
* Changing order of items (modal header close button, etc)
* CSS class syntax changes

The other changes are lots of CSS padding, margin, font and
other spacing tweaks.
2017-11-09 11:12:09 -08:00
Cameron Dawson 83c94d9cae Bug 1398386 - Remove exclusion editor admin panel 2017-09-12 12:25:29 -07:00
Shruti Jasoria e8fb2cefb5 Bug 1391658 - Enable `curly`, `object-curly-spacing`, `quote-props` and `key-spacing`rules as per airbnb recommendations (#2724)
Bug 1391658 - Enable `curly`, `object-curly-spacing`, `quote-props`, `key-spacing` rules as per airbnb recommendation
2017-08-23 10:43:53 -04:00
William Lachance d3824f68fe Bug 1385432 - Add 'no-unneeded-ternary' eslint rule (#2668) 2017-07-31 09:37:25 -04:00
William Lachance e968c8d966 Bug 1383114 - Enforce airbnb recommendations around es6 functions and block spacing (#2648) 2017-07-21 13:59:52 -04:00