hashicorp-copywrite[bot] 5fb9df1640
[COMPLIANCE] License changes (#18443)
* Adding explicit MPL license for sub-package

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Adding explicit MPL license for sub-package

This directory and its subdirectories (packages) contain files licensed with the MPLv2 `LICENSE` file in this directory and are intentionally licensed separately from the BSL `LICENSE` file at the root of this repository.

* Updating the license from MPL to Business Source License

Going forward, this project will be licensed under the Business Source License v1.1. Please see our blog post for more details at <Blog URL>, FAQ at www.hashicorp.com/licensing-faq, and details of the license at www.hashicorp.com/bsl.

* add missing license headers

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

* Update copyright file headers to BUSL-1.1

---------

Co-authored-by: hashicorp-copywrite[bot] <110428419+hashicorp-copywrite[bot]@users.noreply.github.com>
2023-08-11 09:12:13 -04:00

185 lines
6.3 KiB
Handlebars

{{!
Copyright (c) HashiCorp, Inc.
SPDX-License-Identifier: BUSL-1.1
}}
<Route
@name={{routeName}}
as |route|>
<DataLoader @src={{
uri '/${partition}/${nspace}/${dc}/topology/${name}/${kind}'
(hash
partition=route.params.partition
nspace=route.params.nspace
dc=route.params.dc
name=route.params.name
kind=(or route.model.items.firstObject.Service.Kind '')
)
}} as |loader|>
<BlockSlot @name="error">
<AppError
@error={{loader.error}}
@login={{route.model.app.login.open}}
/>
</BlockSlot>
<BlockSlot @name="loaded">
{{#let
route.params.nspace
route.model.dc
route.model.items
loader.data
as |nspace dc items topology|}}
<div class="tab-section">
<div
class="topology-notices"
>
<Disclosure
@expanded={{true}}
as |disclosure|
>
{{! Make a map of key=enabled to tell us which notices are enabled }}
{{! The `false` here is so we can easily open all the notices up by changing to `true` }}
{{#let
(from-entries (array
(array 'filtered-by-acls' (or false topology.FilteredByACLs))
(array 'default-allow' (or false (eq dc.DefaultACLPolicy 'allow')))
(array 'wildcard-intention' (or false topology.wildcardIntention))
(array 'not-defined-intention' (or false topology.notDefinedIntention))
(array 'no-dependencies' (or false (and topology.noDependencies (can 'use acls'))))
(array 'acls-disabled' (or false (and topology.noDependencies (not (can 'use acls')))))
))
as |notices|}}
{{! Make an array only of truthy values to we know how many notices are enabled }}
{{#let (without false
(values notices)
) as |noticesEnabled|}}
{{! Render any enabled notices }}
{{#each-in notices as |prop enabled|}}
{{#if enabled}}
<disclosure.Details
@auto={{false}}
as |details|>
<Hds::Alert id={{details.id}}
@type='inline'
@color={{if (includes prop (array 'filtered-by-acls' 'no-dependencies'))
'neutral'
'warning'}}
class='mb-3 mt-2 topology-metrics-notice'
data-test-notice={{prop}}
as |A|>
<A.Title>
{{compute (fn route.t 'notice.${prop}.header'
(hash
prop=prop
))
}}
</A.Title>
{{#if disclosure.expanded}}
<A.Description>
{{compute (fn route.t 'notice.${prop}.body'
(hash
prop=prop
))
}}
</A.Description>
{{/if}}
{{#if (and disclosure.expanded (not-eq prop 'filtered-by-acls'))}}
{{#if (includes prop (array 'wildcard-intention' 'default-allow' 'no-intentions'))}}
<A.Button
@color='secondary'
@size='small'
@route='dc.services.show.intentions'
@text={{compute (fn route.t 'notice.${prop}.footer.link-text'
(hash
prop=prop
))}}
@icon={{compute (fn route.t 'notice.${prop}.footer.icon'
(hash
prop=prop
))}}
/>
{{else}}
<A.Link::Standalone
@text={{compute (fn route.t 'notice.${prop}.footer.link-text'
(hash
prop=prop
))}}
@href={{compute (fn route.t 'notice.${prop}.footer.link'
(hash
prop=prop
))}}
@icon='docs-link'
@iconPosition='trailing'
/>
{{/if}}
{{/if}}
</Hds::Alert>
</disclosure.Details>
{{/if}}
{{/each-in}}
{{! If more than 2 notices are enabled let the user close them }}
{{#if (gt noticesEnabled.length 2)}}
<disclosure.Action
{{on 'click' disclosure.toggle}}
>
{{compute (fn route.t 'notices.${expanded}'
(hash
expanded=(if disclosure.expanded 'close' 'open')
)
)}}
</disclosure.Action>
{{/if}}
{{/let}}
{{/let}}
</Disclosure>
</div>
<DataSource
@src={{uri '/${partition}/${nspace}/${dc}/ui-config'
(hash
partition=route.params.partition
nspace=route.params.nspace
dc=route.params.dc
)
}}
as |config|>
{{#if config.data}}
<TopologyMetrics
@nspace={{nspace}}
@dc={{dc}}
@service={{items.firstObject}}
@topology={{topology}}
@metricsHref={{render-template config.data.dashboard_url_templates.service
(hash
Datacenter=dc.Name
Service=(hash
Name=items.firstObject.Name
Namespace=(or items.firstObject.Namespace '')
Partition=(or items.firstObject.Partition '')
)
)
}}
@isRemoteDC={{not dc.Local}}
@hasMetricsProvider={{gt config.data.metrics_provider.length 0}}
@oncreate={{route-action 'createIntention'}}
/>
{{/if}}
</DataSource>
</div>
{{/let}}
</BlockSlot>
</DataLoader>
</Route>