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

fixed relationship decription on creds #130

Merged
merged 1 commit into from
Jan 18, 2022
Merged
Show file tree
Hide file tree
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
12 changes: 8 additions & 4 deletions src/components/entity/CredentialItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,18 @@ export default class HighlightedCredItem extends Vue {
if (!this.cred) {
return undefined;
}
let retval: { [index: string]: string } = {};
let retval: { [index: string]: string | undefined } = {};
const claimLabel = this.getClaimLabel(
this.cred.credential_type_id,
this.cred.credential_title
);

const default_title = this.cred.rel_id
? { "Relationship description": this.cred.rel_id as string }
: { "Registration number": this.sourceId };

if (claimLabel === undefined) {
retval = { "Registration number": this.sourceId };
retval = default_title;
} else {
let value = selectFirstAttrItem(
{ key: "type", value: this.cred.credential_title },
Expand All @@ -198,13 +202,13 @@ export default class HighlightedCredItem extends Vue {
if (value?.value) {
retval[claimLabel] = value.value as string;
} else {
retval = { "Registration number": this.sourceId };
retval = default_title;
}
}
let accessor = this.cred.credential_title ? this.cred.credential_title : "";
return {
key: Object.keys(retval)[0],
value: retval[Object.keys(retval)[0]],
value: retval[Object.keys(retval)[0]] as string,
accessor: accessor,
};
}
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/api/v4/credential.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface ICredential extends IApiResource {
export interface ICredentialDisplayType {
id: number;
credential_type: string;
rel_id?: string;
type: string;
authority: string;
authorityLink: string | URL;
Expand Down
1 change: 1 addition & 0 deletions src/utils/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ export function credOrRelationshipToDisplay(
const relItem = item as IRelationship;

display.id = relItem.credential.id;
display.rel_id = relItem.related_topic?.source_id;
display.authority = "";
display.authorityLink = "";
if (credSet !== undefined) {
Expand Down