From 4533a5e959a199105a6f103611bd4d12d711a522 Mon Sep 17 00:00:00 2001 From: John Cowen Date: Tue, 4 May 2021 17:21:54 +0100 Subject: [PATCH] ui: Adds CRD popover 'informed action' for intentions managed by CRDs (#10100) * ui: Adds CRD popover 'informed action' for intentions add via CRDs --- .changelog/10100.txt | 3 ++ .../app/components/aria-menu/index.js | 6 +++ .../consul/intention/list/layout.scss | 3 ++ .../consul/intention/list/table/index.hbs | 38 ++++++++++++++++++- .../app/components/informed-action/skin.scss | 7 ++++ .../app/components/menu-panel/index.hbs | 9 ++++- .../app/components/menu-panel/index.js | 15 ++++++++ .../app/components/menu-panel/layout.scss | 8 +++- .../styles/base/icons/icon-placeholders.scss | 6 +++ 9 files changed, 90 insertions(+), 5 deletions(-) create mode 100644 .changelog/10100.txt diff --git a/.changelog/10100.txt b/.changelog/10100.txt new file mode 100644 index 0000000000..1bdedd2876 --- /dev/null +++ b/.changelog/10100.txt @@ -0,0 +1,3 @@ +```release-note:improvement +ui: Added CRD popover 'informed action' for intentions managed by CRDs +``` diff --git a/ui/packages/consul-ui/app/components/aria-menu/index.js b/ui/packages/consul-ui/app/components/aria-menu/index.js index 2033b725ce..4162a1995d 100644 --- a/ui/packages/consul-ui/app/components/aria-menu/index.js +++ b/ui/packages/consul-ui/app/components/aria-menu/index.js @@ -129,6 +129,12 @@ export default Component.extend({ }, open: function(e) { set(this, 'expanded', true); + const $items = [...this.dom.elements(MENU_ITEMS, this.$menu)]; + if ($items.length === 0) { + this.dom + .element('input[type="checkbox"]', this.$menu.parentElement) + .dispatchEvent(new MouseEvent('click')); + } // Take the trigger out of the tabbing whilst the menu is open this.$trigger.setAttribute('tabindex', '-1'); this._listeners.add(this.dom.document(), { diff --git a/ui/packages/consul-ui/app/components/consul/intention/list/layout.scss b/ui/packages/consul-ui/app/components/consul/intention/list/layout.scss index e208890f77..7b7e3338a3 100644 --- a/ui/packages/consul-ui/app/components/consul/intention/list/layout.scss +++ b/ui/packages/consul-ui/app/components/consul/intention/list/layout.scss @@ -20,6 +20,9 @@ tr > *:last-child { width: 60px; } + .menu-panel.confirmation { + width: 200px; + } } @media #{$--lt-horizontal-nav} { diff --git a/ui/packages/consul-ui/app/components/consul/intention/list/table/index.hbs b/ui/packages/consul-ui/app/components/consul/intention/list/table/index.hbs index d54b8b0cd4..ad3faa2d5d 100644 --- a/ui/packages/consul-ui/app/components/consul/intention/list/table/index.hbs +++ b/ui/packages/consul-ui/app/components/consul/intention/list/table/index.hbs @@ -54,7 +54,10 @@ as |item index|> - + More @@ -100,7 +103,38 @@ as |item index|> {{else}}
  • - View +
    + + <:header> + Managed by CRD + + <:body> +

    + This intention is being managed through an Intention Custom Resource in your Kubernetes cluster. It is view only in the UI. +

    + + <:actions as |Actions|> + + + View + + + + + Cancel + + + +
    +
  • {{/if}}
    diff --git a/ui/packages/consul-ui/app/components/informed-action/skin.scss b/ui/packages/consul-ui/app/components/informed-action/skin.scss index 0e1ab9c406..266eb5340f 100644 --- a/ui/packages/consul-ui/app/components/informed-action/skin.scss +++ b/ui/packages/consul-ui/app/components/informed-action/skin.scss @@ -66,6 +66,13 @@ background-color: $yellow-050; } } + /* brands */ + &.kubernetes { + header::before { + @extend %with-logo-kubernetes-color-icon, %without-mask, %as-pseudo; + } + } + /**/ > ul > .action > * { color: $blue-500; } diff --git a/ui/packages/consul-ui/app/components/menu-panel/index.hbs b/ui/packages/consul-ui/app/components/menu-panel/index.hbs index a07a628660..b114d3876c 100644 --- a/ui/packages/consul-ui/app/components/menu-panel/index.hbs +++ b/ui/packages/consul-ui/app/components/menu-panel/index.hbs @@ -2,7 +2,14 @@ {{#let (hash change=(action "change") ) as |api|}} -