open-consul/ui/packages/consul-ui/app/styles/base/icons
Michael Klein 272c878559
ui: feature-flagged peering mvp (#13425)
* add peers route

* add peers to nav

* use regular app ui patterns peers template

* use empty state in peers UI

* mock `v1/peerings` request

* implement custom adapter/serializer for `peers`-model

* index request for peerings on peers route

* update peers list to show as proper list

* Use tailwind for easier styling

* Unique ids in peerings response mock-api

* Add styling peerings list

* Allow creating empty tooltip

To make it easier to iterate over a set of items where some items
should not display a tooltip and others should.

* Add tooltip Peerings:Badge

* Add undefined peering state badge

* Remove imported/exported services count peering

This won't be included in the initial version of the API response

* Implement Peerings::Search

* Make it possible to filter peerings by name

* Install ember-keyboard

For idiomatic handling of key-presses.

* Clear peering search input when pressing `Escape`

* use peers.index instead of peers for peerings listing

* Allow to include peered services in services-query

* update services mock to add peerName

* add Consul::Peer component

To surface peering information on a resource

* add PeerName as attribute to service model

* surface peering information in service list

* Add tooltip to Consul::Peer

* Make services searchable by peer-name

* Allow passing optional query-params to href-to

* Add peer query-param to dc.services.show

* Pass peer as query-param services listing

* support option peer route-param

* set peer-name undefined in services serializer when empty

* update peer route-param when navigating to peered service

* request sercice with peer-name if need be

* make sure to reset peer route-param when leaving service.show

* componentize services.peer-info

* surface peer info services.show

* make sure to reset peer route-param in main nav

* fix services breadcrumb services.intentions

we need to reset peer route-param here to not break the app

* surface peer when querying for it on service api call

* query for peer info service-instance api calls

* surface peer info service-instance.show

* Camelize peer attributes to match rest of app

* Refactor peers.index to reflect camelized attributes for peer

* Remove unused query-params services.show

* make logo href reset peer route-param

* Cleanup optional peer param query service-instance

* Use replace decorator instead of serializer for empty peerName

* make sure to only send peer info when correct qp is passed

* Always send qp for querying peers services request

* rename with-imports to with-peers

* Use css for peer-icon

* Refactor bucket-list component to surface peer-info

* Remove Consul::Peer component

This info is now displayed via the bucket-list component

* Fix bucket-list component to surface service again

* Update bucket-list docs to reflect peer-info addition

* Remove tailwind related styles

* Remove consul-tailwind package

We won't be using tailwind for now

* Fix typo badge scss

* Add with-import handling mock-api nodes

* Add peerName to node attributes

* include peers when querying nodes

* reflect api updates node list mock

* Create consul::node::peer-info component

* Surface peer-info in nodes list

* Mock peer response for node request

* Make it possible to add peer-name to node request

* Update peer route-param when linking to node

* Reset peers route-param when leaving nodes.show

We need to reset the route-param to not introduce a bug - otherwise
subsequent node show request would request with the old peer query-param

* Add sourcePeer intentions api mock

* add SourcePeer attr to intentions model

* Surface peering info on intentions list

* Request peered intentions differently intentions.edit

* Handle peer info in intentions/exact mock

* Surface peering info intention view

* Add randomized peer data topology mock

* Surface peer info topology view

* fix service/peer-info styling

We aren't using tailwind anymore - we need to create a custom scss file

* Update peerings api mocks

* Update peerings::badge with updated styling

* cleanup intentions/exact mock

* Create watcher component to declaratively register polling

* Poll peers in background when on peers route

* use existing colors for peering-badge

* Add test for requesting service with `with-peers`-query

* add imported/exported count to peers model

* update mock-api to surface exported/imported count on peers

* Show exported/imported peers count on peers list

* Use translations for service import/export UI peers

* Make sure to ask for nodes with peers

* Add match-url step for easier url testing of service urls

* Add test for peer-name on peered services

* Add test for service navigation peered service

* Implement feature-flag handling

* Enable peering feature in test and development

* Redirect peers to services.index when feature-flag is disabled

* Only query for peers when feature is enabled

* Only show peers in nav when feature is enabled

* Componentize peering service count detail

* Handle non-state Peerings::Badge

* Use Peerings::ServiceCount in peerings list

* Only send peer query for peered service-instances.

* Add step to visit url directly

* add test for accessing peered service directly

* Remove unused service import peers.index

* Only query for peer when peer provided node-adapter

* fix tests
2022-06-23 14:16:26 +01:00
..
icons ui: feature-flagged peering mvp (#13425) 2022-06-23 14:16:26 +01:00
README.mdx ui: upgrade ember composable helper (#13394) 2022-06-08 16:07:51 +01:00
base-keyframes.css.js
base-keyframes.scss
base-placeholders.scss
debug.scss
index.scss
overrides.scss

README.mdx

# Iconography

All our iconography uses native CSS properties for adding iconography from The
Outside. You can also add icons using the same properties within `style=""`
attributes, but you should think twice before adding decorative content into
HTML and only do so if you have a good reason/have tried everything else.

Available icons properties are:

- `--icon-name`: See below for available names
- `--icon-color`: By default our icons are set to be monochrome, using
  `--icon-color` will color the icon, you can also use `currentColor`
- `--icon-size`: Set the size of the icon, see below for available values. Our
  values use a `icon-000` naming scheme similar to all our ther naming scales (and
  `font-weight`). We default this to `icon-300` i.e. `1rem`/`16px` and `icon-000`
  means 'use the font-size'
- `--icon-resolution`: Set the resolution of the icon. Currently you can set
  either `1` or `.5` here `resolution` happens to mean the thickness of the lines
  used in the icon. 1 equals thicker lines and should be used at sizes lower than
  `icon-500`. `.5` equals thinner lines and should be used at sizes larger than
  `icon-500`.

All of the above properties can be suffixed with `-start` or `-end`, these are
mainly used for specifying icons using `style=""` attributes. Here `start` and
`end` refer to either the `::before` or `::after` pseudo element to use to
display the icon. If you are not using the `style=""` attribute (which you
probably aren't) consider just using normal `::before` and `::after` CSS
selectors.

```css
.selector::before {
  --icon-name: icon-aws-color;
  content: '';
}
```

```css
.selector::after {
  --icon-name: icon-aws;
  --icon-color: rgb(var(---white));
  content: '';
}
```

If you cannot use CSS or have a good reason to do so, you can very easily add
icons in HTML using these CSS properties.

```hbs preview-template
<h2
  style={{style-map
    (array '--icon-name-start' 'icon-consul')
    (array '--icon-color-start' 'rgb(var(--tone-strawberry-500))')
    (array '--icon-name-end' 'icon-vault')
    (array '--icon-color-end' 'var(--color-vault-500)')
  }}
>
  Header Name
</h2>
```

It's probably worth noting that we could make an icon component using the
following. Under different circumstances this would give us an option that works
"For Everyone, Everywhere" (in Every Framework as it's just native CSS).

```hbs
<span
  class={{class-map
    'visually-hidden'
  }}
  style={{style-map
    (array '--icon-name-start' @name)
    (array '--icon-color' @color)
    (array '--icon-size' @size)
  }}
  ...attributes
>{{yield}}</span>


<Icon @name="icon-name" @color="#FF0000" @size="icon-300" />
```


## Deprecated

Please prefer our Constructable `%placeholder` styles over singular CSS
properties. If you need to drop back, to something not covered there then you
can also use CSS properties directly.

All icons use a `%with-` prefix for example `%with-alert-circle-fill-icon` or
`%with-alert-circle-fill-mask`. We mostly use the `-mask` suffix and also use
the `%as-pseudo` placeholder to tell CSS that we are using the background on a
pseudo element:

If you are not using a pseudo element for whatever reason, then you do not need
to use `%as-pseudo`.

When using `-mask` icons, color will use the `currentColor` of the element. If
you need the color of the icon to be different to the text you can define the
color of the icon itself via the `color` CSS property (preferred) but you can
also use `background-color`.

```css
.selector::before {
  @extend %with-alert-circle-fill-mask, %as-pseudo;
  color: rgb(var(--tone-strawberry-500));
}
```

If you need to use a colored icon (usually an existing brand icon) then don't
use `-mask`, use `-icon` instead:

```css
.selector::before {
  @extend %with-logo-consul-color-icon, %as-pseudo;
}
```

```hbs preview-template
<figure>
    <select
      onchange={{action (mut this.type) value="target.value"}}
    >
      <option>colored</option>
      <option>monochrome</option>
    </select>
    <select
      onchange={{action (mut this.theme) value="target.value"}}
    >
      <option>light</option>
      <option>dark</option>
    </select>
    <input
      oninput={{action (mut this.size) value="target.value"}}
      type="range" min="100" max="900" step="100"
    />
    {{this.size}}
</figure>
<ul
  {{css-props (set this 'icons')
    prefix='icon-'
  }}
  class={{class-map
    (concat 'theme-' (or this.theme 'light'))
  }}
  style={{style-map
    (array '--icon-color' (if (eq this.type 'monochrome') 'rgb(var(--black))'))
    (array '--icon-size' (concat 'icon-' (or this.size '500')))
    (array '--icon-resolution' (if (gt this.size 500) '.5' '1'))
  }}
>
{{#each-in this.icons as |prop value|}}
{{#if (and
    (not (includes prop (array '--icon-name' '--icon-color' '--icon-size' '--icon-resolution')))
    (not (string-includes prop '-24'))
  )
}}
{{#let
  (string-replace (string-replace prop '-16' '') '--' '')
as |name|}}
  <li>
    <figure
      {{with-copyable (concat '--icon-name: ' name ';content: "";')}}
      style={{style-map
        (array '--icon-name-start' name)
      }}
    >
      <figcaption>{{name}}</figcaption>
    </figure>
  </li>
{{/let}}
{{/if}}
{{/each-in}}
</ul>
```