ui/lib/shared/addon/components/page-header-environment/template.hbs

79 lines
2.7 KiB
Handlebars

<a class="dropdown-toggle {{if twoLine 'two-line'}} text-white" aria-haspopup="true" aria-expanded="false" aria-label="{{t 'nav.environment.cluster'}}" data-toggle="environment">
{{#if (eq scope "project")}}
<div class="clip">
<i class="icon icon-cluster icon-fw"></i>
{{project.cluster.displayName}}
</div>
<div class="pl-15 clip text-muted">
<i class="{{project.icon}} project-icon icon-fw"></i>
{{project.displayName}}
</div>
{{else if (eq scope "cluster")}}
<div class="clip">
<i class="icon icon-cluster icon-fw"></i>
{{cluster.displayName}}
</div>
{{else if (eq scope "clusters")}}
<div class="clip">
{{t 'nav.environment.manage'}}
</div>
{{else if (eq scope "admin")}}
<div class="clip">
{{t 'nav.admin.tab'}}
</div>
{{else}}
<div class="clip">
<i class="icon icon-question icon-fw"></i>
{{scope}}
</div>
{{/if}}
<i class="icon icon-chevron-down chevron"></i>
<span class="sr-only">{{t 'nav.srToggleDropdown'}}</span>
</a>
<ul class="dropdown-menu cluster-menu" role="menu" data-dropdown-id="environment">
{{#if (and isOwner scope.current)}}
<li>{{#link-to "authenticated.clusters.project" scope.current.id class="clip"}}{{t 'nav.environment.edit' name=scope.current.displayName}}{{/link-to}}</li>
<li role="presentation" class="divider"></li>
{{/if}}
{{#if projectIsMissing}}
<li role="presentation" class="dropdown-header">{{t 'nav.environment.selected'}}</li>
<li class="{{if (and (eq scope "project") project.active) 'active selected'}}">
<a href="#" {{action (action switchProject project.id)}} class="clip">
<i class="icon {{project.icon}}"></i>
&nbsp;
{{project.displayName}}
</a>
</li>
<li role="presentation" class="divider"></li>
{{/if}}
{{#each byCluster as |entry idx|}}
{{#if (gt idx 0)}}
<li role="presentation" class="divider"></li>
{{/if}}
<li class="header {{if entry.active (if (eq scope 'cluster') 'active selected') 'inactive'}}">
<a href="#" {{action "switchCluster" entry.cluster 'authenticated.clusters.cluster'}}>
<i class="icon icon-cluster icon-fw"></i>
&nbsp;
{{entry.cluster.displayName}}
</a>
</li>
{{#each entry.projects as |p|}}
<li class="{{if (and (eq scope "project") p.active) 'active selected' (unless entry.active 'inactive')}} subitem text-muted">
<a href="#" {{action (action switchProject p.id)}} class="clip project-link">
<i class="icon {{p.icon}} icon-fw"></i>
{{#if p.isDefault}}
<i class="icon icon-star-fill default-project nested"/>
{{/if}}
&nbsp;
{{p.displayName}}
</a>
</li>
{{/each}}
{{/each}}
</ul>