mirror of https://github.com/rancher/ui.git
parent
013986682f
commit
0d06a3e90b
|
|
@ -98,16 +98,7 @@ var Node = Resource.extend(Grafana, StateCounts, ResourceUsage, {
|
||||||
name = get(this, 'nodeName');
|
name = get(this, 'nodeName');
|
||||||
if ( name ) {
|
if ( name ) {
|
||||||
if ( name.match(/[a-z]/i) ) {
|
if ( name.match(/[a-z]/i) ) {
|
||||||
name = name.replace(/\..*$/, '');
|
name = this.parseNodeName(name);
|
||||||
|
|
||||||
const nodesWithSamePrefix = (this.nodes || []).filter((node) => (node.nodeName || '').startsWith(`${ name }.`));
|
|
||||||
|
|
||||||
if ( nodesWithSamePrefix.length > 1 ) {
|
|
||||||
name = this.nodeName.slice(this.nodeName.lastIndexOf('.') + 1, this.nodeName.length)
|
|
||||||
if ( name.match(/^\d+$/) ) {
|
|
||||||
name = this.nodeName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return name;
|
return name;
|
||||||
|
|
@ -209,6 +200,25 @@ var Node = Resource.extend(Grafana, StateCounts, ResourceUsage, {
|
||||||
return out;
|
return out;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
|
parseNodeName(nameIn) {
|
||||||
|
const suffix = nameIn.split('.').slice(1).join('.');
|
||||||
|
const nodesWithSameSuffix = (this.nodes || []).filter((node) => (node.nodeName || '').endsWith(suffix));
|
||||||
|
|
||||||
|
if (nodesWithSameSuffix.length === 1) {
|
||||||
|
return this.nodeName;
|
||||||
|
} else if (nodesWithSameSuffix.length > 1) {
|
||||||
|
const neu = nameIn.replace(/\..*$/, '');
|
||||||
|
|
||||||
|
if ( neu.match(/^\d+$/) ) {
|
||||||
|
return this.nodeName;
|
||||||
|
} else {
|
||||||
|
return neu;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nameIn;
|
||||||
|
},
|
||||||
|
|
||||||
engineIcon: computed('info.os.dockerVersion', function() {
|
engineIcon: computed('info.os.dockerVersion', function() {
|
||||||
if ( (get(this, 'info.os.dockerVersion') || '').startsWith(CONTAINERD) ) {
|
if ( (get(this, 'info.os.dockerVersion') || '').startsWith(CONTAINERD) ) {
|
||||||
return 'icon-container-d';
|
return 'icon-container-d';
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue