Browse Source

Merge pull request #8529 from ArtemDzhereleiko/AD/bug-fix/queue-form

Fixed queue bugs
pull/8611/head
Igor Kulikov 3 years ago
committed by GitHub
parent
commit
469b1ecda7
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      ui-ngx/src/app/modules/home/components/profile/queue/tenant-profile-queues.component.ts
  2. 4
      ui-ngx/src/app/modules/home/components/queue/queue-form.component.html
  3. 13
      ui-ngx/src/app/modules/home/components/queue/queue-form.component.ts

5
ui-ngx/src/app/modules/home/components/profile/queue/tenant-profile-queues.component.ts

@ -14,7 +14,7 @@
/// limitations under the License. /// limitations under the License.
/// ///
import { Component, forwardRef, Input, OnDestroy } from '@angular/core'; import { Component, forwardRef, Input, OnDestroy, OnInit } from '@angular/core';
import { import {
AbstractControl, AbstractControl,
ControlValueAccessor, ControlValueAccessor,
@ -53,7 +53,7 @@ import { takeUntil } from 'rxjs/operators';
} }
] ]
}) })
export class TenantProfileQueuesComponent implements ControlValueAccessor, Validator, OnDestroy { export class TenantProfileQueuesComponent implements ControlValueAccessor, Validator, OnDestroy, OnInit {
tenantProfileQueuesFormGroup: UntypedFormGroup; tenantProfileQueuesFormGroup: UntypedFormGroup;
newQueue = false; newQueue = false;
@ -107,6 +107,7 @@ export class TenantProfileQueuesComponent implements ControlValueAccessor, Valid
setDisabledState(isDisabled: boolean): void { setDisabledState(isDisabled: boolean): void {
this.disabled = isDisabled; this.disabled = isDisabled;
this.newQueue = false;
if (this.disabled) { if (this.disabled) {
this.tenantProfileQueuesFormGroup.disable({emitEvent: false}); this.tenantProfileQueuesFormGroup.disable({emitEvent: false});
} else { } else {

4
ui-ngx/src/app/modules/home/components/queue/queue-form.component.html

@ -40,7 +40,7 @@
<div fxFlex fxLayout="row" fxLayout.xs="column" fxLayoutGap="16px" formGroupName="submitStrategy"> <div fxFlex fxLayout="row" fxLayout.xs="column" fxLayoutGap="16px" formGroupName="submitStrategy">
<div fxFlex> <div fxFlex>
<label class="group-label" translate>queue.submit-strategy</label> <label class="group-label" translate>queue.submit-strategy</label>
<mat-radio-group fxFlex fxLayout="column" fxLayoutGap="15px" formControlName="type" required> <mat-radio-group fxFlex fxLayout="column" formControlName="type" required>
<mat-radio-button *ngFor="let strategy of submitStrategies" [value]="strategy"> <mat-radio-button *ngFor="let strategy of submitStrategies" [value]="strategy">
{{ queueSubmitStrategyTypesMap.get(queueSubmitStrategyTypes[strategy]).label | translate }} {{ queueSubmitStrategyTypesMap.get(queueSubmitStrategyTypes[strategy]).label | translate }}
<mat-icon <mat-icon
@ -78,7 +78,7 @@
<div fxFlex fxLayout="row" fxLayout.xs="column" fxLayoutGap="16px" formGroupName="processingStrategy"> <div fxFlex fxLayout="row" fxLayout.xs="column" fxLayoutGap="16px" formGroupName="processingStrategy">
<div fxFlex> <div fxFlex>
<label class="group-label" translate>queue.processing-strategy</label> <label class="group-label" translate>queue.processing-strategy</label>
<mat-radio-group fxFlex fxLayout="column" fxLayoutGap="15px" formControlName="type" required> <mat-radio-group fxFlex fxLayout="column" formControlName="type" required>
<mat-radio-button *ngFor="let strategy of processingStrategies" [value]="strategy"> <mat-radio-button *ngFor="let strategy of processingStrategies" [value]="strategy">
{{ queueProcessingStrategyTypesMap.get(queueProcessingStrategyTypes[strategy]).label | translate }} {{ queueProcessingStrategyTypesMap.get(queueProcessingStrategyTypes[strategy]).label | translate }}
<mat-icon <mat-icon

13
ui-ngx/src/app/modules/home/components/queue/queue-form.component.ts

@ -129,11 +129,6 @@ export class QueueFormComponent implements ControlValueAccessor, OnInit, OnDestr
this.queueFormGroup.get('submitStrategy').get('type').valueChanges.subscribe(() => { this.queueFormGroup.get('submitStrategy').get('type').valueChanges.subscribe(() => {
this.submitStrategyTypeChanged(); this.submitStrategyTypeChanged();
}); });
if (this.newQueue) {
this.queueFormGroup.get('name').enable({emitEvent: false});
} else {
this.queueFormGroup.get('name').disable({emitEvent: false});
}
} }
ngOnDestroy() { ngOnDestroy() {
@ -149,7 +144,11 @@ export class QueueFormComponent implements ControlValueAccessor, OnInit, OnDestr
this.queueFormGroup.disable({emitEvent: false}); this.queueFormGroup.disable({emitEvent: false});
} else { } else {
this.queueFormGroup.enable({emitEvent: false}); this.queueFormGroup.enable({emitEvent: false});
this.queueFormGroup.get('name').disable({emitEvent: false}); if (this.newQueue) {
this.queueFormGroup.get('name').enable({emitEvent: false});
} else {
this.queueFormGroup.get('name').disable({emitEvent: false});
}
} }
} }
@ -203,7 +202,7 @@ export class QueueFormComponent implements ControlValueAccessor, OnInit, OnDestr
const type: QueueSubmitStrategyTypes = form.get('type').value; const type: QueueSubmitStrategyTypes = form.get('type').value;
const batchSizeField = form.get('batchSize'); const batchSizeField = form.get('batchSize');
if (type === QueueSubmitStrategyTypes.BATCH) { if (type === QueueSubmitStrategyTypes.BATCH) {
batchSizeField.patchValue(1000, {emitEvent: false}); batchSizeField.patchValue(batchSizeField.value ?? 1000, {emitEvent: false});
batchSizeField.setValidators([Validators.min(1), Validators.required]); batchSizeField.setValidators([Validators.min(1), Validators.required]);
batchSizeField.updateValueAndValidity({emitEvent: false}); batchSizeField.updateValueAndValidity({emitEvent: false});
this.hideBatchSize = true; this.hideBatchSize = true;

Loading…
Cancel
Save