Commit graph

2063 commits

Author SHA1 Message Date
Phil Renaud 6ce04ad214 Consolidate stats tracker consts, and add Usage to tracker test 2022-08-03 12:05:45 -04:00
Phil Renaud f153aea726 Temporary CI test to see missing state 2022-08-03 11:23:28 -04:00
Seth Hoenig 103a21c880 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
Jai 13bf88fdf7
refact: default dropdown option based on model (#13969) 2022-08-02 13:23:09 -04:00
Jai e9273cafed
add namespace to path matching algorithm (#13948)
* refact:  namespace should be bound property

* chore: pass bound namespace property in template

* chore: update tests to account for bound namespace refactoring

* test: add test coverage for factoring namespace in path matching algo
2022-08-01 15:33:47 -04:00
Jai 7d90d22956
ui: add namespace filter to variables.index (#13618)
* ui: add namespace filter feature

ui:  add namespace filtering to variables.index

test:  namespace filter

refact:  fix action in template

ui:  move data fetching and query param logic to

ui:  controller query parameter logic

ui:  prevent  from forwarding query param

ui:  create variables controller

refact:  use dependency injection for controlling parent qp

chore: clean-up reset in  route

chore:  clean-up reset in  route

* ui:  add namespace filter to secure var form (#13629)

ui:  update variable factory to accept namespaces

refact:  update  api to accept disabled

ui:  add namespace setting logic to form

refact:  remove debugger

refact:  get correct selectors for

ui:  move data loading to namespace-filter component

chore:  prettify template

ui: update factory to handle namespace setting

refact:  remove inline styling for grid class

* ui:  fix placement of filter in `SecureVariablesForm` (#13762)

* refact:  conditionally render css class

* chore:  remove unused CSS property

* refact:  edit path-input class to prevent textarea override

* refact:  inject missing store service (#13763)

* chore:  patch fixes for when no default namespace is available (#13782)

* test:  add tests for namespace filtering conditions (#13816)

* test:  add tests for namespace filtering and namespaces appearing in form

* patch namespace related issue to saving and querying (#13825)

* refact:  use namespace id, not entity

* refact:  update adapter to edit request to include qp

* ui: early exit if no snapshot

* refact:  test passes wrong interface to method

* chore:  add missing url update URL builder

* refact:  model in  doesn't have absolutePath

* Align error message

* chore:  update tests (#13905)

* chore:  patch brittle tests with better selectors

* chore:  update assertion count

Co-authored-by: Phil Renaud <phil@riotindustries.com>
2022-07-22 16:05:35 -04:00
Phil Renaud 301c6e57f5
Add a title to the evals route (#13865) 2022-07-20 13:28:06 -04:00
Phil Renaud ab7de3886c
Reorder the select boxes on evals so namespaces are first (#13866)
* Reorder the select boxes on evals so namespaces are first

* Wrap evals buttons in a button-bar for consistent styling and spacing
2022-07-20 13:27:58 -04:00
Phil Renaud 0982ad1079
Change path-linked-variables to start with nomad/jobs/, instead of jobs/ (#13862)
* Support pathLinkedEntities starting with nomad/jobs/ instead of jobs/

* links from jobs/groups/tasks to variables now look for nomad/jobs/ instead of jobs/

* Tests updated to reflect nomad/jobs/ change

* Acceptance test for disallowing nomad/foo/, and hint text updates

* Defensive logic in case path not yet set

* Allow exactly nomad/jobs as a variable path
2022-07-20 12:19:01 -04:00
dependabot[bot] da3470733c
build(deps): bump @percy/cli from 1.1.0 to 1.6.1 in /ui (#13724)
Bumps [@percy/cli](https://github.com/percy/cli/tree/HEAD/packages/cli) from 1.1.0 to 1.6.1.
- [Release notes](https://github.com/percy/cli/releases)
- [Commits](https://github.com/percy/cli/commits/v1.6.1/packages/cli)

---
updated-dependencies:
- dependency-name: "@percy/cli"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-07-19 14:09:11 -04:00
Phil Renaud e9ac38c93b
Prettier-applied lint rules for secure variables test (#13841) 2022-07-19 09:33:53 -04:00
Phil Renaud b6f32386aa
Visual Diff tests for Secure Variables (#13689)
* A smattering of snapshot tests for Secure Variables

* Percy imports and linting
2022-07-18 17:00:45 -04:00
Phil Renaud 29af6c6ea0
13553 secure vars linked from jobs (#13708)
* Vars from job prototype

* singular linked variable from job

* Links from task groups and tasks to their variables incl periodic and parameterized

* Lintfix

* Make sure they can list em before we list em

* Tests from job/group/task to var
2022-07-13 11:40:13 -04:00
Phil Renaud 59c12fc758
Remove namespace cache (#13679) 2022-07-11 18:06:18 -04:00
Phil Renaud aa2aa9891f
Adds sort, show/hide, and copy functionality to Variable pages (#13680)
* Sortable header added to variable page

* Showhide and copyable
2022-07-11 16:43:03 -04:00
Phil Renaud e9219a1ae0
Allow wildcard for Evaluations API (#13530)
* Failing test and TODO for wildcard

* Alias the namespace query parameter for Evals

* eval: fix list when using ACLs and * namespace

Apply the same verification process as in job, allocs and scaling
policy list endpoints to handle the eval list when using an ACL token
with limited namespace support but querying using the `*` wildcard
namespace.

* changelog: add entry for #13530

* ui: set namespace when querying eval

Evals have a unique UUID as ID, but when querying them the Nomad API
still expects a namespace query param, otherwise it assumes `default`.

Co-authored-by: Luiz Aoqui <luiz@hashicorp.com>
2022-07-11 16:42:17 -04:00
Phil Renaud 8ea97f267b Link Variables to Jobs (#13627)
* Related entities scaffolded

* Added hint on edit

* Re-classic'd

* Dont create entities when path goes beyond task level

* only show the related entities hint for new vars, not edited ones

* Unit tests for pathLinkedEntities

* Acceptance tests for linked entities

* Add hint on creation

* Will be vs Is on @new boolean flag

* Link styles and namespaces on links

* Unused component class

* Delog

* Defensive shouldShowLinked

* Properly instantiating the accessibilty check test
2022-07-11 13:34:06 -04:00
Phil Renaud 837c693b73 Handling createTime and modifyTime through serialization now that they contain nanoseconds (#13620) 2022-07-11 13:34:06 -04:00
Jai b81adc6f69 ui: create variable permission logic (#13447)
* ui:  inject router service into Variable ability to compute path

* ui:  test create secure variable ability

* refact:  update templates to properly check create ability

* chore:  update token factory to enable 1 path to have create ability

* refact:  remove router service injection for path variable

* refact:  update mirage factory for edit and delete perms on  path for testing

* ui:  handle path matching (#13474)

* test:  write specifications for nearestPath computation

* ui:  write logic for getting all paths

* ui:  nearestPathMatching algorithm

* test:  nearestPathMatching algorithm test

* ui:  handle namespace filtering for capabilities check (#13475)

* ui: add namespace handling

* refact:  add logical OR operator to handle unstructured  object.

* ui:  acceptance test for create flow in secure variables (#13500)

* test:  write happy path test for creating variable

* refact:  add missing data-test attributes

* test:  sad path for disabled button

* fix:  move comment in  file

* test:  acceptance test for editing a variable (#13529)

* refact:  add data-test variable

* test:  happy path and sad path for edit flow

* refact:  update test language to say disabled

* ui:  glob matching algorithm (#13533)

* ui: compute length difference (#13542)

* ui: compute length difference

* refact:  use glob matching and sorting algos in `nearestMatchingPath` (#13544)

* refact:  use const in compute

* ui:  smallest difference logic

* refact:  use glob matching and sorting algo in _nearestPathPath helper

* ui:  add can edit to variable capabilities (#13545)

* ui:  create edit capabilities getter

* ui:  add ember-can check for edit button

* refact:  update test to mock edit capabilities in policy

* fix:  remove unused var

* Edit capabilities for variables depend on Create

Co-authored-by: Phil Renaud <phil@riotindustries.com>

Co-authored-by: Phil Renaud <phil@riotindustries.com>

Co-authored-by: Phil Renaud <phil@riotindustries.com>

* refact:  update token factory (#13596)

* refact:  update rulesJSON in token factory to reflect schema update

* refact:  update capability names (#13597)

* refact:  update rules to match rulesJSON

* refact:  update create to write

* ui:  add `canDestroy` permissions (#13598)

* refact:  update rulesJSON in token factory to reflect schema update

* refact:  update rules to match rulesJSON

* refact:  update create to write

* ui:  add canDestroy capability

* test:  unit test for canDestroy

* ui:  add permission check to template

* test:  acceptance test for delete flow

* refact:  update test to use correct capability name

* refact:  update tests to reflect rulesJSON schema change

* ui:  update path matching logic to account for schema change (#13605)

* refact:  update path matching logic

* refact:  update tests to reflect rulesJSON change

Co-authored-by: Phil Renaud <phil@riotindustries.com>

Co-authored-by: Phil Renaud <phil@riotindustries.com>
2022-07-11 13:34:06 -04:00
Phil Renaud c8455d34d4 Edit Secure Variables as JSON (#13461)
* Toying with insert and update helpers before translation func

* Working prototype that lets you switch between json and tabular

* No longer add the bonus items row in json mode

* Trimmed the ivy from the codemirror (#13503)

* Trimmed the ivy from the codemirror

* editedJSONItems removal

* De-debugger

* Replaced other instances of IvyCodeMirror throughout the app (#13528)

* Replaced other instances of IvyCodeMirror throughout the app

* PR requests for codemirror modifier

* Screen reader setting as param

* Trying a simpler codemirror test helper

* Lint removal

* Screen Reader Label added for a11y

* JSONViewer cleanup

* JSON editor added to /new and all variables stringified before save or translate

* Give users a foothold when editing an empty item in JSON mode

* Copy the empty KV

* No duplicate keys in KV

* Better handling of cursor snapping in json edit field

* Catch formatting errors on the fly

* Basic tests for JSON to Table and Table to JSON in form
2022-07-11 13:34:06 -04:00
Phil Renaud 9043512f03 Secure Variables: JSON view (#13439)
* JSON view init

* Overeager config history reverted

* Set as query parameter

* border added to copy button

* More robust stringifyObject helper

* Testing for stringify-object helper
2022-07-11 13:34:06 -04:00
Jai b2d703b53c dx: update canCreate logic and token generation for secure var dev environment (#13438)
* ui:  add logic for create permission computed property

* ui:  update token factory and variable ability to simulate create permissions for dev env
2022-07-11 13:34:06 -04:00
Phil Renaud 7ddbd36443 Append an empty item when editing an existing Secure Variable (#13436)
* Did-insert modifier to add an extra row when editing

* Defensive logic on model existing

* Defensive pattern on copy keyValues
2022-07-11 13:34:06 -04:00
Phil Renaud 7de6301054 Throw an error if you try to save a Secure Variable with no items (#13424)
* Error thrown if you have no KVs on save

* Acceptance tests for flash messages and no-key-value adds

* Post-hoc accounting for new variable path routing

* Trim on key before validating it as existing
2022-07-11 13:34:06 -04:00
Phil Renaud 4a8463595b Secure Variables: show file metadata on list pages (#13423)
* Add modified times and namespaces to layout

* Undo typing change

* Post-hoc accounting for new variable path routing
2022-07-11 13:34:06 -04:00
Jai 48679fdf99 ui: make eye toggles only toggle on/off for their respective row (#13406)
* chore:  update tests to handle invidual toggle responsibility

* chore:  prettify secure-variable-form template

* ui:  extract input group markup into seperate component
2022-07-11 13:34:05 -04:00
Jai 9f02c23e2f ui: update component api to accept callback fns to be fired on cancel/prompt (#13414)
* ui:  update  component api to accept callback fns to be fired on cancel/prompt

* refact:  cancel callback should fire with outside click handler not on idle

* refact:  rename action to be more specific
2022-07-11 13:34:05 -04:00
Phil Renaud 9e9ad106ba Toast-style global notification state (#13341)
* toast style notification init

* Notificatino styles and messaging for variable save

* pre-PR cleanup

* Typo fix and 5sec timeout

* Prevent text from overlapping the close button
2022-07-11 13:34:05 -04:00
Phil Renaud 4c58356af1 Path Tree compaction refactor (#13415)
* Bones of a just-in-time compaction pathTree

* wooo got compaction going in sub-ms times

* PR cleanup

* Path compaction tests

* lint fix to equal instead of .ok()

* Name prop specifically being equality checked
2022-07-11 13:34:05 -04:00
Phil Renaud 7eb462454b Secure Variables form validation improvements (#13335)
* Validation tests for secure variables form: duplicate path error

* Validation for dot in key name

* Defensive pattern on copy keyValues
2022-07-11 13:34:05 -04:00
Phil Renaud 311d9d1cda variable index header and deletion hook (#13302)
* variable index header and deletion hook

* Some visual improvements to edit header and back button

* Mirage fixtures for variables

* Deletion flow test

* Account for disabled state of add-more button

* Transition destination changes after design chat

* Simplified parent folder path by adding to variable model

* Lint cleanup

* test update to reflect path redirect on delete

* No longer have to re-traverse to a deleted var folder after deletion, tests updated
2022-07-11 13:34:05 -04:00
Phil Renaud e79fea2b4e Notify a user if they try to make a variable with an existing path (#13278)
* Notify a user if they try to make a variable with an existing path

* Stylize error fade

* Bugfix: if you click the dupe link to a variable you havent previously loaded, you lack its keyvalues

* rename and typefix for duplicate path warning
2022-07-11 13:34:04 -04:00
Phil Renaud e58999d62b Disable path input when model is not new (#13273)
* Disable path input when model is not new

* isDisabled tests for secure variables path
2022-07-11 13:34:04 -04:00
Phil Renaud da4cb6422e Secure Variables: Build a path tree and traverse it at /variables/*path (#13202)
* Recursive trie-building with variable paths

* tree structure applied to new path routes and a new util class

* Breadcrumbs for SV paths and prompt when nothing exists at a path

* Lint and test cleanup

* Pre-review cleanup

* lintfix

* Abstracted pathtree each-ins into a new component class

* Path tree component styles

* Types added and PR feedback addressed

* Path tree to variable paths

* Slightly simpler path QP mods

* More pr feedback handling

* Trim moved into a function on variable model

* Traversal and compaction tests for PathTree

* Trim Path tests

* Variable-paths component tests

* Lint fixup for tests
2022-07-11 13:34:04 -04:00
Phil Renaud a628e2969a Secure Variables UI: /variables/new and /variables/*path (#13069)
* variables.new initialized

* Hacky but savey

* Variable wildcard route and multiple creatable at a time

* multiple KVs per variable

* PR Prep cleanup and lintfix

* Delog

* Data mocking in mirage for variables

* Linting fixes

* Re-implement absent params

* Adapter and model tests

* Moves the path-as-id logic to a serializer instead of adapter

* Classic to serializer and lint cleanup

* Pluralized save button (#13140)

* Autofocus modifier and better Add More button UX (#13145)

* Secure Variables: show/hide functionality when adding new values (#13137)

* Flight Icons added and show hide functionality

* PR cleanup

* Linting cleanup

* Position of icon moved to the right of input

* PR feedback addressed

* Delete button and stylistic changes to show hide

* Hmm, eslint doesnt like jsdoc-usage as only reason for import

* More closely match the button styles and delete test

* Simplified new.js model

* Secure Variables: /variables/*path/edit route and functionality (#13170)

* Variable edit page init

* Significant change to where we house model methods

* Lintfix

* Edit a variable tests

* Remove redundant tests

* Asserts expected

* Mirage factory updated to reflect model state
2022-07-11 13:34:04 -04:00
Phil Renaud 7ddc4c8359 Secure Variables UI: Router setup and /variables/index route + guards (#12967)
* Route init

* Bones of a mirage-mocked secure variables policy

* Functinoing policy for list vars

* Delog and transition on route

* Basic guard test

* Page guard tests for secure variables

* Cleanup and unit tests for variables ability

* Linter cleanup

* Set expectations for test assertions

* PR feedback addressed

* Read label changed to View per suggestion
2022-07-11 13:34:03 -04:00
Phil Renaud 462c6653ac
[bugfix, ui] Allow running jobs from a namespace-limited token (#13659)
* Allow running jobs from a namespace-limited token

* qpNamespace cleanup

* Looks like parse can deal with a * namespace

* A little diff cleanup

* Defensive destructuring

* Removing accidental friendly-fire on can-scale

* Testfix: Job run buttons from jobs index

* Testfix: activeRegion job adapter string

* Testfix: unit tests for job abilities correctly reflect the any-namespace rule

* Testfix: job editor test looks for requests with namespace applied on plan
2022-07-11 12:33:17 -04:00
Phil Renaud 84a59ff059
[ui] Fix a bug where redirects after planning/editing a job didn't include namespace (#13588)
* Job editing and planning handles namespace as part of ID instead of queryParam

* Changelog added

* Tests updated to reflect new namespace redirects
2022-07-05 15:58:56 -04:00
Phil Renaud 2e6e95e78c
[ui] Reinstate Meta and Payload sections to Parameterized Child Jobs (#13473)
* Shift meta off job.definition and decodedPayload alias to passed arg

* Changelog
2022-06-24 15:03:08 -04:00
dependabot[bot] 86eac38ce7
build(deps-dev): bump ember-page-title from 6.2.0 to 7.0.0 in /ui (#11738)
Bumps [ember-page-title](https://github.com/ember-cli/ember-page-title) from 6.2.0 to 7.0.0.
- [Release notes](https://github.com/ember-cli/ember-page-title/releases)
- [Changelog](https://github.com/ember-cli/ember-page-title/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ember-cli/ember-page-title/compare/v6.2.0...v7.0.0)

---
updated-dependencies:
- dependency-name: ember-page-title
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-08 10:30:37 -04:00
dependabot[bot] 30fa3103dc
build(deps): bump node-fetch from 2.6.1 to 2.6.7 in /ui (#11909)
Bumps [node-fetch](https://github.com/node-fetch/node-fetch) from 2.6.1 to 2.6.7.
- [Release notes](https://github.com/node-fetch/node-fetch/releases)
- [Changelog](https://github.com/node-fetch/node-fetch/blob/main/docs/CHANGELOG.md)
- [Commits](https://github.com/node-fetch/node-fetch/compare/v2.6.1...v2.6.7)

---
updated-dependencies:
- dependency-name: node-fetch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-08 10:27:01 -04:00
dependabot[bot] 2fb1da8c35
build(deps): bump semver-regex from 3.1.2 to 3.1.4 in /ui (#13224)
Bumps [semver-regex](https://github.com/sindresorhus/semver-regex) from 3.1.2 to 3.1.4.
- [Release notes](https://github.com/sindresorhus/semver-regex/releases)
- [Commits](https://github.com/sindresorhus/semver-regex/compare/v3.1.2...v3.1.4)

---
updated-dependencies:
- dependency-name: semver-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-08 10:25:17 -04:00
dependabot[bot] c2bcb1d3da
chore(deps): bump lodash-es from 4.17.20 to 4.17.21 in /ui (#12323)
Bumps [lodash-es](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21)

---
updated-dependencies:
- dependency-name: lodash-es
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-08 10:23:50 -04:00
dependabot[bot] 70e633aeca
build(deps): bump follow-redirects from 1.14.5 to 1.14.8 in /ui (#12060)
Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.5 to 1.14.8.
- [Release notes](https://github.com/follow-redirects/follow-redirects/releases)
- [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.5...v1.14.8)

---
updated-dependencies:
- dependency-name: follow-redirects
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-08 10:22:49 -04:00
dependabot[bot] b7490a5c79
build(deps): bump mout from 1.2.2 to 1.2.3 in /ui (#12035)
Bumps [mout](https://github.com/mout/mout) from 1.2.2 to 1.2.3.
- [Release notes](https://github.com/mout/mout/releases)
- [Changelog](https://github.com/mout/mout/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mout/mout/compare/v1.2.2...v1.2.3)

---
updated-dependencies:
- dependency-name: mout
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-06-08 10:21:34 -04:00
Seth Hoenig 65f7abf2f4 cli: update default redis and use nomad service discovery
Closes #12927
Closes #12958

This PR updates the version of redis used in our examples from 3.2 to 7.
The old version is very not supported anymore, and we should be setting
a good example by using a supported version.

The long-form example job is now fixed so that the service stanza uses
nomad as the service discovery provider, and so now the job runs without
a requirement of having Consul running and configured.
2022-05-17 10:24:19 -05:00
Phil Renaud 0637eb742f
Add a forgotten comma to snapshot-specific CSS (#13030) 2022-05-16 14:13:51 -04:00
Phil Renaud 45dc1cfd58
12986 UI fails to load job when there is an "@" in job name in nomad 130 (#13012)
* LastIndexOf and always append a namespace on job links

* Confirmed the volume equivalent and simplified idWIthNamespace logic

* Changelog added

* PR comments addressed

* Drop the redirect for the time being

* Tests updated to reflect namespace on links

* Task detail test default namespace link for test
2022-05-13 17:01:27 -04:00
Phil Renaud 916dbdcd2f
Visual diff tests seed-stabilized by default (#12965)
* Seed-stabilization by default

* Hide right-column of topology viz route

* Remove seedless run from thee test:* suite

* Related evals paths render too late

* Vis:Hidden another topo viz unstable item
2022-05-12 16:09:19 -04:00
Georges-Etienne Legendre 864be37c73
Fix Exec not working with reverse proxy X-Nomad-Token (#12925)
* Capture token secret on fetch

* Fix tests

* Fix lint errors
2022-05-10 13:42:12 -04:00