Commit Graph

232 Commits

Author SHA1 Message Date
Buck Doyle 6d037633da
ui: Change global search to use fuzzy search API (#10412)
This updates the UI to use the new fuzzy search API. It’s a drop-in
replacement so the / shortcut to jump to search is preserved, and
results can be cycled through and chosen via arrow keys and the
enter key.

It doesn’t use everything returned by the API:
* deployments and evaluations: these match by id, doesn’t seem like
  people would know those or benefit from quick navigation to them
* namespaces: doesn’t seem useful as they currently function
* scaling policies
* tasks: the response doesn’t include an allocation id, which means they
  can’t be navigated to in the UI without an additional query
* CSI volumes: aren’t actually returned by the API

Since there’s no API to check the server configuration and know whether
the feature has been disabled, this adds another query in
route:application#beforeModel that acts as feature detection: if the
attempt to query fails (500), the global search field is hidden.

Upon having added another query on load, I realised that beforeModel was
being triggered any time service:router#transitionTo was being called,
which happens upon navigating to a search result, for instance, because
of refreshModel being present on the region query parameter. This PR
adds a check for transition.queryParamsOnly and skips rerunning the
onload queries (token permissions check, license check, fuzzy search
feature detection).

Implementation notes:

* there are changes to unrelated tests to ignore the on-load feature
  detection query
* some lifecycle-related guards against undefined were required to
  address failures when navigating to an allocation
* the minimum search length of 2 characters is hard-coded as there’s
  currently no way to determine min_term_length in the UI
2021-04-28 13:31:05 -05:00
Buck Doyle 90ecbdf522
Add job version revert buttons (#10336)
This adds a Revert two-step button to the JobVersions component for
not-current versions, which redirects to the overview on success. It
checks the job version before and after reversion to mitigate the edge
case where reverting to an otherwise-identical version has no effect, as
discussed in #10337.

It uses existing facilities for handling other errors and disabling the
button when permissions are lacking.
2021-04-20 08:33:16 -05:00
Buck Doyle 6d67e90763
Add exchange of one-time token on UI load (#10066)
This adds UI support for receiving the one-time token passed via query parameter, as in #10134
and related PRs, and exchanging it for its corresponding secret ID. When this works, it’s mostly
invisible, with a brief flash of the OTT onscreen.

The authentication failure message now suggests the -authenticate flag.

When OTT exchange fails, it shows a whole-page error.

This includes a known UX shortcoming in that the OTT will not disappear from the URL when an
identifier is specified on the command line, like nomad ui -authenticate jobname. The goal is to
address that shortcoming in a forthcoming pull request.
2021-04-01 13:21:30 -05:00
Michael Lange ac4f173389 Tests for PrimaryMetric::Node 2021-03-24 13:52:52 -07:00
Drew Bailey befcd11579
add on update to services table in allocation details (#10153)
* add on update to services table in allocation details

* populate onupdate test data
2021-03-11 12:28:38 -05:00
Buck Doyle f462d7d1c2
Add button to fail running deployments (#9831)
This closes #8744 and #9826.

It necessitated some customisation options for TwoStepButton. One is inlineText, which puts the confirmation text in the same line as the buttons. Also, there was a single-use configuration option named isInfoAction that I removed in favour of passing a set of class configuration options like this:

                @classes={{hash
                  idleButton="is-warning"
                  confirmationMessage="inherit-color"
                  cancelButton="is-danger is-important"
                  confirmButton="is-warning"}}
2021-02-10 08:38:37 -06:00
Buck Doyle e77c685d0d
Update ember-a11y-testing (#9912)
This includes seemingly-unrelated changes because of dependency updates.
2021-02-02 12:45:40 -06:00
Michael Lange 6ba229e86c Use Hz instead of hz throughout the UI 2021-01-26 10:53:26 -08:00
Buck Doyle 543fb24764
Fix allocation count in CSI volumes table (#9515)
This closes #9495. As detailed in there, the collection query GET
/v1/volumes?type=csi doesn’t return ReadAllocs and WriteAllocs, so the #
Allocs cell was always showing 0 upon first load because it was derived
from the lengths of those arrays. This uses the heretofore-ignored
CurrentReaders and CurrentWriters values to calculate the total instead.

The single-resource query GET /v1/volume/csi%2F:id doesn’t return
CurrentReaders and CurrentWriters that absence doesn’t override the
stored values when visiting an individual item.

Thanks to @apollo13 for reporting this and to @tgross for the API logs
and suggestion.
2020-12-07 08:51:41 -06:00
Buck Doyle ba147a4fca
Add query parameter to override Mirage scenario (#9380) 2020-11-30 08:12:15 -06:00
Tim Gross 4e79ddea45
csi/api: populate ReadAllocs/WriteAllocs fields (#9377)
The API is missing values for `ReadAllocs` and `WriteAllocs` fields, resulting
in allocation claims not being populated in the web UI. These fields mirror
the fields in `nomad/structs.CSIVolume`. Returning a separate list of stubs
for read and write would be ideal, but this can't be done without either
bloating the API response with repeated full `Allocation` data, or causing a
panic in previous versions of the CLI.

The `nomad/structs` fields are persisted with nil values and are populated
during RPC, so we'll do the same in the HTTP API and populate the `ReadAllocs`
and `WriteAllocs` fields with a map of allocation IDs, but with null
values. The web UI will then create its `ReadAllocations` and
`WriteAllocations` fields by mapping from those IDs to the values in
`Allocations`, instead of flattening the map into a list.
2020-11-25 16:44:06 -05:00
Michael Lange f543137ec9 Revert "Temporarily remove poststop from the UI"
This reverts commit f8a505ea2f9def2a7ce7a93e6d0529e1b5da4894.
2020-11-12 09:16:52 -08:00
Buck Doyle 8b5b2116ec
Fix job detail crash when recommendations off (#9269)
Without this, visiting any job detail page on Nomad OSS would crash with
an error like this:

Error: Ember Data Request GET
/v1/recommendations?job=ping%F0%9F%A5%B3&namespace=default returned a
404 Payload (text/xml)

The problem was twofold.

1. The recommendation ability didn’t include anything about checking
whether the feature was present. This adds a request to
/v1/operator/license on application load to determine which features are
present and store them in the system service. The ability now looks for
'Dynamic Application Sizing' in that feature list.

2. Second, I didn’t check permissions at all in the job-fetching or job
detail templates.
2020-11-06 08:21:38 -06:00
Buck Doyle 31b4ed7a6d
Add DAS UI code from enterprise (#9192)
This is a few combined iterations on the DAS feature.
2020-10-29 07:46:42 -05:00
Michael Lange bae7002c73 Show the nomad agent version of the agent the UI is served from 2020-10-25 23:52:06 -07:00
Buck Doyle 8aacab513b
Add logged Faker seed when none is set in tests (#9140)
This will hopefully make it easier to reproduce test failures
that happen intermittently, especially in CI.
2020-10-22 13:45:51 -05:00
Michael Lange f3300bcbf0 Remove the scenarios I didn't need/didn't get to 2020-10-15 11:45:59 -07:00
Michael Lange 4f537c8511 Update scenarios to use new resources code 2020-10-15 02:54:16 -07:00
Michael Lange 64fc738733 Migrate to the new resources properties for allocs and nodes 2020-10-15 02:54:16 -07:00
Michael Lange 5b55f3c740 Medium scale topo scenario 2020-10-15 02:54:14 -07:00
Michael Lange cab4e618fc Add cluster details to the topology page 2020-10-15 02:54:13 -07:00
Michael Lange 49736aed46 Tweak topo scenario 2020-10-15 02:54:13 -07:00
Michael Lange 78ae8fd78b Fix factory bug that made it so pending allocs had no resources 2020-10-15 02:54:13 -07:00
Michael Lange f0a096119f Small cluster example scenario for the topo viz 2020-10-15 02:54:13 -07:00
Michael Lange 7604597041 Acceptance test coverage for the submit time sorting on the periodic and parameterized detail pages 2020-09-19 12:37:38 -07:00
Michael Lange 0f2fd905d8 Derive allocation Resources property from TaskResources 2020-09-04 13:46:50 -07:00
Michael Lange edd904c1c4 Allow for custom resource requirements for jobs that are recognized by allocations
The job factory will now accept an array of resourceSpecs that is a shorthand
notation for memory, cpu, disk, and iops requirements.

These specs get passed down to task groups. The task group factory will
split the resource requirements near evenly (there is variance
threshold) across all expected tasks.

Allocations then construct task-resource objects based on the resources
from the matching task.
2020-09-04 13:46:49 -07:00
Michael Lange f9864930ce Parameterize generateResources to enable property overrides 2020-09-04 13:46:35 -07:00
Michael Lange fc31f80880 Temporarily remove poststop from the UI
Since poststart and poststop are shipping separately, we can't ship them
both in the UI at the same time.
2020-08-31 19:32:38 -07:00
Buck Doyle 7ed43b0332
Merge branch 'master' into f-ui/poststart-poststop 2020-08-28 10:15:18 -05:00
Michael Lange 25bb975749 Clean up erroneous and redundant mirage things 2020-08-27 17:58:24 -07:00
Buck Doyle de3504a738 Add poststart and poststop lifecycle phases 2020-08-26 09:55:42 -05:00
Nick Ethier 3cd5f46613
Update UI to use new allocated ports fields (#8631)
* nomad: canonicalize alloc shared resources to populate ports

* ui: network ports

* ui: remove unused task network references and update tests with new shared ports model

* ui: lint

* ui: revert auto formatting

* ui: remove unused page objects

* structs: remove unrelated test from bad conflict resolution

* ui: formatting
2020-08-20 11:07:13 -04:00
Michael Lange 39583e0ce1 Force mock error scale events to be annotations 2020-08-05 12:02:22 -07:00
Michael Lange 4b7f431981 Acceptance tests for scaling events 2020-07-29 19:07:24 -07:00
Michael Lange 8a995a0db8 Make scale event properties more conditional and serialized correctly 2020-07-29 19:07:24 -07:00
Michael Lange 765077eb03 Model job scaling and events in Mirage 2020-07-29 19:07:24 -07:00
Michael Lange ac056b14db
Merge pull request #8218 from hashicorp/b-ui/plugin-allocation-healthy-flakiness
UI: Add cycling to factory healthy flags
2020-06-19 14:39:47 -07:00
Buck Doyle 0dd9ffdab3 Add cycling to factory healthy flags
This is meant to address the plugin test failure seen here:
https://app.circleci.com/pipelines/github/hashicorp/nomad/10015/workflows/ace5d615-db03-4cfc-86b2-31e9e00473ec/jobs/77014/tests

I believe the problem was that on rare occasions, the set
of mock storage controllers and nodes were all unhealthy,
so the facet test had no rows to iterate through. Since
there are always three of each, this guarantees some
healthy ones will be present.
2020-06-19 15:43:32 -05:00
Michael Lange 689dd92aa8 Mirage updates for task group scaling and scaling post endpoint 2020-06-18 22:08:28 -07:00
Michael Lange c62db754a3 Server monitor page 2020-06-16 10:23:36 -07:00
Michael Lange c080def72e Test coverage for the client monitor page 2020-06-16 10:23:36 -07:00
Buck Doyle 9c0f85d7b6
UI: add filesystem browsing for allocations (#7951)
This partially addresses #7799.

Task state filesystems are contained within a subdirectory of their
parent allocation, so almost everything that existed for browsing task
state filesystems was applicable to browsing allocations, just without
the task name prepended to the path. I aimed to push this differential
handling into as few contained places as possible.

The tests also have significant overlap, so this includes an extracted
behavior to run the same tests for allocations and task states.
2020-06-01 08:15:59 -05:00
Michael Lange 388bb138c2 Always lower case headers now 2020-05-21 10:35:40 -07:00
Michael Lange 22cc9bec74 Work around a mirage bug 2020-05-18 17:23:55 -07:00
Michael Lange eabac917f1 Test coverage for the node-only change to the list view 2020-05-18 15:30:00 -07:00
Michael Lange ee2d1eeb39 Introduce shallow to plugin factories to speed up tests 2020-05-07 17:29:42 -07:00
Michael Lange 11a42b6075 Acceptance test for PluginDetail 2020-05-06 17:36:45 -07:00
Michael Lange 517db723cd Sort allocations on the plugin detail page 2020-05-06 17:21:49 -07:00
Michael Lange 210f6cdb00 Update storage controller mirage code to accommodate EDMF's lack of relationships 2020-05-06 17:21:46 -07:00
Michael Lange ffcaef6b22 Model out the rest of the CSI Plugin properties 2020-05-06 17:21:44 -07:00
Michael Lange 034eeb1ddb
Merge pull request #7855 from hashicorp/b-ui/alloc-wrong-reserved-resources
UI: Make allocation reference own task group instead of job's task group when job versions don't match
2020-05-06 10:08:37 -07:00
Michael Lange 91b97e0170 Stabilize job and allocation job versions in fixtures 2020-05-01 14:29:24 -07:00
Jasmine Dahilig a9004faa11
UI: Add representations for task lifecycles (#7659)
This adds details about task lifecycles to allocations, task groups,
and tasks. It includes a live-updating timeline-like chart on allocations.
2020-04-30 08:15:19 -05:00
Michael Lange e8e41c5757 Acceptance tests for the volumes list page 2020-04-03 19:28:12 -07:00
Michael Lange 59427662d0 Handle namespaces in the mirage handler for volumes 2020-04-03 19:28:10 -07:00
Michael Lange 01341530e7 Add a volume facet to the clients list page 2020-03-30 17:33:44 -07:00
Michael Lange 1bd6a69067
UI: Support for CSI (#7446)
Closes #7197 #7199

Note: Test coverage is limited to adapter and serializer unit tests. All
acceptance tests have been stubbed and all features have been manually
tested end-to-end.

This represents Phase 1 of #6993 which is the core workflow of CSI in
the UI. It includes a couple new pages for viewing all external volumes
as well as the allocations associated with each. It also updates
existing volume related views on job and allocation pages to handle both
Host Volumes and CSI Volumes.
2020-03-25 07:51:26 -05:00
Buck Doyle 674da96a59
UI: add exec terminal (#6697)
This connects Xterm.js to a Nomad exec websocket so people
can interact on clients via live sessions. There are buttons on
job, allocation, task group, and task detail pages that open a
popup that lets them edit their shell command and start a
session.

More is to come, as recorded in issues.
2020-03-24 18:22:16 -05:00
Michael Lange 44a961f4f8 Test coverage for the task detail volumes table 2020-02-13 17:11:35 -08:00
Michael Lange 895d74c503 Test coverage for change in resource rows 2020-02-13 17:11:30 -08:00
Michael Lange c0f1aff963 Fix flaky host volumes test 2020-02-13 17:11:28 -08:00
Michael Lange 18cf59b22f Test coverage for the host volumes table 2020-02-13 17:11:25 -08:00
Michael Lange 0f41bfafad Update existing tests 2020-01-23 16:34:33 -08:00
Michael Lange bfa34d5273 Update the underlying node model when toggling eligibility in mirage 2020-01-23 16:34:12 -08:00
Michael Lange 85066eee07 Mock the drain endpoint 2020-01-23 16:34:08 -08:00
Michael Lange 94955c8b08 Mock the eligibility endpoint in mirage 2020-01-23 16:34:06 -08:00
Buck Doyle 66ab14144a
ui: Change Run Job availability based on ACLs (#5944)
This builds on API changes in #6017 and #6021 to conditionally turn off the
“Run Job” button based on the current token’s capabilities, or the capabilities
of the anonymous policy if no token is present.

If you try to visit the job-run route directly, it redirects to the job list.
2020-01-20 14:57:01 -06:00
Buck Doyle 5da134d074
UI: Change Mirage data to be stable in development (#6389)
This sets a default-but-query-configurable Faker seed in development,
via faker-seed. It also changes uses of Math.random to use Faker’s
randomness so auto-generated data remains stable in development.
2019-10-03 09:13:08 -05:00
Buck Doyle 75aa2e36ee
UI: Change factories to be more dynamic (#6387)
I noticed while working on #6166 that some of the factory properties
that used Faker’s randomisation features are using their output
rather than a function that would call the randomiser. This means that
the randomisation happens once and the value is used for every model
generated by the factory. This wraps the randomiser calls in functions
so different models can have different values.
2019-09-30 09:44:22 -05:00
Buck Doyle 8950626c55
UI: Update Mirage to 1.1.2 (#6166) 2019-09-26 13:47:07 -05:00
Mahmood Ali 16f7a3f31b ui: protect against nil services
Protect against case where an alloc has no services and avoid
dereferencing null.

Here, we ensure that the model and test serializers mimic the API by
having nil TaskGroup.Services instead of an empty array.
2019-09-16 16:50:30 -04:00
Buck Doyle b5e5798e54
UI: add Consul Connect features (#6108) 2019-09-04 09:39:56 -05:00
Buck Doyle 49b9dd5b9b
UI: Add creation time to evaluations table (#6050) 2019-08-22 08:11:24 -05:00
Michael Lange 74c9b1ac60
Merge pull request #5871 from hashicorp/f-ui/alloc-fs
UI: Allocation file system explorer
2019-08-20 10:18:23 -07:00
Michael Lange 1e620953e4 Remove the temporary allocationFileExplorer mirage scenario 2019-08-20 09:40:49 -07:00
Buck Doyle ed652051d4
Add ability to control Mirage logging via query (#6105)
This lets us turn Mirage logging on without editing any
files, which makes it easier to switch between branches.
2019-08-20 08:36:08 -05:00
Michael Lange 836e7426b8 Encode characters in file paths to ensure proper URIs 2019-08-14 12:54:11 -07:00
Michael Lange 8cb6a20f8f Include all client fs endpoints in the hosts block 2019-08-07 17:34:41 -07:00
Michael Lange 02c9ab1582 Add additional troublesome characters to the alloc-file name factory 2019-08-07 15:29:57 -07:00
Michael Lange e84604fcdb Update factory-based fs tests to sort properly 2019-07-31 01:41:00 -07:00
Michael Lange 6f519c9037 Add file mocks to every mirage scenario 2019-07-30 17:25:50 -07:00
Michael Lange e347d76c24 Refactor existing fs tests to use new mirage factories 2019-07-30 17:25:46 -07:00
Michael Lange 6325c78b1e cat, stream, and readat mocks for alloc fs 2019-07-30 17:25:44 -07:00
Michael Lange e6d1314254 Use the alloc file factory for the fs stat and fs ls end points 2019-07-30 17:25:43 -07:00
Michael Lange c8977c18ba Mirage factory for file system fixtures 2019-07-30 17:25:42 -07:00
Buck Doyle 595eb480ba
UI: Add allocation directory rendering (#5873)
This lets users navigate the allocation filesystem. It doesn’t
support viewing actual files yet.
2019-07-02 16:42:38 -05:00
Michael Lange af6daf34d2 Give the allTheThings scenario a better name 2019-06-19 17:18:43 -07:00
Michael Lange 6201003f3f New Mirage scenario for puppeteer script to use 2019-06-19 17:18:40 -07:00
Michael Lange 8d31474fdc Support task restarting in the allocation adapter 2019-05-21 09:24:17 -07:00
Michael Lange 000bfce30f Add preemption properties to Mirage allocation factory 2019-04-22 16:40:07 -07:00
Michael Lange 6988dc1b5c Introduce the concept of 'shallow' job models in Mirage 2019-04-11 20:08:09 -07:00
Michael Lange 243adeb165 Reduce the number of task groups and task events that are made 2019-04-11 18:15:35 -07:00
Michael Lange fa90590462 Update everything to work with the mirage backwards incompat 2019-04-10 14:54:37 -07:00
Michael Lange b6b2fd2114 Address the copy/copyable deprecation 2019-04-10 14:54:35 -07:00
Michael Lange 4464c473e5
Add nodeClass to the node model 2019-04-10 10:34:10 -05:00
Michael Lange aa0cbadb30 Improve mirage modeling of allocations
Pending allocations never have tasks
2018-11-09 17:11:47 -08:00
Michael Lange 4e21366714
Merge pull request #4852 from hashicorp/b-ui-dispatched-job-page
UI: Show the correct template for dispatched jobs
2018-11-09 14:36:35 -08:00
Michael Lange 8e18903996 Show the correct template for parameterized job children 2018-11-07 21:04:27 -08:00
Michael Lange 5057574c69 Correctly mark parameterized children as parameterized: true 2018-11-07 17:07:40 -08:00