init
This commit is contained in:
commit
a096824b20
10 files changed
+252
-43
No files matched your search
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -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 };
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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';
|
||||
|
||||
<Meta title="Rose|Dropdown" component="Dropdown" />
|
||||
|
||||
@@ -124,8 +125,8 @@ Dropdown indicator can be hidden using `showCaret` attribute.
|
||||
</Rose::Dropdown>
|
||||
```
|
||||
|
||||
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
|
||||
<Rose::Form as |form|>
|
||||
@@ -145,6 +146,67 @@ form field.
|
||||
</Rose::Form>
|
||||
```
|
||||
|
||||
```html
|
||||
<Rose::Form as |form|>
|
||||
<Rose::Dropdown @text="Items" @ignoreClickInside={{true}} as |dropdown|>
|
||||
<Rose::Form::Checkbox::Group
|
||||
@name='checkbox-group'
|
||||
@items={{this.items}}
|
||||
@selectedItems={{this.selectedItems}}
|
||||
@onChange={{fn this.onChange}}
|
||||
as |group|
|
||||
>
|
||||
<dropdown.item>
|
||||
<group.checkbox
|
||||
@label={{group.item.name}}
|
||||
value={{group.item.id}}
|
||||
/>
|
||||
</dropdown.item>
|
||||
</Rose::Form::Checkbox::Group>
|
||||
|
||||
</Rose::Dropdown>
|
||||
</Rose::Form>
|
||||
```
|
||||
|
||||
|
||||
<Preview>
|
||||
<Story name="Dropdown with Checkboxes" height="10rem">{{
|
||||
template: hbs`
|
||||
<Rose::Form as |form|>
|
||||
<Rose::Dropdown @ignoreClickInside={{true}} @text="Items" as |dropdown|>
|
||||
<Rose::Form::Checkbox::Group
|
||||
@name={{name}}
|
||||
@disabled={{disabled}}
|
||||
@items={{items}}
|
||||
@selectedItems={{selectedItems}}
|
||||
@onChange={{onChange}}
|
||||
as |group|
|
||||
>
|
||||
<dropdown.item>
|
||||
<group.checkbox
|
||||
@label={{group.item.name}}
|
||||
value={{group.item.id}}
|
||||
/>
|
||||
</dropdown.item>
|
||||
</Rose::Form::Checkbox::Group>
|
||||
</Rose::Dropdown>
|
||||
</Rose::Form>
|
||||
`,
|
||||
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'),
|
||||
}
|
||||
}}</Story>
|
||||
</Preview>
|
||||
|
||||
|
||||
|
||||
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
|
||||
|
||||
@@ -69,4 +69,78 @@ $checkmark: url("data:image/svg+xml;utf-8,<svg viewBox='0 0 24 24' fill='%231563
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.rose-form-checkbox {
|
||||
color: currentColor;
|
||||
margin-bottom: 0;
|
||||
.rose-form-checkbox-label {
|
||||
display: block;
|
||||
margin: -#{$paddingY} -#{$paddingX};
|
||||
padding-top: sizing.rems(xs) + sizing.rems(xxxxs);
|
||||
padding-bottom: sizing.rems(xs) + sizing.rems(xxxxs);
|
||||
padding-left: sizing.rems(s);
|
||||
padding-right: sizing.rems(xl) + sizing.rems(l);
|
||||
font-weight: normal;
|
||||
|
||||
&:hover {
|
||||
background-color: var(--ui-gray-subtler-5);
|
||||
}
|
||||
|
||||
&::after {
|
||||
//top: 0.25rem
|
||||
top: sizing.rems(xxs);
|
||||
right: sizing.rems(xs);
|
||||
left: auto;
|
||||
border: sizing.rems(xxxs) solid var(--ui-gray-subtler-2);
|
||||
border-radius: sizing.rems(xxxs);
|
||||
transform: scale(0.66);
|
||||
}
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
top: sizing.rems(xs);
|
||||
left: 0;
|
||||
display: block;
|
||||
width: sizing.rems(m);
|
||||
height: sizing.rems(m);
|
||||
pointer-events: none;
|
||||
content: ' ';
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
|
||||
.rose-form-checkbox-field {
|
||||
&:hover {
|
||||
~ .rose-form-checkbox-label {
|
||||
&::after {
|
||||
border-color: var(--ui-gray);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:checked {
|
||||
~ .rose-form-checkbox-label {
|
||||
color: var(--action);
|
||||
background-color: var(--action-subtler-1h);
|
||||
&::after {
|
||||
border-color: var(--action);
|
||||
background-size: sizing.rems(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:disabled {
|
||||
~ .rose-form-checkbox-label {
|
||||
opacity: 0.5;
|
||||
&::after {
|
||||
border-color: var(--ui-gray-subtler-2);
|
||||
background-color: var(--ui-gray-subtler-4);
|
||||
}
|
||||
&::before {
|
||||
background: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,8 @@ export default class ScopesScopeAuthMethodsRoute extends Route {
|
||||
this.can.can('list collection', scope, { collection: 'auth-methods' })
|
||||
) {
|
||||
const { type } = this;
|
||||
console.log(type, 'what is type in authhh')
|
||||
|
||||
return this.resourceFilterStore.queryBy(
|
||||
'auth-method',
|
||||
{ type },
|
||||
|
||||
@@ -6,6 +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/resource-filter-param';
|
||||
|
||||
const POLL_TIMEOUT_SECONDS = config.sessionPollingTimeoutSeconds;
|
||||
|
||||
@@ -16,9 +17,12 @@ export default class ScopesScopeSessionsRoute extends Route {
|
||||
@service intl;
|
||||
@service notify;
|
||||
@service session;
|
||||
@service resourceFilterStore;
|
||||
|
||||
// =attributes
|
||||
|
||||
@resourceFilterParam(['active', 'pending', 'canceling', 'terminated']) status;
|
||||
|
||||
/**
|
||||
* A simple Ember Concurrency-based polling task that refreshes the route
|
||||
* every POLL_TIMEOUT_SECONDS seconds. This is necessary to display changes
|
||||
@@ -53,7 +57,15 @@ export default class ScopesScopeSessionsRoute extends Route {
|
||||
*/
|
||||
async model() {
|
||||
const { id: scope_id } = this.modelFor('scopes.scope');
|
||||
const sessions = await this.store.query('session', { scope_id });
|
||||
// const sessions = await this.store.query('session', { scope_id });
|
||||
|
||||
const { status } = this;
|
||||
const sessions = await this.resourceFilterStore.queryBy(
|
||||
'session',
|
||||
{ status },
|
||||
{ scope_id }
|
||||
);
|
||||
|
||||
const sessionAggregates = await all(
|
||||
sessions.map(session => 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 = [];
|
||||
}
|
||||
}
|
||||
@@ -13,21 +13,62 @@
|
||||
</page.header>
|
||||
|
||||
<page.body>
|
||||
{{{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')
|
||||
)
|
||||
}}
|
||||
<Rose::Toolbar>
|
||||
<Rose::Form>
|
||||
<section>
|
||||
<Rose::Form as |form|>
|
||||
{{#with
|
||||
(resource-filter-param 'scopes.scope.sessions' 'status')
|
||||
as |filter|
|
||||
}}
|
||||
<Rose::Dropdown
|
||||
@text={{t 'form.status.label'}}
|
||||
@text={{t (concat 'form.' filter.name '.label')}}
|
||||
@count={{filter.selectedValue.length}}
|
||||
@ignoreClickInside={{true}}
|
||||
/>
|
||||
</section>
|
||||
as |dropdown|
|
||||
>
|
||||
|
||||
<form.checkboxGroup
|
||||
@name={{filter.name}}
|
||||
@items={{filter.allowedValues}}
|
||||
@selectedItems={{filter.selectedValue}}
|
||||
@onChange={{route-action 'filterBy' filter.name}}
|
||||
as |group|
|
||||
>
|
||||
<dropdown.item>
|
||||
<group.checkbox
|
||||
@label={{t
|
||||
(concat 'resources.session.status.' group.item)
|
||||
}}
|
||||
value={{group.item}}
|
||||
/>
|
||||
</dropdown.item>
|
||||
</form.checkboxGroup>
|
||||
</Rose::Dropdown>
|
||||
{{/with}}
|
||||
|
||||
{{#if
|
||||
(has-resource-filter-param-selections 'scopes.scope.sessions')
|
||||
}}
|
||||
<Rose::Button
|
||||
@style='inline-link-action'
|
||||
@iconLeft='flight-icons/svg/x-16'
|
||||
{{on 'click' (route-action 'clearAllFilters')}}
|
||||
>{{t 'actions.clear-all-filters'}}
|
||||
</Rose::Button>
|
||||
{{/if}}
|
||||
</Rose::Form>
|
||||
</Rose::Toolbar>
|
||||
{{/if}}
|
||||
|
||||
{{#if @model}}
|
||||
<Rose::Table as |table|>
|
||||
<table.header as |header|>
|
||||
<header.row as |row|>
|
||||
@@ -98,10 +139,18 @@
|
||||
{{/each}}
|
||||
</table.body>
|
||||
</Rose::Table>
|
||||
|
||||
{{else}}
|
||||
|
||||
{{else if (has-resource-filter-param-selections
|
||||
'scopes.scope.sessions'
|
||||
)}}
|
||||
<Rose::Layout::Centered>
|
||||
<Rose::Message @title={{t 'titles.no-results'}} as |message|>
|
||||
<message.description>
|
||||
{{t 'descriptions.no-results'}}
|
||||
</message.description>
|
||||
</Rose::Message>
|
||||
</Rose::Layout::Centered>
|
||||
{{else}}
|
||||
<Rose::Layout::Centered>
|
||||
<Rose::Message
|
||||
@title={{t 'resources.session.messages.none.title'}}
|
||||
as |message|
|
||||
@@ -111,9 +160,6 @@
|
||||
</message.description>
|
||||
</Rose::Message>
|
||||
</Rose::Layout::Centered>
|
||||
|
||||
{{/if}}
|
||||
|
||||
{{/if}}
|
||||
</page.body>
|
||||
|
||||
</Rose::Layout::Page>
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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=
|
||||
|
||||
Reference in new issue
Block a user