Unverified Commit e89dd0e3 authored by Evgeny Stepanovych's avatar Evgeny Stepanovych Committed by GitHub
Browse files

NAS-118801: Removing any (#7265)

parent fac10e86
base NAS-010101 NAS-110800 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-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 developer/lyy llll master metrics-enable patch-1 patch-235 rel-v0.0.1 release/22.12 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-12.12.3 DN110M-CS-v2.0
No related merge requests found
Showing with 82 additions and 83 deletions
+82 -83
export enum DatasetChecksum {
Sha512 = 'SHA512',
Edonr = 'EDONR',
Fletcher2 = 'FLETCHER2',
Fletcher4 = 'FLETCHER4',
On = 'ON',
Sha256 = 'SHA256',
Skein = 'SKEIN',
}
......@@ -15,6 +15,7 @@ export type IscsiPortalUpdate = Omit<IscsiPortal, 'id' | 'tag'>;
export interface IscsiInterface {
ip: string;
port: number;
}
export interface IscsiInitiatorGroup {
......
......@@ -9,8 +9,9 @@ export interface Job<R = unknown, A = unknown[]> {
description: string;
error: string;
exc_info: {
type: ResponseErrorType | null;
extra: Record<string, unknown>;
type?: ResponseErrorType | null;
extra: string | number | boolean | unknown[] | Record<string, unknown>;
repr?: string;
};
exception: string;
id: number;
......
......@@ -28,16 +28,16 @@ export class FormSelectComponent implements Field, AfterViewInit, AfterViewCheck
@ViewChild('field', { static: true }) field: MatFormField;
formReady = false;
selected: string;
selectedValues: string[] = [];
selected: unknown;
selectedValues: unknown[] = [];
selectStates: boolean[] = []; // Collection of checkmark states
customTriggerValue: string[];
private _formValue: string | string[];
private _formValue: unknown;
private entityUtils = new EntityUtils();
get formValue(): string | string[] {
get formValue(): unknown {
return this._formValue;
}
set formValue(value: string | string[]) {
set formValue(value: unknown) {
const result = this.config.multiple ? this.selectedValues : this.selected;
this._formValue = result;
}
......@@ -153,7 +153,7 @@ export class FormSelectComponent implements Field, AfterViewInit, AfterViewCheck
}
updateValues(): void {
const newValues: string[] = [];
const newValues: unknown[] = [];
const triggerValue: string[] = [];
this.selectStates.forEach((item, index) => {
if (item) {
......
......@@ -22,6 +22,7 @@ import { Observable, Subscription } from 'rxjs';
import { filter } from 'rxjs/operators';
import { ApiDirectory, ApiParams } from 'app/interfaces/api-directory.interface';
import { FormConfiguration } from 'app/interfaces/entity-form.interface';
import { Job } from 'app/interfaces/job.interface';
import { FieldSets } from 'app/modules/entity/entity-form/classes/field-sets';
import {
FieldConfig, FormArrayConfig, FormDictConfig, FormListConfig, FormSelectConfig,
......@@ -404,27 +405,27 @@ export class EntityFormComponent implements OnInit, OnDestroy, OnChanges, AfterV
this.router.navigate(new Array('/').concat(route));
}
addCall(body: any): Observable<any> {
const payload = [];
addCall(body: unknown): Observable<unknown> {
const payload: unknown[] = [];
const call = this.conf.addCall;
payload.push(body);
if (this.conf.isCreateJob) {
return this.ws.job(call, payload);
return this.ws.job(call, payload as ApiParams<keyof ApiDirectory>);
}
return this.ws.call(call, payload);
return this.ws.call(call, payload as ApiParams<keyof ApiDirectory>);
}
editCall(body: any): Observable<any> {
const payload = [body];
editCall(body: unknown): Observable<unknown> {
const payload: unknown[] = [body];
if (this.pk) {
payload.unshift(this.pk);
}
if (this.conf.isEditJob) {
return this.ws.job(this.conf.editCall, payload);
return this.ws.job(this.conf.editCall, payload as ApiParams<keyof ApiDirectory>);
}
return this.ws.call(this.conf.editCall, payload);
return this.ws.call(this.conf.editCall, payload as ApiParams<keyof ApiDirectory>);
}
onSubmit(event: Event): void {
......@@ -483,11 +484,11 @@ export class EntityFormComponent implements OnInit, OnDestroy, OnChanges, AfterV
this.loader.close();
this.loaderOpen = false;
if ((this.conf.isEditJob || this.conf.isCreateJob) && res.error) {
if (res.exc_info && res.exc_info.extra) {
new EntityUtils().handleWsError(this, res);
if ((this.conf.isEditJob || this.conf.isCreateJob) && (res as Job).error) {
if ((res as Job).exc_info && (res as Job).exc_info.extra) {
new EntityUtils().handleWsError(this, res as Job);
} else {
this.dialog.errorReport('Error', res.error, res.exception);
this.dialog.errorReport('Error', (res as Job).error, (res as Job).exception);
}
} else {
if (this.conf.afterSave) {
......
......@@ -197,7 +197,7 @@ export interface FormRadioConfig<P = unknown> extends BaseFieldConfig<P>{
export interface FormRadioOption {
label: string;
value: any;
value: unknown;
hiddenFromDisplay?: boolean;
tooltip?: string;
}
......@@ -298,7 +298,7 @@ export interface FormReadFileConfig<P = unknown> extends BaseFieldConfig<P> {
*/
export interface FormInputListConfig<P = unknown> extends BaseFieldConfig<P> {
type: 'input-list';
customEventMethod: (parent: any) => void;
customEventMethod: (parent: unknown) => void;
}
export type FieldConfig<P = unknown> =
......
export interface FormSelectOption {
label: string;
value: any;
value: unknown;
hiddenFromDisplay?: boolean;
disable?: boolean;
disabled?: boolean; // TODO: One of these is a typo.
......
......@@ -10,7 +10,7 @@ import { EntityTableAction } from 'app/modules/entity/entity-table/entity-table.
templateUrl: './entity-table-actions.component.html',
})
export class EntityTableActionsComponent implements OnInit, OnChanges {
@Input() entity: EntityTableComponent;
@Input() entity: EntityTableComponent<Record<string, unknown>>;
@Input() row: Record<string, unknown>;
@Input() iconName = 'more_vert';
@Input() action: string;
......
......@@ -17,7 +17,7 @@ import { EntityTableService } from 'app/services/entity-table.service';
})
export class EntityTableAddActionsComponent implements OnInit, AfterViewInit {
@ViewChild('filter', { static: false }) filter: ElementRef;
@Input() entity: EntityTableComponent;
@Input() entity: EntityTableComponent<Record<string, unknown>>;
filterValue = '';
actions: EntityTableAction[];
......
......@@ -13,7 +13,7 @@ import { TaskService } from 'app/services';
})
export class EntityTableRowDetailsComponent implements OnInit, OnChanges {
@Input() config: Record<string, unknown>;
@Input() parent: EntityTableComponent;
@Input() parent: EntityTableComponent<Record<string, unknown>>;
columns: EntityTableColumn[] = [];
actions: EntityTableAction[] = [];
......
<ng-template #pageHeader>
<ix-page-title-header>
<ix-entity-table-add-actions [entity]="this"></ix-entity-table-add-actions>
<ix-entity-table-add-actions [entity]="asGenericTable(this)"></ix-entity-table-add-actions>
</ix-page-title-header>
</ng-template>
......@@ -217,7 +217,7 @@
(mouseout)="onHover($event, false)"
>
<ix-entity-table-actions
[entity]="this"
[entity]="asGenericTable(this)"
[row]="element"
(mouseover)="onHover($event, true)"
(mouseout)="onHover($event, false)"
......@@ -430,7 +430,7 @@
>
<ix-entity-table-row-details
[config]="element"
[parent]="this"
[parent]="asGenericTable(this)"
></ix-entity-table-row-details>
</div>
</td>
......
......@@ -40,7 +40,7 @@ import { EntityJobComponent } from 'app/modules/entity/entity-job/entity-job.com
import {
EntityTableAction,
EntityTableColumn, EntityTableColumnProp,
EntityTableConfig, EntityTableConfigConfig, EntityTableConfirmDialog,
EntityTableConfig, EntityTableConfigConfig, EntityTableConfirmDialog, SomeRow,
} from 'app/modules/entity/entity-table/entity-table.interface';
import { EntityUtils } from 'app/modules/entity/utils';
import { selectJob } from 'app/modules/jobs/store/job.selectors';
......@@ -59,12 +59,6 @@ import {
waitForPreferences,
} from 'app/store/preferences/preferences.selectors';
interface SomeRow {
id?: string | number;
multiselect_id?: string | number;
[key: string]: any;
}
@UntilDestroy()
@Component({
changeDetection: ChangeDetectionStrategy.OnPush,
......@@ -80,9 +74,9 @@ interface SomeRow {
]),
],
})
export class EntityTableComponent<Row extends SomeRow = any> implements OnInit, AfterViewInit, OnDestroy {
export class EntityTableComponent<Row extends SomeRow = SomeRow> implements OnInit, AfterViewInit, OnDestroy {
@Input() title = '';
@Input() conf: EntityTableConfig;
@Input() conf: EntityTableConfig<Row>;
@ViewChild('newEntityTable', { static: false }) entitytable: TemplateRef<void>;
@ViewChild(MatPaginator, { static: false }) paginator: MatPaginator;
......@@ -149,7 +143,7 @@ export class EntityTableComponent<Row extends SomeRow = any> implements OnInit,
dataSource: MatTableDataSource<Row>;
rows: Row[] = [];
currentRows: Row[] = []; // Rows applying filter
getFunction: Observable<any>;
getFunction: Observable<unknown>;
config: EntityTableConfigConfig = {
paging: true,
sorting: { columns: this.columns },
......@@ -712,7 +706,7 @@ export class EntityTableComponent<Row extends SomeRow = any> implements OnInit,
}
generateRows(res: any): Row[] {
let rows: any[];
let rows: Row[];
if (this.loaderOpen) {
this.loader.close();
this.loaderOpen = false;
......@@ -720,17 +714,17 @@ export class EntityTableComponent<Row extends SomeRow = any> implements OnInit,
if (res.data) {
if (res.data.result) {
rows = new EntityUtils().flattenData(res.data.result);
rows = new EntityUtils().flattenData(res.data.result) as Row[];
} else {
rows = new EntityUtils().flattenData(res.data);
rows = new EntityUtils().flattenData(res.data) as Row[];
}
} else {
rows = new EntityUtils().flattenData(res);
rows = new EntityUtils().flattenData(res) as Row[];
}
rows.forEach((row) => {
Object.keys(row).forEach((attr) => {
row[attr] = this.rowValue(row, attr);
(row[attr as keyof Row] as unknown) = this.rowValue(row, attr);
});
});
......@@ -740,7 +734,7 @@ export class EntityTableComponent<Row extends SomeRow = any> implements OnInit,
}
} else {
this.currentRows.forEach((row) => {
const index = _.findIndex(rows, { id: row.id });
const index = _.findIndex(rows, { id: row.id } as _.PartialShallow<Row>);
if (index > -1) {
Object.keys(rows[index]).forEach((prop) => {
row[prop as keyof Row] = rows[index][prop];
......@@ -750,7 +744,7 @@ export class EntityTableComponent<Row extends SomeRow = any> implements OnInit,
const newRows: Row[] = [];
this.rows.forEach((row) => {
const index = _.findIndex(rows, { id: row.id });
const index = _.findIndex(rows, { id: row.id } as _.PartialShallow<Row>);
if (index < 0) {
return;
}
......@@ -789,7 +783,7 @@ export class EntityTableComponent<Row extends SomeRow = any> implements OnInit,
return [];
}
rowValue(row: any, attr: string): unknown {
rowValue(row: Record<string, unknown>, attr: string): unknown {
if (this.conf.rowValue) {
try {
return this.conf.rowValue(row, attr);
......@@ -1052,10 +1046,11 @@ export class EntityTableComponent<Row extends SomeRow = any> implements OnInit,
// Stores currently selected columns in preference service
selectColumnsToShowOrHide(): void {
const newColumnPreferences: TableDisplayedColumns = {
// TODO: Some type here is incorrect
const newColumnPreferences = {
title: this.title,
cols: this.conf.columns as any,
};
cols: this.conf.columns,
} as unknown as TableDisplayedColumns;
this.store$.pipe(select(selectPreferencesState), take(1), untilDestroyed(this)).subscribe((state) => {
if (!state.areLoaded) {
......@@ -1241,4 +1236,8 @@ export class EntityTableComponent<Row extends SomeRow = any> implements OnInit,
this.changeDetectorRef.markForCheck();
});
}
asGenericTable(entity: EntityTableComponent<Row>): EntityTableComponent<Record<string, unknown>> {
return entity as EntityTableComponent<Record<string, unknown>>;
}
}
......@@ -5,7 +5,13 @@ import { ApiMethod } from 'app/interfaces/api-directory.interface';
import { EmptyConfig, EmptyType } from 'app/modules/entity/entity-empty/entity-empty.component';
import { EntityTableComponent } from 'app/modules/entity/entity-table/entity-table.component';
export interface EntityTableConfig<Row = unknown> {
export interface SomeRow {
id?: string | number;
multiselect_id?: string | number;
[key: string]: any;
}
export interface EntityTableConfig<Row extends SomeRow = SomeRow> {
columns: EntityTableColumn[];
title?: string;
......@@ -14,7 +20,7 @@ export interface EntityTableConfig<Row = unknown> {
columnFilter?: boolean;
hideTopActions?: boolean;
queryCall?: ApiMethod;
queryCallOption?: any;
queryCallOption?: unknown;
queryCallJob?: boolean;
resourceName?: string;
routeEdit?: string | string[];
......@@ -54,29 +60,29 @@ export interface EntityTableConfig<Row = unknown> {
*/
getCustomEmptyConfig?: (emptyType: EmptyType) => EmptyConfig;
wsDeleteParams?: (row: Row, id: string | number) => unknown;
addRows?: (entity: EntityTableComponent) => void;
changeEvent?: (entity: EntityTableComponent) => void;
preInit?: (entity: EntityTableComponent) => void;
afterInit?: (entity: EntityTableComponent) => void;
dataHandler?: (entity: EntityTableComponent) => unknown;
addRows?: (entity: EntityTableComponent<Row>) => void;
changeEvent?: (entity: EntityTableComponent<Row>) => void;
preInit?: (entity: EntityTableComponent<Row>) => void;
afterInit?: (entity: EntityTableComponent<Row>) => void;
dataHandler?: (entity: EntityTableComponent<Row>) => unknown;
resourceTransformIncomingRestData?: (data: unknown) => unknown;
getActions?: (row: Row) => EntityTableAction<Row>[];
getAddActions?: () => EntityTableAction[];
getAddActions?: () => EntityTableAction<Row>[];
rowValue?: (row: unknown, attr: string) => unknown;
wsMultiDeleteParams?: (selected: Row[]) => [string, (string[][] | number[][])?];
doAdd?: (id?: string | number, tableComponent?: EntityTableComponent) => void;
doEdit?: (id?: string | number, tableComponent?: EntityTableComponent) => void;
doAdd?: (id?: string | number, tableComponent?: EntityTableComponent<Row>) => void;
doEdit?: (id?: string | number, tableComponent?: EntityTableComponent<Row>) => void;
onCheckboxChange?: (row: Row) => void;
onSliderChange?: (row: Row) => void;
onButtonClick?: (row: Row) => void;
callGetFunction?: (entity: EntityTableComponent) => void;
prerequisiteFailedHandler?: (entity: EntityTableComponent) => void;
callGetFunction?: (entity: EntityTableComponent<Row>) => void;
prerequisiteFailedHandler?: (entity: EntityTableComponent<Row>) => void;
afterDelete?(): void;
onRowClick?: (row: Row) => void;
}
export interface EntityTableAction<Row = unknown> {
export interface EntityTableAction<Row extends SomeRow = SomeRow> {
id: string | number;
// TODO: Either name or actionName may be unnecessary
name: string;
......@@ -87,7 +93,7 @@ export interface EntityTableAction<Row = unknown> {
onClick: (row?: Row) => void;
title?: string;
disabled?: boolean;
actions?: EntityTableAction[];
actions?: EntityTableAction<Row>[];
matTooltip?: string;
ttposition?: TooltipPosition;
}
......
......@@ -70,7 +70,7 @@ export class TableService {
});
}
delete(table: TableComponent, item: Record<string, any>, action?: string): void {
delete(table: TableComponent, item: Record<string, unknown>, action?: string): void {
const deleteMsg: string = table.tableConf.confirmDeleteDialog?.isMessageComplete
? ''
: this.getDeleteMessage(table, item, action);
......
......@@ -9,10 +9,10 @@ import { DialogService } from 'app/services';
// eslint-disable-next-line @typescript-eslint/naming-convention
export const NULL_VALUE = 'null_value';
// eslint-disable-next-line @typescript-eslint/ban-types
export type ItemBeforeFlattening = object & {
export type ItemBeforeFlattening = {
id: string | number;
children?: ItemBeforeFlattening[];
[key: string]: unknown;
};
type DataBeforeFlattening = ItemBeforeFlattening | ItemBeforeFlattening[];
......
......@@ -19,7 +19,7 @@ export class FormErrorHandlerService {
}
if ('exc_info' in error && error.exc_info.type === ResponseErrorType.Validation && error.exc_info.extra) {
this.handleValidationError({ ...error, extra: error.exc_info.extra as any }, formGroup);
this.handleValidationError({ ...error, extra: error.exc_info.extra as string[][] }, formGroup);
return;
}
......
......@@ -65,7 +65,7 @@ export class ManageCatalogsComponent implements EntityTableConfig<Catalog>, OnIn
catalogSyncJobIds: number[] = [];
private dialogRef: MatDialogRef<EntityJobComponent>;
protected entityList: EntityTableComponent;
protected entityList: EntityTableComponent<Catalog>;
constructor(
private mdDialog: MatDialog,
......@@ -113,7 +113,7 @@ export class ManageCatalogsComponent implements EntityTableConfig<Catalog>, OnIn
}
}
afterInit(entityList: EntityTableComponent): void {
afterInit(entityList: EntityTableComponent<Catalog>): void {
this.entityList = entityList;
}
......
......@@ -215,7 +215,7 @@ export class CertificatesDashComponent implements OnInit {
hideCancel: true,
});
} else {
this.tableService.delete(table, row);
this.tableService.delete(table, row as unknown as Record<string, unknown>);
}
},
},
......
......@@ -49,7 +49,7 @@ export class CloudsyncListComponent implements EntityTableConfig<CloudSyncTaskUi
routeAddTooltip = this.translate.instant('Add Cloud Sync Task');
routeEdit: string[] = ['tasks', 'cloudsync', 'edit'];
wsDelete = 'cloudsync.delete' as const;
entityList: EntityTableComponent;
entityList: EntityTableComponent<CloudSyncTaskUi>;
asyncView = true;
filterValue = '';
......@@ -103,7 +103,7 @@ export class CloudsyncListComponent implements EntityTableConfig<CloudSyncTaskUi
this.filterValue = this.route.snapshot.paramMap.get('dataset') || '';
}
afterInit(entityList: EntityTableComponent): void {
afterInit(entityList: EntityTableComponent<CloudSyncTaskUi>): void {
this.entityList = entityList;
this.slideInService.onClose$.pipe(untilDestroyed(this)).subscribe(() => {
this.entityList.getData();
......
......@@ -1323,7 +1323,7 @@ export class ReplicationFormComponent implements FormConfiguration {
this.toggleNamingSchemaOrRegex();
}
resourceTransformIncomingRestData(wsResponse: any): any {
resourceTransformIncomingRestData(wsResponse: any): unknown {
this.queryRes = _.cloneDeep(wsResponse);
wsResponse['source_datasets_PUSH'] = wsResponse['source_datasets'];
wsResponse['target_dataset_PUSH'] = wsResponse['target_dataset'];
......
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