diff --git a/ui/packages/consul-ui/app/components/consul/acl/list/index.hbs b/ui/packages/consul-ui/app/components/consul/acl/list/index.hbs new file mode 100644 index 0000000000..371e0155e2 --- /dev/null +++ b/ui/packages/consul-ui/app/components/consul/acl/list/index.hbs @@ -0,0 +1,122 @@ +
+ + + Name + Type + + + + {{item.Name}} + + + {{#if (eq item.Type 'management')}} + {{item.Type}} + {{else}} + {{item.Type}} + {{/if}} + + + + + + More + + +
  • + Edit +
  • + {{#if (eq item.ID token.SecretID) }} +
  • + +
    +
    +
    +
    + Confirm logout +
    +

    + Are you sure you want to stop using this ACL token? This will log you out. +

    +
    +
      +
    • + +
    • +
    • + +
    • +
    +
    +
    +
  • + {{else}} +
  • + +
    +
    +
    +
    + Confirm use +
    +

    + Are you sure you want to use this ACL token? +

    +
    +
      +
    • + +
    • +
    • + +
    • +
    +
    +
    +
  • + {{/if}} +
  • + +
  • + {{# if (not-eq item.ID 'anonymous') }} +
  • + +
    +
    +
    +
    + Confirm Delete +
    +

    + Are you sure you want to delete this token? +

    +
    +
      +
    • + +
    • +
    • + +
    • +
    +
    +
    +
  • + {{/if}} +
    +
    +
    +
    +
    diff --git a/ui/packages/consul-ui/app/components/consul/acl/search-bar/index.hbs b/ui/packages/consul-ui/app/components/consul/acl/search-bar/index.hbs new file mode 100644 index 0000000000..c5beb16ad4 --- /dev/null +++ b/ui/packages/consul-ui/app/components/consul/acl/search-bar/index.hbs @@ -0,0 +1,59 @@ + diff --git a/ui/packages/consul-ui/app/components/consul/intention/list/index.hbs b/ui/packages/consul-ui/app/components/consul/intention/list/index.hbs index 92a43a6038..9c1606db5f 100644 --- a/ui/packages/consul-ui/app/components/consul/intention/list/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/intention/list/index.hbs @@ -3,15 +3,8 @@ ...attributes {{did-update this.updateCRDManagement @items}} > - - - -{{#let (hash - Table=(component 'consul/intention/list/table' delete=writer.delete items=this.items) +{{yield (hash + Table=(component 'consul/intention/list/table' delete=@delete items=this.items) CheckNotice=(if this.checkedItem (component 'consul/intention/list/check' item=this.checkedItem) '' @@ -20,15 +13,5 @@ (component 'consul/intention/notice/custom-resource') '' ) -) as |api|}} - - {{#if (gt this.items.length 0)}} - {{yield api to="idle"}} - {{else}} - {{yield api to="empty"}} - {{/if}} -{{/let}} - - - +)}} \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/consul/intention/list/index.js b/ui/packages/consul-ui/app/components/consul/intention/list/index.js index 01d0181bac..e07c637a2c 100644 --- a/ui/packages/consul-ui/app/components/consul/intention/list/index.js +++ b/ui/packages/consul-ui/app/components/consul/intention/list/index.js @@ -5,13 +5,8 @@ import { tracked } from '@glimmer/tracking'; import { sort } from '@ember/object/computed'; export default class ConsulIntentionList extends Component { - @service('filter') filter; - @service('sort') sort; - @service('search') search; @service('repository/intention') repo; - @sort('searched', 'comparator') sorted; - @tracked isManagedByCRDs; constructor(owner, args) { @@ -19,25 +14,11 @@ export default class ConsulIntentionList extends Component { this.updateCRDManagement(args.items); } get items() { - return this.sorted; - } - get filtered() { - const predicate = this.filter.predicate('intention'); - return this.args.items.filter(predicate(this.args.filters)); - } - get searched() { - if (typeof this.args.search === 'undefined') { - return this.filtered; - } - const predicate = this.search.predicate('intention'); - return this.filtered.filter(predicate(this.args.search)); - } - get comparator() { - return [this.args.sort]; + return this.args.items || []; } get checkedItem() { - if (this.searched.length === 1) { - return this.searched[0].SourceName === this.args.search ? this.searched[0] : null; + if (this.items.length === 1 && this.args.check) { + return this.items[0].SourceName === this.args.check ? this.items[0] : null; } return null; } diff --git a/ui/packages/consul-ui/app/components/consul/intention/search-bar/index.hbs b/ui/packages/consul-ui/app/components/consul/intention/search-bar/index.hbs index 630376dde7..57cfa5faa3 100644 --- a/ui/packages/consul-ui/app/components/consul/intention/search-bar/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/intention/search-bar/index.hbs @@ -2,27 +2,48 @@ class="consul-intention-search-bar filter-bar" ...attributes > - +
    - Intent + Permission {{#let components.Optgroup components.Option as |Optgroup Option|}} - - - + + + {{/let}} @@ -32,7 +53,7 @@ class="type-sort" data-test-sort-control @position="right" - @onchange={{action onsort}} + @onchange={{action @onsort}} @multiple={{false}} as |components|> @@ -49,27 +70,27 @@ )) as |selectable| }} - {{get selectable sort}} + {{get selectable @sort}} {{/let}} {{#let components.Optgroup components.Option as |Optgroup Option|}} - - + + - - + + - - + + - - + + {{/let}} diff --git a/ui/packages/consul-ui/app/components/consul/intention/search-bar/index.js b/ui/packages/consul-ui/app/components/consul/intention/search-bar/index.js deleted file mode 100644 index 4798652642..0000000000 --- a/ui/packages/consul-ui/app/components/consul/intention/search-bar/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({ - tagName: '', -}); diff --git a/ui/packages/consul-ui/app/components/consul/intention/search-bar/index.scss b/ui/packages/consul-ui/app/components/consul/intention/search-bar/index.scss index 22ee1ea745..a823657d47 100644 --- a/ui/packages/consul-ui/app/components/consul/intention/search-bar/index.scss +++ b/ui/packages/consul-ui/app/components/consul/intention/search-bar/index.scss @@ -1,9 +1,12 @@ .consul-intention-search-bar { .value-allow button::before { - @extend %with-arrow-right-color-mask, %as-pseudo; + @extend %with-arrow-right-mask, %as-pseudo; color: $green-500; } .value-deny button::before { @extend %with-deny-color-icon, %as-pseudo; } + .value- button::before { + @extend %with-layers-mask, %as-pseudo; + } } diff --git a/ui/packages/consul-ui/app/components/consul/kv/list/index.hbs b/ui/packages/consul-ui/app/components/consul/kv/list/index.hbs index efef90339f..8099596e35 100644 --- a/ui/packages/consul-ui/app/components/consul/kv/list/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/kv/list/index.hbs @@ -1,58 +1,56 @@ - - -{{#if (gt items.length 0)}} - - - Name - - - - {{right-trim (left-trim item.Key parent.Key) '/'}} - - - - - - More - - -
  • - {{if item.isFolder 'View' 'Edit'}} -
  • -
  • - -
    -
    -
    -
    - Confirm Delete -
    -

    - Are you sure you want to delete this key? -

    -
    -
      -
    • - -
    • -
    • - -
    • -
    -
    -
    -
  • -
    -
    -
    -
    -{{else}} - {{yield}} -{{/if}} -
    -
    \ No newline at end of file + + + Name + + + + {{right-trim (left-trim item.Key @parent.Key) '/'}} + + + + + + More + + +
  • + {{if item.isFolder 'View' 'Edit'}} +
  • +
  • + +
    +
    +
    +
    + Confirm Delete +
    +

    + Are you sure you want to delete this key? +

    +
    +
      +
    • + +
    • +
    • + +
    • +
    +
    +
    +
  • +
    +
    +
    +
    \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/consul/kv/list/index.js b/ui/packages/consul-ui/app/components/consul/kv/list/index.js deleted file mode 100644 index 8e9833de26..0000000000 --- a/ui/packages/consul-ui/app/components/consul/kv/list/index.js +++ /dev/null @@ -1,6 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({ - tagName: '', - ondelete: function() {}, -}); diff --git a/ui/packages/consul-ui/app/components/consul/kv/search-bar/index.hbs b/ui/packages/consul-ui/app/components/consul/kv/search-bar/index.hbs new file mode 100644 index 0000000000..0652216a11 --- /dev/null +++ b/ui/packages/consul-ui/app/components/consul/kv/search-bar/index.hbs @@ -0,0 +1,68 @@ + \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/consul/node/list/index.hbs b/ui/packages/consul-ui/app/components/consul/node/list/index.hbs index 081655a423..a7a9f871b1 100644 --- a/ui/packages/consul-ui/app/components/consul/node/list/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/node/list/index.hbs @@ -1,5 +1,7 @@ -{{#if (gt items.length 0)}} - +
    @@ -24,8 +26,8 @@ - {{#if (eq item.Address leader.Address)}} - Leader + {{#if (eq item.Address @leader.Address)}} + Leader {{/if}} {{#if (gt item.Services.length 0)}} @@ -46,4 +48,3 @@
    -{{/if}} diff --git a/ui/packages/consul-ui/app/components/consul/node/list/index.js b/ui/packages/consul-ui/app/components/consul/node/list/index.js deleted file mode 100644 index 4798652642..0000000000 --- a/ui/packages/consul-ui/app/components/consul/node/list/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({ - tagName: '', -}); diff --git a/ui/packages/consul-ui/app/components/consul/node/search-bar/index.hbs b/ui/packages/consul-ui/app/components/consul/node/search-bar/index.hbs index 82814f07aa..eb377d583d 100644 --- a/ui/packages/consul-ui/app/components/consul/node/search-bar/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/node/search-bar/index.hbs @@ -1,14 +1,39 @@ -
    - + +
    @@ -18,10 +43,10 @@ {{#let components.Optgroup components.Option as |Optgroup Option|}} - - - - + + + + {{/let}} @@ -31,7 +56,7 @@ class="type-sort" data-test-sort-control @position="right" - @onchange={{action onsort}} + @onchange={{action @onsort}} @multiple={{false}} as |components|> @@ -44,19 +69,19 @@ )) as |selectable| }} - {{get selectable sort}} + {{get selectable @sort}} {{/let}} {{#let components.Optgroup components.Option as |Optgroup Option|}} - - + + - - + + {{/let}} diff --git a/ui/packages/consul-ui/app/components/consul/node/search-bar/index.js b/ui/packages/consul-ui/app/components/consul/node/search-bar/index.js deleted file mode 100644 index 4798652642..0000000000 --- a/ui/packages/consul-ui/app/components/consul/node/search-bar/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({ - tagName: '', -}); diff --git a/ui/packages/consul-ui/app/components/consul/nspace/list/index.hbs b/ui/packages/consul-ui/app/components/consul/nspace/list/index.hbs index d5fcc588ed..085f9d045e 100644 --- a/ui/packages/consul-ui/app/components/consul/nspace/list/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/nspace/list/index.hbs @@ -1,59 +1,60 @@ -{{#if (gt items.length 0)}} - - - {{#if item.DeletedAt}} -

    - Deleting {{item.Name}}... -

    - {{else}} - {{item.Name}} - {{/if}} -
    - -
    -
    Description
    -
    - {{item.Description}} -
    -
    - {{#if (env 'CONSUL_ACLS_ENABLED')}} - - {{/if}} -
    - - {{#if (not item.DeletedAt)}} - - - - Edit - - - {{#if (not-eq item.Name 'default') }} - - - Delete - - - - - Confirm delete - - -

    - Are you sure you want to delete this namespace? -

    -
    - - Delete - -
    -
    -
    - {{/if}} -
    - {{/if}} -
    -
    + + +{{#if item.DeletedAt}} +

    + Deleting {{item.Name}}... +

    {{else}} - {{yield to="empty"}} -{{/if}} \ No newline at end of file + {{item.Name}} +{{/if}} +
    + +
    +
    Description
    +
    + {{item.Description}} +
    +
    + {{#if (env 'CONSUL_ACLS_ENABLED')}} + + {{/if}} +
    + +{{#if (not item.DeletedAt)}} + + + + Edit + + + {{#if (not-eq item.Name 'default') }} + + + Delete + + + + + Confirm delete + + +

    + Are you sure you want to delete this namespace? +

    +
    + + Delete + +
    +
    +
    + {{/if}} +
    +{{/if}} +
    +
    \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/consul/nspace/list/index.js b/ui/packages/consul-ui/app/components/consul/nspace/list/index.js index 287b2bea3c..5b894ebb42 100644 --- a/ui/packages/consul-ui/app/components/consul/nspace/list/index.js +++ b/ui/packages/consul-ui/app/components/consul/nspace/list/index.js @@ -1,10 +1,8 @@ -import Component from '@ember/component'; +import Component from '@glimmer/component'; +import { action } from '@ember/object'; -export default Component.extend({ - tagName: '', - actions: { - isLinkable: function(item) { - return !item.DeletedAt; - }, - }, -}); +export default class ConsulNspaceList extends Component { + isLinkable(item) { + return !item.DeletedAt; + } +} diff --git a/ui/packages/consul-ui/app/components/consul/nspace/search-bar/index.hbs b/ui/packages/consul-ui/app/components/consul/nspace/search-bar/index.hbs index f7a5beca93..ab47be81b4 100644 --- a/ui/packages/consul-ui/app/components/consul/nspace/search-bar/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/nspace/search-bar/index.hbs @@ -1,15 +1,41 @@ - - + +
    @@ -20,15 +46,15 @@ )) as |selectable| }} - {{get selectable sort}} + {{get selectable @sort}} {{/let}} {{#let components.Optgroup components.Option as |Optgroup Option|}} - - + + {{/let}} diff --git a/ui/packages/consul-ui/app/components/consul/nspace/search-bar/index.js b/ui/packages/consul-ui/app/components/consul/nspace/search-bar/index.js deleted file mode 100644 index 4798652642..0000000000 --- a/ui/packages/consul-ui/app/components/consul/nspace/search-bar/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({ - tagName: '', -}); diff --git a/ui/packages/consul-ui/app/components/consul/policy/list/index.hbs b/ui/packages/consul-ui/app/components/consul/policy/list/index.hbs index cf5985f11d..738b581d6d 100644 --- a/ui/packages/consul-ui/app/components/consul/policy/list/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/policy/list/index.hbs @@ -1,5 +1,7 @@ -{{#if (gt items.length 0)}} - + {{#if (eq (policy/typeof item) 'policy-management')}}
    @@ -40,7 +42,7 @@ {{#if (not-eq (policy/typeof item) 'policy-management')}} - + Delete @@ -63,5 +65,4 @@ {{/if}} - -{{/if}} \ No newline at end of file + \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/consul/policy/list/index.js b/ui/packages/consul-ui/app/components/consul/policy/list/index.js deleted file mode 100644 index 4798652642..0000000000 --- a/ui/packages/consul-ui/app/components/consul/policy/list/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({ - tagName: '', -}); diff --git a/ui/packages/consul-ui/app/components/consul/policy/search-bar/index.hbs b/ui/packages/consul-ui/app/components/consul/policy/search-bar/index.hbs index 0bddc4fcb9..5572c00dc9 100644 --- a/ui/packages/consul-ui/app/components/consul/policy/search-bar/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/policy/search-bar/index.hbs @@ -1,14 +1,38 @@ - - + +
    @@ -19,16 +43,16 @@ {{#let components.Optgroup components.Option as |Optgroup Option|}} {{#each dcs as |dc|}} - + {{/each}} {{/let}} - + @@ -38,8 +62,8 @@ {{#let components.Optgroup components.Option as |Optgroup Option|}} - - + + {{/let}} @@ -49,7 +73,7 @@ class="type-sort" data-test-sort-control @position="right" - @onchange={{action onsort}} + @onchange={{action @onsort}} @multiple={{false}} as |components|> @@ -60,15 +84,15 @@ )) as |selectable| }} - {{get selectable sort}} + {{get selectable @sort}} {{/let}} {{#let components.Optgroup components.Option as |Optgroup Option|}} - - + + {{/let}} diff --git a/ui/packages/consul-ui/app/components/consul/policy/search-bar/index.js b/ui/packages/consul-ui/app/components/consul/policy/search-bar/index.js index 5570647734..2d96508a2c 100644 --- a/ui/packages/consul-ui/app/components/consul/policy/search-bar/index.js +++ b/ui/packages/consul-ui/app/components/consul/policy/search-bar/index.js @@ -1,3 +1,3 @@ -import Component from '@ember/component'; +import Component from '@glimmer/component'; -export default Component.extend({}); +export default class ConsulPolicySearchBarComponent extends Component {} diff --git a/ui/packages/consul-ui/app/components/consul/role/list/index.hbs b/ui/packages/consul-ui/app/components/consul/role/list/index.hbs index d45d4398fd..ba2da7e606 100644 --- a/ui/packages/consul-ui/app/components/consul/role/list/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/role/list/index.hbs @@ -1,5 +1,8 @@ -{{#if (gt items.length 0)}} - + {{item.Name}} @@ -19,7 +22,7 @@ Edit - + Delete @@ -41,5 +44,4 @@ - -{{/if}} \ No newline at end of file + \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/consul/role/list/index.js b/ui/packages/consul-ui/app/components/consul/role/list/index.js deleted file mode 100644 index 4798652642..0000000000 --- a/ui/packages/consul-ui/app/components/consul/role/list/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({ - tagName: '', -}); diff --git a/ui/packages/consul-ui/app/components/consul/role/search-bar/index.hbs b/ui/packages/consul-ui/app/components/consul/role/search-bar/index.hbs index 359f672c44..0aae4f1979 100644 --- a/ui/packages/consul-ui/app/components/consul/role/search-bar/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/role/search-bar/index.hbs @@ -1,15 +1,40 @@ - - + +
    @@ -22,19 +47,19 @@ )) as |selectable| }} - {{get selectable sort}} + {{get selectable @sort}} {{/let}} {{#let components.Optgroup components.Option as |Optgroup Option|}} - - + + - - + + {{/let}} diff --git a/ui/packages/consul-ui/app/components/consul/role/search-bar/index.js b/ui/packages/consul-ui/app/components/consul/role/search-bar/index.js deleted file mode 100644 index 5570647734..0000000000 --- a/ui/packages/consul-ui/app/components/consul/role/search-bar/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({}); diff --git a/ui/packages/consul-ui/app/components/consul/service-instance/list/index.hbs b/ui/packages/consul-ui/app/components/consul/service-instance/list/index.hbs index e305b90358..603b29c092 100644 --- a/ui/packages/consul-ui/app/components/consul/service-instance/list/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/service-instance/list/index.hbs @@ -1,84 +1,86 @@ -{{#if (gt items.length 0)}} - - - {{#if (eq routeName "dc.services.show")}} - - {{item.ID}} - - {{else}} - - {{item.Service.ID}} - - {{/if}} - - - {{#if checks}} - - + + + {{#if (eq @routeName "dc.services.show")}} + + {{item.ID}} + {{else}} - - - + + {{item.Service.ID}} + {{/if}} + + + {{#if @checks}} + + + {{else}} + + + + {{/if}} {{#if item.ProxyInstance}} -
    -
    - - This service uses a proxy for the Consul service mesh - -
    -
    - in service mesh with proxy -
    -
    +
    +
    + + This service uses a proxy for the Consul service mesh + +
    +
    + in service mesh with proxy +
    +
    {{/if}} {{#if (gt item.Node.Node.length 0)}} -
    -
    - - Node - -
    -
    - {{item.Node.Node}} -
    -
    +
    +
    + + Node + +
    +
    + {{item.Node.Node}} +
    +
    {{/if}} {{#if item.Service.Port}} -
    -
    - - IP Address and Port - -
    -
    - {{#if (not-eq item.Service.Address '')}} - {{item.Service.Address}}:{{item.Service.Port}} - {{else}} - {{item.Node.Address}}:{{item.Service.Port}} - {{/if}} -
    -
    +
    +
    + + IP Address and Port + +
    +
    + {{#if (not-eq item.Service.Address '')}} + {{item.Service.Address}}:{{item.Service.Port}} + {{else}} + {{item.Node.Address}}:{{item.Service.Port}} + {{/if}} +
    +
    {{/if}} -{{#if (and checks item.Port)}} -
    -
    - Port -
    -
    - - :{{item.Port}} -
    -
    +{{#if (and @checks item.Port)}} +
    +
    + Port +
    +
    + + :{{item.Port}} +
    +
    {{/if}} {{#if checks}} - + {{else}} - + {{/if}} -
    -
    -{{/if}} \ No newline at end of file +
    +
    \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/consul/service-instance/list/index.js b/ui/packages/consul-ui/app/components/consul/service-instance/list/index.js deleted file mode 100644 index 4798652642..0000000000 --- a/ui/packages/consul-ui/app/components/consul/service-instance/list/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({ - tagName: '', -}); diff --git a/ui/packages/consul-ui/app/components/consul/service-instance/search-bar/index.hbs b/ui/packages/consul-ui/app/components/consul/service-instance/search-bar/index.hbs index 95df8a2925..d4d44b52b7 100644 --- a/ui/packages/consul-ui/app/components/consul/service-instance/search-bar/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/service-instance/search-bar/index.hbs @@ -1,14 +1,43 @@ - - + +
    @@ -18,18 +47,18 @@ {{#let components.Optgroup components.Option as |Optgroup Option|}} - - - - + + + + {{/let}} -{{#if (gt sources.length 0)}} +{{#if (gt @sources.length 0)}} @@ -39,8 +68,8 @@ {{#let components.Optgroup components.Option as |Optgroup Option|}} -{{#each sources as |source|}} - +{{#each @sources as |source|}} + {{/each}} {{/let}} @@ -52,7 +81,7 @@ class="type-sort" data-test-sort-control @position="right" - @onchange={{action onsort}} + @onchange={{action @onsort}} @multiple={{false}} as |components|> @@ -65,19 +94,19 @@ )) as |selectable| }} - {{get selectable sort}} + {{get selectable @sort}} {{/let}} {{#let components.Optgroup components.Option as |Optgroup Option|}} - - + + - - + + {{/let}} diff --git a/ui/packages/consul-ui/app/components/consul/service-instance/search-bar/index.js b/ui/packages/consul-ui/app/components/consul/service-instance/search-bar/index.js deleted file mode 100644 index 4798652642..0000000000 --- a/ui/packages/consul-ui/app/components/consul/service-instance/search-bar/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({ - tagName: '', -}); diff --git a/ui/packages/consul-ui/app/components/consul/service/list/index.hbs b/ui/packages/consul-ui/app/components/consul/service/list/index.hbs index 4d29021fd8..9aaac6180d 100644 --- a/ui/packages/consul-ui/app/components/consul/service/list/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/service/list/index.hbs @@ -1,5 +1,10 @@ -{{#if (gt items.length 0)}} - +
    @@ -84,5 +89,4 @@ {{/if}} - -{{/if}} \ No newline at end of file + \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/consul/service/list/index.js b/ui/packages/consul-ui/app/components/consul/service/list/index.js index b802add9e4..b90fa5ee41 100644 --- a/ui/packages/consul-ui/app/components/consul/service/list/index.js +++ b/ui/packages/consul-ui/app/components/consul/service/list/index.js @@ -1,11 +1,9 @@ -import Component from '@ember/component'; -import { get } from '@ember/object'; +import Component from '@glimmer/component'; +import { action } from '@ember/object'; -export default Component.extend({ - tagName: '', - actions: { - isLinkable: function(item) { - return get(item, 'InstanceCount') > 0; - }, - }, -}); +export default class ConsulServiceList extends Component { + @action + isLinkable(item) { + return item.InstanceCount > 0; + } +} diff --git a/ui/packages/consul-ui/app/components/consul/service/search-bar/index.hbs b/ui/packages/consul-ui/app/components/consul/service/search-bar/index.hbs index 79e9066d3f..007bd3e9da 100644 --- a/ui/packages/consul-ui/app/components/consul/service/search-bar/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/service/search-bar/index.hbs @@ -1,14 +1,38 @@ - - + +
    @@ -18,16 +42,16 @@ {{#let components.Optgroup components.Option as |Optgroup Option|}} - - - - + + + + {{/let}} @@ -37,24 +61,24 @@ {{#let components.Optgroup components.Option as |Optgroup Option|}} - + - - - + + + - - + + {{/let}} -{{#if (gt sources.length 0)}} +{{#if (gt @sources.length 0)}} @@ -64,8 +88,8 @@ {{#let components.Optgroup components.Option as |Optgroup Option|}} -{{#each sources as |source|}} - +{{#each @sources as |source|}} + {{/each}} {{/let}} @@ -77,7 +101,7 @@ class="type-sort" data-test-sort-control @position="right" - @onchange={{action onsort}} + @onchange={{action @onsort}} @multiple={{false}} as |components|> @@ -90,19 +114,19 @@ )) as |selectable| }} - {{get selectable sort}} + {{get selectable @sort}} {{/let}} {{#let components.Optgroup components.Option as |Optgroup Option|}} - - + + - - + + {{/let}} diff --git a/ui/packages/consul-ui/app/components/consul/service/search-bar/index.js b/ui/packages/consul-ui/app/components/consul/service/search-bar/index.js deleted file mode 100644 index 4798652642..0000000000 --- a/ui/packages/consul-ui/app/components/consul/service/search-bar/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({ - tagName: '', -}); diff --git a/ui/packages/consul-ui/app/components/consul/token/list/index.hbs b/ui/packages/consul-ui/app/components/consul/token/list/index.hbs index 82160db514..5440458752 100644 --- a/ui/packages/consul-ui/app/components/consul/token/list/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/token/list/index.hbs @@ -1,7 +1,9 @@ -{{#if (gt items.length 0)}} - + -{{#if (eq item.AccessorID token.AccessorID)}} +{{#if (eq item.AccessorID @token.AccessorID)}}
    @@ -35,14 +37,14 @@ {{#if (not (token/is-legacy item))}} - + Duplicate {{/if}} {{#if (eq item.AccessorID token.AccessorID)}} - + Logout @@ -63,7 +65,7 @@ {{else}} - + Use @@ -84,8 +86,8 @@ {{/if}} - {{#if (not (or (token/is-anonymous item) (eq item.AccessorID token.AccessorID)))}} - + {{#if (not (or (token/is-anonymous item) (eq item.AccessorID @token.AccessorID)))}} + Delete @@ -108,5 +110,4 @@ {{/if}} - -{{/if}} \ No newline at end of file + \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/consul/token/list/index.js b/ui/packages/consul-ui/app/components/consul/token/list/index.js deleted file mode 100644 index 4798652642..0000000000 --- a/ui/packages/consul-ui/app/components/consul/token/list/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({ - tagName: '', -}); diff --git a/ui/packages/consul-ui/app/components/consul/token/search-bar/index.hbs b/ui/packages/consul-ui/app/components/consul/token/search-bar/index.hbs index 52618e5402..e5cdacd1c6 100644 --- a/ui/packages/consul-ui/app/components/consul/token/search-bar/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/token/search-bar/index.hbs @@ -1,13 +1,39 @@ - - + +
    @@ -17,9 +43,9 @@ {{#let components.Optgroup components.Option as |Optgroup Option|}} - - - + + + {{/let}} @@ -29,7 +55,7 @@ class="type-sort" data-test-sort-control @position="right" - @onchange={{action onsort}} + @onchange={{action @onsort}} @multiple={{false}} as |components|> @@ -40,15 +66,15 @@ )) as |selectable| }} - {{get selectable sort}} + {{get selectable @sort}} {{/let}} {{#let components.Optgroup components.Option as |Optgroup Option|}} - - + + {{/let}} diff --git a/ui/packages/consul-ui/app/components/consul/token/search-bar/index.js b/ui/packages/consul-ui/app/components/consul/token/search-bar/index.js deleted file mode 100644 index 5570647734..0000000000 --- a/ui/packages/consul-ui/app/components/consul/token/search-bar/index.js +++ /dev/null @@ -1,3 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({}); diff --git a/ui/packages/consul-ui/app/components/consul/upstream/list/index.hbs b/ui/packages/consul-ui/app/components/consul/upstream/list/index.hbs index 5668c935b9..5a1aade217 100644 --- a/ui/packages/consul-ui/app/components/consul/upstream/list/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/upstream/list/index.hbs @@ -1,4 +1,9 @@ - + {{#if (gt item.InstanceCount 0)}}
    @@ -19,8 +24,9 @@
    - {{#if (and (env 'CONSUL_NSPACES_ENABLED') (not-eq item.Namespace nspace))}} - + {{#if (and (env 'CONSUL_NSPACES_ENABLED') (not-eq item.Namespace @nspace))}} + {{item.Namespace}} + {{item.Name}} {{else}} @@ -35,11 +41,11 @@ {{/if}}
    - {{#if (and (env 'CONSUL_NSPACES_ENABLED') (not-eq item.Namespace nspace))}} + {{#if (and (env 'CONSUL_NSPACES_ENABLED') (not-eq item.Namespace @nspace))}}
    - Namespace + Namespace
    @@ -47,18 +53,19 @@
    {{/if}} -{{#if (gt item.GatewayConfig.Addresses.length 0)}} {{#each item.GatewayConfig.Addresses as |address|}}
    + Address +
    +
    -
    -
    {{address}}
    + {{address}} +
    {{/each}} -{{/if}}
    diff --git a/ui/packages/consul-ui/app/components/consul/upstream/list/index.js b/ui/packages/consul-ui/app/components/consul/upstream/list/index.js index b802add9e4..b90fa5ee41 100644 --- a/ui/packages/consul-ui/app/components/consul/upstream/list/index.js +++ b/ui/packages/consul-ui/app/components/consul/upstream/list/index.js @@ -1,11 +1,9 @@ -import Component from '@ember/component'; -import { get } from '@ember/object'; +import Component from '@glimmer/component'; +import { action } from '@ember/object'; -export default Component.extend({ - tagName: '', - actions: { - isLinkable: function(item) { - return get(item, 'InstanceCount') > 0; - }, - }, -}); +export default class ConsulServiceList extends Component { + @action + isLinkable(item) { + return item.InstanceCount > 0; + } +} diff --git a/ui/packages/consul-ui/app/components/consul/upstream/search-bar/index.hbs b/ui/packages/consul-ui/app/components/consul/upstream/search-bar/index.hbs index d8a4af87b9..9cdc7242a3 100644 --- a/ui/packages/consul-ui/app/components/consul/upstream/search-bar/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/upstream/search-bar/index.hbs @@ -1,13 +1,37 @@ - - + +
    @@ -17,8 +41,8 @@ {{#let components.Optgroup components.Option as |Optgroup Option|}} - - + + {{/let}} @@ -28,7 +52,7 @@ class="type-sort" data-test-sort-control @position="right" - @onchange={{action onsort}} + @onchange={{action @onsort}} @multiple={{false}} as |components|> @@ -41,19 +65,19 @@ )) as |selectable| }} - {{get selectable sort}} + {{get selectable @sort}} {{/let}} {{#let components.Optgroup components.Option as |Optgroup Option|}} - - + + - - + + {{/let}} diff --git a/ui/packages/consul-ui/app/components/consul/upstream/search-bar/index.js b/ui/packages/consul-ui/app/components/consul/upstream/search-bar/index.js deleted file mode 100644 index 4798652642..0000000000 --- a/ui/packages/consul-ui/app/components/consul/upstream/search-bar/index.js +++ /dev/null @@ -1,5 +0,0 @@ -import Component from '@ember/component'; - -export default Component.extend({ - tagName: '', -}); diff --git a/ui/packages/consul-ui/app/components/data-collection/index.hbs b/ui/packages/consul-ui/app/components/data-collection/index.hbs new file mode 100644 index 0000000000..45e6c381c9 --- /dev/null +++ b/ui/packages/consul-ui/app/components/data-collection/index.hbs @@ -0,0 +1,5 @@ +{{yield (hash + items=this.items + Collection=(if (gt this.items.length 0) (component 'anonymous') '') + Empty=(if (eq this.items.length 0) (component 'anonymous') '') +)}} diff --git a/ui/packages/consul-ui/app/components/data-collection/index.js b/ui/packages/consul-ui/app/components/data-collection/index.js new file mode 100644 index 0000000000..fcde9b9f16 --- /dev/null +++ b/ui/packages/consul-ui/app/components/data-collection/index.js @@ -0,0 +1,56 @@ +import Component from '@glimmer/component'; +import { inject as service } from '@ember/service'; +import { sort } from '@ember/object/computed'; +import { defineProperty } from '@ember/object'; + +export default class DataCollectionComponent extends Component { + @service('filter') filter; + @service('sort') sort; + @service('search') search; + + get type() { + return this.args.type; + } + + get items() { + // the ember sort computed accepts either: + // 1. The name of a property (as a string) returning an array properties to sort by + // 2. A function to use for sorting + let comparator = 'comparator'; + if (typeof this.comparator === 'function') { + comparator = this.comparator; + } + defineProperty(this, 'sorted', sort('searched', comparator)); + return this.sorted; + } + + get searched() { + if (typeof this.args.search === 'undefined') { + return this.filtered; + } + const predicate = this.search.predicate(this.type); + const options = {}; + if (typeof this.args.filters.searchproperties !== 'undefined') { + options.properties = this.args.filters.searchproperties; + } + return this.filtered.filter(predicate(this.args.search, options)); + } + + get filtered() { + if (typeof this.args.filters === 'undefined') { + return this.args.items; + } + const predicate = this.filter.predicate(this.type); + if (typeof predicate === 'undefined') { + return this.args.items; + } + return this.args.items.filter(predicate(this.args.filters)); + } + + get comparator() { + if (typeof this.args.sort === 'undefined') { + return []; + } + return this.sort.comparator(this.type)(this.args.sort); + } +} diff --git a/ui/packages/consul-ui/app/components/filter-bar/index.scss b/ui/packages/consul-ui/app/components/filter-bar/index.scss new file mode 100644 index 0000000000..1e3f2d0f88 --- /dev/null +++ b/ui/packages/consul-ui/app/components/filter-bar/index.scss @@ -0,0 +1,5 @@ +@import './skin'; +@import './layout'; +%filter-bar-reversed { + color: inherit; +} diff --git a/ui/packages/consul-ui/app/components/filter-bar/layout.scss b/ui/packages/consul-ui/app/components/filter-bar/layout.scss new file mode 100644 index 0000000000..eb9019ea0e --- /dev/null +++ b/ui/packages/consul-ui/app/components/filter-bar/layout.scss @@ -0,0 +1,45 @@ +.filter-bar { + &, + > div { + display: flex; + } + & { + padding: 4px 8px; + } + .sort { + margin-left: auto; + } + .popover-select { + position: relative; + z-index: 3; + } + .popover-menu > [type='checkbox'] + label button { + padding-left: 1.5rem !important; + padding-right: 1.5rem !important; + + } + .popover-menu [role='menuitem'] { + justify-content: normal !important; + } +} +@media #{$--lt-horizontal-filters} { + .filter-bar { + &, + & > div { + flex-wrap: wrap; + } + .search { + position: relative; + z-index: 4; + width: 100%; + margin-bottom: .3rem; + } + } +} +@media #{$--lt-horizontal-selects} { + .filter-bar { + .filters, .sort { + display: none; + } + } +} diff --git a/ui/packages/consul-ui/app/components/filter-bar/skin.scss b/ui/packages/consul-ui/app/components/filter-bar/skin.scss new file mode 100644 index 0000000000..49feb3c5e0 --- /dev/null +++ b/ui/packages/consul-ui/app/components/filter-bar/skin.scss @@ -0,0 +1,13 @@ +.filter-bar { + & { + background-color: $gray-010; + border-bottom: $decor-border-100; + border-color: $gray-200; + } + .filters, .sort { + .popover-menu > [type='checkbox']:checked + label button { + color: $blue-500; + background-color: $gray-100; + } + } +} diff --git a/ui/packages/consul-ui/app/components/freetext-filter/README.stories.mdx b/ui/packages/consul-ui/app/components/freetext-filter/README.stories.mdx new file mode 100644 index 0000000000..009a68ec3e --- /dev/null +++ b/ui/packages/consul-ui/app/components/freetext-filter/README.stories.mdx @@ -0,0 +1,45 @@ +import { Meta, Story, Canvas } from '@storybook/addon-docs/blocks'; +import { hbs } from 'ember-cli-htmlbars'; + + + +# FreetextFilter + + + {(args) => ({ + template: hbs``, + context: args + })} + + {(args) => ({ + template: hbs` + + + + Search across + + + + {{#let popover.Optgroup popover.Option as |Optgroup Option|}} + + + {{/let}} + + + `, + context: args + })} + + + diff --git a/ui/packages/consul-ui/app/components/freetext-filter/index.hbs b/ui/packages/consul-ui/app/components/freetext-filter/index.hbs index 8ec2ffde24..8c70ff8b89 100644 --- a/ui/packages/consul-ui/app/components/freetext-filter/index.hbs +++ b/ui/packages/consul-ui/app/components/freetext-filter/index.hbs @@ -1,6 +1,19 @@ -
    - +
    + + {{yield}}
    \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/freetext-filter/index.js b/ui/packages/consul-ui/app/components/freetext-filter/index.js index 98f6a3109b..a8eeda4ae7 100644 --- a/ui/packages/consul-ui/app/components/freetext-filter/index.js +++ b/ui/packages/consul-ui/app/components/freetext-filter/index.js @@ -1,19 +1,25 @@ -import Component from '@ember/component'; -import { inject as service } from '@ember/service'; +import Component from '@glimmer/component'; +import { action } from '@ember/object'; + const ENTER = 13; -export default Component.extend({ - dom: service('dom'), - tagName: '', - actions: { - change: function(e) { - this.onsearch( - this.dom.setEventTargetProperty(e, 'value', value => (value === '' ? undefined : value)) - ); - }, - keydown: function(e) { - if (e.keyCode === ENTER) { - e.preventDefault(); - } - }, - }, -}); +export default class FreetextFilter extends Component { + get placeholder() { + return this.args.placeholder || 'Search'; + } + + get onsearch() { + return this.args.onsearch || (() => {}); + } + + @action + change(e) { + this.onsearch(e); + } + + @action + keydown(e) { + if (e.keyCode === ENTER) { + e.preventDefault(); + } + } +} diff --git a/ui/packages/consul-ui/app/styles/components/filter-bar/index.scss b/ui/packages/consul-ui/app/components/freetext-filter/index.scss similarity index 100% rename from ui/packages/consul-ui/app/styles/components/filter-bar/index.scss rename to ui/packages/consul-ui/app/components/freetext-filter/index.scss diff --git a/ui/packages/consul-ui/app/components/freetext-filter/layout.scss b/ui/packages/consul-ui/app/components/freetext-filter/layout.scss new file mode 100644 index 0000000000..57fc5b72a7 --- /dev/null +++ b/ui/packages/consul-ui/app/components/freetext-filter/layout.scss @@ -0,0 +1,28 @@ +.freetext-filter { + --height: 2.2rem; + & { + display: flex; + position: relative; + height: var(--height); + } + &_input, + & > label { + flex-grow: 1; + } + &_input, + &_label { + height: 100%; + } + &_input { + padding: 8px 10px; + padding-left: var(--height); + min-width: 12.7rem; + width: 100%; + } + &_label { + visibility: hidden; + position: absolute; + z-index: 1; + width: var(--height); + } +} diff --git a/ui/packages/consul-ui/app/components/freetext-filter/skin.scss b/ui/packages/consul-ui/app/components/freetext-filter/skin.scss new file mode 100644 index 0000000000..26d51da712 --- /dev/null +++ b/ui/packages/consul-ui/app/components/freetext-filter/skin.scss @@ -0,0 +1,49 @@ +.freetext-filter { + & { + border: $decor-border-100; + border-radius: $decor-radius-100; + + background-color: $white; + border-color: $gray-200; + color: $gray-400; + } + &:hover, + &:hover * { + border-color: $gray-400; + } + & *, + &_input::placeholder { + cursor: inherit; + color: inherit; + border-color: inherit; + } + + &_input { + -webkit-appearance: none; + border: none; + } + &_label::after { + @extend %as-pseudo; + position: absolute; + top: 50%; + left: 50%; + width: 16px; + height: 16px; + margin-left: -8px; + margin-top: -8px; + } + &_label::after { + @extend %with-search-mask; + } + .popover-menu { + background-color: $gray-050; + color: $gray-800; + } + .popover-menu { + border-left: 1px solid; + border-color: inherit; + } + .popover-menu > [type='checkbox']:checked + label button { + background-color: $gray-200; + } +} diff --git a/ui/packages/consul-ui/app/components/more-popover-menu/index.hbs b/ui/packages/consul-ui/app/components/more-popover-menu/index.hbs index 614a70c727..6fd727f119 100644 --- a/ui/packages/consul-ui/app/components/more-popover-menu/index.hbs +++ b/ui/packages/consul-ui/app/components/more-popover-menu/index.hbs @@ -1,5 +1,12 @@ -
    - +
    + More diff --git a/ui/packages/consul-ui/app/components/popover-menu/index.hbs b/ui/packages/consul-ui/app/components/popover-menu/index.hbs index b72f25d661..a894f2d5f6 100644 --- a/ui/packages/consul-ui/app/components/popover-menu/index.hbs +++ b/ui/packages/consul-ui/app/components/popover-menu/index.hbs @@ -1,6 +1,9 @@ - {{yield}} -
    - +{{yield}} +
    + {{#let (hash MenuItem=(component @@ -18,46 +21,46 @@ ) ) as |components|}} - {{#let (hash - toggle=this.toggle.click - ) - as |api|}} +{{#let (hash + toggle=this.toggle.click +) +as |api|}} - - - - + + + + - - - - - {{#each submenus as |sub|}} - - {{/each}} + + + + + {{#each submenus as |sub|}} + + {{/each}} + + {{#if hasHeader}} + + {{yield components api}} + {{#yield-slot name="header"}}{{else}}{{/yield-slot}} - {{#if hasHeader}} - - {{yield components api}} - {{#yield-slot name="header"}}{{else}}{{/yield-slot}} - - {{/if}} - - - {{yield components api}} - - - + {{/if}} + + + {{yield components api}} + + + - {{/let}} +{{/let}} {{/let}} - -
    \ No newline at end of file +
    +
    \ No newline at end of file diff --git a/ui/packages/consul-ui/app/components/popover-menu/menu-item/index.hbs b/ui/packages/consul-ui/app/components/popover-menu/menu-item/index.hbs index ef42ac9dc9..3470979693 100644 --- a/ui/packages/consul-ui/app/components/popover-menu/menu-item/index.hbs +++ b/ui/packages/consul-ui/app/components/popover-menu/menu-item/index.hbs @@ -7,7 +7,7 @@
    {{yield}} diff --git a/ui/packages/consul-ui/app/components/popover-select/index.hbs b/ui/packages/consul-ui/app/components/popover-select/index.hbs index 871fb32506..a3ceb2cde7 100644 --- a/ui/packages/consul-ui/app/components/popover-select/index.hbs +++ b/ui/packages/consul-ui/app/components/popover-select/index.hbs @@ -1,4 +1,9 @@ - + {{yield}} {{#let (component 'popover-select/optgroup' components=components) @@ -28,4 +33,4 @@ {{/let}} - + diff --git a/ui/packages/consul-ui/app/components/popover-select/index.js b/ui/packages/consul-ui/app/components/popover-select/index.js index 5c63497fb2..4062c054e3 100644 --- a/ui/packages/consul-ui/app/components/popover-select/index.js +++ b/ui/packages/consul-ui/app/components/popover-select/index.js @@ -40,10 +40,7 @@ export default Component.extend(Slotted, { this.dom.setEventTargetProperties(e, { selected: target => value, selectedItems: target => { - const opts = [...options]; - if (opts.length > 0) { - return opts.join(','); - } + return [...options].join(','); }, }) ); diff --git a/ui/packages/consul-ui/app/components/toggle-button/index.hbs b/ui/packages/consul-ui/app/components/toggle-button/index.hbs index deeb81d9d2..0f497bdb18 100644 --- a/ui/packages/consul-ui/app/components/toggle-button/index.hbs +++ b/ui/packages/consul-ui/app/components/toggle-button/index.hbs @@ -1,12 +1,15 @@ -