* Bug 1574651 - add tc_root_url to each repository
* Fix issues introduced since initial creation of this feature
* Fix unit tests
* Fix retriggers in Compare Chooser of Perfherder
Switch Perfherder to react-router
Use top-level of app as a cache for projects, frameworks, alerts data and compare data
Cleanup files and move constants to dedicated perfherder file
Remove angular-related libraries and bump up the neutrino entry and asset limits
This fixes the issues with retriggering and add-new-jobs that the
original PR introduced. It also adds a few unit tests to catch
this potential mistake in the future.
This reverts commit ffd871ae34.
`jest-dom` has moved to `@testing-library/jest-dom`. Please uninstall jest-dom and install `@testing-library/jest-dom` instead,
or use an older version of `jest-dom`. If you do upgrade to `@testing-library/jest-dom`, make sure to update your usage of `jest-dom`
to use `@testing-library/jest-dom/extend-expect` rather than simply `jest-dom/extend-expect`. Learn more about this change here:
https://github.com/testing-library/dom-testing-library/issues/260 Thanks!
* Rename details panel ``selectedJob`` to ``selectedJobFull``
The job that's passed in the DetailsPanel has a bunch of extra fields
that are not in the normal downloaded list of jobs. So I wanted to
depict that ``selectedJob`` is not the same thing as what you see
in the DetailsPanel.
* Stop using Redux where not necessary
I was using Redux to assign the selectedJob in a few details
classes when I should have just passed it where it was needed.
* New addAggregateFields function
Instead of using a more heavy weight JobModel for each job,
we just persist some fields that were getting constantly calculated
over and over. This was especially true during filtering and re-rendering.
* Remove some cruft leftover from Buildbot.
Bugfiler used an undocumented bugzilla api to search for
product/component pairs, and bugzilla recently moved the api endpoint,
breaking the bug filer. This patch points to the correct endpoint.
This is the second part to the Font Awesome conversion started in #4556.
After this PR, all that is left is the Perfherder parts, which can be
converted from the inline HTML style SVG+JS to using
`@fortawesome/react-fontawesome` as part of the React conversion.
Also remove all Karma support and update the docs to only mention ``Jest``.
One of the test files was testing some AngularJS filters. I converted these
tests to test the equivalent helper functions.
Wrench jobs are a job type for the standalone WebRender test suite, and
run reftests as part of the job. Having reftest-ish things like the
reftest analyzer links for these jobs is desirable.
Since it's unnecessary given that we now have the ability to import JSON
directly, and the current usage is causing ESLint warnings like:
```
warning: Illegal usage of jasmine global (jest/no-jasmine-globals) at tests/ui/unit/context/pushes.tests.jsx:15:5:
13 |
14 | beforeEach(() => {
> 15 | jasmine.getJSONFixtures().fixturesPath = 'base/tests/ui/mock';
| ^
16 |
17 | fetchMock.get(
18 | getProjectUrl('/resultset/?full=true&count=10', repoName),
```
This means the only `jasmine-jquery` feature we're now using is the
`toHaveLength` matcher, so use of `jasmine-jquery` can be dropped entirely
once the tests are migrated to Jest, which supports `toHaveLength`
natively.
Since it's more reliable (and strict) at code formatting than ESLint.
We use it via an ESLint plugin, and so disable the style-related AirBnB
preset rules, leaving the AirBnB guide to handle only correctness and
best practices rules.
It's highly encouraged to use an IDE integration or Git commit hook
to run Prettier (or `yarn lint --fix`) automatically. See:
* https://prettier.io/docs/en/editors.html
* https://prettier.io/docs/en/precommit.html
We may consider enabling a git commit hook out of the box (using eg
Husky) in the future, however they have previously been known to
interfere with partial-staging workflows, so would need to test the
fixes they have made for them thoroughly first.
In future PRs we may also want to start formatting JSON/CSS/Markdown
using Prettier too.
Neutrino controls our frontend linting, transpilation, source-maps,
testing, dev-server and optimisation of production builds.
Highlights of the upgrade are:
* Major version updates to the individual tools within (such as webpack,
Babel and ESLint), significantly improving performance, fixing
transpilation/minification correctness bugs, adding support for newer
ECMAScript features, and increasing linter coverage.
* Hot reloading in the dev server now works for all entry-points and not
just the jobs view, shortening the feedback cycle.
* Reduced bundle size due to webpack 4's tree shaking, scope hoisting,
automatic shared/vendor code chunk splitting (no need for the manually
maintained 'vendor' list).
* CSS is now extracted out of JS, which improves performance, reduces
bundle size and prevents the initial white flash of un-styled content.
* Support for dynamic imports/code splitting (needed for bug 1502192).
* Support for Jest via a new Jest preset (unblocks bug 1364045).
* Support for public class field declarations (unblocks bug 1480166).
* Improved source-maps (increases the quality of production exception
trace-backs and fixes several debugger breakpoint bugs).
* Reduced amount of custom configuration required for our fairly complex
frontend needs, reducing maintenance burden and allowing for easier
future Neutrino upgrades.
In addition this PR:
* Fixes the WhiteNoise `immutable_file_test()` regex, so that it now
correctly enables browser caching of images, fonts and source maps.
* Enables webpack-dev-server's overlay feature, which displays any
compilation errors in the browser, saving having to switch back
to the console (this can be enabled for warnings too if desired).
* Enables webpack-dev-server's automatic browser-opening feature,
which saves having to manually navigate to `localhost:5000` after
running `yarn start`.
* Switches Karma tests to run Firefox in headless mode, reducing the
workflow disruption when running `yarn test`.
* Uses the new webpack `performance` option to enable maximum asset
file size thresholds, to help prevent bundle-size regressions.
* Rewrites the `package.json` script commands so that they now work
correctly on Windows, even when setting environment variables.
Performance comparison:
* Local `yarn build`:
- Cached: 2m34s -> 23s
- Uncached: 2m34s -> 58s
* Local `yarn start`:
- Cached: 34.5s -> 13.6s
- Uncached: 34.5s -> 31.3s
* Local `yarn test`
- Cached: 61.5s -> 19.8s
- Uncached: 61.5s -> 22.0s
* Local `yarn lint`
- Cached: 3.8s -> 1.8s
- Uncached: 13.7s -> 13.4s
* Travis end-to-end time:
9 minutes -> 6 minutes
* Heroku deploy end-to-end time:
14 minutes -> 9 minutes
* Switch from using job.result_set_id to job.push_id
* Switch to using template strings for aggregateIds
* Fix notification where selected job not in push range
* Fix push status notifications(watching) to use safe React lifecycle method
* Fix some lodash _ imports to specific file imports
* Remove last usage of globalFilterChanged event
* Rename usage internal to PushJobs from "platforms" to "filteredPlatforms"
This takes what ThResultSetStore used to do and moves it to a React Context
called "Pushes.jsx" and into the "Push.jsx" component to manage
its own jobs.
This pre-emptively fixes the issues found by the newer ESLint and
ESLint plugins that come with Neutrino 9 - in order to reduce the
size of the Neutrino 9 PR.
* Remove vestigial pinboard service file
* Test cleanup: hanging commas, arrow functions, quotes, etc.
* Fix async job tests. Using .then meant they sometimes didn't
return before the test run completedand would throw a warning
AND not execute the test ``expect``.
* Fix resultset tests fetching
Some models changed to use ``fetch`` so we needed to use
``fetchMock`` instead of ``$httpBackend`` for setting expected results.
* Fix warnings in bugfiler tests: We needed to pass some dummy objects
for PropTypes that are required.
* Fix warnings in JobGroup tests: We needed to pass some dummy objects
for PropTypes that are required here, too.
This somewhat improves the accessibility of Treeherder for blind users, as a screen reader can read the title attribute, and the user doesn't need to open each log to find the status.
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
Also convert term resultState back to resultStatus
I had wanted to migrate to using "resultState" instead, as it
seemed more descriptive of what it is. But the filter params
are using "resultStatus" and it would not be worth
the effort to migrate. It doesn't really matter, but I want to be
consistent to remove confusion, so moving these terms back
to "resultStatus"-ish names.
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.
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.
After looking at these, I think I want to go back to using "th" prefix and "ph" prefix.
It is a nice way to see right off the bat that these are constants that are established
by our code and not some external library. So converting ``platformMap`` back to
``thPlatformMap``. It also makes for less code/blame churn as we move to imported
constants.
* Move thOptionOrder to constants.js
* Move thFailureResults to constants.js
* Move thRepoGroupOrder to constants.js
* Move thFavIcons to constants.js
* Move phCompareDefaultOriginalRepo to constants.js
* Move phCompareDefaultNewRepo to constants.js
* Move thDefaultRepo to constants.js
* Move thTitleSuffixLimit to constants.js
* Move phTimeRanges to constants.js
* Move thDateFormat to constants.js
* Move phDefaultTimeRangeValue to constants.js
* Move phTimeRangeValues to constants.js
* Move phBlockers to constants.js
* Move phDefaultFramework to constants.js
* Move phAlertSummaryStatusMap to constants.js
* Move phAlertSummaryIssueTrackersMap to constants.js
* Move phAlertStatusMap to constants.js
* Move thJobNavSelectors to constants.js
* Move thPerformanceBranches to constants.js
* Move phDashboardValues to dashboard.js
* Move phCompareBaseLineDefaultTimeRange to constants.js
* Move thPinboardCountError to constants.js
* Remove now-unused values.js
* Move thResultStatusFilters to constants.js
* Move thEvents to constants.js
* Move thAggregateIds to a aggregateIdHelper.js
* Move thReftestStatus to jobHelper.js
* Remove now-unused provider.js
* Don't use SERVICE_DOMAIN for references to the front-end code
* Change getRootUrl to getApiUrl to better represent what it is for
* Convert other usages of SERVICE_DOMAIN to getApiUrl
* Convert usages of SERVICE_DOMAIN to getProjectUrl
* Convert uses of SERVICE_DOMAIN to getServiceUrl
* Convert tests to use ``urlHelper``
I believe this was the main bug causing the slowdown. It was setting state
in ``filterPlatform`` which is called once per platform when a filter change is
made. But that ``setState`` was updating ALL the platforms for that push.
* Remove unnecessary clonejobs artifact
* Fix the regression with expand/collapse counts
* Very minor optimizations and cleanup
* Add some unit tests for groups
* Move JobDetailsPane to details-panel folder
* Convert to 2 space indent
* Cleanup props with deconstruction
* Subsume some filters into jobdetailspane
* Subsume logic for job signature filtering
* Subsume logic for visibleFields and visibleTimeFields
* Only need latest classification, not whole array
* Ensure all helper functions are named
* Move getBugUrl, getSlaveHealthUrl, getInspectTaskUrl, getWorkerExplorerUrl,
getLogViewerUrl, getRootUrl, getProjectUrl and getProjectJobUrl to urlHelper
* Move getJobsUrl to only place its used
* Replace thServiceDomain with SERVICE_DOMAIN
* remove thUrl provider
This converts virtually all of the CJS imports, apart from:
* the partials/plugin template loading in cache-loader - since that
is being handled in bug 1441614
* `.eslintrc.js` / `neutrino-custom/*` - since they are used by node
directly (which doesn't yet support ES6 modules) rather than via
webpack.
File extensions have been omitted for JS/JSX, otherwise eslint reports:
`Unexpected use of file extension "js" for "..." (import/extensions)`
An AngularJS module declares a dependency on another module like so:
```
const fooModule = angular.module('foo', ['name_of_dep_module']);
```
This is suboptimal, since:
a) the dependency is only validated at runtime not during the build
b) the module name often doesn't match the NPM package name, making
it hard to know whether imports are unused.
As such, many AngularJS packages now export a string containing the
module name, which allows for an ES6-like approach (it still uses
globals underneath, but better than nothing):
```
import nameOfDepModule from 'dep-module';
const fooModule = angular.module('foo', [nameOfDepModule]);
```
Just to complicate things, some modules don't export the module name,
but the actual module object itself. This can't be passed to
`angular.module()` directly, so for these modules we have to use the
`name` property on the module instead:
https://docs.angularjs.org/api/ng/type/angular.Module#name
eg:
```
import depModuleObject from 'awkward-dep-module';
const fooModule = angular.module('foo', [depModuleObject.name]);
```
In fact, the treeherder modules do just that - however its not worth
fixing, since otherwise we'd have to change every file that registers
directives/filters/values/... to fetch the module first, using
`angular.module('name-of-existing-module')`.