Skip to content

Commit

Permalink
Merge branch 'main' of github.com:suvarnakale/Admin-Portal into main
Browse files Browse the repository at this point in the history
  • Loading branch information
suvarnakale committed Sep 11, 2023
2 parents 2b6d5ed + b2f7edb commit 7fbfbf1
Show file tree
Hide file tree
Showing 8 changed files with 253 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/app/admin/config-workflow/config-workflow.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ <h4>{{ entityName }}</h4>
</div>

<div class="mb-3">
<div class="fs-14 fw-bold my-2">{{'ATTRIBUTES_REQUIRED_FOR_ATTESTATION' | translate}}<button data-toggle="modal" data-target="#editWorlflowModal" (click)="setModalValues(workflowIndex)"
class="color-sec badge bg-color-secondary p-1 fs-12 mx-2">{{'EDIT' | translate}}</button></div>
<div class="fs-14 fw-bold my-2">{{'ATTRIBUTES_REQUIRED_FOR_ATTESTATION' | translate}}<span data-toggle="modal" data-target="#editWorlflowModal" (click)="setModalValues(workflowIndex)"
class="color-sec bg-color-secondary px-2 py-1 fs-12 mx-2 border-0 rounded-4" role="button">{{'EDIT' | translate}}</span></div>
<div class="p-4 bg-light w-100">
{{ workflowForm.value.workflowItems[workflowIndex].attestationProperties ? workflowForm.value.workflowItems[workflowIndex].attestationProperties.join(', ').substring(0, 100) : "NO_ATTRIBUTE_SELECTED" | translate }}
</div>
Expand Down
34 changes: 34 additions & 0 deletions src/app/admin/config-workflow/config-workflow.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export class ConfigWorkflowComponent implements OnInit {
conditionSelectOptions: any = [];
saveModalWorkflowIndex: number;
modalSelectedAttributes: any = [];
fullSchemas: any = [];
javaspelMethods = [
{ name: "EQUAL_TO", value: "equals" },
{ name: "NOT_EQUAL_TO", value: "not_equals" },
Expand Down Expand Up @@ -118,6 +119,7 @@ export class ConfigWorkflowComponent implements OnInit {

let selectedMenuList: any;
this.generalService.getData("/Schema").subscribe((res) => {
this.fullSchemas = res;
for (let i = 0; i < res.length; i++) {
this.schemaName.push(JSON.parse(res[i]["schema"]));

Expand Down Expand Up @@ -829,6 +831,38 @@ export class ConfigWorkflowComponent implements OnInit {
attestationPolicies.push(attestationPolicyItem);
}
console.log("attestationPolicies", attestationPolicies);
let payload = {};
let osidOfSchema = "";
for(let i = 0; i < this.fullSchemas?.length; i++){
if(this.fullSchemas[i].name === this.entityName){
if (this.schemaName[i]["_osConfig"]) {
this.schemaName[i]["_osConfig"].attestationPolicies = attestationPolicies;
} else {
this.schemaName[i] = {
...this.schemaName[i],
_osConfig: {
"attestationPolicies": attestationPolicies
}
}
}

// Updated payload of schema to be sent to backend
payload = {
"name": this.fullSchemas[i].name,
"description": this.fullSchemas[i].description,
"schema": JSON.stringify(this.schemaName[i]),
"referedSchema": this.fullSchemas[i].referedSchema,
"status": this.fullSchemas[i].status
}
osidOfSchema = this.fullSchemas[i].osid;
}
}

this.generalService.putData('/Schema', osidOfSchema, payload).subscribe((res) => {
console.log(res)
}, (err) => {
console.log(err)
})
}
}

130 changes: 130 additions & 0 deletions src/app/admin/roles/roles.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
<app-header></app-header>

<div class="m-0 mt-5 row h-100">
<nav id="sidebar" class="col-2 border3 card">
<ul id="sideMenu" class="list-unstyled components">
<!-- <li class="menu" routerLinkActive="active-link" [routerLinkActiveOptions]="{exact:true}">
<a class="a-menu"routerLink="/started/get-started" (click)="openMenu('get-started')">{{'GET_STARTED' | translate}}</a>
</li> -->
<li class="menu" routerLinkActive="active-link">
<a class="a-menu fs-14 p-3 d-block" routerLink="/#"
><b>{{ "DASHBOARD" | translate }}</b></a
>
</li>
<li class="menu" routerLinkActive="active-link" *ngIf="isSchemaCreated">
<a class="a-menu fs-14 p-3 d-block" routerLink="/schema"
><b>{{ "SCHEMA" | translate }}</b></a
>
</li>
<li class="menu" routerLinkActive="active-link">
<a class="a-menu fs-14 p-3 d-block" routerLink="/a"
><b>{{ "ATTESTATION_WORKFLOW" | translate }}</b></a
>
</li>
<li class="menu" routerLinkActive="active-link">
<a class="a-menu fs-14 p-3 d-block" routerLink="/a"
><b>{{ "VERIFIABLE_CREDENTIALS" | translate }}</b></a
>
</li>

<li class="menu" routerLinkActive="active-link">
<a class="a-menu fs-14 p-3 d-block" routerLink="/a"
><b>{{ "OWNERSHIP" | translate }}</b></a
>
</li>
<li
class="menu"
routerLinkActive="active-link"
class="active-link"
[routerLinkActiveOptions]="{ exact: true }"
>
<a class="a-menu fs-14 p-3 d-block" routerLink="/roles"
><b>{{ "ROLES" | translate }}</b></a
>
</li>
<li class="menu" routerLinkActive="active-link">
<a class="a-menu fs-14 p-3 d-block" routerLink="/a"
><b>{{ "THEME" | translate }}</b></a
>
</li>

<li class="menu" routerLinkActive="active-link">
<a class="a-menu fs-14 p-3 d-block" routerLink="/#"
><b>{{ "HELP" | translate }}</b></a
>
</li>
<li class="menu" routerLinkActive="active-link">
<a class="a-menu fs-14 p-3 d-block" routerLink="/#"
><b>{{ "ACCOUNT" | translate }}</b></a
>
</li>
</ul>
</nav>

<div class="col bg-grey-4 w-100">
<div class="col pr-4 mb-6 w-100">
<div
class="w-100 d-flex justify-content-between card-body py-2 mt-3 align-items-center"
>
<div class="heading-2">
<h3>Roles</h3>
</div>
<button
class="btn flex-end bg-color-primary bg-color-primary-sm px-3 my-2 ml-auto mr-2 text-white fs-16"
>
<i class="fa fa-plus mx-2" aria-hidden="true"></i>Add Role
</button>
</div>

<div class="card w-75 p-2">
<table class="table table-borderless">
<thead>
<tr>
<th scope="col" class="fw-bold">
<span class="p-1 ml-2"> {{ "ROLE" | translate }}</span>
</th>
<th scope="col" class="fw-bold">
<span class="p-1 ml-2">Last Updated</span>
</th>
<th scope="col" class="fw-bold">
<span class="p-1 ml-2"></span>
</th>
</tr>
</thead>
<tbody>
<tr class="border-bottom">
<td class="p-3">
<span class="p-1 ml-2">Admin</span>
</td>
<td class="p-3">
<span class="p-1 ml-2">14 Oct 2022</span>
</td>
<td class="p-3">
<button
class="btn bg-color-secondary color-sec fw-bold float-end submit-button px-3 my-2 ml-2 mr-2 mt-n2"
>
<i class="fa fa-edit mx-2" aria-hidden="true"></i>Edit
</button>
</td>
</tr>
<tr>
<td class="p-3">
<span class="p-1 ml-2">School Admin</span>
</td>
<td class="p-3">
<span class="p-1 ml-2">14 Oct 2022</span>
</td>
<td class="p-3">
<button
class="btn bg-color-secondary color-sec fw-bold float-end submit-button px-3 my-2 ml-2 mr-2 mt-n2"
>
<i class="fa fa-edit mx-2" aria-hidden="true"></i>Edit
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
7 changes: 7 additions & 0 deletions src/app/admin/roles/roles.component.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
a,
a:hover,
a:focus {
color: inherit;
text-decoration: none;
transition: all 0.3s;
}
71 changes: 71 additions & 0 deletions src/app/admin/roles/roles.component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import { Component, OnInit } from "@angular/core"
import { ActivatedRoute } from "@angular/router"
import { TranslateService } from "@ngx-translate/core"
import { GeneralService } from "src/app/services/general/general.service"

@Component({
selector: "roles-template",
templateUrl: "./roles.component.html",
styleUrls: ["./roles.component.scss"]
})
export class RolesComponent implements OnInit {
params: any
isSettingMenu: boolean = false

status: boolean = false
activeMenu: string = ""
sideMenu: any
menus: any
an_menus: any
currentMenu: number = 0
items = []
isLoading: boolean = true
isSchemaCreated: boolean = false
constructor(
private activeRoute: ActivatedRoute,
private generalService: GeneralService,
public translate: TranslateService
) {}

ngOnInit(): void {
this.activeRoute.params.subscribe((params) => {
this.params = params

if (params.hasOwnProperty("page") && params.page)
// this.activeMenu = params.page;
console.log({ params })
})

this.generalService.getData("/Schema").subscribe(
(res) => {
this.readSchema(res)
},
(err) => {
this.items = []
this.isLoading = false
}
)
}

readSchema(res) {
for (let i = 0; i < res.length; i++) {
if (typeof res[i].schema == "string") {
res[i].schema = JSON.parse(res[i].schema)
this.isSchemaCreated = true

if (
!res[i].schema.hasOwnProperty("isRefSchema") &&
!res[i].schema.isRefSchema
) {
this.items.push(res[i])
}

this.isLoading = false
}
}
}

clickEvent() {
this.status = !this.status
}
}
2 changes: 1 addition & 1 deletion src/app/admin/sidemenu/sidemenu.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<a class="a-menu fs-14 p-3 d-block" type="button" (click)="navigateTo('ownership')"><b>{{'OWNERSHIP' | translate}}</b></a>
</li>
<li class="menu" routerLinkActive="active-link">
<a class="a-menu fs-14 p-3 d-block" routerLink="/a"><b>{{'ROLES' | translate}}</b></a>
<a class="a-menu fs-14 p-3 d-block" routerLink="/roles"><b>{{'ROLES' | translate}}</b></a>
</li>
<li class="menu" routerLinkActive="active-link">
<a class="a-menu fs-14 p-3 d-block" routerLink="/a"><b>{{'THEME' | translate}}</b></a>
Expand Down
6 changes: 6 additions & 0 deletions src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { CreateEntityComponent } from "../app/admin/create-entity/create-entity.
import { ConfigWorkflowComponent } from "./admin/config-workflow/config-workflow.component";
import { CreateVcTemplateComponent } from "./admin/create-vc-template/create-vc-template.component";
import { OwnershipComponent } from "./admin/ownership/ownership.component";
import { RolesComponent } from "./admin/roles/roles.component";
import { SidemenuComponent } from "./admin/sidemenu/sidemenu.component";
import { DashboardComponent } from "./admin/dashboard/dashboard.component";
import { AddTemplateComponent } from "./admin/add-template/add-template.component";
Expand Down Expand Up @@ -215,6 +216,11 @@ const routes: Routes = [
component: DashboardComponent,
canActivate: [AuthGuard],
},
{
path: "roles",
component: RolesComponent,
canActivate: [AuthGuard],
},
{
path: "add-template",
component: AddTemplateComponent,
Expand Down
2 changes: 2 additions & 0 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ import { CreateVcTemplateComponent } from './admin/create-vc-template/create-vc-
import { OwnershipComponent } from './admin/ownership/ownership.component';
import { SidemenuComponent } from './admin/sidemenu/sidemenu.component';
import { DashboardComponent } from './admin/dashboard/dashboard.component';
import { RolesComponent } from './admin/roles/roles.component';
import { AddTemplateComponent } from './admin/add-template/add-template.component';
import { TestAndLaunchComponent } from './admin/test-and-launch/test-and-launch.component';
import { TestAndVerifyComponent } from './admin/test-and-verify/test-and-verify.component';
Expand Down Expand Up @@ -182,6 +183,7 @@ import { SwaggeruiComponent } from './admin/publish/swaggerui/swaggerui.componen
OwnershipComponent,
SidemenuComponent,
DashboardComponent,
RolesComponent,
AddTemplateComponent,
TestAndLaunchComponent,
TestAndVerifyComponent,
Expand Down

0 comments on commit 7fbfbf1

Please sign in to comment.