diff --git a/addons/core/addon/decorators/route-resource-filter.js b/addons/core/addon/decorators/resource-filter.js similarity index 97% rename from addons/core/addon/decorators/route-resource-filter.js rename to addons/core/addon/decorators/resource-filter.js index 4bc519f36..df84cb09a 100644 --- a/addons/core/addon/decorators/route-resource-filter.js +++ b/addons/core/addon/decorators/resource-filter.js @@ -147,7 +147,7 @@ class RouteResourceFilter extends EmberObject { findBySerialized ) { const owner = getOwner(routeInstance); - const containerKey = `route-resource-filter:${name}@${routeInstance.routeName}`; + const containerKey = `resource-filter:${name}@${routeInstance.routeName}`; const factory = owner.factoryFor(containerKey); if (!factory) { // create factory @@ -186,7 +186,7 @@ class RouteResourceFilter extends EmberObject { * * export default class MyRoute extends Route { * - * @resourceFilterParam({ + * @resourceFilter({ * allowed: ['active', 'pending'], * defaultvalue: ['active'], // optional * }) @@ -203,7 +203,7 @@ class RouteResourceFilter extends EmberObject { * } * */ -export function resourceFilterParam({ +export function resourceFilter({ allowed, defaultValue, serialize, diff --git a/addons/core/addon/helpers/has-route-resource-filter-selections.js b/addons/core/addon/helpers/has-resource-filter-selections.js similarity index 96% rename from addons/core/addon/helpers/has-route-resource-filter-selections.js rename to addons/core/addon/helpers/has-resource-filter-selections.js index fabdddab7..3a026c5aa 100644 --- a/addons/core/addon/helpers/has-route-resource-filter-selections.js +++ b/addons/core/addon/helpers/has-resource-filter-selections.js @@ -11,7 +11,7 @@ import { action } from '@ember/object'; * * @example * - * {{#if (has-route-resource-filter-selections 'route.name' 'field')}} + * {{#if (has-resource-filter-selections 'route.name' 'field')}} * Field has filter selections. * {{/if}} */ diff --git a/addons/core/addon/helpers/route-resource-filter.js b/addons/core/addon/helpers/resource-filter.js similarity index 86% rename from addons/core/addon/helpers/route-resource-filter.js rename to addons/core/addon/helpers/resource-filter.js index 483202b0c..1872a1d5d 100644 --- a/addons/core/addon/helpers/route-resource-filter.js +++ b/addons/core/addon/helpers/resource-filter.js @@ -7,15 +7,15 @@ import { action } from '@ember/object'; * Use this helper to fetch the current value of a resource filter param, * as well as its allowedValues. * - * @see resourceFilterParam (decorator) + * @see resourceFilter (decorator) * * @example * - * {{#with route-resource-filter 'status' as |param|}} + * {{#with resource-filter 'status' as |param|}} * {{param.name}} / {{param.value}} / {{param.selectedValue}} * {{/with}} */ -export default class RouteResourceFilterHelper extends Helper { +export default class ResourceFilterHelper extends Helper { // =services @service router; @@ -50,7 +50,7 @@ export default class RouteResourceFilterHelper extends Helper { */ compute([routeName, name]) { const owner = getOwner(this); - const containerKey = `route-resource-filter:${name}@${routeName}`; + const containerKey = `resource-filter:${name}@${routeName}`; const resourceFilter = owner.lookup(containerKey); const { allowedValues, value: selectedValue } = resourceFilter; return { name, allowedValues, selectedValue }; diff --git a/addons/core/app/decorators/resource-filter.js b/addons/core/app/decorators/resource-filter.js new file mode 100644 index 000000000..48ab848b6 --- /dev/null +++ b/addons/core/app/decorators/resource-filter.js @@ -0,0 +1 @@ +export { default } from 'core/decorators/resource-filter'; diff --git a/addons/core/app/decorators/route-resource-filter.js b/addons/core/app/decorators/route-resource-filter.js deleted file mode 100644 index 0cb7c2631..000000000 --- a/addons/core/app/decorators/route-resource-filter.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'core/decorators/route-resource-filter'; diff --git a/addons/core/app/helpers/has-resource-filter-selections.js b/addons/core/app/helpers/has-resource-filter-selections.js new file mode 100644 index 000000000..26765e488 --- /dev/null +++ b/addons/core/app/helpers/has-resource-filter-selections.js @@ -0,0 +1 @@ +export { default } from 'core/helpers/has-resource-filter-selections'; diff --git a/addons/core/app/helpers/has-route-resource-filter-selections.js b/addons/core/app/helpers/has-route-resource-filter-selections.js deleted file mode 100644 index 53d9763a0..000000000 --- a/addons/core/app/helpers/has-route-resource-filter-selections.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'core/helpers/has-route-resource-filter-selections'; diff --git a/addons/core/app/helpers/resource-filter.js b/addons/core/app/helpers/resource-filter.js new file mode 100644 index 000000000..573aa1050 --- /dev/null +++ b/addons/core/app/helpers/resource-filter.js @@ -0,0 +1 @@ +export { default } from 'core/helpers/resource-filter'; diff --git a/addons/core/app/helpers/route-resource-filter.js b/addons/core/app/helpers/route-resource-filter.js deleted file mode 100644 index 42f9b4ea1..000000000 --- a/addons/core/app/helpers/route-resource-filter.js +++ /dev/null @@ -1 +0,0 @@ -export { default } from 'core/helpers/route-resource-filter'; diff --git a/ui/admin/app/routes/scopes/scope/auth-methods.js b/ui/admin/app/routes/scopes/scope/auth-methods.js index f77cb4409..491cdd44d 100644 --- a/ui/admin/app/routes/scopes/scope/auth-methods.js +++ b/ui/admin/app/routes/scopes/scope/auth-methods.js @@ -4,7 +4,7 @@ import { action } from '@ember/object'; import loading from 'ember-loading/decorator'; import { confirm } from 'core/decorators/confirm'; import { notifySuccess, notifyError } from 'core/decorators/notify'; -import { resourceFilterParam } from 'core/decorators/route-resource-filter'; +import { resourceFilter } from 'core/decorators/resource-filter'; export default class ScopesScopeAuthMethodsRoute extends Route { // =services @@ -17,7 +17,7 @@ export default class ScopesScopeAuthMethodsRoute extends Route { // =attributes - @resourceFilterParam({ allowed: ['password', 'oidc'] }) type; + @resourceFilter({ allowed: ['password', 'oidc'] }) type; // =methods diff --git a/ui/admin/app/routes/scopes/scope/sessions.js b/ui/admin/app/routes/scopes/scope/sessions.js index f572bb15d..29a0d87a5 100644 --- a/ui/admin/app/routes/scopes/scope/sessions.js +++ b/ui/admin/app/routes/scopes/scope/sessions.js @@ -6,7 +6,7 @@ import { task, timeout } from 'ember-concurrency'; import { A } from '@ember/array'; import { notifySuccess, notifyError } from 'core/decorators/notify'; import config from '../../../config/environment'; -import { resourceFilterParam } from 'core/decorators/route-resource-filter'; +import { resourceFilter } from 'core/decorators/resource-filter'; const POLL_TIMEOUT_SECONDS = config.sessionPollingTimeoutSeconds; @@ -21,7 +21,10 @@ export default class ScopesScopeSessionsRoute extends Route { // =attributes - @resourceFilterParam(['active', 'pending', 'canceling', 'terminated'], ['active','pending', 'canceling']) status; + @resourceFilter({ + allowed: ['active', 'pending', 'canceling', 'terminated'], + defaultValue: ['active','pending', 'canceling'] + }) status; /** * A simple Ember Concurrency-based polling task that refreshes the route diff --git a/ui/admin/app/templates/scopes/scope/auth-methods/index.hbs b/ui/admin/app/templates/scopes/scope/auth-methods/index.hbs index 1160284be..ea12808c3 100644 --- a/ui/admin/app/templates/scopes/scope/auth-methods/index.hbs +++ b/ui/admin/app/templates/scopes/scope/auth-methods/index.hbs @@ -39,15 +39,13 @@ {{#if (or @model - (has-route-resource-filter-selections - 'scopes.scope.auth-methods' 'type' - ) + (has-resource-filter-selections 'scopes.scope.auth-methods' 'type') ) }} {{#with - (route-resource-filter 'scopes.scope.auth-methods' 'type') + (resource-filter 'scopes.scope.auth-methods' 'type') as |filter| }} - {{else if (has-route-resource-filter-selections + {{else if (has-resource-filter-selections 'scopes.scope.auth-methods' 'type' )}} diff --git a/ui/admin/app/templates/scopes/scope/sessions/index.hbs b/ui/admin/app/templates/scopes/scope/sessions/index.hbs index 591b6ecc6..ec412bb5e 100644 --- a/ui/admin/app/templates/scopes/scope/sessions/index.hbs +++ b/ui/admin/app/templates/scopes/scope/sessions/index.hbs @@ -16,14 +16,13 @@ {{#if (feature-flag 'filter')}} {{#if (or - @model - (has-route-resource-filter-selections 'scopes.scope.sessions' 'type') + @model (has-resource-filter-selections 'scopes.scope.sessions' 'type') ) }} {{#with - (route-resource-filter 'scopes.scope.sessions' 'status') + (resource-filter 'scopes.scope.sessions' 'status') as |filter| }} - {{else if (has-route-resource-filter-selections - 'scopes.scope.sessions' 'type' - )}} + {{else if (has-resource-filter-selections 'scopes.scope.sessions' 'type')}} diff --git a/ui/desktop/app/routes/scopes/scope/projects/sessions.js b/ui/desktop/app/routes/scopes/scope/projects/sessions.js index 3f351ad6f..12618d741 100644 --- a/ui/desktop/app/routes/scopes/scope/projects/sessions.js +++ b/ui/desktop/app/routes/scopes/scope/projects/sessions.js @@ -4,7 +4,7 @@ import { task, timeout } from 'ember-concurrency'; import config from '../../../../config/environment'; import { action } from '@ember/object'; import { notifySuccess, notifyError } from 'core/decorators/notify'; -import { resourceFilterParam } from 'core/decorators/route-resource-filter'; +import { resourceFilter } from 'core/decorators/resource-filter'; const POLL_TIMEOUT_SECONDS = config.sessionPollingTimeoutSeconds; @@ -18,7 +18,10 @@ export default class ScopesScopeProjectsSessionsRoute extends Route { // =attributes - @resourceFilterParam(['active', 'pending', 'canceling', 'terminated'], ['active','pending', 'canceling']) status; + @resourceFilter({ + allowed: ['active', 'pending', 'canceling', 'terminated'], + defaultValue: ['active','pending', 'canceling'] + }) status; /** * A simple Ember Concurrency-based polling task that refreshes the route diff --git a/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs b/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs index 055b1558d..798489e7e 100644 --- a/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs +++ b/ui/desktop/app/templates/scopes/scope/projects/sessions/index.hbs @@ -13,7 +13,7 @@ {{#if (or @model - (has-route-resource-filter-selections + (has-resource-filter-selections 'scopes.scope.projects.sessions' 'type' ) ) @@ -21,7 +21,7 @@ {{#with - (route-resource-filter 'scopes.scope.projects.sessions' 'status') + (resource-filter 'scopes.scope.projects.sessions' 'status') as |filter| }} - {{else if (has-route-resource-filter-selections + {{else if (has-resource-filter-selections 'scopes.scope.projects.sessions' 'type' )}}