Skip to content

Commit 377e598

Browse files
4913, 4887, 4919
Signed-off-by: Stepan Kiryakov <stepan.kiryakov@envisionblockchain.com>
1 parent 69d7199 commit 377e598

File tree

5 files changed

+26
-11
lines changed

5 files changed

+26
-11
lines changed

frontend/src/app/modules/schema-engine/schema-configuration/schema-configuration.component.html

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,25 @@
1616
<div *ngIf="isPolicy" class="dropdown-field guardian-input-container">
1717
<label class="form-label" htmlFor="policy">* Policy</label>
1818
<p-dropdown
19+
*ngIf="isNewSchema"
1920
class="guardian-dropdown"
2021
panelStyleClass="guardian-dropdown-panel width-825"
2122
(onChange)="onFilter($event)"
2223
[options]="policies"
23-
[attr.disabled-dropdown]="!isNewSchema"
24+
appendTo="body"
25+
formControlName="topicId"
26+
id="policy"
27+
optionLabel="name"
28+
optionValue="topicId"
29+
placeholder="Policy"
30+
></p-dropdown>
31+
<p-dropdown
32+
*ngIf="!isNewSchema"
33+
class="guardian-dropdown"
34+
panelStyleClass="guardian-dropdown-panel width-825"
35+
(onChange)="onFilter($event)"
36+
[options]="allPolicies"
37+
[attr.disabled-dropdown]="true"
2438
appendTo="body"
2539
formControlName="topicId"
2640
id="policy"

frontend/src/app/modules/schema-engine/schema-configuration/schema-configuration.component.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ function NoBindingValidator(control: UntypedFormControl): ValidationErrors | nul
4242
export class SchemaConfigurationComponent implements OnInit {
4343
@Input('type') type!: 'new' | 'edit' | 'version';
4444
@Input('policies') policies!: any[];
45+
@Input('allPolicies') allPolicies!: any[];
4546
@Input('tools') tools!: any[];
4647
@Input('schemaType') schemaType!: SchemaType;
4748
@Input('extended') extended!: boolean;
@@ -268,7 +269,7 @@ export class SchemaConfigurationComponent implements OnInit {
268269
props.topicId = [this._topicId, NoBindingValidator];
269270
} else if (this.isPolicy) {
270271
props.entity = new UntypedFormControl(SchemaEntity.VC, Validators.required);
271-
props.topicId = [this._topicId];
272+
props.topicId = [this._topicId, Validators.required];
272273
} else {
273274
props.entity = new UntypedFormControl(SchemaEntity.VC, Validators.required);
274275
props.topicId = [this._topicId];
@@ -1028,7 +1029,7 @@ export class SchemaConfigurationComponent implements OnInit {
10281029
if (!field) {
10291030
return;
10301031
}
1031-
1032+
10321033
if (condition.changeEvents) {
10331034
condition.fieldValue.patchValue('', {
10341035
emitEvent: false

frontend/src/app/modules/schema-engine/schema-dialog/schema-dialog.component.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
[hidden]="!!json"
3636
[extended]="extended"
3737
[policies]="policies"
38+
[allPolicies]="allPolicies"
3839
[tools]="tools"
3940
[schemaType]="schemaType"
4041
[properties]="properties"

frontend/src/app/modules/schema-engine/schema-dialog/schema-dialog.component.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ export class SchemaDialog {
3232
public subSchemas: Schema[];
3333
public topicId: any;
3434
public policies: any[];
35+
public allPolicies: any[];
3536
public tools: any[];
3637
public properties: any[];
3738
public category: string;
@@ -76,6 +77,7 @@ export class SchemaDialog {
7677
this.type = this.config.data.type || null;
7778
this.schemaType = this.config.data.schemaType || 'policy';
7879
this.policies = this.config.data.policies || [];
80+
this.allPolicies = this.config.data.allPolicies || [];
7981
this.tools = this.config.data.tools || [];
8082
this.properties = this.config.data.properties || [];
8183
this.category = this.config.data.category;

frontend/src/app/views/schemas/schemas.component.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -493,14 +493,7 @@ export class SchemaConfigComponent implements OnInit {
493493

494494
this.policyNameByTopic = {};
495495
this.policyIdByTopic = {};
496-
this.allPolicies = [{
497-
name: 'All Policies',
498-
topicId: null
499-
},
500-
{
501-
name: 'No Binding',
502-
topicId: SchemaConfigComponent.NOT_BINDED
503-
}];
496+
this.allPolicies = [];
504497
for (const policy of policies) {
505498
if (policy.topicId) {
506499
this.policyIdByTopic[policy.topicId] = policy.id;
@@ -1120,6 +1113,7 @@ export class SchemaConfigComponent implements OnInit {
11201113
schemaType: this.type,
11211114
topicId: this.currentTopic,
11221115
policies: this.policies,
1116+
allPolicies: this.allPolicies,
11231117
modules: this.modules,
11241118
tools: this.draftTools,
11251119
properties: this.properties,
@@ -1197,6 +1191,7 @@ export class SchemaConfigComponent implements OnInit {
11971191
schemaType: this.type,
11981192
topicId: this.currentTopic,
11991193
policies: this.policies,
1194+
allPolicies: this.allPolicies,
12001195
modules: this.modules,
12011196
tools: this.draftTools,
12021197
properties: this.properties,
@@ -1278,6 +1273,7 @@ export class SchemaConfigComponent implements OnInit {
12781273
topicId: this.currentTopic,
12791274
schemaType: this.type,
12801275
policies: this.policies,
1276+
allPolicies: this.allPolicies,
12811277
modules: this.modules,
12821278
tools: this.draftTools,
12831279
properties: this.properties,
@@ -1309,6 +1305,7 @@ export class SchemaConfigComponent implements OnInit {
13091305
topicId: this.currentTopic,
13101306
schemaType: this.type,
13111307
policies: this.policies,
1308+
allPolicies: this.allPolicies,
13121309
modules: this.modules,
13131310
tools: this.draftTools,
13141311
properties: this.properties,

0 commit comments

Comments
 (0)