From 3ff89279e6c858fa2cf48082001c87917be22b72 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Thu, 1 Sep 2022 10:27:34 -0700 Subject: [PATCH] =?UTF-8?q?chore:=20=F0=9F=A4=96=20add=20refreshRouteOnCha?= =?UTF-8?q?nge=20option=20to=20resource=20filters=20(#1289)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/addon/components/doc-link/index.hbs | 13 ++++---- .../addon/components/error/message/index.hbs | 15 +++++---- .../components/form/authenticate/index.hbs | 9 +++--- .../form/authenticate/oidc/index.hbs | 9 +++--- .../form/authenticate/password/index.hbs | 32 +++++++++++-------- .../addon/components/loading-button/index.hbs | 8 ++--- .../pending-confirmations/index.hbs | 5 +-- .../components/toolbar-refresher/index.hbs | 2 +- .../core/addon/decorators/resource-filter.js | 15 +++++++-- .../tests/dummy/app/templates/application.hbs | 4 +-- .../components/pending-confirmations-test.js | 12 +++++-- .../helpers/format-date-iso-test.js | 5 ++- .../unit/authenticators/password-test.js | 5 ++- .../core/tests/unit/services/confirm-test.js | 12 +++++-- 14 files changed, 92 insertions(+), 54 deletions(-) diff --git a/addons/core/addon/components/doc-link/index.hbs b/addons/core/addon/components/doc-link/index.hbs index 18ecb8406..dcb7df4c1 100644 --- a/addons/core/addon/components/doc-link/index.hbs +++ b/addons/core/addon/components/doc-link/index.hbs @@ -1,8 +1,9 @@ - - + target='_blank' + rel='noreferrer noopener' + title={{t 'actions.get-topic-help'}} +> + + \ No newline at end of file diff --git a/addons/core/addon/components/error/message/index.hbs b/addons/core/addon/components/error/message/index.hbs index a602536c5..9afc20e2a 100644 --- a/addons/core/addon/components/error/message/index.hbs +++ b/addons/core/addon/components/error/message/index.hbs @@ -1,10 +1,13 @@ - {{t (concat "errors." this.messageCode ".description")}} + as |message| +> + {{t + (concat 'errors.' this.messageCode '.description') + }} {{#if this.helpRoute}} - {{t "actions.help"}} + {{t 'actions.help'}} {{/if}} - + \ No newline at end of file diff --git a/addons/core/addon/components/form/authenticate/index.hbs b/addons/core/addon/components/form/authenticate/index.hbs index e87376970..d9a5fbfe1 100644 --- a/addons/core/addon/components/form/authenticate/index.hbs +++ b/addons/core/addon/components/form/authenticate/index.hbs @@ -1,9 +1,10 @@ -{{!-- //TODO fix the issue and delete disabling the rule --}} -{{!-- template-lint-disable no-passed-in-event-handlers --}} +{{! //TODO fix the issue and delete disabling the rule }} +{{! template-lint-disable no-passed-in-event-handlers }} {{#if @model.type}} - {{component (concat "form/authenticate/" @model.type) + {{component + (concat 'form/authenticate/' @model.type) submit=@submit cancel=false disabled=@disabled }} -{{/if}} +{{/if}} \ No newline at end of file diff --git a/addons/core/addon/components/form/authenticate/oidc/index.hbs b/addons/core/addon/components/form/authenticate/oidc/index.hbs index e8e1294fe..0ec8100df 100644 --- a/addons/core/addon/components/form/authenticate/oidc/index.hbs +++ b/addons/core/addon/components/form/authenticate/oidc/index.hbs @@ -1,5 +1,5 @@ + @submitText={{t 'actions.authenticate'}} + @showCancel={{false}} + /> - + \ No newline at end of file diff --git a/addons/core/addon/components/form/authenticate/password/index.hbs b/addons/core/addon/components/form/authenticate/password/index.hbs index ee47910d8..ec469d8a3 100644 --- a/addons/core/addon/components/form/authenticate/password/index.hbs +++ b/addons/core/addon/components/form/authenticate/password/index.hbs @@ -1,28 +1,32 @@ + @label={{t 'form.login_name.label'}} + /> + @label={{t 'form.password.label'}} + /> + @submitText={{t 'actions.authenticate'}} + @showCancel={{false}} + /> - + \ No newline at end of file diff --git a/addons/core/addon/components/loading-button/index.hbs b/addons/core/addon/components/loading-button/index.hbs index bfea9f7ee..be7070e6c 100644 --- a/addons/core/addon/components/loading-button/index.hbs +++ b/addons/core/addon/components/loading-button/index.hbs @@ -6,13 +6,9 @@ 'flight-icons/svg/loading-16' 'flight-icons/svg/reload-16' }} - class={{if - this.isLoading - 'loading-button is-loading' - 'loading-button' - }} + class={{if this.isLoading 'loading-button is-loading' 'loading-button'}} @disabled={{this.isLoading}} {{on 'click' this.toggleRefresh}} > {{yield}} - + \ No newline at end of file diff --git a/addons/core/addon/components/pending-confirmations/index.hbs b/addons/core/addon/components/pending-confirmations/index.hbs index 49c8a6ded..c5ec18d35 100644 --- a/addons/core/addon/components/pending-confirmations/index.hbs +++ b/addons/core/addon/components/pending-confirmations/index.hbs @@ -2,5 +2,6 @@ {{yield confirmation (fn this.accept confirmation) - (fn this.deny confirmation)}} -{{/each}} + (fn this.deny confirmation) + }} +{{/each}} \ No newline at end of file diff --git a/addons/core/addon/components/toolbar-refresher/index.hbs b/addons/core/addon/components/toolbar-refresher/index.hbs index 787bf4ec8..90db4508b 100644 --- a/addons/core/addon/components/toolbar-refresher/index.hbs +++ b/addons/core/addon/components/toolbar-refresher/index.hbs @@ -6,4 +6,4 @@ {{t 'actions.refresh'}} - + \ No newline at end of file diff --git a/addons/core/addon/decorators/resource-filter.js b/addons/core/addon/decorators/resource-filter.js index 4c291c066..9830dcc1d 100644 --- a/addons/core/addon/decorators/resource-filter.js +++ b/addons/core/addon/decorators/resource-filter.js @@ -112,8 +112,12 @@ class RouteResourceFilter extends EmberObject { * @static * @param {Route} routeClass * @param {string} name + * @param {boolean} refreshRouteOnChange - set to false if you plan to + * transition from a sibling to this route, which is currently + * buggy in Ember. When set to false, you must manually refresh + * the route as necessary. */ - static setupRouteQueryParams(routeClass, name) { + static setupRouteQueryParams(routeClass, name, refreshRouteOnChange = true) { const filterKey = `filter-${name}`; // If the route has no query params specified yet, declare them. @@ -127,7 +131,7 @@ class RouteResourceFilter extends EmberObject { // param changes refresh the model but do not contribute to browser history. // See https://guides.emberjs.com/release/routing/query-params/ routeClass.queryParams[filterKey] = { - refreshModel: true, + refreshModel: refreshRouteOnChange, replace: true, }; } @@ -213,6 +217,7 @@ export function resourceFilter({ defaultValue, serialize, findBySerialized, + refreshRouteOnChange, }) { /** * @param {object} target @@ -221,7 +226,11 @@ export function resourceFilter({ * @return {object{get, set}} */ return function (target, name /*, descriptor*/) { - RouteResourceFilter.setupRouteQueryParams(target, name); + RouteResourceFilter.setupRouteQueryParams( + target, + name, + refreshRouteOnChange + ); let instance; diff --git a/addons/core/tests/dummy/app/templates/application.hbs b/addons/core/tests/dummy/app/templates/application.hbs index 4785fe202..a1973e25c 100644 --- a/addons/core/tests/dummy/app/templates/application.hbs +++ b/addons/core/tests/dummy/app/templates/application.hbs @@ -1,2 +1,2 @@ -

Welcome to Ember

-

{{relative-datetime-live this.now}}

+

Welcome to Ember

+

{{relative-datetime-live this.now}}

\ No newline at end of file diff --git a/addons/core/tests/integration/components/pending-confirmations-test.js b/addons/core/tests/integration/components/pending-confirmations-test.js index 5e8227ddc..c077fec97 100644 --- a/addons/core/tests/integration/components/pending-confirmations-test.js +++ b/addons/core/tests/integration/components/pending-confirmations-test.js @@ -15,14 +15,22 @@ module('Integration | Component | pending-confirmations', function (hooks) {
Pending
`); - assert.strictEqual(findAll('.pending').length, 0, 'No pending confirmations'); + assert.strictEqual( + findAll('.pending').length, + 0, + 'No pending confirmations' + ); service.confirm(); await render(hbs`
Pending
`); - assert.strictEqual(findAll('.pending').length, 1, 'One pending confirmations'); + assert.strictEqual( + findAll('.pending').length, + 1, + 'One pending confirmations' + ); }); test('it exposes a confirm action that confirms the confirmation', async function (assert) { diff --git a/addons/core/tests/integration/helpers/format-date-iso-test.js b/addons/core/tests/integration/helpers/format-date-iso-test.js index ee931143d..b29251a87 100644 --- a/addons/core/tests/integration/helpers/format-date-iso-test.js +++ b/addons/core/tests/integration/helpers/format-date-iso-test.js @@ -11,6 +11,9 @@ module('Integration | Helper | format-date-iso', function (hooks) { await render(hbs`{{format-date-iso inputValue}}`); - assert.strictEqual(this.element.textContent.trim(), '2020-01-01T00:00:00.999Z'); + assert.strictEqual( + this.element.textContent.trim(), + '2020-01-01T00:00:00.999Z' + ); }); }); diff --git a/addons/core/tests/unit/authenticators/password-test.js b/addons/core/tests/unit/authenticators/password-test.js index b57b463df..e13e61ab5 100644 --- a/addons/core/tests/unit/authenticators/password-test.js +++ b/addons/core/tests/unit/authenticators/password-test.js @@ -32,7 +32,10 @@ module('Unit | Authenticator | password', function (hooks) { return new Response(200); }); authenticator.restore(mockData); - assert.strictEqual(applicationAdapter.headers.Authorization, 'Bearer token1234'); + assert.strictEqual( + applicationAdapter.headers.Authorization, + 'Bearer token1234' + ); }); test('it adds an authorization header to application adapter on authenticate', async function (assert) { diff --git a/addons/core/tests/unit/services/confirm-test.js b/addons/core/tests/unit/services/confirm-test.js index 56d31e210..f46ecdcda 100644 --- a/addons/core/tests/unit/services/confirm-test.js +++ b/addons/core/tests/unit/services/confirm-test.js @@ -18,9 +18,17 @@ module('Unit | Service | confirm', function (hooks) { assert.expect(3); const service = this.owner.lookup('service:confirm'); service.enabled = true; - assert.strictEqual(service.pending.length, 0, 'No pending confirmations yet'); + assert.strictEqual( + service.pending.length, + 0, + 'No pending confirmations yet' + ); const confirmation = service.confirm(); - assert.strictEqual(service.pending.length, 1, 'One pending confirmation created'); + assert.strictEqual( + service.pending.length, + 1, + 'One pending confirmation created' + ); confirmation.confirm(); assert.strictEqual(service.pending.length, 0, 'Confirmation was confirmed'); });