Unverified Commit 4d06dbd8 authored by AlexKarpov's avatar AlexKarpov Committed by GitHub
Browse files

NAS-111962 / 22.12 / NAS-111962: Not an interger error in Transfers field in Sync Cloud ta… (#7070)

* NAS-111962: Not an interger error in Transfers field in Sync Cloud task FIX

* NAS-111962: small refactoring

* NAS-111962: small refactoring #2
parent d5ca70dd
base DOCS NAS-010101 NAS-110800 NAS-117028-22.12-BETA.2 NAS-117846 NAS-118113 NAS-118165 NAS-118303 NAS-118454-22.12 NAS-118505-22.12 NAS-118545 NAS-118548 NAS-119131 NAS-119140 NAS-119180-22.12.1 NAS-119431 NAS-119556-23.10 NAS-119615-22.12.1 NAS-119668 NAS-119695 NAS-119749-bluefin NAS-119750-22.12.1 NAS-119806 NAS-119812 NAS-119886-22.12.1 NAS-119996 NAS-119996-bluefin NAS-120045 NAS-120047 NAS-120057 NAS-120173-22.12.1 NAS-120181-22.12.1 NAS-120264-22.12.1 NAS-120274 NAS-120296-22.12.1 NAS-120326-22.12.1 NAS-120490_ NAS-120503 NAS-121006-22.12.2 NAS-121124 NAS-121128-22.12.2 NAS-121128-release-22.12.2 NAS-121136 NAS-121177 NAS-121218-22.12.3 NAS-121300 NAS-121316 NAS-121541 NAS-121542 NAS-121686 NAS-121721-22.12.3 NAS-121778 NAS-121827 NAS-121884-22.12.3 NAS-122267-22.12.4 NAS-122372 NAS-122601 NAS-122686 NAS-122706 NAS-122721 NAS-122751-23.10-BETA.1 NAS-122759 NAS-122781 NAS-122794-23.10 NAS-122855 NAS-122870-bluefin NAS-122969 NAS-122993-22.12.4 NAS-123055-22.12.4 NAS-123278 NAS-123295 NAS-123437 NAS-123478-22.12.4 NAS-123484 NAS-123492 NAS-123526-22.12.4 NAS-123651 NAS-123651-23.10-BETA.1 NAS-123666 NAS-123723 NAS-123723-cobia NAS-123762 NAS-123762-23.10 NAS-123778-23.10 NAS-123778-23.10-RC.1 NAS-123778-RC.1 NAS-123801 NAS-123810-23.10 NAS-123813-22.12.4 NAS-123836 NAS-123836-23.10-BETA.1 NAS-123836-24.04 NAS-123861 NAS-123911-23.10-BETA.1 NAS-123928-23.10 NAS-123931-22.12.4 NAS-123945 NAS-124044 NAS-124077 NAS-124131-23.10 NAS-124137 NAS-124183 NAS-124231 NAS-124232 NAS-124237-23.10 NAS-124325-23.10.0 NAS-124335 NAS-124354 NAS-124430 NAS-124454 NAS-124481-23.10.0 NAS-124481-23.10.1 NAS-124555-23.10.0 NAS-124555-23.10.1 NAS-124666 NAS-124707-23.10.0 NAS-124707-23.10.1 NAS-124716 NAS-124846-23.10.0 NAS-124846-23.10.1 NAS-124892 NAS-124895-23.10.1 NAS-124908 NAS-124951 NAS-124964 NAS-124999 NAS-125092 NAS-125213-23.10.1 NAS-125307 NAS-125532 NAS-125568 NAS-125607-validator NAS-125616-23.10.2 NAS-125654 NAS-125703-23.10.2 NAS-125728 NAS-125931 NAS-126699 NAS-126774-24.04-RC.1 NAS-126774-dragonfish NAS-126795 NAS-126795-test NAS-126795-test2 NAS-127001 NAS-127002-24.04-RC.1 NAS-127022 NAS-127041-24.04-BETA.1 NAS-127049-24.04-RC.1 NAS-127297-24.04-RC.1 NAS-127297-24.10 NAS-127369 NAS-127551 NAS-127551-alt NAS-127589-24.04.0 NAS-127593 NAS-127615-24.04.0 NAS-127660 NAS-127794 NAS-127829-24.10 NAS-127854-24.04.0 NAS-128030 NAS-128045 NAS-128071 NAS-128173 NAS-128209 NAS-128287 NAS-128289 TE-1553-dragonfish TE-1628 auto-129 bugfix/NAS-117859-sidebar-menu-fix bugfix/NAS-117941-error-when-removing-pools-and-visit-datasets bugfix/NAS-118171-rsynk-task-local-path bugfix/NAS-118260-boot-env-keep-table-row bugfix/NAS-118282-search-input-fixes bugfix/NAS-118404-dataset-icon-role-double-toooltip bugfix/NAS-118414-warning-modal-icon bugfix/NAS-118415-tree-select-undefined bugfix/NAS-118454-acl-manager-after-dataset-creation-fix bugfix/NAS-118470-multiselext-styles-are-broken bugfix/NAS-118503-datasets-glitch-fix bugfix/NAS-118504-redirect-to-correct-dataset-after-permissions-submit bugfix/NAS-118510-redirect-url-fix-after-manual-change bugfix/NAS-118530-advanced-settings-box-duplicates bugfix/NAS-118541-progress-bar-oberflows bugfix/NAS-118557-replication-task-forbid-custom-retention-policy-cases bugfix/NAS-118600-smb-share-redirect bugfix/NAS-118601-remove-mixed-for-zfs-datasets dataset-tree-tooltips developer/lyy feature/NAS-117754-font-rendering feature/NAS-117968-tooltips-to-status-icons-on-pools feature/NAS-118058-improve-dashboard-icons-sync-pool-and-storage feature/NAS-118147-html-refactoring feature/NAS-118269-improve-ui feature/NAS-118303 feature/NAS-118333-storage-dashboard-icons-update feature/NAS-118334-screentype-enum feature/NAS-118335-improve-spinners-look feature/NAS-118349-datasets-long-names feature/NAS-118360-handle-clipboard-api-not-available feature/NAS-118412-pool-processing-modal feature/NAS-118466-root-path-mnt feature/NAS-118543-user-password-field feauture/NAS-117474-datasets-table-header-sticky llll master metrics-enable patch-1 patch-235 rel-v0.0.1 release/22.12 release/22.12-BETA.2 release/22.12-RC.1 release/22.12.1 release/22.12.2 release/22.12.3 release/22.12.4 release/23.10-BETA.1 release/23.10-RC.1 release/23.10.0 release/23.10.1 release/23.10.1.1 release/23.10.1.2 release/23.10.1.3 release/23.10.2 release/24.04-BETA.1 release/24.04-RC.1 release/24.04.0 renediepenbroek/master revert-7745-NAS-120274 stable/bluefin stable/cobia stable/dragonfish test-xxxyyy testing-refine-branchout-process testing-refine-branchout-process2 v0.0.2 TS-24.04-RC.1 TS-24.04-BETA.1 TS-23.10.2 TS-23.10.1.3 TS-23.10.1.2 TS-23.10.1.1 TS-23.10.1 TS-23.10.0.1 TS-23.10.0 TS-23.10-RC.1 TS-23.10-BETA.1 TS-22.12.4.2 TS-22.12.4.1 TS-22.12.4 TS-22.12.3.3 TS-22.12.3.2 TS-22.12.3.1 TS-22.12.3 TS-22.12.2 TS-22.12.1 TS-22.12.0 TS-22.12-RC.1 TS-22.12-BETA.2 TS-12.12.3 DN110M-CS-v2.0
No related merge requests found
Showing with 143 additions and 60 deletions
+143 -60
<div id="{{config.name}}" class="dynamic-field form-input form-element" [formGroup]="group" [ngClass]="fieldShow" [class.has-pwtoggle]="config.togglePw" [class.has-tooltip]="config.tooltip" *ngIf="!config['isHidden']">
<div
*ngIf="!config['isHidden']"
id="{{ config.name }}"
class="dynamic-field form-input form-element"
[formGroup]="group"
[ngClass]="fieldShow"
[class.has-pwtoggle]="config.togglePw"
[class.has-tooltip]="config.tooltip"
>
<div *ngIf="config.placeholder" class="label-container">
<label class="label input-text">
{{config.placeholder | translate}}
{{ config.placeholder | translate }}
<span *ngIf="config.required">*</span>
</label>
<ix-tooltip *ngIf="config.tooltip" [header]="config.placeholder" [message]="config.tooltip"></ix-tooltip>
<ix-tooltip
*ngIf="config.tooltip"
[header]="config.placeholder"
[message]="config.tooltip"
></ix-tooltip>
</div>
<!-- need to prevent browser autofill :/ -->
<input name="DummyUsername" type="text">
<input name="DummyPassword" type="password">
<input name="DummyUsername" type="text" />
<input name="DummyPassword" type="password" />
<div class="full-width" [ngClass]="{'has_toggle_pw': config.togglePw}" *ngIf="config.inputType != 'file' else elseBlock">
<div
*ngIf="config.inputType != 'file'; else elseBlock"
class="full-width"
[ngClass]="{ has_toggle_pw: config.togglePw }"
>
<mat-spinner
diameter='30'
class="form-input-spinner"
id="{{config.name}}_form-input-spinner"
*ngIf="config.isLoading">
diameter="30"
class="form-input-spinner"
id="{{ config.name }}_form-input-spinner"
*ngIf="config.isLoading"
>
</mat-spinner>
<div *ngIf="config.maskValue">
<p>{{'Enter' | translate}} <strong>{{config.maskValue}}</strong> {{'below to confirm.' | translate}}</p>
<p [ngStyle]="{'position': 'relative', 'top':'15px', 'opacity': '.38'}">{{config.maskValue}}</p>
<p>
{{ 'Enter' | translate }} <strong>{{ config.maskValue }}</strong>
{{ 'below to confirm.' | translate }}
</p>
<p [ngStyle]="{ position: 'relative', top: '15px', opacity: '.38' }">
{{ config.maskValue }}
</p>
</div>
<div class="input-container">
<span *ngIf="config.searchable" class="searchable"><mat-icon>search</mat-icon></span>
<span *ngIf="config.searchable" class="searchable"
><mat-icon>search</mat-icon></span
>
<input
[ngStyle]="{'padding-left': config.searchable ? '2rem' : '', 'padding-right': shouldShowResetInput() ? '2rem': ''}"
autocomplete="new-password"
ix-auto
ix-auto-type="input"
ix-auto-identifier="{{ config.placeholder }}"
[ngStyle]="{
'padding-left': config.searchable ? '2rem' : '',
'padding-right': shouldShowResetInput() ? '2rem' : ''
}"
[type]="config.inputType ? config.inputType : 'text'"
[attr.value]="config.value"
[formControlName]="config.name"
[readonly]="config.readonly"
[required]="config.required"
[max]="config.max"
[min]="config.min"
(blur)="blurEvent()"
autocomplete="new-password"
ix-auto
ix-auto-type="input"
ix-auto-identifier="{{config.placeholder}}"
(change)="valueChange()"
(paste)="onPaste($event)"
(input)="onInput()">
[attr.value]="config.value"
[formControlName]="config.name"
[readonly]="config.readonly"
[required]="config.required"
[max]="config.max"
[min]="config.min"
(blur)="blurEvent()"
(change)="valueChange()"
(paste)="onPaste($event)"
(input)="onInput($event)"
/>
<span *ngIf="shouldShowResetInput()" class="reset-input">
<mat-icon (click)="resetInput()" fontSet="mdi-set" fontIcon="mdi-close-circle"></mat-icon>
<mat-icon
fontSet="mdi-set"
fontIcon="mdi-close-circle"
(click)="resetInput()"
></mat-icon>
</span>
</div>
<button
*ngIf="config.togglePw"
mat-icon-button type="button"
mat-icon-button
type="button"
class="toggle_pw"
ix-auto
ix-auto-type="button"
ix-auto-identifier="{{ config.name }}_toggle-pw"
(click)="togglePassword()"
ix-auto
ix-auto-type="button"
ix-auto-identifier="{{config.name}}_toggle-pw">
<i class="material-icons" matTooltip="Hide" *ngIf="showPassword">visibility</i>
<i class="material-icons" matTooltip="Show" *ngIf="!showPassword">visibility_off</i>
>
<i class="material-icons" matTooltip="Hide" *ngIf="showPassword"
>visibility</i
>
<i class="material-icons" matTooltip="Show" *ngIf="!showPassword"
>visibility_off</i
>
</button>
</div>
<ng-template #elseBlock>
<span [style.margin-right.px]="10">{{config.placeholder | translate}}</span>
<input type="file" id="fileInput" (change)="changeListener($event)"/>
<span [style.margin-right.px]="10">{{
config.placeholder | translate
}}</span>
<input type="file" id="fileInput" (change)="changeListener($event)" />
</ng-template>
<div class="margin-for-error">
<ix-form-errors [control]="group.controls[config.name]" [config]="config"></ix-form-errors>
<mat-error *ngIf="config['hasErrors']"><div [innerHTML]="config['errors']"></div></mat-error>
<mat-error *ngIf="config.warnings"><div [innerHTML]="config.warnings | translate"></div></mat-error>
<mat-hint *ngIf="config.hint"><div [innerHTML]="config.hint | translate"></div></mat-hint>
<ix-form-errors
[control]="group.controls[config.name]"
[config]="config"
></ix-form-errors>
<mat-error *ngIf="config['hasErrors']">
<div [innerHTML]="config['errors']"></div
></mat-error>
<mat-error *ngIf="config.warnings"
><div [innerHTML]="config.warnings | translate"></div
></mat-error>
<mat-hint *ngIf="config.hint"
><div [innerHTML]="config.hint | translate"></div
></mat-hint>
</div>
</div>
import {
Component, ViewChild,
} from '@angular/core';
import { Component, ViewChild } from '@angular/core';
import { UntypedFormGroup } from '@angular/forms';
import { TranslateService } from '@ngx-translate/core';
import globalHelptext from 'app/helptext/global-helptext';
......@@ -10,7 +8,10 @@ import { EntityFormService } from 'app/modules/entity/entity-form/services/entit
@Component({
templateUrl: './form-input.component.html',
styleUrls: ['./form-input.component.scss', '../dynamic-field/dynamic-field.scss'],
styleUrls: [
'./form-input.component.scss',
'../dynamic-field/dynamic-field.scss',
],
})
export class FormInputComponent implements Field {
@ViewChild('fileInput', { static: true }) fileInput: HTMLInputElement;
......@@ -21,9 +22,10 @@ export class FormInputComponent implements Field {
showPassword = false;
private hasPasteEvent = false;
constructor(public translate: TranslateService,
private formService: EntityFormService) {
}
constructor(
public translate: TranslateService,
private formService: EntityFormService,
) {}
changeListener($event: Event): void {
this.readFile($event.target as HTMLInputElement);
......@@ -81,34 +83,47 @@ export class FormInputComponent implements Field {
}
if (this.config.inputType === 'number') {
const numberValue = this.group.controls[this.config.name].value * 1;
this.group.controls[this.config.name].setValue(numberValue);
const numberValue = this.group.controls[this.config.name].value;
if (this.config.min !== undefined && numberValue < this.config.min) {
this.group.controls[this.config.name].setErrors({
manualValidateError: true,
manualValidateErrorMsg: globalHelptext.invalidInputValueWithMin + String(this.config.min),
manualValidateErrorMsg:
globalHelptext.invalidInputValueWithMin + String(this.config.min),
});
}
if (this.config.max !== undefined && numberValue > this.config.max) {
this.group.controls[this.config.name].setErrors({
manualValidateError: true,
manualValidateErrorMsg: globalHelptext.invalidInputValueWithMax + String(this.config.max),
manualValidateErrorMsg:
globalHelptext.invalidInputValueWithMax + String(this.config.max),
});
}
}
}
hasValue(): boolean {
return this.group.controls[this.config.name].value && this.group.controls[this.config.name].value.toString().length;
return (
this.group.controls[this.config.name].value
&& this.group.controls[this.config.name].value.toString().length
);
}
shouldShowResetInput(): boolean {
return this.hasValue() && !this.config.readonly && !this.config.togglePw && this.config.inputType !== 'password' && !this.config.disabled;
return (
this.hasValue()
&& !this.config.readonly
&& !this.config.togglePw
&& this.config.inputType !== 'password'
&& !this.config.disabled
);
}
resetInput(): void {
this.group.controls[this.config.name].setValue('');
this.group.controls[this.config.name].setValue(
this.config.inputType === 'number' ? null : '',
);
}
onPaste(event: ClipboardEvent): void {
......@@ -126,7 +141,25 @@ export class FormInputComponent implements Field {
}
}
onInput(): void {
onInput(event: Event): void {
const inputValue = (event as MessageEvent).data;
if (this.config.inputType === 'number') {
if (this.config.errors) {
this.config.errors = null;
}
if (!this.shouldShowResetInput() && !inputValue !== null) {
this.group.controls[this.config.name].setErrors({
pattern: true,
});
}
if (inputValue === null) {
this.group.controls[this.config.name].setValue(null);
}
}
if (this.hasPasteEvent) {
this.hasPasteEvent = false;
} else {
......
......@@ -20,7 +20,7 @@
"LDAP": "",
"LUN ID": "",
"MTU": "",
"Manage Advanced Settings": "",
"Manage Advanced Settings": "Керувати розширеними налаштуваннями",
"N/A": "",
"NAA": "",
"NFS": "",
......@@ -48,7 +48,7 @@
"Share Attached": "",
"Sysctl": "",
"TLS Crypt Auth": "",
"This dataset is used by the system": "",
"This dataset is used by the system": "Цей набір даних використовується системою",
"TrueCommand": "",
"UID": "",
"UPS": "",
......@@ -60,7 +60,7 @@
"WebDAV Share": "",
"Webdav": "",
"ZFS Health": "",
"Zvol Space Management": "",
"Zvol Space Management": "Керування простором Zvol",
" Please click the button below to add {item}.": "Натисніть кнопку нижче, щоб додати {item}.",
" When the <b>UPS Mode</b> is set to <i>slave</i>. Enter the open network port number of the UPS <i>Master</i> system. The default port is <i>3493</i>.": "Коли <b>Режим ДБЖ</b> встановлений у <i>відомий</i>. Введіть номер відкритого мережного порту <і>провідної</i> ДБЖ. Стандартний порт - <i>3493</i>.",
" bytes.": "байт.",
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment