diff options
Diffstat (limited to 'client/src/app/shared/shared-moderation')
-rw-r--r-- | client/src/app/shared/shared-moderation/batch-domains-modal.component.html | 14 | ||||
-rw-r--r-- | client/src/app/shared/shared-moderation/batch-domains-modal.component.ts | 8 |
2 files changed, 10 insertions, 12 deletions
diff --git a/client/src/app/shared/shared-moderation/batch-domains-modal.component.html b/client/src/app/shared/shared-moderation/batch-domains-modal.component.html index 6a3c65721..8306a96bc 100644 --- a/client/src/app/shared/shared-moderation/batch-domains-modal.component.html +++ b/client/src/app/shared/shared-moderation/batch-domains-modal.component.html | |||
@@ -1,6 +1,6 @@ | |||
1 | <ng-template #modal> | 1 | <ng-template #modal> |
2 | <div class="modal-header"> | 2 | <div class="modal-header"> |
3 | <h4 i18n class="modal-title">{{ action }}</h4> | 3 | <h4 class="modal-title">{{ action }}</h4> |
4 | 4 | ||
5 | <my-global-icon iconName="cross" aria-label="Close" role="button" (click)="hide()"></my-global-icon> | 5 | <my-global-icon iconName="cross" aria-label="Close" role="button" (click)="hide()"></my-global-icon> |
6 | </div> | 6 | </div> |
@@ -11,15 +11,15 @@ | |||
11 | <label i18n for="hosts">1 host (without "http://") per line</label> | 11 | <label i18n for="hosts">1 host (without "http://") per line</label> |
12 | 12 | ||
13 | <textarea | 13 | <textarea |
14 | [placeholder]="placeholder" formControlName="domains" type="text" id="hosts" name="hosts" | 14 | [placeholder]="placeholder" formControlName="hosts" type="text" id="hosts" name="hosts" |
15 | class="form-control" [ngClass]="{ 'input-error': formErrors['domains'] }" ngbAutofocus | 15 | class="form-control" [ngClass]="{ 'input-error': formErrors['hosts'] }" ngbAutofocus |
16 | ></textarea> | 16 | ></textarea> |
17 | 17 | ||
18 | <div *ngIf="formErrors.domains" class="form-error"> | 18 | <div *ngIf="formErrors.hosts" class="form-error"> |
19 | {{ formErrors.domains }} | 19 | {{ formErrors.hosts }} |
20 | 20 | ||
21 | <div *ngIf="form.controls['domains'].errors.validDomains"> | 21 | <div *ngIf="form.controls['hosts'].errors.validHosts"> |
22 | {{ form.controls['domains'].errors.validDomains.value }} | 22 | {{ form.controls['hosts'].errors.validHosts.value }} |
23 | </div> | 23 | </div> |
24 | </div> | 24 | </div> |
25 | </div> | 25 | </div> |
diff --git a/client/src/app/shared/shared-moderation/batch-domains-modal.component.ts b/client/src/app/shared/shared-moderation/batch-domains-modal.component.ts index 6edbb6023..20be728f6 100644 --- a/client/src/app/shared/shared-moderation/batch-domains-modal.component.ts +++ b/client/src/app/shared/shared-moderation/batch-domains-modal.component.ts | |||
@@ -2,7 +2,7 @@ import { Component, EventEmitter, Input, OnInit, Output, ViewChild } from '@angu | |||
2 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' | 2 | import { FormReactive, FormValidatorService } from '@app/shared/shared-forms' |
3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' | 3 | import { NgbModal } from '@ng-bootstrap/ng-bootstrap' |
4 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' | 4 | import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap/modal/modal-ref' |
5 | import { DOMAINS_VALIDATOR, getNotEmptyHosts } from '../form-validators/batch-domains-validators' | 5 | import { splitAndGetNotEmpty, UNIQUE_HOSTS_VALIDATOR } from '../form-validators/host-validators' |
6 | 6 | ||
7 | @Component({ | 7 | @Component({ |
8 | selector: 'my-batch-domains-modal', | 8 | selector: 'my-batch-domains-modal', |
@@ -28,7 +28,7 @@ export class BatchDomainsModalComponent extends FormReactive implements OnInit { | |||
28 | if (!this.action) this.action = $localize`Process domains` | 28 | if (!this.action) this.action = $localize`Process domains` |
29 | 29 | ||
30 | this.buildForm({ | 30 | this.buildForm({ |
31 | domains: DOMAINS_VALIDATOR | 31 | hosts: UNIQUE_HOSTS_VALIDATOR |
32 | }) | 32 | }) |
33 | } | 33 | } |
34 | 34 | ||
@@ -41,9 +41,7 @@ export class BatchDomainsModalComponent extends FormReactive implements OnInit { | |||
41 | } | 41 | } |
42 | 42 | ||
43 | submit () { | 43 | submit () { |
44 | this.domains.emit( | 44 | this.domains.emit(splitAndGetNotEmpty(this.form.controls['hosts'].value)) |
45 | getNotEmptyHosts(this.form.controls['domains'].value) | ||
46 | ) | ||
47 | this.form.reset() | 45 | this.form.reset() |
48 | this.hide() | 46 | this.hide() |
49 | } | 47 | } |