refactor: 💡 more renaming

This commit is contained in:
Randall Morey committed 2021-12-06 17:26:36 -05:00
1 parent 400b0b5f0b
commit ddc7fe939d
15 files changed
+35 -38

No files matched your search

@@ -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,
@@ -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}}
*/
@@ -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 };
@@ -0,0 +1 @@
export { default } from 'core/decorators/resource-filter';
@@ -1 +0,0 @@
export { default } from 'core/decorators/route-resource-filter';
@@ -0,0 +1 @@
export { default } from 'core/helpers/has-resource-filter-selections';
@@ -1 +0,0 @@
export { default } from 'core/helpers/has-route-resource-filter-selections';
@@ -0,0 +1 @@
export { default } from 'core/helpers/resource-filter';
@@ -1 +0,0 @@
export { default } from 'core/helpers/route-resource-filter';
@@ -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
+5 -2
View File
@@ -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
@@ -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')
)
}}
<Rose::Toolbar>
<Rose::Form as |form|>
{{#with
(route-resource-filter 'scopes.scope.auth-methods' 'type')
(resource-filter 'scopes.scope.auth-methods' 'type')
as |filter|
}}
<Rose::Dropdown
@@ -76,9 +74,7 @@
{{/with}}
{{#if
(has-route-resource-filter-selections
'scopes.scope.auth-methods' 'type'
)
(has-resource-filter-selections 'scopes.scope.auth-methods' 'type')
}}
<Rose::Button
@style='inline-link-action'
@@ -211,7 +207,7 @@
</table.body>
</Rose::Table>
{{else if (has-route-resource-filter-selections
{{else if (has-resource-filter-selections
'scopes.scope.auth-methods' 'type'
)}}
@@ -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')
)
}}
<Rose::Toolbar>
<Rose::Form as |form|>
{{#with
(route-resource-filter 'scopes.scope.sessions' 'status')
(resource-filter 'scopes.scope.sessions' 'status')
as |filter|
}}
<Rose::Dropdown
@@ -52,9 +51,7 @@
{{/with}}
{{#if
(has-route-resource-filter-selections
'scopes.scope.sessions' 'type'
)
(has-resource-filter-selections 'scopes.scope.sessions' 'type')
}}
<Rose::Button
@style='inline-link-action'
@@ -139,9 +136,7 @@
</table.body>
</Rose::Table>
{{else if (has-route-resource-filter-selections
'scopes.scope.sessions' 'type'
)}}
{{else if (has-resource-filter-selections 'scopes.scope.sessions' 'type')}}
<Rose::Layout::Centered>
<Rose::Message @title={{t 'titles.no-results'}} as |message|>
<message.description>
@@ -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
@@ -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 @@
<Rose::Toolbar>
<Rose::Form as |form|>
{{#with
(route-resource-filter 'scopes.scope.projects.sessions' 'status')
(resource-filter 'scopes.scope.projects.sessions' 'status')
as |filter|
}}
<Rose::Dropdown
@@ -50,7 +50,7 @@
{{/with}}
{{#if
(has-route-resource-filter-selections
(has-resource-filter-selections
'scopes.scope.projects.sessions' 'type'
)
}}
@@ -142,7 +142,7 @@
{{/each}}
</table.body>
</Rose::Table>
{{else if (has-route-resource-filter-selections
{{else if (has-resource-filter-selections
'scopes.scope.projects.sessions' 'type'
)}}
<Rose::Layout::Centered>