From 1935771a7031804a9b8be53e7f90ed0c23df29c1 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Wed, 10 Nov 2021 11:25:02 -0500 Subject: [PATCH 01/10] apply filtering to auth-methods mocks and fix null handling --- addons/api/addon/services/resource-filter-store.js | 5 +++-- addons/api/mirage/config.js | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/addons/api/addon/services/resource-filter-store.js b/addons/api/addon/services/resource-filter-store.js index 8bd4130ae..660fd8694 100644 --- a/addons/api/addon/services/resource-filter-store.js +++ b/addons/api/addon/services/resource-filter-store.js @@ -34,6 +34,7 @@ export class ResourceFilter { ); }) .flat(); + console.log(this.#filterObject, clauses); return this.and(clauses); } @@ -52,7 +53,7 @@ export class ResourceFilter { * @return {string} */ equals(key, value) { - return `"/item/${key}" == "${value}"`; + return value !== null ? `"/item/${key}" == "${value}"` : null; } /** @@ -76,7 +77,7 @@ export class ResourceFilter { * @return {string} */ parenthetical(expression) { - return `(${expression})`; + return expression ? `(${expression})` : null; } } diff --git a/addons/api/mirage/config.js b/addons/api/mirage/config.js index 89e2a82b5..0bfff1ff1 100644 --- a/addons/api/mirage/config.js +++ b/addons/api/mirage/config.js @@ -55,8 +55,9 @@ export default function () { this.get( '/auth-methods', - ({ authMethods }, { queryParams: { scope_id: scopeId } }) => { - return authMethods.where({ scopeId }); + ({ authMethods }, { queryParams: { scope_id: scopeId, filter } }) => { + const resultSet = authMethods.where({ scopeId }); + return resultSet.filter(makeBooleanFilter(filter)); } ); this.post('/auth-methods'); From a47657edf47f1316bcec12e7e2743b94dc58fdd2 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Wed, 10 Nov 2021 11:46:48 -0500 Subject: [PATCH 02/10] fix: checkboxgroup should be exposed on form --- addons/rose/addon/components/rose/form/index.hbs | 1 + addons/rose/package.json | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/rose/addon/components/rose/form/index.hbs b/addons/rose/addon/components/rose/form/index.hbs index e23e52c0b..18f637ea3 100644 --- a/addons/rose/addon/components/rose/form/index.hbs +++ b/addons/rose/addon/components/rose/form/index.hbs @@ -17,6 +17,7 @@ {{yield (hash radioGroup=(component 'rose/form/radio/group' disabled=this.disabled) checkbox=(component 'rose/form/checkbox' disabled=this.disabled) + checkboxGroup=(component 'rose/form/checkbox/group' disabled=this.disabled) input=(component 'rose/form/input' disabled=this.disabled) select=(component 'rose/form/select' disabled=this.disabled) textarea=(component 'rose/form/textarea' disabled=this.disabled) diff --git a/addons/rose/package.json b/addons/rose/package.json index 27dd6680e..a085fd175 100644 --- a/addons/rose/package.json +++ b/addons/rose/package.json @@ -35,7 +35,8 @@ "ember-named-blocks-polyfill": "^0.2.4", "ember-radio-button": "^2.0.1", "ember-uuid": "^2.1.0", - "emberx-select": "github:adopted-ember-addons/emberx-select#bc5f774" + "emberx-select": "github:adopted-ember-addons/emberx-select#bc5f774", + "ember-composable-helpers": "^4.5.0" }, "devDependencies": { "@babel/core": "^7.15.5", @@ -65,7 +66,6 @@ "ember-cli-sass": "^10.0.1", "ember-cli-sri": "^2.1.1", "ember-cli-terser": "^4.0.2", - "ember-composable-helpers": "^4.5.0", "ember-disable-prototype-extensions": "^1.1.3", "ember-export-application-global": "^2.0.1", "ember-inline-svg": "^1.0.0", From bbd0847a21ad70d5159ca0d93fd0fd9b4b73214b Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Wed, 10 Nov 2021 12:40:07 -0500 Subject: [PATCH 03/10] =?UTF-8?q?chore:=20=F0=9F=A4=96=20initial=20auth=20?= =?UTF-8?q?methods=20resource=20filtering=20by=20type?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../addon/services/resource-filter-store.js | 1 - .../app/routes/scopes/scope/auth-methods.js | 18 ++++++++++- .../scopes/scope/auth-methods/index.hbs | 32 +++++++++++++++++++ 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/addons/api/addon/services/resource-filter-store.js b/addons/api/addon/services/resource-filter-store.js index 660fd8694..9dbca0f5e 100644 --- a/addons/api/addon/services/resource-filter-store.js +++ b/addons/api/addon/services/resource-filter-store.js @@ -34,7 +34,6 @@ export class ResourceFilter { ); }) .flat(); - console.log(this.#filterObject, clauses); return this.and(clauses); } diff --git a/ui/admin/app/routes/scopes/scope/auth-methods.js b/ui/admin/app/routes/scopes/scope/auth-methods.js index 687c5ef81..74753f340 100644 --- a/ui/admin/app/routes/scopes/scope/auth-methods.js +++ b/ui/admin/app/routes/scopes/scope/auth-methods.js @@ -4,6 +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/resource-filter-param'; export default class ScopesScopeAuthMethodsRoute extends Route { // =services @@ -12,6 +13,11 @@ export default class ScopesScopeAuthMethodsRoute extends Route { @service notify; @service session; @service can; + @service resourceFilterStore; + + // =attributes + + @resourceFilterParam(['password', 'oidc']) type; // =methods @@ -32,7 +38,12 @@ export default class ScopesScopeAuthMethodsRoute extends Route { if ( this.can.can('list collection', scope, { collection: 'auth-methods' }) ) { - return this.store.query('auth-method', { scope_id }); + const { type } = this; + return this.resourceFilterStore.queryBy( + 'auth-method', + { type }, + { scope_id } + ); } } @@ -185,4 +196,9 @@ export default class ScopesScopeAuthMethodsRoute extends Route { const value = { from, to }; array.addObject(value); } + + @action + filterBy(field, value) { + this[field] = value; + } } 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 f4e285c77..0234133bb 100644 --- a/ui/admin/app/templates/scopes/scope/auth-methods/index.hbs +++ b/ui/admin/app/templates/scopes/scope/auth-methods/index.hbs @@ -52,6 +52,38 @@ {{/unless}} {{/if}} + {{#if (feature-flag 'filter')}} + + + {{#with + (resource-filter-param 'scopes.scope.auth-methods' 'type') + as |filter| + }} + + + + + + + + {{/with}} + + + {{/if}} + From 08c5f1db22ca794f3d4e875ce2c11cfbb6cd75e8 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Wed, 10 Nov 2021 16:18:41 -0500 Subject: [PATCH 04/10] chore: i18n filters --- ui/admin/app/templates/scopes/scope/auth-methods/index.hbs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 0234133bb..c5982d1de 100644 --- a/ui/admin/app/templates/scopes/scope/auth-methods/index.hbs +++ b/ui/admin/app/templates/scopes/scope/auth-methods/index.hbs @@ -73,7 +73,7 @@ > @@ -223,4 +223,4 @@ {{/if}} - \ No newline at end of file + From 665e7445d393c8b04b340622ebdd9bd20aa9a52b Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Fri, 12 Nov 2021 09:25:43 -0500 Subject: [PATCH 05/10] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20add=20"no=20result?= =?UTF-8?q?s"=20messaging=20when=20filtering=20down=20to=20zero?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../addon/decorators/resource-filter-param.js | 6 ++ .../has-resource-filter-param-selections.js | 73 ++++++++++++++++ .../has-resource-filter-param-selections.js | 1 + addons/core/package.json | 3 +- addons/core/translations/en-us.yaml | 2 + .../scopes/scope/auth-methods/index.hbs | 87 +++++++++++-------- yarn.lock | 64 +++++++++----- 7 files changed, 181 insertions(+), 55 deletions(-) create mode 100644 addons/core/addon/helpers/has-resource-filter-param-selections.js create mode 100644 addons/core/app/helpers/has-resource-filter-param-selections.js diff --git a/addons/core/addon/decorators/resource-filter-param.js b/addons/core/addon/decorators/resource-filter-param.js index 61978ee06..b8395a20f 100644 --- a/addons/core/addon/decorators/resource-filter-param.js +++ b/addons/core/addon/decorators/resource-filter-param.js @@ -46,6 +46,9 @@ export function resourceFilterParam(allowedValues, defaultValue) { // If the route has no query params specified yet, declare them. if (!Object.keys(target.queryParams).length) target.queryParams = {}; + // If the route has no resource filters list specified yet, create one. + if (!target.resourceFilterParams) target.resourceFilterParams = []; + // Add the resource filter query parameter to the route. Resource filter // param changes refresh the model but do not contribute to browser history. // See https://guides.emberjs.com/release/routing/query-params/ @@ -54,6 +57,9 @@ export function resourceFilterParam(allowedValues, defaultValue) { replace: true, }; + // Note the name of this filter param. + target.resourceFilterParams.push(name); + // Store the allowed values for future lookup // (via `ResourceFilterParamHelper`). target[filterAllowedValuesKey] = allowedValues; diff --git a/addons/core/addon/helpers/has-resource-filter-param-selections.js b/addons/core/addon/helpers/has-resource-filter-param-selections.js new file mode 100644 index 000000000..6f6015078 --- /dev/null +++ b/addons/core/addon/helpers/has-resource-filter-param-selections.js @@ -0,0 +1,73 @@ +import Helper from '@ember/component/helper'; +import { inject as service } from '@ember/service'; +import { getOwner } from '@ember/application'; +import { action } from '@ember/object'; + +/** + * Use this helper to determine if a resource filter for a route has any + * currently selected value. + * + * @see resourceFilterParam (decorator) + * + * @example + * + * {{#if (has-resource-filter-param-selections 'route.name' 'field')}} + * Field has filter selections. + * {{/if}} + */ +export default class HasResourceFilterParamSelectionsHelper extends Helper { + // =services + + @service router; + + // =methods + + // =lifecycle management methods + + /** + * Recompute this helper when the route changes. + */ + constructor() { + super(...arguments); + this.router.on('routeDidChange', this.routeDidChange); + } + + /** + * Stop listening to route events when this helper is destroyed. + */ + willDestroy() { + this.router.off('routeDidChange', this.routeDidChange); + super.willDestroy(); + } + + // =compute method + + /** + * Returns true if the specified route has a value set for + * any resource filter. + * @param {string} routeName + * @return {boolean} + */ + compute([routeName]) { + const owner = getOwner(this); + const route = owner.lookup(`route:${routeName}`); + const names = route.resourceFilterParams; + const selectedValues = names.map((name) => route[name] || null).flat(); + const anyTruthy = selectedValues.reduce( + (previousValue, currentValue) => previousValue || currentValue, + false + ); + return Boolean(anyTruthy); + } + + // =actions + + /** + * Triggers a recompute (see above) when the route changes, especially when + * route query params change. + */ + @action + routeDidChange() { + this.recompute(); + } +} diff --git a/addons/core/app/helpers/has-resource-filter-param-selections.js b/addons/core/app/helpers/has-resource-filter-param-selections.js new file mode 100644 index 000000000..b6ab1bc86 --- /dev/null +++ b/addons/core/app/helpers/has-resource-filter-param-selections.js @@ -0,0 +1 @@ +export { default } from 'core/helpers/has-resource-filter-param-selections'; diff --git a/addons/core/package.json b/addons/core/package.json index b51acc24b..fd10d6d9f 100644 --- a/addons/core/package.json +++ b/addons/core/package.json @@ -37,10 +37,10 @@ "ember-intl": "^5.7.0", "ember-loading": "^0.4.0", "ember-route-action-helper": "^2.0.8", + "ember-truth-helpers": "^3.0.0", "rose": "*" }, "devDependencies": { - "js-bexpr": "hashicorp/js-bexpr#9b4a4b54d85eba67fdfc0990133d1518d890b1e1", "@ember/optional-features": "^2.0.0", "@ember/test-helpers": "^2.4.2", "@glimmer/component": "^1.0.4", @@ -73,6 +73,7 @@ "eslint-plugin-prettier": "^4.0.0", "eslint-plugin-qunit": "^6.2.0", "faker": "^5.5.3", + "js-bexpr": "hashicorp/js-bexpr#9b4a4b54d85eba67fdfc0990133d1518d890b1e1", "loader.js": "^4.7.0", "npm-run-all": "^4.1.5", "prettier": "^2.4.0", diff --git a/addons/core/translations/en-us.yaml b/addons/core/translations/en-us.yaml index 8f98f633c..73a720d62 100644 --- a/addons/core/translations/en-us.yaml +++ b/addons/core/translations/en-us.yaml @@ -29,11 +29,13 @@ titles: welcome-to-boundary: Welcome to Boundary label: Label value: Value + no-results: No Results descriptions: empty-set: There are no items to display yet. You may be able to add items or try back later. origin-initialization: To get started, please enter your origin URL create-but-not-list: You do not have permission to list {resource}, but you can create new instances. neither-list-nor-create: You do not have permission to list or create {resource}. + no-results: We found no matching records. questions: delete-confirm: Are you sure you want to delete this resource? remove-confirm: Are you sure you want to remove this association? 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 c5982d1de..4c4509ede 100644 --- a/ui/admin/app/templates/scopes/scope/auth-methods/index.hbs +++ b/ui/admin/app/templates/scopes/scope/auth-methods/index.hbs @@ -35,8 +35,47 @@ - {{#if @model}} + {{#if + (or + @model + (has-resource-filter-param-selections 'scopes.scope.auth-methods') + ) + }} + + + {{#with + (resource-filter-param 'scopes.scope.auth-methods' 'type') + as |filter| + }} + + + + + + + + {{/with}} + + + {{/if}} + + {{#if @model}} {{#if (feature-flag 'primary-auth-method')}} {{#unless this.hasPrimaryAuthMethod}} - - {{#with - (resource-filter-param 'scopes.scope.auth-methods' 'type') - as |filter| - }} - - - - - - - - {{/with}} - - - {{/if}} - @@ -189,6 +196,18 @@ + {{else if (has-resource-filter-param-selections + 'scopes.scope.auth-methods' + )}} + + + + + {{t 'descriptions.no-results'}} + + + + {{else}} @@ -223,4 +242,4 @@ {{/if}} - + \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 3d3cb02ab..991935f89 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6993,14 +6993,14 @@ browserify-zlib@^0.2.0: pako "~1.0.5" browserslist@4.14.2, browserslist@^4.0.0, browserslist@^4.12.0, browserslist@^4.14.5, browserslist@^4.16.5, browserslist@^4.16.6, browserslist@^4.16.7, browserslist@^4.17.3: - version "4.17.4" - resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.17.4.tgz#72e2508af2a403aec0a49847ef31bd823c57ead4" - integrity sha512-Zg7RpbZpIJRW3am9Lyckue7PLytvVxxhJj1CaJVlCWENsGEAOlnlt8X0ZxGRPp7Bt9o8tIRM5SEXy4BCPMJjLQ== + version "4.17.6" + resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.17.6.tgz#c76be33e7786b497f66cad25a73756c8b938985d" + integrity sha512-uPgz3vyRTlEiCv4ee9KlsKgo2V6qPk7Jsn0KAn2OBqbqKo3iNcPEC1Ti6J4dwnz+aIRfEEEuOzC9IBk8tXUomw== dependencies: - caniuse-lite "^1.0.30001265" - electron-to-chromium "^1.3.867" + caniuse-lite "^1.0.30001274" + electron-to-chromium "^1.3.886" escalade "^3.1.1" - node-releases "^2.0.0" + node-releases "^2.0.1" picocolors "^1.0.0" bser@2.1.1: @@ -7311,10 +7311,10 @@ caniuse-api@^3.0.0: lodash.memoize "^4.1.2" lodash.uniq "^4.5.0" -caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001157, caniuse-lite@^1.0.30001265: - version "1.0.30001271" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001271.tgz#0dda0c9bcae2cf5407cd34cac304186616cc83e8" - integrity sha512-BBruZFWmt3HFdVPS8kceTBIguKxu4f99n5JNp06OlPD/luoAMIaIK5ieV5YjnBLH3Nysai9sxj9rpJj4ZisXOA== +caniuse-lite@^1.0.0, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001157, caniuse-lite@^1.0.30001274: + version "1.0.30001279" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001279.tgz#eb06818da481ef5096a3b3760f43e5382ed6b0ce" + integrity sha512-VfEHpzHEXj6/CxggTwSFoZBBYGQfQv9Cf42KPlO79sWXCD1QNKWKsKzFeWL7QpZHJQYAvocqV6Rty1yJMkqWLQ== capture-exit@^2.0.0: version "2.0.0" @@ -8570,7 +8570,7 @@ debug@^3.0.0, debug@^3.0.1, debug@^3.1.0, debug@^3.1.1, debug@^3.2.6: dependencies: ms "^2.1.1" -debuglog@^1.0.1: +debuglog@*, debuglog@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/debuglog/-/debuglog-1.0.1.tgz#aa24ffb9ac3df9a2351837cfb2d279360cd78492" integrity sha1-qiT/uaw9+aI1GDfPstJ5NgzXhJI= @@ -9151,10 +9151,10 @@ electron-rebuild@^2.0.3: tar "^6.0.5" yargs "^16.0.0" -electron-to-chromium@^1.3.867: - version "1.3.884" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.884.tgz#0cd8c3a80271fd84a81f284c60fb3c9ecb33c166" - integrity sha512-kOaCAa+biA98PwH5BpCkeUeTL6mCeg8p3Q3OhqzPyqhu/5QUnWAN2wr/3IK8xMQxIV76kfoQpP+Bn/wij/jXrg== +electron-to-chromium@^1.3.886: + version "1.3.895" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.3.895.tgz#9b0f8f2e32d8283bbb200156fd5d8dfd775f31ed" + integrity sha512-9Ww3fB8CWctjqHwkOt7DQbMZMpal2x2reod+/lU4b9axO1XJEDUpPMBxs7YnjLhhqpKXIIB5SRYN/B4K0QpvyQ== element-resize-detector@^1.2.2: version "1.2.3" @@ -10335,6 +10335,13 @@ ember-template-recast@^5.0.1, ember-template-recast@^5.0.3: tmp "^0.2.1" workerpool "^6.1.4" +ember-truth-helpers@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/ember-truth-helpers/-/ember-truth-helpers-3.0.0.tgz#86766bdca4ac9b86bce3d262dff2aabc4a0ea384" + integrity sha512-hPKG9QqruAELh0li5xaiLZtr88ioWYxWCXisAWHWE0qCP4a2hgtuMzKUPpiTCkltvKjuqpzTZCU4VhQ+IlRmew== + dependencies: + ember-cli-babel "^7.22.1" + ember-try-config@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/ember-try-config/-/ember-try-config-3.0.0.tgz#012d8c90cae9eb624e2b62040bf7e76a1aa58edc" @@ -13392,7 +13399,7 @@ import-lazy@^4.0.0: resolved "https://registry.yarnpkg.com/import-lazy/-/import-lazy-4.0.0.tgz#e8eb627483a0a43da3c03f3e35548be5cb0cc153" integrity sha512-rKtvo6a868b5Hu3heneU+L4yEQ4jYKLtjpnPeUdK7h0yzXGmyBTypknlkCvHFBqfX9YlorEiMM6Dnq/5atfHkw== -imurmurhash@^0.1.4: +imurmurhash@*, imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= @@ -15194,6 +15201,11 @@ lodash._baseflatten@^3.0.0: lodash.isarguments "^3.0.0" lodash.isarray "^3.0.0" +lodash._baseindexof@*: + version "3.1.0" + resolved "https://registry.yarnpkg.com/lodash._baseindexof/-/lodash._baseindexof-3.1.0.tgz#fe52b53a1c6761e42618d654e4a25789ed61822c" + integrity sha1-/lK1OhxnYeQmGNZU5KJXie1hgiw= + lodash._baseuniq@~4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/lodash._baseuniq/-/lodash._baseuniq-4.6.0.tgz#0ebb44e456814af7905c6212fa2c9b2d51b841e8" @@ -15202,11 +15214,16 @@ lodash._baseuniq@~4.6.0: lodash._createset "~4.0.0" lodash._root "~3.0.0" -lodash._bindcallback@^3.0.0: +lodash._bindcallback@*, lodash._bindcallback@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/lodash._bindcallback/-/lodash._bindcallback-3.0.1.tgz#e531c27644cf8b57a99e17ed95b35c748789392e" integrity sha1-5THCdkTPi1epnhftlbNcdIeJOS4= +lodash._cacheindexof@*: + version "3.0.2" + resolved "https://registry.yarnpkg.com/lodash._cacheindexof/-/lodash._cacheindexof-3.0.2.tgz#3dc69ac82498d2ee5e3ce56091bafd2adc7bde92" + integrity sha1-PcaayCSY0u5ePOVgkbr9Ktx73pI= + lodash._createassigner@^3.0.0: version "3.1.1" resolved "https://registry.yarnpkg.com/lodash._createassigner/-/lodash._createassigner-3.1.1.tgz#838a5bae2fdaca63ac22dee8e19fa4e6d6970b11" @@ -15216,12 +15233,19 @@ lodash._createassigner@^3.0.0: lodash._isiterateecall "^3.0.0" lodash.restparam "^3.0.0" +lodash._createcache@*: + version "3.1.2" + resolved "https://registry.yarnpkg.com/lodash._createcache/-/lodash._createcache-3.1.2.tgz#56d6a064017625e79ebca6b8018e17440bdcf093" + integrity sha1-VtagZAF2JeeevKa4AY4XRAvc8JM= + dependencies: + lodash._getnative "^3.0.0" + lodash._createset@~4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/lodash._createset/-/lodash._createset-4.0.3.tgz#0f4659fbb09d75194fa9e2b88a6644d363c9fe26" integrity sha1-D0ZZ+7CddRlPqeK4imZE02PJ/iY= -lodash._getnative@^3.0.0: +lodash._getnative@*, lodash._getnative@^3.0.0: version "3.9.1" resolved "https://registry.yarnpkg.com/lodash._getnative/-/lodash._getnative-3.9.1.tgz#570bc7dede46d61cdcde687d65d3eecbaa3aaff5" integrity sha1-VwvH3t5G1hzc3mh9ZdPuy6o6r/U= @@ -15439,7 +15463,7 @@ lodash.pick@^4.4.0: resolved "https://registry.yarnpkg.com/lodash.pick/-/lodash.pick-4.4.0.tgz#52f05610fff9ded422611441ed1fc123a03001b3" integrity sha1-UvBWEP/53tQiYRRB7R/BI6AwAbM= -lodash.restparam@^3.0.0: +lodash.restparam@*, lodash.restparam@^3.0.0: version "3.6.1" resolved "https://registry.yarnpkg.com/lodash.restparam/-/lodash.restparam-3.6.1.tgz#936a4e309ef330a7645ed4145986c85ae5b20805" integrity sha1-k2pOMJ7zMKdkXtQUWYbIWuWyCAU= @@ -16669,7 +16693,7 @@ node-pre-gyp@^0.11.0: semver "^5.3.0" tar "^4" -node-releases@^2.0.0: +node-releases@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/node-releases/-/node-releases-2.0.1.tgz#3d1d395f204f1f2f29a54358b9fb678765ad2fc5" integrity sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA== From 655d590353eebdd3ef52503d9d0f77fc24010812 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Fri, 12 Nov 2021 10:26:30 -0500 Subject: [PATCH 06/10] =?UTF-8?q?chore:=20=F0=9F=A4=96=20reduce=20mock=20a?= =?UTF-8?q?uth=20methods=20in=20global=20to=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/api/mirage/scenarios/default.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/api/mirage/scenarios/default.js b/addons/api/mirage/scenarios/default.js index 965234b5d..9291f8a3e 100644 --- a/addons/api/mirage/scenarios/default.js +++ b/addons/api/mirage/scenarios/default.js @@ -22,7 +22,7 @@ export default function (server) { // Auth const globalAuthMethods = server.createList( 'auth-method', - 4, + 1, { scope: globalScope }, 'withAccountsAndUsersAndManagedGroups' ); From be866ecf0c37ec5a11cbcb8c8e56b45841a60052 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Fri, 12 Nov 2021 15:33:29 -0500 Subject: [PATCH 07/10] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20dropdown=20should?= =?UTF-8?q?=20support=20@count=20to=20display=20a=20count=20badge?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- addons/rose/addon/components/rose/dropdown/index.hbs | 3 +++ addons/rose/addon/components/rose/dropdown/index.stories.mdx | 5 +++-- .../addon/styles/rose/components/dropdown/_dropdown.scss | 5 +++++ .../rose/tests/integration/components/rose/dropdown-test.js | 5 +++++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/addons/rose/addon/components/rose/dropdown/index.hbs b/addons/rose/addon/components/rose/dropdown/index.hbs index 5d02e87e8..d3679b3a6 100644 --- a/addons/rose/addon/components/rose/dropdown/index.hbs +++ b/addons/rose/addon/components/rose/dropdown/index.hbs @@ -18,6 +18,9 @@ {{@text}} + {{#if @count}} + {{@count}} + {{/if}} diff --git a/addons/rose/addon/components/rose/dropdown/index.stories.mdx b/addons/rose/addon/components/rose/dropdown/index.stories.mdx index 1f3545707..129302461 100644 --- a/addons/rose/addon/components/rose/dropdown/index.stories.mdx +++ b/addons/rose/addon/components/rose/dropdown/index.stories.mdx @@ -1,6 +1,6 @@ import { Meta, Story, Preview } from '@storybook/addon-docs/blocks'; import { hbs } from 'ember-cli-htmlbars'; -import { boolean } from '@storybook/addon-knobs'; +import { number, boolean } from '@storybook/addon-knobs'; @@ -11,7 +11,7 @@ A simple dropdown component with support for links and buttons. {{ template: hbs` - + Menu item Menu item @@ -23,6 +23,7 @@ A simple dropdown component with support for links and buttons. `, context: { + count: number('count', 0), showCaret: boolean('showCaret', true), }, }} diff --git a/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss b/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss index b8f3450f4..785708943 100644 --- a/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss +++ b/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss @@ -39,6 +39,11 @@ $chevronGrey: url("data:image/svg+xml;utf-8,`); + assert.equal(find('.rose-badge').textContent.trim(), '2'); + }); + test('it supports an icon', async function (assert) { await render( hbs`` From f44c3d783fa1c2a6d79c8a152f9b4765c6f0e1d4 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Fri, 12 Nov 2021 15:37:58 -0500 Subject: [PATCH 08/10] feature: show filter selection count in auth methods --- ui/admin/app/templates/scopes/scope/auth-methods/index.hbs | 1 + 1 file changed, 1 insertion(+) 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 4c4509ede..2d15d30f2 100644 --- a/ui/admin/app/templates/scopes/scope/auth-methods/index.hbs +++ b/ui/admin/app/templates/scopes/scope/auth-methods/index.hbs @@ -50,6 +50,7 @@ }} From f7dd4e6b9917819e9e74f8ccb414a1e3792484e6 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Fri, 12 Nov 2021 16:11:45 -0500 Subject: [PATCH 09/10] feature: add clear all filters feature --- addons/core/translations/actions/en-us.yaml | 1 + .../styles/rose/components/toolbar/_toolbar.scss | 7 +++++-- ui/admin/app/routes/scopes/scope/auth-methods.js | 13 +++++++++++++ .../templates/scopes/scope/auth-methods/index.hbs | 10 ++++++++++ 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/addons/core/translations/actions/en-us.yaml b/addons/core/translations/actions/en-us.yaml index 144ced636..118c5f601 100644 --- a/addons/core/translations/actions/en-us.yaml +++ b/addons/core/translations/actions/en-us.yaml @@ -35,3 +35,4 @@ close: Close toggle-secret: Toggle secret visibility minimize: Minimize fullscreen: Fullscreen +clear-all-filters: Clear all filters diff --git a/addons/rose/addon/styles/rose/components/toolbar/_toolbar.scss b/addons/rose/addon/styles/rose/components/toolbar/_toolbar.scss index cf6bd1491..80dd508c0 100644 --- a/addons/rose/addon/styles/rose/components/toolbar/_toolbar.scss +++ b/addons/rose/addon/styles/rose/components/toolbar/_toolbar.scss @@ -6,8 +6,11 @@ $xxxxs: sizing.rems(xxxxs); // 1 .rose-toolbar { background-color: var(--ui-gray-subtler-6); + padding: $xxs + $xxxxs; - .rose-form { - padding: $xxs + $xxxxs; + button { + display: inline-block; + font-weight: normal; + vertical-align: middle; } } diff --git a/ui/admin/app/routes/scopes/scope/auth-methods.js b/ui/admin/app/routes/scopes/scope/auth-methods.js index 74753f340..e83a95911 100644 --- a/ui/admin/app/routes/scopes/scope/auth-methods.js +++ b/ui/admin/app/routes/scopes/scope/auth-methods.js @@ -197,8 +197,21 @@ export default class ScopesScopeAuthMethodsRoute extends Route { array.addObject(value); } + /** + * Sets the specified resource filter field to the specified value. + * @param {string} field + * @param value + */ @action filterBy(field, value) { this[field] = value; } + + /** + * Clears and filter selections. + */ + @action + clearAllFilters() { + this.type = []; + } } 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 2d15d30f2..d6075980e 100644 --- a/ui/admin/app/templates/scopes/scope/auth-methods/index.hbs +++ b/ui/admin/app/templates/scopes/scope/auth-methods/index.hbs @@ -72,6 +72,16 @@ {{/with}} + + {{#if + (has-resource-filter-param-selections 'scopes.scope.auth-methods') + }} + {{t 'actions.clear-all-filters'}} + {{/if}} {{/if}} From 374614b7d1bcfed4b8b869462859f1c3a387fd20 Mon Sep 17 00:00:00 2001 From: Randall Morey Date: Sat, 13 Nov 2021 09:41:39 -0500 Subject: [PATCH 10/10] make dropdown badge darker --- .../rose/components/dropdown/_dropdown.scss | 4 +++ yarn.lock | 27 ++++--------------- 2 files changed, 9 insertions(+), 22 deletions(-) diff --git a/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss b/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss index 785708943..62a8f3d36 100644 --- a/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss +++ b/addons/rose/addon/styles/rose/components/dropdown/_dropdown.scss @@ -103,6 +103,10 @@ $chevronGrey: url("data:image/svg+xml;utf-8,