Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure we don't try to get length of undefined endpoint description #3274

Merged
merged 3 commits into from
Dec 17, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,20 @@ export class CardCfInfoComponent implements OnInit, OnDestroy {
this.subs.forEach(s => s.unsubscribe());
}

private getMetadataFromInfo(entity: EntityInfo<APIResource<ICfV2Info>>) {
return entity && entity.entity && entity.entity.entity ? entity.entity.entity : null;
}

private getDescription(entity: EntityInfo<APIResource<ICfV2Info>>): string {
let desc = '-';
if (entity && entity.entity && entity.entity.entity) {
const metadata = entity.entity.entity;
if (metadata.description.length === 0) {
// No descripion - custom overrides
if (metadata.support === '[email protected]') {
desc = 'PCF Dev';
}
} else {
desc = metadata.description;
desc += metadata.build ? ` (${metadata.build})` : '';
const metadata = this.getMetadataFromInfo(entity);
if (metadata) {
if (metadata.description) {
return metadata.description + (metadata.build ? ` (${metadata.build})` : '');
}
if (metadata.support === '[email protected]') {
return 'PCF Dev';
}
}
return desc;
return '-';
}
}