Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: [VAULT-21530] Custom Messages List View w/ Pagination and LazyPaginatedQuery #24133

Conversation

kiannaquach
Copy link
Contributor

@kiannaquach kiannaquach commented Nov 15, 2023

Custom Banners List View

custom-banners-list

TODO:

  • Write serializer and adapter tests (VAULT-22047 tests and mirage)
  • Write more integration tests for messages list view and refactor it to use mirage handler (VAULT-22047 tests and mirage)
  • Refactor mirage so it can generate more list data (VAULT-22047 tests and mirage)
  • Search by name in the toolbar filters (VAULT-22046)

@kiannaquach kiannaquach added this to the 1.16.0-rc1 milestone Nov 15, 2023
@github-actions github-actions bot added the hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed label Nov 15, 2023
<nav class="tabs" aria-label="custom-messages">
<ul>
<LinkTo
class={{if @authenticated "active"}}
Copy link
Contributor Author

@kiannaquach kiannaquach Nov 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An issue I ran into: when transitioning to different tabs, the page query params are retained from the previous tab. This is the default behavior since controllers are singletons. I tried adding a resetController to reset the page to 1. I noticed that we have explicitly state what the query params are in order for the tabs to transition with the correct query params. Here's a similar description of what I saw happening: https://guides.emberjs.com/v2.14.0/routing/query-params/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to reset to null. Let's zoom through this as it gets a little confusing. Ex:

resetController(controller, isExiting) {
    if (isExiting) {
      controller.set('pageFilter', null);
      controller.set('page', null);
    }
  }

@kiannaquach kiannaquach marked this pull request as ready for review November 16, 2023 02:19
Copy link

Build Results:
All builds succeeded! ✅

}

async query(store, type, query) {
const { authenticated } = query;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if query is false? Does the API error? You might want to consider a catch statement here and doing something with the error if it's a 404 (no response, e.g. no items in the list) vs anything else like a 403. There is a good example of this on the ldap library adapter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I originally had a try/catch here but the 404/403 error didn't bubble to the query. Since I'm using lazyPaginatedQuery, I did the try/catch in the route instead and the errors get surfaced in there. https://github.com/hashicorp/vault/pull/24133/files#diff-5a46be6bfd29de6b487be8b6242b62bdd861524c47cc1fb10eb4a876e00c129f

<nav class="tabs" aria-label="custom-messages">
<ul>
<LinkTo
class={{if @authenticated "active"}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should be able to reset to null. Let's zoom through this as it gets a little confusing. Ex:

resetController(controller, isExiting) {
    if (isExiting) {
      controller.set('pageFilter', null);
      controller.set('page', null);
    }
  }

After user logs in
</LinkTo>
<LinkTo
class={{unless @authenticated "active"}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you might also try using the ember truth-helper not. https://github.com/jmurphyau/ember-truth-helpers. It reads easier than unless.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linter recommends unless instead of if not @authenticated🫠

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TIL.

Copy link
Contributor

@Monkeychip Monkeychip left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work! 🙌🏻

@kiannaquach kiannaquach merged commit 0905d48 into ui/VAULT-19096/customizable-banners Nov 17, 2023
63 checks passed
@kiannaquach kiannaquach deleted the ui/VAULT-21530/custom-messages-list branch November 17, 2023 16:47
kiannaquach added a commit that referenced this pull request Jan 23, 2024
* UI: [VAULT-21521] Initial config-ui engine and routes set up (#23922)

* UI: [VAULT-21526] Create adapter, serializer, and model files (#23947)

* UI: [VAULT-21588] Add Custom Messages to the sidebar (#23946)

* UI: [VAULT-21527] Mirage setup (#24000)

* UI: [VAULT-21530] Custom Messages List View w/ Pagination and LazyPaginatedQuery (#24133)

* UI: Add list to adapter query param (#24187)

* UI: [VAULT-21532] Create message (#24407)

* WIP create message

* Add breadcrumns

* Create and edit form

* Add save to create/edit form

* Add cancel and todo

* Fix cancel route

* Fix breadcrumb label to be title case

* add start time logic

* Update breadcrumb

* Fix breadcrumbs and merge conflict test

* Update create form description

* Fix sidenav so it always highlights

* Fix up forms

* Mostly working create form

* Form cleanup

* Fix link title and href form fields

* Default startTime

* Fix messages

* Update dropdown to use the updated ConfirmAction component

* Update create and edit form

* Add wip tests

* Fix breadcrumb formatter

* Comment out test

* Update create message test

* Update more tests

* Add comment for fixing date on edit

* Update Message form

* Code cleanup!

* Add validation tests

* Remove authenticated from route model

* SOme more code cleanup

* Add controller so authenticated is parsed

* Working radio buttons

* Use an object instead of arrays

* Wip date form

* Fix license headers

* Fix license headers addition of files

* Fix copyright format issues and clean up code

* Fix tests

* Rename FormField radio getter and ay11 improvements

* Address feedback

* Fix specific date so it remembers the values

* Address feedback!

* Update more form fields

* Use formfield action instead

* Update to every

* Update syntax of onchange

* Fix tests

* Update willDestroy so it doesnt break tests

* Remove set and brodcast datetimelocal

* Put FormField back the way it was in favor of putting FormField to a seperate PR

* Remove getter in formfield component file

* Address more feedback

* Put back test

* Update datetime string format var name and location

* UI: [VAULT-21534 VAULT-21533 VAULT-21536] edit, preview, and delete custom message (#24603)

* Working edit

* VAULT-21536 update delete message and create/update flash message

* VAULT-21533 add preview modal

* Update serializer

* Preview refinements

* Move preview to its own component

* Move breadcrumbs to setupController

* Add more tests

* Address some feedback

* Address more feedback!

* Update serailizer

* Remove stylesheet

* Add comment

* UI: [VAULT-21435] Message details (#24645)

* WIP

* Fix timezone bug

* Fix date issues on create/edit form

* Add details screen

* Use allFields instead of formFields

* Fix tests

* Address comments!

* UI: VAULT-21538 unauth endpoint message display (#24665)

* WIP unauth display

* Add modal custom message

* Close multiple modals

* Update todo with ticket number

* On init make custom message request

* Use serializer

* Update fetchMessages

* Add copyright headers

* Add services and serializers

* Send null instead of empty strings

* Fix tests!

* Add copywrite headers

* Add some acceptance tests

* Test cleanup

* Put tests back

* pass hooks to module

* Move module out

* Seperate tests

* Copywrite

* Add aria-prohibited-attr runList options

* Code cleanup

* Add date-time-local transform

* Add copyright headers

* Remove comments

* Remove date transform stuff for now!

* Put getISODateFormat back into the serailize function

* UI: Date time local transform (#24694)

* Date time local

* Add deserialize

* Add copyright header

* check if date exists

* Use parseISO for date strings since datefns requires this in new update

* Update tests

* Ensure we cehck for an ISOString

* Add checks so tests wont fail

* Update parseISO

* Address feedback

* UI: multiple banner message on create and edit form (#24742)

* WIP multiple banner message on create and edit form

* Fix tests

* Put checks back

* Add try/catch to query

* Fix breadcrumbs

* Add page size to pagination

* Add multiple modal message tests

* Address feedback

* Check for valid form first

* Add extra checks

* Address feedback

* Move getter to the route

* Fix tests!

* Address more feedback

* Use still when cancelling

* Update multiple banner modal

* Fix tests

* Set user confirmation to empty string

* UI: VAULT-21539 auth messages display (#24842)

* WIP auth message display

* Move block to show only when authenticated

* VAULT-22046 working search by name

* Some code clean up

* Fix merge conflict

* Add tests

* Fetch messages again after creation

* UI: [VAULT-22908] Update kv object editor, add max number of messages reached modal, small improvements (#24918)

* Update kv object editor to only use a single row

* continute using kv editype

* Fix failing dashboard tests!

* Fix failing test on sidebranch

* Fix tests and update validations

* Add optional tag

* Address feedback

* Add documentation

* Clear messages when logging out

* Fix tests!

* Add 100 message limit modal

* Add max message modal test

* Do more checks!

* Pair with Claire on the refactor of validator!

* Only show validationerror for multiple rows

* Update pageSize to 100 since when paginations are active it causes accessbility errors

* Fix tests!

* Add links to test

* Make banners dismissable

* Add cancel button

* Address feedback!

* Update test selectors

* Update validator

* Remove validations check in kvobjecteditor

* Revert validationError in kvobjecteditor template

* Put back if/else statements for link

* Add changelog

* UI: fix link bug and add colors (#24977)

* Fix edit bug and put transform back

* Edit badgeColor

* Add tests

* Revert changes to transform

* Edit badge colors

* remove universal object transform

* Update changelog filename

* UI: Add form inline warning (#24986)

* Add form inline warning

* Remove title

* Only show form warning for unauth

* Address feedback!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hashicorp-contributed-pr If the PR is HashiCorp (i.e. not-community) contributed pr/no-changelog ui
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants