Commit Graph

80 Commits

Author SHA1 Message Date
Jai Bhagat e7f0cd28f3 edit fuzzy search callback logic
Namespaces are set-up in Nomad to be an object that has an id property.
However, namespaces actually don't have that shape. Our search was expecting
a namespace object, but we actually don't have a namespace assigned to jobs
in our config and namespace is set to null. Normally, these namespaces would
be set to default, but that would require us to refactor our Mirage config
if we wanted to assert that namespaces are 'default' and not null. So this is
a bandaid solution.
2021-07-26 17:25:43 -04:00
Nicholas Cioli 4d9fa38a5e
ui: add parameterized dispatch interface (#10675)
* ui: add parameterized dispatch interface

This commit adds a new interface for dispatching parameteried jobs, if
the user has the right permissions. The UI can be accessed by viewing a
parameterized job and clicking on the "Dispatch Job" button located in
the "Job Launches" section.

* fix failing lint test

* clean up dispatch and remove meta

This commit cleans up a few things that had typos and
inconsistent naming. In line with this, the custom
`meta` view was removed in favor of using the
included `AttributesTable`.

* ui: encode dispatch job payload and start adding tests

* ui: remove unused test imports

* ui: redesign job dispatch form

* ui: initial acceptance tests for dispatch job

* ui: generate parameterized job children with correct id format

* ui: fix job dispatch breadcrumb link

* ui: refactor job dispatch component into glimmer component and add form validation

* ui: remove unused CSS class

* ui: align job dispatch button

* ui: handle namespace-specific requests on job dispatch

* ui: rename payloadMissing to payloadHasError

* ui: don't re-fetch job spec on dispatch job

* ui: keep overview tab selected on job dispatch page

* ui: fix task and task-group linting

* ui: URL encode job id on dispatch job tests

* ui: fix error when job meta is null

* ui: handle job dispatch from adapter

* ui: add more tests for dispatch job page

* ui: add "job dispatch" capability check

* ui: update job dispatch from code review

Co-authored-by: Luiz Aoqui <luiz@hashicorp.com>
2021-07-20 18:27:41 -04:00
Jai Bhagat 9b756998d3 add name property back to agent schema in ember mirage
The name property had to be added back to the agent schema
in the Agent Factory because the /agent/monitor endpoint in
the config finds agents by their names and since member is not
a proper entity in our Mirage Config we can't just findBy name
of the member. So although we're following the correct schema
we're set-up to rely on this.
2021-07-11 16:09:43 -04:00
Jai Bhagat 46f8b3dc66 refactor tests that depend on Agent fixutres in Mirage 2021-07-08 08:01:15 -04:00
Jai Bhagat 2efa6cc7e4 add agent serializer
This commit adds a serializer for the Agent. When the factory was originally
designed to have the Member properities directly on the Agent class which was
not set-up properly technically, but since we didn't really make use of the
Agent endpoint.
2021-07-06 16:42:07 -04:00
Jai Bhagat b92ab047ff edit the computed agent version property
This PR edits the computed agent version that is returned upon hitting
the agent self request endpoint. The reason is because we believe that
the Agent Member Tag property sometimes returns null because we may have
cases where there are only clients and no servers and only servers are
included in the Serf Gossip Protocol. There may be other cases where we
do in fact have servers but the node is erased for some reason. We are
unsure how to replicate that issue, however.

edit mirage config

This commit updates the Mirage Config because our acceptance tests
depend on the Mirage Config, while we rely on Mirage Factories to
populate fixture data for us to use when to run the Nomad UI locally

Revert "update the open-button disability functionality depending on a job's state"

This reverts commit 5190b308a51d55a7b0617854164c155d36d7e513.
2021-06-14 13:22:36 -04:00
Buck Doyle 7b42bb0e2d
ui: Fix server list leader determination for IPv6 (#10530)
This closes #10513, thanks to @bastelfreak for the report.
GET /status/leader returns an IPv6 host with square brackets
around the IP address as expected, but the rpcAddr property
on the agent model does not.

This fixes rpcAddr, updates the Mirage /status/leader mock
to properly format an IPv6 host, and changes the agent
factory to sometimes produce IPv6 addresses.

I added a formatHost utility function to centralise the
conditional square bracket-wrapping that would have
otherwise been further scattered around.
2021-05-13 12:29:51 -05:00
Buck Doyle ef21c5f75b
Add guard against missing namespace in Mirage (#10474)
Similarly to 735f056, this won’t happen with real data,
but can happen in the current Mirage factory setup.
2021-04-30 09:18:23 -05:00
Michael Lange e8593ec1bb
ui: Update namespaces design (#10444)
This rethinks namespaces as a filter on list pages rather than a global setting.

The biggest net-new feature here is being able to select All (*) to list all jobs
or CSI volumes across namespaces.
2021-04-29 15:00:59 -05:00
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
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
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
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 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 59427662d0 Handle namespaces in the mirage handler for volumes 2020-04-03 19:28:10 -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
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
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
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 8cb6a20f8f Include all client fs endpoints in the hosts block 2019-08-07 17:34:41 -07:00
Michael Lange e84604fcdb Update factory-based fs tests to sort properly 2019-07-31 01:41:00 -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
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 8d31474fdc Support task restarting in the allocation adapter 2019-05-21 09:24:17 -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 174dc02025 Improve client stat simulation and add a chance for requests to error 2018-11-01 22:11:56 -07:00
Michael Lange f15e3ba0c2 Test coverage for NodeStatsTracker 2018-09-11 16:27:06 -07:00
Michael Lange 3c2e7b7dd3
Merge pull request #4616 from hashicorp/f-ui-promote-canary
UI: Promote canary
2018-08-30 09:48:31 -07:00
Michael Lange 62e9cf268b Test coverage for the promote canary feature 2018-08-30 09:38:29 -07:00
Michael Lange b5b4a979f9 Test coverage for the job-editor component
Most of this was ported over from the existing job run acceptance tests
2018-08-23 09:00:14 -07:00
Michael Lange 3cee992a97 Test coverage for scheduler dry-run addition to the plan page 2018-08-20 16:44:37 -07:00
Michael Lange f53fb08144 Rework job parse mirage request to get the job ID out of the payload 2018-08-16 17:22:22 -07:00