Skip to content

Commit

Permalink
#795 - Redirection of view/add button - Done
Browse files Browse the repository at this point in the history
  • Loading branch information
suvarnakale committed Oct 5, 2023
1 parent 7d43dd6 commit 84c118c
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 19 deletions.
7 changes: 5 additions & 2 deletions src/app/admin/advance-editor/advance-editor.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,16 @@ export class AdvanceEditorComponent implements OnInit {

showLessVc() {
this.isShowLessVc = !this.isShowLessVc;
if(this.jsonSchema.status == 'PUBLISHED'){
var credTemp = document.getElementsByClassName("jsoneditor-text");
credTemp[0].setAttribute("disabled", "true");
}
}

ngOnInit(): void {
this.formioJsonBuild(this.jsonSchema);

var coll = document.getElementsByClassName("collapsible");

for (let i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function () {
this.classList.toggle("active");
Expand All @@ -73,7 +76,7 @@ export class AdvanceEditorComponent implements OnInit {
}

formioJsonBuild(jsonFields) {

jsonFields = JSON.parse(jsonFields['schema']);
if (typeof (jsonFields['_osConfig']['credentialTemplate']) == 'string') {
fetch(jsonFields['_osConfig']['credentialTemplate'])
.then(response => response.text())
Expand Down
3 changes: 2 additions & 1 deletion src/app/admin/edit-template/edit-template.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export class EditTemplateComponent implements OnInit, OnDestroy {
this.generalService.getData('/Schema/' + this.schemaOsid).subscribe((response) => {
let data = JSON.parse(response['schema']);
this.certificateTitle = response['name'];
this.userJson = data;
this.userJson = response;
});

}
Expand Down Expand Up @@ -563,6 +563,7 @@ export class EditTemplateComponent implements OnInit, OnDestroy {
}

jsonSchemaData(jsonSchema) {
console.log(jsonSchema);
this.schemaContent = jsonSchema._data;
this.getCrtTempFields(this.schemaContent);
this.schemaDiv = false;
Expand Down
47 changes: 32 additions & 15 deletions src/app/admin/ownership/ownership.component.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<div class="col-md-12 pr-4 mb-6">
<div class="ml-4 mt-5 w-70" *ngIf="schemaStatus == 'PUBLISHED'">
<span class="bg-color-secondary p-3">
{{ 'OWNERSHIP_IS_READONLY' | translate }}
</span>
</div>
<form [formGroup]="ownershipForm">
<div class="step p-5">
<div class="step p-4">
<div class="mb-2">
<span class="fs-16 fw-bold mb-2">{{'HOW_CAN_ENTITIES_LOGIN' | translate}}</span>
</div>
Expand All @@ -14,16 +19,18 @@
<div class="row">
<div class="col-6 ml-3">
<span class="fs-12 fw-bold"></span><br />
<div class="d-flex justify-content-center align-items-center mr-5">
<fieldset class="form-check mr-3">
<input class="form-check-input rounded-lg checkbox-lg" type="checkbox" id="flexCheckUserID" formControlName="userIDCheckbox">
<div class="d-flex justify-content-center align-items-center ml-1">
<fieldset class="form-check mr-3" [disabled]="schemaStatus == 'PUBLISHED'">
<div style="margin-left: -80%">
<input class="form-check-input rounded-lg checkbox-lg" type="checkbox" id="flexCheckUserID" formControlName="userIDCheckbox" >
<label class="form-check-label fs-14" for="flexCheckUserID">
{{'USERID' | translate}}
</label>
</div>
</fieldset>
<fieldset [disabled]="!ownershipForm.value.primaryLogin.userIDCheckbox">
<select name="userID" id="userID" formControlName="userIDField"
class="w-100 br-4 border-1 border-light fs-14 p-3 ml-5">
class="w-100 br-4 border-1 border-light fs-14 p-3 ml-3">
<option value="" disabled selected hidden>{{'SELECT_FIELD' | translate}}</option>
<option *ngFor="let property of propertyNames; let i = index;"
[value]="property">{{ property }}</option>
Expand All @@ -34,12 +41,14 @@
<div class="col-4 mr-3">
<span class="fs-12 fw-bold"></span><br />
<div class="d-flex justify-content-center align-items-center">
<fieldset class="form-check mr-2" required>
<fieldset class="form-check mr-2" [disabled]="schemaStatus == 'PUBLISHED'">
<div style="margin-left: -40%">
<input class="form-check-input rounded-lg checkbox-lg" type="checkbox"
id="flexCheckEmail" formControlName="emailCheckbox">
<label class="form-check-label fs-14" for="flexCheckEmail">
{{'EMAIL' | translate}}<span class="text-danger">*</span>
</label>
</div>
</fieldset>
<fieldset [disabled]="!ownershipForm.value.primaryLogin.emailCheckbox">
<select name="email" id="email" formControlName="emailField"
Expand All @@ -56,7 +65,7 @@
<div class="col-6">
<span class="fs-12 fw-bold"></span><br />
<div class="d-flex justify-content-center align-items-center">
<fieldset class="form-check" required>
<fieldset class="form-check" [disabled]="schemaStatus == 'PUBLISHED'">
<input class="form-check-input rounded-lg checkbox-lg" type="checkbox"
id="flexCheckMobile" formControlName="mobilenumberCheckbox">
<label class="form-check-label fs-14" for="flexCheckMobile">
Expand All @@ -76,7 +85,7 @@
<div class="col-4 mr-3">
<span class="fs-12 fw-bold"></span><br />
<div class="d-flex justify-content-center align-items-center ml-3">
<fieldset class="form-check ">
<fieldset class="form-check" [disabled]="schemaStatus == 'PUBLISHED'">
<input class="form-check-input rounded-lg checkbox-lg" type="checkbox"
id="flexCheckPassword" formControlName="passwordCheckbox">
<label class="form-check-label fs-14" for="flexCheckPassword">
Expand All @@ -101,16 +110,17 @@
</div>
</div>

<div class="step px-5">
<div class="step px-4">
<div class="mb-2">
<span class="fs-16 fw-bold">{{'WHO_IS_AUTHORISED_FOR_ISSUANCE' | translate}}</span>
</div>
<div class="card w-100 p-3">
<div class="px-3">
<div class="mb-3">
<div class="custom-control custom-radio my-4">
<fieldset class="form-check" [disabled]="schemaStatus == 'PUBLISHED'">
<div class="custom-control custom-radio my-4" >
<input type="radio" id="customRadio1" class="custom-control-input radio-lg"
value="anonymous" formControlName="issuer" [defaultChecked]="true">
value="anonymous" formControlName="issuer" [defaultChecked]="true" >
<label class="custom-control-label fs-14" for="customRadio1">{{'ANONYMOUS' |
translate}}</label>
</div>
Expand All @@ -119,6 +129,7 @@
formControlName="issuer">
<label class="custom-control-label fs-14" for="customRadio2">{{'ROLE' | translate}}</label>
</div>
</fieldset>
<fieldset class="ml-4" [disabled]="ownershipForm.value.issuer ==='role'?false:true">
<span class="fs-14 fw-bold">{{'SELECT_ROLE' | translate}}</span><br />
<select name="issuerRole" id="issuerRole" formControlName="issuerRole"
Expand All @@ -128,21 +139,24 @@
</select>
</fieldset>
</div>
<div class="px-3 form-inline">
<fieldset class="form-check" [disabled]="schemaStatus == 'PUBLISHED'">
<div class="px-1 form-inline">
<label for="newRole" class="fs-14 fw-bold">Create a New Role:</label>
<input type="text" class="form-control col-4 ml-2" id="newRole" name="newRole" placeholder="Enter new role" />
</div>
</fieldset>
</div>
</div>
</div>

<div class="step px-5 mt-5">
<div class="step px-4 mt-5">
<div class="mb-2">
<span class="fs-16 fw-bold">{{'WHO_IS_AUTHORISED_TO_INVITE_ROLES' | translate}}</span>
</div>
<div class="card w-100 p-3">
<div class="px-3">
<div class="mb-3" id="forchemaPublished">
<div class="mb-3">
<fieldset class="form-check" [disabled]="schemaStatus == 'PUBLISHED'">
<div class="custom-control custom-radio my-4">
<input type="radio" id="inviteCustomRadio1" class="custom-control-input radio-lg"
value="anonymous" formControlName="invitee" [defaultChecked]="true">
Expand All @@ -153,6 +167,7 @@
formControlName="invitee">
<label class="custom-control-label fs-14" for="inviteCustomRadio2">{{'INVITE_ROLES' | translate}}</label>
</div>
</fieldset>
<fieldset class="ml-4" [disabled]="ownershipForm.value.invitee ==='inviteRoles'?false:true">
<span class="fs-14 fw-bold">{{'SELECT_ROLE' | translate}}</span><br />
<select name="inviteRole" id="inviteRole" formControlName="inviteRole"
Expand All @@ -162,10 +177,12 @@
</select>
</fieldset>
</div>
<div class="px-3 form-inline">
<fieldset class="form-check" [disabled]="schemaStatus == 'PUBLISHED'">
<div class="px-1 form-inline">
<label for="newRole" class="fs-14 fw-bold">Create a New Role:</label>
<input type="text" class="form-control col-4 ml-2" id="newRole" name="newRole" placeholder="Enter new role" />
</div>
</fieldset>
</div>
</div>
</div>
Expand Down
4 changes: 3 additions & 1 deletion src/app/admin/ownership/ownership.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export class OwnershipComponent implements OnInit, OnChanges {
propertyNames = [];
selectedProperty: any;
entityList: any[];
schemaStatus: any;

constructor(
private activeRoute: ActivatedRoute,
Expand Down Expand Up @@ -87,6 +88,7 @@ export class OwnershipComponent implements OnInit, OnChanges {
for (let i = 0; i < this.items.length; i++) {
this.entityList.push(this.items[i].name);
if (this.items[i]["name"] == this.entityName) {
this.schemaStatus = this.items[i].status;
let properties = this.items[i]["schema"]["definitions"][this.entityName]["properties"];
let requiredProperties = this.items[i]["schema"]["definitions"][this.entityName]["required"];
for(let j=0; j< requiredProperties.length; j++){
Expand All @@ -106,7 +108,7 @@ export class OwnershipComponent implements OnInit, OnChanges {
}

submitOwnershipForm() {
if (this.ownershipForm.value.uniqueField.length === 0) {
if (this.ownershipForm.value.uniqueField == undefined || this.ownershipForm.value.uniqueField.length === 0) {
return;
}

Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/global/en-global.json
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@
"SCHEMA_IS_PUBLISHED": "Schema is Published",
"EXPLORE_API_HERE": "Explore API here",
"SCHEMA_PUBLISHED":"Schema(s) published.",
"OWNERSHIP_IS_READONLY":"Ownership flow is read-only because the schema has been published.",

"DASHBOARD": "Dashboard",
"ATTESTATION_WORKFLOW": "Attestation Workflow",
Expand Down
1 change: 1 addition & 0 deletions src/assets/i18n/global/hi-global.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
"SCHEMA_IS_PUBLISHED": "स्कीमा प्रकाशित हो चुकी है",
"EXPLORE_API_HERE": "एपीआई को यहां एक्सप्लोर करें",
"SCHEMA_PUBLISHED":"स्कीमा प्रकाशित।",
"OWNERSHIP_IS_READONLY":"स्वामित्व प्रवाह केवल पढ़ने के लिए है क्योंकि स्कीमा प्रकाशित हो चुकी है।",

"DASHBOARD": "डैशबोर्ड",
"ATTESTATION_WORKFLOW": "प्रमाणन कार्यप्रवाह",
Expand Down

0 comments on commit 84c118c

Please sign in to comment.