Skip to content

Commit

Permalink
Added changes for HipChat
Browse files Browse the repository at this point in the history
Issue #58

 fixed the alert to use camelCaseToTitleCase
  • Loading branch information
jonmccormick committed Apr 21, 2017
1 parent 228ee08 commit 29d9ece
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 19 deletions.
5 changes: 3 additions & 2 deletions src/listener/utils/transforms/alert.js
Expand Up @@ -40,6 +40,7 @@ export default class Alert extends Resource {
if (this.__isNonDisplayField__(field) || !this[field]) {
continue;
}

if (field === 'associatedResource') {
fields.push({
title: 'Resource',
Expand All @@ -48,7 +49,7 @@ export default class Alert extends Resource {
});
} else {
fields.push({
title: field,
title: this.camelCaseToTitleCase(field),
short: true,
value: this[field]
});
Expand All @@ -66,7 +67,7 @@ export default class Alert extends Resource {
if (field === 'associatedResource') {
output += '\t\u2022 Resource: ' + this[field].resourceName + '\n';
} else {
output += '\t\u2022 ' + field + ': ' + this[field] + '\n';
output += '\t\u2022 ' + this.camelCaseToTitleCase(field) + ': ' + this[field] + '\n';
}
}
//Add status to output only for HipChat
Expand Down
6 changes: 2 additions & 4 deletions src/listener/utils/transforms/server-hardware.js
Expand Up @@ -44,10 +44,8 @@ export default class ServerHardware extends Resource {
continue;
}

let displayField = this.camelCaseToTitleCase(field);

fields.push({
title: displayField,
title: this.camelCaseToTitleCase(field),
short: true,
value: this[field]
});
Expand Down Expand Up @@ -77,7 +75,7 @@ export default class ServerHardware extends Resource {
if (this.__isNonDisplayField__(field) || !this[field]) {
continue;
}
output += '\t\u2022 ' + field + ': ' + this[field] + '\n';
output += '\t\u2022 ' + this.camelCaseToTitleCase(field) + ': ' + this[field] + '\n';
}
if (this.serverProfileUri) {
output += '\t\u2022 Profile: ' + getDeviceName(this.serverProfileUri) + '\n';
Expand Down
Expand Up @@ -49,10 +49,8 @@ export default class ServerProfileCompliancePreview extends Resource {
value = this[field];
}

let displayField = this.camelCaseToTitleCase(field);

fields.push({
title: displayField,
title: this.camelCaseToTitleCase(field),
short: false,
value: value
});
Expand All @@ -73,7 +71,7 @@ export default class ServerProfileCompliancePreview extends Resource {
value = this[field];
}
if (value) {
output += field + ':\n' + value + '\n';
output += this.camelCaseToTitleCase(field) + ':\n' + value + '\n';
}
}
return output;
Expand Down
6 changes: 2 additions & 4 deletions src/listener/utils/transforms/server-profile-template.js
Expand Up @@ -39,10 +39,8 @@ export default class ServerProfileTemplate extends Resource {
continue;
}

let displayField = this.camelCaseToTitleCase(field);

fields.push({
title: displayField,
title: this.camelCaseToTitleCase(field),
short: true,
value: this[field]
});
Expand All @@ -56,7 +54,7 @@ export default class ServerProfileTemplate extends Resource {
if (this.__isNonDisplayField__(field) || !this[field]) {
continue;
}
output += '\t\u2022 ' + field + ': ' + this[field] + '\n';
output += '\t\u2022 ' + this.camelCaseToTitleCase(field) + ': ' + this[field] + '\n';
}
return output;
}
Expand Down
6 changes: 2 additions & 4 deletions src/listener/utils/transforms/server-profile.js
Expand Up @@ -43,10 +43,8 @@ export default class ServerProfile extends Resource {
continue;
}

let displayField = this.camelCaseToTitleCase(field);

fields.push({
title: displayField,
title: this.camelCaseToTitleCase(field),
short: true,
value: this[field]
});
Expand All @@ -67,7 +65,7 @@ export default class ServerProfile extends Resource {
if (this.__isNonDisplayField__(field) || !this[field]) {
continue;
}
output += '\t\u2022 ' + field + ': ' + this[field] + '\n';
output += '\t\u2022 ' + this.camelCaseToTitleCase(field) + ': ' + this[field] + '\n';
}
if (this.serverHardwareUri) {
output += '\t\u2022 Server Hardware: ' + getDeviceName(this.serverHardwareUri) + '\n';
Expand Down
2 changes: 1 addition & 1 deletion src/test/resource.js
Expand Up @@ -55,7 +55,7 @@ describe('Resource', () => {
myKeys[6].should.equal('pxeBootPolicy');
});

it('camelCaseToTitleCase undefined', () => {
it('camelCaseToTitleCase empty', () => {
let serverProfileResource = new Resource(oneViewResource);
let myKeys = Object.keys(oneViewResource);
serverProfileResource.camelCaseToTitleCase('').should.equal('');
Expand Down

0 comments on commit 29d9ece

Please sign in to comment.