PublicEndpoints

This commit is contained in:
Vincent Fiduccia 2018-04-04 15:59:12 -07:00
parent 4ab13d4385
commit cebfde7338
No known key found for this signature in database
GPG Key ID: 2B29AD6BB2BB2582
2 changed files with 8 additions and 9 deletions

View File

@ -77,14 +77,12 @@ var PublicEndpoint = Resource.extend({
let out = '';
out += get(this,'port');
let proto = get(this,'protocol').toLowerCase();
if (proto !== 'tcp') {
out += '/' + proto;
}
out += '/' + proto;
return out;
}),
linkEndpoint: computed('isTcp', 'isMaybeSecure', 'displayEndpoint', function() {
if (get(this,'isTcp')) {
linkEndpoint: computed('isTcpish', 'isMaybeSecure', 'displayEndpoint', 'port', function() {
if (get(this,'isTcpish') && get(this, 'port') > 0 ) {
let out = get(this,'endpoint');
if (get(this,'isMaybeSecure')) {
@ -97,8 +95,9 @@ var PublicEndpoint = Resource.extend({
}
}),
isTcp: computed('protocol', function() {
return get(this,'protocol').toLowerCase() === 'tcp';
isTcpish: computed('protocol', function() {
const proto = get(this, 'protocol').toLowerCase();
return ( ['tcp','http','https'].includes(proto) );
}),
isMaybeSecure: computed('port', function() {

View File

@ -9,7 +9,7 @@ export default Mixin.create({
const endpoints = (get(this, 'publicEndpoints') || []);
endpoints.forEach((endpoint) => {
if (get(endpoint, 'isTcp')) {
if (get(endpoint, 'isTcpish')) {
parts.push('<span>' +
'<a target="_blank" rel="noreferrer nofollow noopener" href="' + Util.escapeHtml(get(endpoint, 'linkEndpoint')) + '">' +
Util.escapeHtml(get(endpoint, 'displayEndpoint')) +
@ -20,7 +20,7 @@ export default Mixin.create({
}
});
let pub = parts.join(" / ");
let pub = parts.join(', ');
if (pub) {
return pub.htmlSafe();