74 Commits

Author SHA1 Message Date
Phil Renaud
36c2439503 [ui] Tests for Sentinel Policies (#22398)
* Tests for Sentinel Policies UI

* Further sentinel tests

* job allocations test reinstated
2024-05-31 10:38:54 -04:00
hashicorp-copywrite[bot]
a9d61ea3fd Update copyright file headers to BUSL-1.1 2023-08-10 17:27:29 -05:00
hashicorp-copywrite[bot]
f005448366 [COMPLIANCE] Add Copyright and License Headers 2023-04-10 15:36:59 +00:00
Luiz Aoqui
1e84a53c1b ui: fix alloc memory stats to match CLI output (#15909) 2023-01-26 17:08:13 -05:00
Phil Renaud
fdc736488f Taskframe, not frame 2022-08-03 13:15:54 -04:00
Phil Renaud
642d5cc2aa Consolidate stats tracker consts, and add Usage to tracker test 2022-08-03 12:05:45 -04:00
Seth Hoenig
17000bad0b ui: fix bug where allocation memory usage is always zero
This PR fixes a bug where allocation memory usage is always zero on
Linux systems where the kernel is configured to use cgroups v2.
2022-08-02 17:04:02 -05:00
Luiz Aoqui
7f1b838abb ui: fix bug that prevented files streaming (#12719)
During the Ember dependecy upgrade work,
https://github.com/hashicorp/nomad/commit/ce8c039f4ce7359d60ede5dee36b9cef82
moved the `isSupported` method from using Ember's `reopenClass` to a
getter, but `reopenClass` creates a static method, so the getter must be
static as well.
2022-04-20 14:39:18 -04:00
Michael Klein
fe6cbbf078 Upgrade Ember and friends 3.28 (#12215)
* chore: upgrade forward compatible packages

* chore: v3.20.2...v3.24.0

* chore: silence string prototype extension deprecation

* refact: don't test clicking disabled button job-list

Recent test-helper upgrades will guard against clicking disabled buttons
as this is not something that real users can do. We need to change our
tests accordingly.

* fix: await async test helper `expectError`

We have to await this async test function otherwise the test's
rendering context will be torn down before we run assertions
against it.

* fix: don't try to click disabled two-step-button

Recent test-helper updates prohibit clicking disabled buttons. We need
to adapt the tests accordingly.

* fix: recommendation-accordion

Use up-to-date semantics for handling list-accordion closing
in recommendation-accordion.

* fixes toggling recommendation-accordion toggle.

* fix: simple-unless linting error application.hbs

There's no reason to use unless here - we can use if instead.

* fix: no-quoteless-attributes recommendation accordion

* fix: no-quoteless-attributes recommendation-chart

* fix: allow `unless` - global-header.hbs

This is a valid use of unless in our opinion.

* fix: allow unless in job-diff

This is not a great use for unless but we don't want to change this
behavior atm.

* fix: no-attrs-in-components list-pager

There is no need to use this.attrs in classic components. When we
will convert to glimmer we will use `@`-instead.

* fix: simple-unless job/definition

We can convert to a simple if here.

* fix: allow inline-styles stats-box component

To make linter happy.

* fix: disable no-action and no-invalid-interactive

Will be adressed in follow-up PRs.

* chore: update ember-classic-decorator to latest

* chore: upgrade ember-can to latest

* chore: upgrade ember-composable-helpers to latest

* chore: upgrade ember-concurrency

* fix: recomputation deprecation `Trigger`

schedule `do` on actions queue to work around recomputation deprecation
when triggering Trigger on `did-insert`.

* chore: upgrade ember-cli-string-helpers

* chore: upgrade ember-copy

* chore: upgrade ember-data-model-fragments

* chore: upgrade ember-deprecation-workflow

* chore: upgrade ember-inline-svg

* chore: upgrade ember-modifier

* chore: upgrade ember-truth-helpers

* chore: upgrade ember-moment & ember-cli-moment-shim

* chore: upgrade ember-power-select

* chore: upgrade ember-responsive

* chore: upgrade ember-sinon

* chore: upgrade ember-cli-mirage

For now we will stay on 2.2 - upgrades > 2.3 break the build.

* chore: upgrade 3.24.0 to 3.28.5

* fix: add missing classic decorators on adapters

* fix: missing classic decorators to serializers

* fix: don't reopen Ember.Object anymore

* fix: remove unused useNativeEvents

ember-cli-page-objects doesn't provide this method anymore

* fix: add missing attributeBindings for test-selectors

ember-test-selectors doesn't provides automatic bindings for
data-test-* attributes anymore.

* fix: classic decorator for application serializer test

* fix: remove `removeContext` from tests.

It is unneeded and ember-cli-page-objects doesn't provides
this method anymore.

* fix: remove deprecations `run.*`-invocations

* fix: `collapseWhitespace` in optimize test

* fix: make sure to load async relationship before access

* fix: dependent keys for relationship computeds

We need to add `*.isFulfilled` as dependent keys for computeds that
access async relationships.

* fix: `computed.read`-invocations use `read` instead

* chore: prettify templates

* fix: use map instead of mapBy ember-cli-page-object

Doesn't work with updated ember-cli-page-object anymore.

* fix: remove remaining deprecated `run.*`-calls

* chore: add more deprecations deprecation-workflow

* fix: `implicit-injection`-deprecation

All routes that add watchers will need to inject the store-service
as the store service is internally used in watchers.

* fix: more implicit injection deprecations

* chore: silence implicit-injection deprecation

We can tackle the deprecation when we find the time.

* fix: new linting errors after upgrade

* fix: remove merge conflicts prettierignore

* chore: upgrade to run node 12.22 when building binaries
2022-03-08 12:28:36 -05:00
Jai Bhagat
8c600acb35 ui: prettify js files 2022-01-20 09:54:56 -05:00
Jai Bhagat
d0f8322786 ui: fix auto-fixable linting errors 2022-01-20 09:46:45 -05:00
Nicholas Cioli
801a7324a3 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
Michael Lange
d9426df7af Correctly sort tasks in alloc stat tracker so the main task takes precedence 2021-03-24 15:10:46 -07:00
Michael Lange
8ae76455fb 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
Buck Doyle
e47ce42548 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
0c9b2e417b 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
Michael Lange
48f6e7ffdc Remove special-casing of Safari to force use of a PollLogger 2020-06-24 20:30:52 -07:00
Buck Doyle
e993a71f6f Add manually-converted classes
I don’t know why the codemod ignored these files 🧐
2020-06-15 10:14:26 -05:00
Buck Doyle
24eadd269c 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
11d80ae489 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
505510915b Replace XHRToken with AbortController 2020-05-21 10:35:39 -07:00
Mahmood Ali
6021ea6d25 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
a3645e2ce7 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
cad5261ec1 ui: send authentication ws handshake
Have the UI send the authentication websocket handshake message.
2020-04-03 11:49:22 -04:00
Buck Doyle
27df92a967 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
60c80696b7 Don't initialize variables before you need them 2019-12-05 10:51:51 -08:00
Michael Lange
a8f668667d Fix a race condition where a response sent after the logger stops never gets canceled 2019-12-05 00:19:35 -08:00
Buck Doyle
882a0210fe 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
bd9d73ba5d Fix a bug where tail calls for files weren't getting the correct params 2019-07-30 17:25:41 -07:00
Michael Lange
ccbe31f0d6 Always escape < and > to avoid inadvertently rendering html 2019-07-30 17:22:54 -07:00
Michael Lange
a609606901 Add a plainText mode 2019-07-30 17:22:53 -07:00
Michael Lange
07f1c89cc5 Use the stream decode util and never opt to use the plain query param 2019-07-30 17:22:45 -07:00
Michael Lange
c68962078a Replace the adapter cancellation methods with a cancellation token system 2019-05-20 10:29:22 -07:00
Conor Mongey
aa4c1288f3 Return a htmlSafe string rather than use triple curlies 2019-05-02 21:47:24 +01:00
Conor Mongey
d2323e0cb8 Converts ANSI terminal codes to HTML in logs 2019-05-02 21:47:23 +01:00
Michael Lange
f6232f1817 ES5 getters codemod 2019-04-10 14:54:36 -07:00
Michael Lange
e74873f9c1 Address the Ember.Logger deprecations 2019-04-10 14:54:35 -07:00
Michael Lange
c95821e84e Make your tests orders of magnitude faster with One Neat Trick™ 2018-11-06 16:17:21 -08:00
Michael Lange
9f98029898 Gracefully handle response errors in stat trackers
1. Check if the response is a 4xx/5xx
2. If it is, skip the append step and track a frame miss
3. If enough frame misses occur in a row, treat it as a pause

A "pause" is when a null data frame is added, which shows up as a
gap in line charts.
2018-11-01 22:08:57 -07:00
Michael Lange
4d5fa15ea7 Remove no longer used allocation-stats class 2018-09-26 10:59:26 -07:00
Michael Lange
47ec74eb3a Update stat tracker unit tests 2018-09-19 19:30:18 -07:00
Michael Lange
866f650de8 Acceptance test coverage for all the pages with resource utilization graphs 2018-09-19 16:33:51 -07:00
Michael Lange
01195a810c Unit tests for the stats trackers service 2018-09-19 15:33:29 -07:00
Michael Lange
8de545c1b7 Add cancelation support to stats trackers 2018-09-17 16:59:09 -07:00
Michael Lange
f0208c0a24 Add request throttling to the abstract stats tracker
This is the best of three options

1. Users of stats trackers control polling (old method)
2. Stat tracker is stateful and has start/stop methods (like logging)
3. Stat trackers blindly throttle requests

This is the best option because it means N number of concurrent users of
a stats tracker can request polling without inundating the tracker with
redundant frames (or the network with redundant requests), but they also
don't have to coordinate amongst themselves to determine what state a
tracker should be in.
2018-09-17 15:58:28 -07:00
Michael Lange
f84b145401 Use the appropriate methods and types in the stat trackers 2018-09-14 10:21:01 -07:00
Michael Lange
adc05976c2 Use the prototype instead of "private" property backups 2018-09-14 09:38:17 -07:00
Michael Lange
9a102b73b9 Make rollingArray work with mutable array extension methods 2018-09-14 08:57:26 -07:00
Michael Lange
48910d8334 New primary-metric component
It encapsulates all the tracker, polling, and markup for this style
of metric.
2018-09-13 17:01:24 -07:00
Michael Lange
4cd9164d4e Use addObject to get kvo behaviors 2018-09-13 17:01:24 -07:00