Fix broken ports component on container details

fixed misspelled name
swap out old container table component for form-ports
update form-ports to be editable
This commit is contained in:
Westly Wright 2017-08-16 12:05:59 -07:00
parent 3f44c38641
commit c242d188aa
No known key found for this signature in database
GPG Key ID: 4FAB3D8673DC54A3
3 changed files with 111 additions and 79 deletions

View File

@ -1,16 +1,19 @@
<div class="clearfix"> <div class="clearfix">
<label class="acc-label">{{t 'formPorts.header'}}</label> <label class="acc-label">{{t 'formPorts.header'}}</label>
{{#if (and portsArray.length (not showIp))}} {{#if (and portsArray.length (not showIp))}}
{{#if editing}}
<div class="pull-right text-small"> <div class="pull-right text-small">
<a role="button" class="btn bg-transparent p-0" {{action "showIp"}}> <a role="button" class="btn bg-transparent p-0" {{action "showIp"}}>
{{t 'formPorts.showIpLink'}} {{t 'formPorts.showIpLink'}}
</a> </a>
</div> </div>
{{/if}} {{/if}}
{{/if}}
</div> </div>
{{#if portsArray.length}} {{#if portsArray.length}}
<table class="table fixed no-lines small mb-10"> <table class="table fixed no-lines small mb-10">
<thead>
<tr class="hidden-sm"> <tr class="hidden-sm">
{{#if showIp}} {{#if showIp}}
<th>{{t 'formPorts.bindAddress.label'}}</th> <th>{{t 'formPorts.bindAddress.label'}}</th>
@ -19,13 +22,14 @@
<th>{{t 'formPorts.public.label'}}</th> <th>{{t 'formPorts.public.label'}}</th>
<th width="10"></th> <th width="10"></th>
<th>{{t 'formPorts.private.label'}}{{field-required}}</th> <th>{{t 'formPorts.private.label'}}{{#if editing}}{{field-required}}{{/if}}</th>
<th width="10"></th> <th width="10"></th>
<th width="80">{{t 'formPorts.protocol.label'}}</th> <th width="80">{{t 'formPorts.protocol.label'}}</th>
<th width="40">&nbsp;</th> <th width="40">&nbsp;</th>
</tr> </tr>
</thead>
<tbody>
{{#each portsArray as |port|}} {{#each portsArray as |port|}}
<div class="pt-10"></div>
<tr> <tr>
{{#if showIp}} {{#if showIp}}
<td data-title="{{t 'formPorts.public.label'}}"> <td data-title="{{t 'formPorts.public.label'}}">
@ -36,14 +40,27 @@
<span class="text-muted">{{t 'generic.any'}}</span> <span class="text-muted">{{t 'generic.any'}}</span>
{{/if}} {{/if}}
{{else}} {{else}}
{{#if editing}}
{{input class="form-control input-sm" type="text" value=port.bindAddress placeholder=(t 'formPorts.bindAddress.placeholder')}} {{input class="form-control input-sm" type="text" value=port.bindAddress placeholder=(t 'formPorts.bindAddress.placeholder')}}
{{else}}
{{#if port.bindAddress}}
{{port.bindAddress}}
{{else}}
<span class="text-muted">{{t 'generic.na'}}</span>
{{/if}}
{{/if}}
{{/if}} {{/if}}
</td> </td>
<td>&nbsp;</td> <td>&nbsp;</td>
{{/if}} {{/if}}
<td data-title="{{t 'formPorts.public.label'}}"> <td data-title="{{t 'formPorts.public.label'}}">
{{#if editing}}
{{input-integer class="form-control input-sm public" min="1" max="65535" value=port.public placeholder=(t 'formPorts.public.placeholder')}} {{input-integer class="form-control input-sm public" min="1" max="65535" value=port.public placeholder=(t 'formPorts.public.placeholder')}}
{{else}}
{{port.public}}
{{/if}}
</td> </td>
<td>&nbsp;</td> <td>&nbsp;</td>
@ -51,7 +68,11 @@
{{#if port.existing}} {{#if port.existing}}
<div class="text-muted">{{port.private}}</div> <div class="text-muted">{{port.private}}</div>
{{else}} {{else}}
{{#if editing}}
{{input-integer class="form-control input-sm" min="1" max="65535" value=port.private placeholder=(t 'formPorts.private.placeholder')}} {{input-integer class="form-control input-sm" min="1" max="65535" value=port.private placeholder=(t 'formPorts.private.placeholder')}}
{{else}}
{{port.private}}
{{/if}}
{{/if}} {{/if}}
</td> </td>
<td>&nbsp;</td> <td>&nbsp;</td>
@ -60,10 +81,15 @@
{{#if port.existing}} {{#if port.existing}}
<div class="text-muted">{{upper-case port.protocol}}</div> <div class="text-muted">{{upper-case port.protocol}}</div>
{{else}} {{else}}
{{#if editing}}
{{new-select {{new-select
class="form-control input-sm" class="form-control input-sm"
content=protocolOptions content=protocolOptions
value=port.protocol}} value=port.protocol
}}
{{else}}
{{port.protocol}}
{{/if}}
{{/if}} {{/if}}
</td> </td>
@ -71,13 +97,16 @@
{{#if port.existing}} {{#if port.existing}}
&nbsp; &nbsp;
{{else}} {{else}}
{{#if editing}}
<button class="btn bg-primary btn-sm" {{action "removePort" port}}> <button class="btn bg-primary btn-sm" {{action "removePort" port}}>
<i class="icon icon-minus"/><span class="sr-only">{{t 'generic.remove'}}</span> <i class="icon icon-minus"/><span class="sr-only">{{t 'generic.remove'}}</span>
</button> </button>
{{/if}} {{/if}}
{{/if}}
</td> </td>
</tr> </tr>
{{/each}} {{/each}}
</tbody>
</table> </table>
{{else}} {{else}}
{{#if editing}} {{#if editing}}
@ -86,8 +115,10 @@
{{/if}} {{/if}}
<div> <div>
{{#if editing}}
<button class="btn bg-link icon-btn p-0" {{action "addPort"}}> <button class="btn bg-link icon-btn p-0" {{action "addPort"}}>
<span class="darken"><i class="icon icon-plus text-small"/></span> <span class="darken"><i class="icon icon-plus text-small"/></span>
<span>{{t 'formPorts.addAction'}}</span> <span>{{t 'formPorts.addAction'}}</span>
</button> </button>
{{/if}}
</div> </div>

View File

@ -60,6 +60,7 @@
initialPorts=launchConfig.ports initialPorts=launchConfig.ports
errors=portErrors errors=portErrors
changedStr=(action (mut launchConfig.ports)) changedStr=(action (mut launchConfig.ports))
editing=true
}} }}
</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">

View File

@ -148,11 +148,11 @@
statusClass=(if model.container.publicEndpoints.length 'bg-success' 'text-muted') statusClass=(if model.container.publicEndpoints.length 'bg-success' 'text-muted')
expandAll=al.expandAll expandAll=al.expandAll
expand=(action expandFn) expand=(action expandFn)
componentName='container-table'
as | parent | as | parent |
}} }}
{{compontent parent.intent {{container/form-ports
model=model.container initialPorts=model.container.ports
editing=false
}} }}
{{/accordion-list-item}} {{/accordion-list-item}}
</div> </div>