Commit Graph

68 Commits

Author SHA1 Message Date
Georges-Etienne Legendre d057025ce6
Capture ACL Token from self API call for Reverse Proxy use-case (#10563)
* Proposed fix for #10561

Signed-off-by: Georges-Etienne Legendre <legege@legege.com>

* Add acceptance tests for reverse proxy use-case

Signed-off-by: Georges-Etienne Legendre <legege@legege.com>

* Use reads instead of computed/get

Signed-off-by: Georges-Etienne Legendre <legege@legege.com>

* Move back the line closer to the task

Signed-off-by: Georges-Etienne Legendre <legege@legege.com>

* skip a11y-audit-called lint rule on reverse proxy tests

Co-authored-by: Luiz Aoqui <luiz@hashicorp.com>
2021-07-12 20:42:08 -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
Georges-Etienne Legendre 5ad8c8136a
Fix exec not working for another region (#10539)
This conditionally includes a region query parameter when
opening the exec socket.
2021-05-13 09:14:16 -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 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 e9e52e0dfe
Update Ember/Ember CLI to 3.20 (#9641)
This doesn’t include Ember Data, as we are still back on 3.12.

Most changes are deprecation updates, linting fixes, and dependencies. It can
be read commit-by-commit, though many of them are mechanical and skimmable.
For the new linting exclusions, I’ve added them to the Tech Debt list.

The decrease in test count is because linting is no longer included in ember test.

There’s a new deprecation warning in the logs that can be fixed by updating Ember
Power Select but when I tried that it caused it to render incorrectly, so I decided to
ignore it for now and address it separately.
2021-02-17 15:01:44 -06:00
Michael Lange f487562955 Don't include the region param in authorizedRequest if it's already in the URL 2021-02-01 09:54:46 -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
Michael Lange be7b0040d3 Show dismissable no live updating notice on the topology page 2020-11-04 19:25:12 -08: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 d5b54ad84c Reset the system and refetch namespaces with every token change 2020-07-10 15:18:36 -07:00
Michael Lange f786ee5eae Persist the log stream/mode setting to localStorage 2020-06-30 17:09:52 -07:00
Buck Doyle ee7141a59a
Add phase 1 of global search (#8175)
This introduces a DataCaches service so recently-updated collections don’t need
to be requeried within a minute, or based on the current route. It only searches
jobs and nodes. There are known bugs that will be addressed in upcoming PRs.
2020-06-19 13:05:28 -05:00
Buck Doyle 6efc64818b Add fixes for ESLint getter-return
…I GUESS
2020-06-10 16:18:56 -05:00
Buck Doyle 89136cbf6a Add massaged results of class codemod
Manual interventions:
• decorators on the same line for service and controller
  injections and most computed property macros
• preserving import order when possible, both per-line
  and intra-line
• moving new imports to the bottom
• removal of classic decorator for trivial cases
• conversion of init to constructor when appropriate
2020-06-10 16:18:42 -05:00
Buck Doyle 1cca7abcab
Add Ember ESLint plugin (#8134)
This is extracted from #8094, where I have run into some snags. Since
these ESLint fixes aren’t actually connected to the Ember 3.16 update
but involve changes to many files, we might as well address them
separately. Where possible I fixed the problems but in cases where
a fix seemed too involved, I added per-line or -file exceptions.
2020-06-09 16:03:28 -05:00
Buck Doyle 0b2fc7532d
UI: Remove Ember Freestyle (#7839)
This completes the migration to Storybook by replacing the colour palette and typeface components that I left out.
2020-05-06 15:11:15 -05:00
Michael Lange 9ba563c48e Always pass credential in fetch requests, but also treat options reasonably
Now options can be provided without also having to remember to pass
credentials. This is convenient for abort controller signals.
2020-04-29 17:34:49 -07:00
Mahmood Ali 23be53a366
Merge pull request #7612 from hashicorp/b-auth-alloc-exec-ws
Authenticate alloc/exec websocket requests
2020-04-06 09:24:51 -04:00
Mahmood Ali cec76a4f66 ui: send authentication ws handshake
Have the UI send the authentication websocket handshake message.
2020-04-03 11:49:22 -04:00
Michael Lange 3fc1874c0e New service for storing user settings 2020-04-02 12:50:28 -07:00
Buck Doyle 8932686aa6
UI: Fix check for Mirage presence setting up sockets (#7497)
Without this, exec UI doesn’t work at all in the binary. I made an
unfortunate error in not copying the environment check from
app/utils/fetch.js.
2020-03-25 13:23:23 -05: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 59897f9716 Handle the case where ACLs aren't enabled in abilities 2020-01-31 09:41:36 -08:00
Michael Lange 175f80da16 Fix token referencing from the token controller, as well as resetting 2020-01-31 09:41:35 -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 9b2fb14e51
UI: Update Ember to 3.12 LTS (#6419)
This is mostly deprecation fixes and blueprint changes. There
are some dependency updates too; the changes to Ember
Basic Dropdown necessitated changing it to angle bracket
component invocation. The conversion of the rest of the
templates will happen separately.
2019-10-15 13:32:58 -05:00
Michael Lange 4736803a24 ES5 getters codemod 2019-04-10 14:54:36 -07:00
Michael Lange b6b2fd2114 Address the copy/copyable deprecation 2019-04-10 14:54:35 -07:00
Michael Lange 5bfd1d0ddd Reattach resources to stats trackers in the event they were destroyed 2019-03-29 16:09:14 -07:00
Michael Lange ec21bab24d
Merge pull request #4833 from hashicorp/b-ui-gracefully-handle-stat-errors
UI: Gracefully handle stat errors
2018-11-09 14:35:48 -08:00
Michael Lange 36fed0919d Move jsonWithDefault to a util 2018-11-01 22:07:58 -07:00
Michael Lange 7cd8179637 Test coverage for breadcrumb qp change 2018-10-31 13:27:35 -07:00
Michael Lange 46936b6091 Unit tests for the stats trackers service 2018-09-19 15:33:29 -07:00
Michael Lange b7169596c1 New service to manage stats trackers
This solves two problems:

1. redundant trackers making redundant requests
2. trackers being obliterated as soon as the primary metric component
   is destroyed

It introduces a new problem where visiting more and more node and
allocation pages adds to an ever-growing list of trackers that can
assume lots of memory, but it solves the problem by using a
least-recently-used cache to limit the number of trackers tracked.
2018-09-17 15:53:59 -07:00
Michael Lange 33da5ed14f
Merge pull request #4600 from hashicorp/f-ui-job-writes
UI: Job Writes
2018-08-30 10:41:14 -07:00
Michael Lange 0eb5e61e36 Switch token storage to localStorage from sessionStorage 2018-08-28 10:05:15 -07:00
Michael Lange c81ba192dc Fix a blocking queries bug
The lowest valid blocking query index is 1, but the API will return 0 if
there has yet to be an index set (no response). This in conjunction with
that 0 being stored as a string made the "fallback to 1" guard not work.
2018-08-21 13:47:01 -07:00
Michael Lange 9f3a37f1c2 Simplify the control flow around changing namespaces and regions
The UI will no longer try to redirect to the appropriate namespace or
region if one is found in localStorage. Instead, it will assume that
the lack of query param means the default namespaces or region is
desired.
2018-08-09 18:22:39 -07:00
Michael Lange 6e2bb48fd5 Handle errors when getting regions or the default regions
This protects against volatility in the server and, more commonly, ACLs
returning forbidden responses.
2018-08-09 18:22:39 -07:00
Michael Lange 3180e57138 Only deal with the region param (in the app and in api calls) when necessary 2018-08-09 18:22:39 -07:00
Michael Lange c4c79c7a1f Get the server's region (aka default region) from the API
The default region shouldn't be used as a qp since no qp means the same
thing.
2018-08-09 18:22:38 -07:00
Michael Lange 0cfeba49d7 Add the region qp to all requests made through the token service 2018-08-09 18:22:38 -07:00
Michael Lange 93f41278b1 Clear up the data flow for namespaces
This is incredibly tricky with query params, since there is a bundle of
timing issues, lifecycle issues, missing features, and all around
gotchas with query params.

This solution has no observers and no instances of the system service
being set from the jobs controller.

The upside to this is no observers, much easier to follow logic, no more
dependent key chain reactions.
2018-08-09 18:22:38 -07:00
Michael Lange a430baba4f Harden up the system service for the event of store unloading 2018-08-09 18:22:37 -07:00
Michael Lange 2bb770361b Add three-way region property (query param, service, localStorage) 2018-08-09 18:22:37 -07:00