Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
Signed-off-by: Stepan Kiryakov <stepan.kiryakov@envisionblockchain.com>
  • Loading branch information
Stepan-Kirjakov committed Dec 27, 2024
1 parent bde527c commit 53be341
Show file tree
Hide file tree
Showing 43 changed files with 2,915 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,6 @@

<div *ngIf="stepper[1]" class="nav-body-container">
<div class="step-body-container">







<div class="node-container" *ngFor="let current of steps">
<div *ngIf="current.type === 'validate'" class="node-header">
<span class="node-status" [attr.status]="current.item.status"></span>
Expand Down Expand Up @@ -217,31 +210,7 @@
</ng-container>

</div>

</div>























</div>
</div>
<div *ngIf="stepper[2]" class="nav-body-container">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,6 @@ export class PolicyLabelDocumentViewComponent implements OnInit {
this.steps = this.validator.getDocument();
this.validator.setData(this.relationships);
this.validator.setVp(this.document);
// this.steps.shift();
console.log( this.steps )

//
this.schemasMap = new Map<string, Schema>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ export abstract class BaseDetailsComponent {
.updateFiles(first.consensusTimestamp)
.subscribe({
next: (result) => {
if(result) {
if (result) {
this.first = result;
this.setFiles(this.first);
}
Expand Down Expand Up @@ -239,15 +239,19 @@ export abstract class BaseDetailsComponent {
const url = item.files[i];
const document = item.documents?.[i];
const json = this.getDocument(document);
const credentialSubject = this.getCredentialSubject(document);
const documentObject = this.getDocumentObject(document);
const credentialSubject = this.getCredentialSubject(documentObject);
const verifiableCredential = this.getVerifiableCredential(documentObject);
const cid = new CID(url);
const ipfs = {
version: cid.version,
cid: url,
global: cid.toV1().toString('base32'),
document,
json,
credentialSubject
documentObject,
credentialSubject,
verifiableCredential
}
if (!document) {
item._ipfsStatus = false;
Expand All @@ -267,15 +271,35 @@ export abstract class BaseDetailsComponent {
}
}

protected getCredentialSubject(item: any): any {
protected getDocumentObject(item: any): any {
try {
return JSON.parse(item).credentialSubject[0];
return JSON.parse(item);
} catch (error) {
console.log(error);
return null;
}
}

protected getCredentialSubject(item: any): any {
try {
return item.credentialSubject[0];
} catch (error) {
return {};
}
}

protected getVerifiableCredential(item: any): any[] {
try {
return item.verifiableCredential;
} catch (error) {
return [];
}
}

protected getFirstDocument() {
return this.first._ipfs[0];
}

protected setRelationships(result: Relationships): void {
this.relationships = result;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,120 @@ <h1>{{ 'details.header.label' | transloco }}</h1>

<p-tabPanel [header]="'details.view' | transloco">
@if (label) {

<div class="step-container">
<div class="step-body-container">
@for (current of steps; track current) {
<div class="node-container">
@if (current.type === 'validate') {
<div class="node-header">
<span class="node-status" [attr.status]="current.item.status"></span>
@if (current.prefix) {
<span class="node-prefix">{{current.prefix}}</span>
}
<span>{{current.title}}</span>
</div>
} @else {
<div class="node-body">
@if (current.prefix) {
<div class="node-sub-header">
<span class="node-prefix">{{current.name}}</span>
</div>
}

@if (current.type === 'variables') {
@for (variable of current.config; track variable) {
<div class="field-container">
<div class="field-name">
{{variable.fieldDescription}}
</div>
@if (variable.isArray) {
<div class="field-value-array">
@for (v of variable.value; track v) {
<div class="field-value">
{{getVariableValue(v)}}
</div>
}
</div>
} @else {
<div class="field-value">
{{getVariableValue(variable.value)}}
</div>
}
</div>
}
}
@if (current.type === 'scores') {
@for (score of current.config; track score) {
<div class="score-container">
@if (score.relationships) {
<div class="fields-container">
@for (variable of score._relationships; track variable) {
<div class="field-container">
<div class="field-name">
{{variable.fieldDescription}}
</div>
@if (variable.isArray) {
<div class="field-value-array">
@for (v of variable.value; track v) {
<div class="field-value">
{{getVariableValue(v)}}
</div>
}
</div>
} @else {
<div class="field-value">
{{getVariableValue(variable.value)}}
</div>
}
</div>
}
</div>
}
<div class="score-name">
{{score.description}}
</div>
@if (score._options) {
<div class="options-container">
@for (option of score._options; track option) {
<div class="option-container">
<div class="option-checkbox">
<p-radioButton
class="guardian-radio-button radio-button-24"
[name]="score.id"
[value]="option.value"
[(ngModel)]="score.value"
[inputId]="option.id"
readonly="true"
></p-radioButton>
</div>
<label class="option-name" [for]="option.id">
{{option.description}}
</label>
</div>
}
</div>
}
</div>
}
}
@if (current.type === 'formulas') {
@for (formula of current.config; track formula) {
<div class="field-container">
<div class="field-name">
{{formula.description}}
</div>
<div class="field-value">
{{formula.value}}
</div>
</div>
}
}
</div>
}
</div>
}
</div>
</div>
}
</p-tabPanel>

Expand Down
Loading

0 comments on commit 53be341

Please sign in to comment.