Skip to content

Commit 8ba31d3

Browse files
MonikaSharma06monika-Dianomic
andauthored
changes to fix double quote entry in name field of ACL and filter (#253)
* changes to fix double quote entry in name field of ACL and filter --------- Co-authored-by: monika-Dianomic <monika@dianomic>
1 parent e9d1885 commit 8ba31d3

File tree

4 files changed

+11
-13
lines changed

4 files changed

+11
-13
lines changed

src/app/components/core/control-dispatcher/add-control-acl/add-control-acl.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
<div class="field-body">
3030
<div class="field">
3131
<div class="control">
32-
<input name="name" class="input" type="text" placeholder="Name" required [(ngModel)]="name" title="No double quotes!" pattern="[^\x22]+" autocomplete="off"
32+
<input name="name" class="input" type="text" placeholder="Name" required [(ngModel)]="name" title="No double quotes!" autocomplete="off"
3333
[ngClass]="{'is-static static-acl':editMode, 'is-small':sharedService.checkAuth() && !editMode}"
3434
[readonly]="!sharedService.checkAuth()">
3535
</div>

src/app/components/core/control-dispatcher/add-control-acl/add-control-acl.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ export class AddControlAclComponent implements OnInit {
176176
}
177177

178178
addFormControls(index, urlData: any = null) {
179-
this.aclForm.form.controls['name'].setValidators([Validators.required, CustomValidator.nospaceValidator]);
179+
this.aclForm.form.controls['name'].setValidators([Validators.required, CustomValidator.nospaceValidator, Validators.pattern('^[^\x22]+$')]);
180180
this.aclForm.form.addControl('urls', new FormGroup({}));
181181
this.initURLControl(index, urlData);
182182
}

src/app/components/core/filter/add-filter-wizard/add-filter-wizard.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
<div class="column">
5454
<div class="field">
5555
<div class="control">
56-
<input class="input" id="name" type="text" placeholder="name" title="No double quotes!" pattern="[^\x22]+" autocomplete="off" formControlName="name" required
56+
<input class="input" id="name" type="text" placeholder="name" title="No double quotes!" autocomplete="off" formControlName="name" required
5757
(input)="validateServiceName($event)">
5858
<small *ngIf="!isValidName" class="help is-danger level-left">Application name is required</small>
5959
</div>
@@ -129,7 +129,7 @@
129129
<div class="field-body">
130130
<div class="field">
131131
<div class="control">
132-
<input class="input" id="name" type="text" placeholder="name" title="No double quotes!" pattern="[^\x22]+" autocomplete="off" formControlName="name" required
132+
<input class="input" id="name" type="text" placeholder="name" title="No double quotes!" autocomplete="off" formControlName="name" required
133133
(input)="validateServiceName($event)">
134134
<small *ngIf="!isValidName" class="help is-danger level-left">Application name is required</small>
135135
</div>
@@ -153,7 +153,7 @@
153153
<button (click)="movePrevious()" data-nav="previous" class="button" id="previous">Back</button>
154154
</div>
155155
<div class="steps-action">
156-
<button (click)="gotoNext()" data-nav="next" [disabled]="disabledBtn" class="button is-link"
156+
<button (click)="gotoNext()" data-nav="next" [disabled]="serviceForm.invalid" class="button is-link"
157157
id="next">Next</button>
158158
</div>
159159
</div>

src/app/components/core/filter/add-filter-wizard/add-filter-wizard.component.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ export class AddFilterWizardComponent implements OnInit {
3232
public show = false;
3333
public stopLoading = false;
3434
public placeholderText = 'fetching available plugins...';
35-
public disabledBtn = false;
36-
3735
increment = 1;
3836
maxRetry = 15;
3937
initialDelay = 1000;
@@ -65,13 +63,13 @@ export class AddFilterWizardComponent implements OnInit {
6563
ngOnInit() {
6664
this.getCategories();
6765
this.serviceForm = this.formBuilder.group({
68-
name: ['', Validators.required],
66+
name: ['', [Validators.required, Validators.pattern('[^\x22]+')]],
6967
plugin: [{ value: '', disabled: false }, Validators.required],
70-
pluginToInstall: [{ value: null, disabled: false }, Validators.required]
68+
pluginToInstall: [{ value: null, disabled: false }]
7169
});
7270
this.getInstalledFilterPlugins();
7371
}
74-
72+
7573
toggleAvailablePlugins() {
7674
if (this.show) {
7775
this.show = false;
@@ -273,7 +271,7 @@ export class AddFilterWizardComponent implements OnInit {
273271
this.ngProgress.start();
274272
this.serviceForm.controls.pluginToInstall.disable();
275273
this.serviceForm.controls.plugin.disable();
276-
this.disabledBtn = true;
274+
this.serviceForm.setErrors({ 'invalid': true });
277275
this.alertService.activityMessage('Installing ' + pluginName + ' filter plugin...', true);
278276
this.service.installPlugin(pluginData).
279277
subscribe(
@@ -286,7 +284,7 @@ export class AddFilterWizardComponent implements OnInit {
286284
this.ngProgress.done();
287285
this.serviceForm.controls.pluginToInstall.enable();
288286
this.serviceForm.controls.plugin.enable();
289-
this.disabledBtn = false;
287+
this.serviceForm.setErrors({ 'invalid': false });
290288
if (error.status === 0) {
291289
console.log('service down ', error);
292290
} else {
@@ -343,7 +341,7 @@ export class AddFilterWizardComponent implements OnInit {
343341
this.getInstalledFilterPlugins(true);
344342
this.serviceForm.controls.pluginToInstall.enable();
345343
this.serviceForm.controls.plugin.enable();
346-
this.disabledBtn = false;
344+
this.serviceForm.setErrors({ 'invalid': false });
347345
});
348346
}
349347

0 commit comments

Comments
 (0)