mirror of https://github.com/rancher/ui.git
Use externalIpAddress when available
This commit is contained in:
parent
e08481961d
commit
687c07dbd6
|
|
@ -1,5 +1,5 @@
|
|||
import { computed, get } from '@ember/object';
|
||||
import { alias } from '@ember/object/computed';
|
||||
import { alias, or } from '@ember/object/computed';
|
||||
import Resource from 'ember-api-store/models/resource';
|
||||
import { download } from 'shared/utils/util';
|
||||
import C from 'ui/utils/constants';
|
||||
|
|
@ -88,7 +88,7 @@ var Node = Resource.extend(StateCounts, ResourceUsage, {
|
|||
return out;
|
||||
}.property('actionLinks.{activate,deactivate,evacuate}','links.{update,remove,config}','driver'),
|
||||
|
||||
displayIp: alias('ipAddress'),
|
||||
displayIp: or('externalIpAddress','ipAddress'),
|
||||
|
||||
displayName: computed('name','nodeName','requestedHostname','id', function() {
|
||||
let name = get(this,'name');
|
||||
|
|
|
|||
|
|
@ -51,9 +51,15 @@ var PublicEndpoint = Resource.extend({
|
|||
let out = '';
|
||||
if ( allNodes ) {
|
||||
const globalStore = get(this, 'globalStore');
|
||||
const node = globalStore.all('node').findBy('clusterId', get(this,'scope.currentCluster.id'));
|
||||
const nodes = globalStore.all('node').filterBy('clusterId', get(this,'scope.currentCluster.id'));
|
||||
let node = nodes.findBy('externalIpAddress');
|
||||
if ( node ) {
|
||||
out = get(node, 'ipAddress');
|
||||
out = get(node, 'externalIpAddress');
|
||||
} else {
|
||||
node = nodes.findBy('ipAddress');
|
||||
if ( node ) {
|
||||
out = get(node, 'ipAddress');
|
||||
}
|
||||
}
|
||||
} else if ( addresses && addresses.length ) {
|
||||
out = addresses[0];
|
||||
|
|
|
|||
|
|
@ -17,11 +17,19 @@
|
|||
{{else}}
|
||||
<a href="{{href-to 'node' model.clusterId model.id}}">{{model.displayName}}</a>
|
||||
{{/if}}
|
||||
{{#if (and model.displayIp (not-eq model.displayIp model.displayName))}}
|
||||
<div class="text-small text-muted">
|
||||
{{#copy-inline clipboardText=model.displayIp size="small"}}
|
||||
{{format-ip model.displayIp}}
|
||||
{{/copy-inline}}
|
||||
{{#if (or model.externalIpAddress model.ipAddress)}}
|
||||
<div class="text-small text-muted clip">
|
||||
{{#if model.externalIpAddress}}
|
||||
{{#copy-inline clipboardText=model.externalIpAddress size="small"}}
|
||||
{{format-ip model.externalIpAddress}}
|
||||
{{/copy-inline}}
|
||||
/
|
||||
{{/if}}
|
||||
{{#if model.ipAddress}}
|
||||
{{#copy-inline clipboardText=model.ipAddress size="small"}}
|
||||
{{format-ip model.ipAddress}}
|
||||
{{/copy-inline}}
|
||||
{{/if}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</td>
|
||||
|
|
|
|||
Loading…
Reference in New Issue