Commit Graph

136 Commits

Author SHA1 Message Date
Jai Bhagat 52cf998e2c ui: fix remaining linting errors 2022-01-20 10:39:02 -05:00
Jai Bhagat 3a9057a89c ui: prettify js files 2022-01-20 09:54:56 -05:00
Jai Bhagat 645db53775 ui: disable linting on files that use controllerFor 2022-01-20 09:46:49 -05:00
Jai Bhagat c4bc5ab352 ui: fix auto-fixable linting errors 2022-01-20 09:46:45 -05:00
Luiz Aoqui c7ae13a1f3
Fix ACL requirements for job details UI (#11672) 2022-01-12 21:26:02 -05:00
Jai Bhagat e957e5b7d7 feat: create trigger component
Create Trigger Component and deprecate Breadcrumb-Utils pattern.
2021-12-21 07:46:25 -05:00
Jai Bhagat 346c436a6e fix: delete state from routes and move to controllers and add renderless component to templates 2021-12-21 07:45:12 -05:00
Luiz Aoqui 2288f33e38
ui: fix tests broken by d3-format upgrade 2021-11-05 18:09:13 -04:00
Jai 563d609118
System Batch UI, Client Status Bar Chart and Client Tab page view (#11078) 2021-10-07 17:11:38 -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
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
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 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 b6af7a31e2 Aggregate the BANs in the cluster details panel 2021-03-31 09:29:14 -07:00
Michael Lange a0e59f81ab Use common helpers and utils for formatting hertz 2021-03-31 09:29:14 -07:00
Michael Lange 2a614b18a2 Add startingUnit option to the unit formatting utils 2021-03-31 09:29:02 -07:00
Michael Lange 285c9a9b50 Refactor formatBytes helper to use core units util 2021-03-31 09:29:01 -07:00
Michael Lange f6a377cd12 Units utils
Consolidates all the bytes and hertz units logic in one place.
2021-03-31 09:29:01 -07:00
Michael Lange 4f51a55293 Correctly sort tasks in alloc stat tracker so the main task takes precedence 2021-03-24 15:10:46 -07:00
Michael Lange 3c51105a85 Stacked percentages of tasks for alloc charts
This leverages the existing pre-processing being done in the
allocation-stats-tracker to also create additive percentages relative to
the allocation resources vs. the task resources.

This can then be used in a chart to create a stacked area representation
of consumption.
2021-03-24 13:52:51 -07:00
Michael Lange 9a430651c4 Move new glimmer style string to its own home 2021-02-23 10:18:58 -08:00
Michael Lange ce8b9c42f2 New computed property: uniquely
Wraps up a common pattern used in charts for building a a string that
incorporates the ember guid
2021-02-23 10:18:57 -08: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
Buck Doyle e3392b7da8
Fix exec escaping for emoji task name (#7813)
This closes #7459.

While emoji don’t actually need escaping, expanding the
expression that enumerates all task name characters that
don’t need escaping to include emoji is prohibitive, since
it’s a discontinuous range. The emoji-regex project has
such an expression and it’s 12kB.

This fixes the regular expression to property escape emoji
as a single character instead of as its component bytes.
Thanks to @DingoEatingFuzz for the suggestion.
2021-02-09 09:33:48 -06:00
Buck Doyle 099162a55c
Change exec URLs to use job’s namespace/region (#9968)
This closes #9966. It was looking at the query parameters
for the namespace and region, but allocation (and task!)
routes don’t have a namespace query parameter. Since the URL
generator requires the job for all calls, it makes sense to
extract the namespace and region from the job instead.
2021-02-04 13:14:15 -06:00
Michael Lange 320a63dc68 Improve the message-from-adapter-error util
Automatically detect ACL errors
Provide a generic error message as a fallback
2021-01-28 12:18:52 -08:00
Michael Lange 654533229c Make the style-string property glimmer safe 2020-10-30 16:14:31 -07: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
Buck Doyle 517bc3c17b
Change htmlSafe prototype calls to imports (#9075) 2020-10-13 11:50:28 -05:00
Buck Doyle 7ea8dcc799
Add handling for allocation-less exec URL (#8856)
This closes #8769. This new-window-opening code is not possible
to properly exercise within Ember’s testing facilities 😞
2020-09-15 14:48:29 -05:00
Buck Doyle eadb91e734
Add exec heartbeat keepalive (#8759)
This closes #8727, thanks to @jfcantu for the suggestion.
The CLI implementation of exec already has a 10-second
heartbeat so this mirrors that:
https://github.com/hashicorp/nomad/blob/v0.12.3/api/allocations.go#L161-L173
2020-08-28 10:13:33 -05:00
Buck Doyle 7f0177548d
Add specificity to exec allocation URL generation (#8463)
Thanks to @notnoop for this UX improvement suggestion.
The allocation’s task group is always known, so it
might as well be preselected in the sidebar when the
exec window opens. Also, if the task group only has
one task, might as well preselect it too.
2020-07-20 16:07:39 -05:00
Michael Lange 3182adeefa Remove special-casing of Safari to force use of a PollLogger 2020-06-24 20:30:52 -07:00
Michael Lange 57f4e9a62e Create new AbortController with each tick of the ec task loops
This was a disturbing discovery. Requests in watch loops would recycle
AbortControllers meaning once any request was aborted, all requests
forever after were skipped. I noticed it with deployments and job
summary on the job detail page.

I suspect this regression occurred when jQuery was removed. This needs
test coverage still to make sure it doesn't happen again.
2020-06-18 22:08:27 -07:00
Buck Doyle cd11cd290c Add manually-converted classes
I don’t know why the codemod ignored these files 🧐
2020-06-15 10:14:26 -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
Michael Lange de73b9539d Replace XHRToken with AbortController 2020-05-21 10:35:39 -07:00
Michael Lange fb48f3de39
Merge pull request #7971 from hashicorp/b-ui/plugin-extend-watchable
UI: Make the Plugin adapter extend Watchable
2020-05-15 09:15:59 -07:00
Michael Lange 9de6165510 Protect against making watch requests using adapters that don't extend Watchable 2020-05-14 14:36:38 -07:00
Buck Doyle 588164ef44
Change exec URL-generation to use Ember get (#7963)
This fixes a bug in #7815 where you can’t open an exec window from
the allocation overview because accessing `allocation.job.plainId`
fails across the proxied relationship.
2020-05-14 14:09:09 -05:00
Buck Doyle d4708860f0
UI: Fix exec popup link for job id ≠ name (#7815)
This closes #7814. It makes URL-generation more central and changes
the exec URL to include job id instead of name.
2020-04-29 07:54:04 -05: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
Buck Doyle fbe40a5d36
UI: add handling for exec command-editing keys (#7601)
This is a minimal implementation that closes #7463. It doesn’t include
true support for moving around within the command to edit using arrow
keys because it gets too complex when managing wrapping at the edge of
the terminal. Instead, arrow keys are ignored. It also ignores ^A and
^E, which are cursor manipulations that pose similar problems to arrow
keys. It does support ^U, which deletes the entire command.

It also allows a command to be pasted, which was previously unsupported.
This is accomplished by migrating from Xterm.js’s onKey handler to
onData, which is recommended here:
https://github.com/xtermjs/xterm.js/issues/2673#issuecomment-574897733

onData is a higher-level handler that issues events with the final
interpreted data instead of the individual key events. That means the
processing in this PR has changed from inspecting DOM key events to
inspecting their ASCII equivalents, which I’ve extracted into a utility
dictionary for use in tests and implementation.

One consequence of ignoring most control characters is that if you paste
a string that includes a control character, that character will be
stripped. It’s somewhat strange for compound sequences like arrow keys; 
if you run copy('/bin/b' + '\x1b[D' + 'ash') in a Javascript console and
paste what’s on the clipboard, you get "/bin/b[Dash". That’s because
the left arrow key, as in that centre portion of the string,
is represented by the escape character and a coded sequence. Stripping
the control character leaves the coded sequence as part of the paste.
That seems like an acceptable compromise vs either ignoring any pasted
string with control characters (confusing UX) or trying to interpret and
strip all such compound control sequences (difficult to be exhaustive).
2020-04-03 12:14:47 -05: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 fdd2f8df37 Use new text encoder for stream frames
This pattern was introduced with Exec and fixes the multibyte encoding
issue that the native window.atob has.
2020-03-30 12:50:43 -07:00
Michael Lange 2711eb032c
Merge pull request #7470 from kybin/kybin-patch-1
UI: decode unicode properly in log page
2020-03-30 12:06:51 -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
kim yongbin 4378db612b
UI: decode unicode properly in log page 2020-03-25 01:03:39 +09:00