diff --git a/addons/api/addon/services/resource-filter-store.js b/addons/api/addon/services/resource-filter-store.js index 9dbca0f5e..949541dac 100644 --- a/addons/api/addon/services/resource-filter-store.js +++ b/addons/api/addon/services/resource-filter-store.js @@ -104,6 +104,7 @@ export default class ResourceFilterStoreService extends Service { const query = Object.assign({}, storeQuery); // Apply filters to store query when available if (filter.queryExpression) query.filter = filter.queryExpression; + console.log(modelName, query, 'queryyyyy', this.store.query(modelName, query)) return this.store.query(modelName, query); } } diff --git a/addons/core/addon/helpers/resource-filter-param.js b/addons/core/addon/helpers/resource-filter-param.js index e78ac20a7..fefc30009 100644 --- a/addons/core/addon/helpers/resource-filter-param.js +++ b/addons/core/addon/helpers/resource-filter-param.js @@ -49,14 +49,19 @@ export default class ResourceFilterParamHelper extends Helper { * @return {object} */ compute([routeName, name]) { + console.log(routeName, name, 'route namess') const owner = getOwner(this); // Filter options const route = owner.lookup(`route:${routeName}`); const filterAllowedValuesKey = `filter-allowed-values-${name}`; + console.log(route, filterAllowedValuesKey, 'foiltallowed values') const allowedValues = route[filterAllowedValuesKey]; + console.log(allowedValues, 'allowed values') + // Selected filters const rawValue = route[name]; const selectedValue = rawValue || null; + console.log(name, allowedValues, selectedValue, 'pfcrrfe') return { name, allowedValues, selectedValue }; } diff --git a/addons/core/translations/resources/en-us.yaml b/addons/core/translations/resources/en-us.yaml index 609f74266..f787cf133 100644 --- a/addons/core/translations/resources/en-us.yaml +++ b/addons/core/translations/resources/en-us.yaml @@ -135,6 +135,11 @@ session: title_plural: Sessions active_plural: Active Sessions description: A session is a connection to a target initiated through Boundary. + status: + active: Active + pending: Pending + canceling: Canceling + terminated: Terminated messages: none: title: No Sessions diff --git a/addons/rose/addon/components/rose/dropdown/index.stories.mdx b/addons/rose/addon/components/rose/dropdown/index.stories.mdx index 129302461..985e9011f 100644 --- a/addons/rose/addon/components/rose/dropdown/index.stories.mdx +++ b/addons/rose/addon/components/rose/dropdown/index.stories.mdx @@ -1,6 +1,7 @@ import { Meta, Story, Preview } from '@storybook/addon-docs/blocks'; import { hbs } from 'ember-cli-htmlbars'; -import { number, boolean } from '@storybook/addon-knobs'; +import { boolean, object } from '@storybook/addon-knobs'; +import { action } from '@storybook/addon-actions'; @@ -124,8 +125,8 @@ Dropdown indicator can be hidden using `showCaret` attribute. ``` -Dropdowns also support radio buttons. Currently, this is the only supported -form field. +Dropdowns also support radio buttons and checkboxes. Currently, radio buttons and checkboxes are the only supported +form fields. ```html @@ -145,6 +146,67 @@ form field. ``` +```html + + + + + + + + + + +``` + + + + {{ + template: hbs` + + + + + + + + + + `, + context: { + disabled: boolean('disabled', false), + items: object('items', [ + { id: 1, name: 'Foo' }, + { id: 2, name: 'Bar' }, + { id: 3, name: 'Baz' }, + ]), + selectedItems: object('selectedItems', []), + onChange: action('changed'), + } + }} + + + + Closing dropdown after clicking inside it's content can be ignored using `ignoreClickInside`. This is useful when dropdown contains keyvalue items that users need to select/copy/interact with. ```html diff --git a/addons/rose/addon/styles/rose/components/dropdown/_item.scss b/addons/rose/addon/styles/rose/components/dropdown/_item.scss index 2d9634e42..96e29dd5a 100644 --- a/addons/rose/addon/styles/rose/components/dropdown/_item.scss +++ b/addons/rose/addon/styles/rose/components/dropdown/_item.scss @@ -69,4 +69,78 @@ $checkmark: url("data:image/svg+xml;utf-8, hash({ session, @@ -69,7 +81,7 @@ export default class ScopesScopeSessionsRoute extends Route { this.store.findRecord('target', session.target_id) ) : null, - })) + })) ); // Sort sessions by time created... let sortedSessionAggregates = @@ -79,6 +91,7 @@ export default class ScopesScopeSessionsRoute extends Route { ...sortedSessionAggregates.filter((aggregate) => aggregate.session.status === 'active'), ...sortedSessionAggregates.filter((aggregate) => aggregate.session.status !== 'active'), ]; + console.log(sessionAggregates, 'sorted aggrefa') return sortedSessionAggregates; } @@ -109,4 +122,22 @@ export default class ScopesScopeSessionsRoute extends Route { await session.cancelSession(); } + /** + * Sets the specified resource filter field to the specified value. + * @param {string} field + * @param value + */ + @action + filterBy(field, value) { + console.log(field, value, 'actionnnn') + this[field] = value; + } + + /** + * Clears and filter selections. + */ + @action + clearAllFilters() { + this.status = []; + } } diff --git a/ui/admin/app/templates/scopes/scope/sessions/index.hbs b/ui/admin/app/templates/scopes/scope/sessions/index.hbs index 01aa8f737..8082c77a4 100644 --- a/ui/admin/app/templates/scopes/scope/sessions/index.hbs +++ b/ui/admin/app/templates/scopes/scope/sessions/index.hbs @@ -13,21 +13,62 @@ + {{{log @model (has-resource-filter-param-selections 'scopes.scope.sessions') 'ppppp'}}} + {{{log (resource-filter-param 'scopes.scope.sessions' 'status') 'ferfre' }}} - {{#if @model}} - {{#if (feature-flag 'filter')}} + {{#if + (or + @model + (has-resource-filter-param-selections 'scopes.scope.sessions') + ) + }} - -
+ + {{#with + (resource-filter-param 'scopes.scope.sessions' 'status') + as |filter| + }} -
+ as |dropdown| + > + + + + + + + + {{/with}} + + {{#if + (has-resource-filter-param-selections 'scopes.scope.sessions') + }} + {{t 'actions.clear-all-filters'}} + + {{/if}}
{{/if}} + {{#if @model}} @@ -98,10 +139,18 @@ {{/each}} - - {{else}} - + {{else if (has-resource-filter-param-selections + 'scopes.scope.sessions' + )}} + + + {{t 'descriptions.no-results'}} + + + + {{else}} + - - {{/if}} - +{{/if}}
- \ No newline at end of file diff --git a/ui/admin/config/environment.js b/ui/admin/config/environment.js index 613c6a3e8..f3555e72b 100644 --- a/ui/admin/config/environment.js +++ b/ui/admin/config/environment.js @@ -35,7 +35,7 @@ module.exports = function (environment) { companyName: 'HashiCorp', notifyTimeout: 4000, - sessionPollingTimeoutSeconds: 2.5, + sessionPollingTimeoutSeconds: 111111112.5, oidcPollingTimeoutSeconds: 1, documentation: { @@ -155,7 +155,7 @@ module.exports = function (environment) { // Notification timeout should be 0 for fast tests ENV.notifyTimeout = 0; // Polling timeouts should be short - ENV.sessionPollingTimeoutSeconds = 0.25; + ENV.sessionPollingTimeoutSeconds = 111111110.25; ENV.oidcPollingTimeoutSeconds = 0; ENV.enableConfirmService = false; diff --git a/yarn.lock b/yarn.lock index 991935f89..8bcb1a8fc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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@*, debuglog@^1.0.1: +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= @@ -13399,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@*, imurmurhash@^0.1.4: +imurmurhash@^0.1.4: version "0.1.4" resolved "https://registry.yarnpkg.com/imurmurhash/-/imurmurhash-0.1.4.tgz#9218b9b2b928a238b13dc4fb6b6d576f231453ea" integrity sha1-khi5srkoojixPcT7a21XbyMUU+o= @@ -15201,11 +15201,6 @@ 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" @@ -15214,16 +15209,11 @@ lodash._baseuniq@~4.6.0: lodash._createset "~4.0.0" lodash._root "~3.0.0" -lodash._bindcallback@*, lodash._bindcallback@^3.0.0: +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" @@ -15233,19 +15223,12 @@ 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@*, lodash._getnative@^3.0.0: +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= @@ -15463,7 +15446,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@*, lodash.restparam@^3.0.0: +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=