Rework ingress detail page

rancher/rancher#15096
This commit is contained in:
Westly Wright 2018-10-04 10:17:01 -07:00
parent 3d4712fd44
commit eba597048d
No known key found for this signature in database
GPG Key ID: 4FAB3D8673DC54A3
5 changed files with 155 additions and 112 deletions

View File

@ -1,67 +1,67 @@
{{#accordion-list-item {{#accordion-list-item
title=(t 'formLabelsAnnotations.title') title=(t 'formLabelsAnnotations.title')
detail=(t detailKey appName=settings.appName) detail=(t detailKey appName=settings.appName)
showStatus=true showStatus=true
status=status status=status
statusClass=statusClass statusClass=statusClass
expandAll=expandAll expandAll=expandAll
expand=(action expandFn) expand=(action expandFn)
}} }}
<div class="row"> <div class="row">
{{#if editing}} {{#if editing}}
<div class="col span-6"> <div class="col span-6">
<div class="clearfix"> <div class="clearfix">
<label class="acc-label">{{t 'formUserLabels.title'}}</label> <label class="acc-label">{{t 'formUserLabels.title'}}</label>
</div>
{{#if userLabelArray.length}}
<table class="table fixed no-lines js-label-table">
<thead>
<tr class="hidden-xs hidden-sm">
<th>{{t 'formUserLabels.key.label'}}{{field-required}}</th>
<th width="30">&nbsp;</th>
<th>{{t 'formUserLabels.value.label'}}</th>
<th width="40">&nbsp;</th>
</tr>
</thead>
<tbody>
{{#each userLabelArray as |label|}}
<tr>
<td data-title="key">
{{input-paste pasted="pastedLabels" class="form-control input-sm key js-label" type="text" value=label.key placeholder="formUserLabels.key.placeholder" disabled=(eq label.readonly true)}}
</td>
<td class="valign-top text-center">
{{#if editing}}
{{t 'formKeyValue.separator'}}
{{/if}}
</td>
<td data-title="label">
{{input class="form-control input-sm" type="text" value=label.value placeholder=(t 'formUserLabels.value.placeholder') disabled=(eq label.readonly true)}}
</td>
<td class="text-right">
<button class="btn bg-primary btn-sm" {{action "removeLabel" label}} disabled={{eq label.readonly true}}><i class="icon icon-minus"/><span class="sr-only">{{t 'generic.remove'}}</span></button>
</td>
</tr>
{{/each}}
</tbody>
</table>
<div class="protip mb-5">
{{t 'formUserLabels.protip'}}
</div> </div>
{{/if}} {{#if userLabelArray.length}}
<table class="table fixed no-lines js-label-table">
<thead>
<tr class="hidden-xs hidden-sm">
<th>{{t 'formUserLabels.key.label'}}{{field-required}}</th>
<th width="30">&nbsp;</th>
<th>{{t 'formUserLabels.value.label'}}</th>
<th width="40">&nbsp;</th>
</tr>
</thead>
<tbody>
{{#each userLabelArray as |label|}}
<tr>
<td data-title="key">
{{input-paste pasted="pastedLabels" class="form-control input-sm key js-label" type="text" value=label.key placeholder="formUserLabels.key.placeholder" disabled=(eq label.readonly true)}}
</td>
<button class="btn bg-link icon-btn" {{action "addUserLabel"}}> <td class="valign-top text-center">
<span class="darken"><i class="icon icon-plus text-small"/></span> {{#if editing}}
<span>{{t 'formUserLabels.addAction'}}</span> {{t 'formKeyValue.separator'}}
</button> {{/if}}
</div> </td>
<td data-title="label">
{{input class="form-control input-sm" type="text" value=label.value placeholder=(t 'formUserLabels.value.placeholder') disabled=(eq label.readonly true)}}
</td>
<td class="text-right">
<button class="btn bg-primary btn-sm" {{action "removeLabel" label}} disabled={{eq label.readonly true}}><i class="icon icon-minus"/><span class="sr-only">{{t 'generic.remove'}}</span></button>
</td>
</tr>
{{/each}}
</tbody>
</table>
<div class="protip mb-5">
{{t 'formUserLabels.protip'}}
</div>
{{/if}}
<button class="btn bg-link icon-btn" {{action "addUserLabel"}}>
<span class="darken"><i class="icon icon-plus text-small"/></span>
<span>{{t 'formUserLabels.addAction'}}</span>
</button>
</div>
{{else}} {{else}}
{{#if model.canHaveLabels}} {{#if model.canHaveLabels}}
{{table-labels {{table-labels
header=(t 'formUserLabels.title') header=(t 'formUserLabels.title')
model=model.labels model=model.labels
}} }}
{{/if}} {{/if}}
{{/if}} {{/if}}
@ -70,18 +70,18 @@
{{/unless}} {{/unless}}
<div class="col {{if editing 'span-6' 'span-12'}}"> <div class="col {{if editing 'span-6' 'span-12'}}">
{{#if editing}} {{#if editing}}
{{form-key-value {{form-key-value
header=(t 'formAnnotations.title') header=(t 'formAnnotations.title')
editing=editing editing=editing
initialMap=model.annotations initialMap=model.annotations
changed=(action "annotationsChange") changed=(action "annotationsChange")
addActionLabel="formAnnotations.addActionLabel" addActionLabel="formAnnotations.addActionLabel"
}} }}
{{else}} {{else}}
{{table-labels {{table-labels
header=(t 'formAnnotations.title') header=(t 'formAnnotations.title')
model=model.annotations model=model.annotations
labelIntlSec="annotationsSection" labelIntlSec="annotationsSection"
}} }}
{{/if}} {{/if}}
</div> </div>

View File

@ -5,50 +5,50 @@
<div class="row"> <div class="row">
<div class="col span-11-of-23 mt-0 mb-0"> <div class="col span-11-of-23 mt-0 mb-0">
{{form-name-description {{form-name-description
model=ingress model=ingress
nameDisabled=existing nameDisabled=existing
namePlaceholder="servicePage.newIngress.form.name.placeholder" namePlaceholder="servicePage.newIngress.form.name.placeholder"
descriptionPlaceholder="servicePage.newIngress.form.description.placeholder" descriptionPlaceholder="servicePage.newIngress.form.description.placeholder"
}} }}
</div> </div>
<div class="col span-11-of-23 mt-0 mb-0 offset-1-of-23"> <div class="col span-11-of-23 mt-0 mb-0 offset-1-of-23">
{{form-namespace {{form-namespace
editing=(and editing (not existing)) editing=(and editing (not existing))
namespace=namespace namespace=namespace
errors=namespaceErrors errors=namespaceErrors
}} }}
</div> </div>
</div> </div>
<section class="mt-40 horizontal-form container-fluid"> <section class="mt-40 horizontal-form container-fluid">
{{form-ingress-rule {{form-ingress-rule
ingress=ingress ingress=ingress
editing=true editing=true
}} }}
<hr class="mt-30 mb-30" /> <hr class="mt-30 mb-30" />
</section> </section>
{{#accordion-list as | al expandFn | }} {{#accordion-list as | al expandFn | }}
{{form-ssl-termination {{form-ssl-termination
editing=true certificates=certificates
ingress=ingress editing=true
namespace=namespace expandAll=al.expandAll
namespacedCertificates=namespacedCertificates expandFn=expandFn
certificates=certificates ingress=ingress
expandAll=al.expandAll namespace=namespace
expandFn=expandFn namespacedCertificates=namespacedCertificates
}} }}
{{form-labels-annotations {{form-labels-annotations
classNames="accordion-wrapper" annotationErrors=annotationErrors
labelErrors=labelErrors classNames="accordion-wrapper"
initialLabels=ingress.labels expandAll=al.expandAll
setLabels=(action 'setLabels') expandFn=expandFn
expandAll=al.expandAll initialLabels=ingress.labels
expandFn=expandFn labelErrors=labelErrors
model=ingress model=ingress
annotationErrors=annotationErrors setLabels=(action 'setLabels')
}} }}
{{/accordion-list}} {{/accordion-list}}

View File

@ -18,16 +18,33 @@
<section class="mt-40 horizontal-form container-fluid"> <section class="mt-40 horizontal-form container-fluid">
{{form-ingress-rule {{form-ingress-rule
ingress=model.ingress ingress=model.ingress
editing=false editing=false
}} }}
<hr class="mt-30 mb-30" />
</section> </section>
{{form-ssl-termination <hr class="mt-30 mb-30" />
editing=false
ingress=model.ingress <section class="horizontal-form container-fluid">
namespace=model.ingress.namespace {{#accordion-list as | al expandFn | }}
namespacedCertificates=model.namespacedCertificates {{form-ssl-termination
certificates=model.certificates editing=false
}} expandAll=al.expandAll
expandFn=expandFn
ingress=model.ingress
namespace=model.ingress.namespace
namespacedCertificates=model.namespacedCertificates
certificates=model.certificates
}}
{{form-labels-annotations
classNames="accordion-wrapper"
editing=false
expandAll=al.expandAll
expandFn=expandFn
initialLabels=model.ingress.labels
model=model.ingress
}}
{{/accordion-list}}
</section>

View File

@ -19,23 +19,43 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col span-6 mt-0 mb-0"> <div class="col mt-0 mb-0 {{if (eq mode 'manual') 'span-6' 'span-12'}}" >
{{#unless rule.new}} {{#if editing}}
{{#unless rule.new}}
<div class="radio">
<label>{{radio-button selection=mode value="existing"}} {{t 'formIngress.hostMode.existing' domain=(if existingHost existingHost 'n/a') htmlSafe=true}}</label>
</div>
{{/unless}}
{{#if settings.ingress-ip-domain}}
<div class="radio">
<label>{{radio-button selection=mode value="automatic"}} {{t 'formIngress.hostMode.automatic' domain=settings.ingress-ip-domain htmlSafe=true}}</label>
</div>
{{/if}}
<div class="radio"> <div class="radio">
<label>{{radio-button selection=mode value="existing"}} {{t 'formIngress.hostMode.existing' domain=(if existingHost existingHost 'n/a') htmlSafe=true}}</label> <label>{{radio-button selection=mode value="manual"}} {{t 'formIngress.hostMode.manual'}}</label>
</div> </div>
{{/unless}}
{{#if settings.ingress-ip-domain}}
<div class="radio"> <div class="radio">
<label>{{radio-button selection=mode value="automatic"}} {{t 'formIngress.hostMode.automatic' domain=settings.ingress-ip-domain htmlSafe=true}}</label> <label class="{{if defaultDisabled 'text-muted'}}">{{radio-button selection=mode value="default" disabled=defaultDisabled}} {{t 'formIngress.hostMode.default'}}</label>
</div> </div>
{{else}}
{{#if (eq mode "existing")}}
<div>
<label>{{t 'formIngress.hostMode.existing' domain=(if existingHost existingHost 'n/a') htmlSafe=true}}</label>
</div>
{{else if (eq mode "automatic")}}
<div>
<label>{{t 'formIngress.hostMode.automatic' domain=settings.ingress-ip-domain htmlSafe=true}}</label>
</div>
{{else if (eq mode "manual")}}
<div>
<label>{{t 'formIngress.hostMode.manual'}}</label>
</div>
{{else}}
<div>
<label>{{t 'formIngress.hostMode.default'}}</label>
</div>
{{/if}}
{{/if}} {{/if}}
<div class="radio">
<label>{{radio-button selection=mode value="manual"}} {{t 'formIngress.hostMode.manual'}}</label>
</div>
<div class="radio">
<label class="{{if defaultDisabled 'text-muted'}}">{{radio-button selection=mode value="default" disabled=defaultDisabled}} {{t 'formIngress.hostMode.default'}}</label>
</div>
</div> </div>
{{#if (eq mode "manual")}} {{#if (eq mode "manual")}}
@ -50,5 +70,10 @@
<hr class="mt-20 mb-20" /> <hr class="mt-20 mb-20" />
{{form-ingress-backends ingress=ingress isDefault=isDefault rule=rule editing=editing}} {{form-ingress-backends
ingress=ingress
isDefault=isDefault
rule=rule
editing=editing
}}
</div> </div>

View File

@ -4,11 +4,12 @@
<hr/> <hr/>
{{#each rules as |rule|}} {{#each rules as |rule|}}
{{form-ingress-rows {{form-ingress-rows
removeRule=(action 'removeRule') removeRule=(action 'removeRule')
rules=rules rules=rules
rule=rule rule=rule
ingress=ingress ingress=ingress
editing=editing}} editing=editing
}}
{{else}} {{else}}
<div class="p-20">{{t 'formIngress.noRules'}}</div> <div class="p-20">{{t 'formIngress.noRules'}}</div>
{{/each}} {{/each}}