Skip to content

Commit

Permalink
feat(server): add toString to OnmsServer
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin Reed committed Jun 7, 2017
1 parent 6811f90 commit cb5cf95
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/api/OnmsServer.ts
Expand Up @@ -6,6 +6,7 @@ const URI = require('urijs');

import {OnmsAuthConfig} from '../api/OnmsAuthConfig';
import {ServerMetadata} from './ServerMetadata';
import {SERVER_TYPES} from './ServerType';
import {UUID} from '../internal/UUID';

/**
Expand Down Expand Up @@ -80,4 +81,16 @@ export class OnmsServer {
}
return URI(this.url).hostname();
}

/** a pretty string representation of this server */
public toString() {
if (this.metadata) {
return 'OpenNMS '
+ (this.metadata.type === SERVER_TYPES.MERIDIAN ? 'Meridian' : 'Horizon')
+ ' ' + this.metadata.version.displayVersion
+ ' at ' + this.host;
} else {
return 'OpenNMS at ' + this.host;
}
}
}

0 comments on commit cb5cf95

Please sign in to comment.