Skip to content

Commit

Permalink
NAS-132334: PR update
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKarpov98 committed Nov 15, 2024
2 parents 76a2086 + 92ec97a commit 4da12ef
Show file tree
Hide file tree
Showing 408 changed files with 3,002 additions and 3,000 deletions.
4 changes: 0 additions & 4 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
{
"vsicons.presets.angular": true,
"typescript.updateImportsOnFileMove.enabled": "always",
"typescript.preferences.importModuleSpecifier": "non-relative",
"eslint.options": {
"extensions": [".ts", ".html"]
},
"eslint.validate": [
"typescript",
"html"
Expand Down
4 changes: 4 additions & 0 deletions eslint/eslint-ts-rules-extra.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ export const extraRules = {
"importNames": ["NgIf"],
"message": "Use built-in control flow syntax instead"
},
{
"name": "@angular/core",
"importNames": ["CUSTOM_ELEMENTS_SCHEMA"],
},
{
"name": "@angular/common",
"importNames": ["CommonModule"],
Expand Down
6 changes: 0 additions & 6 deletions src/app/enums/boot-environment-action.enum.ts

This file was deleted.

7 changes: 0 additions & 7 deletions src/app/enums/boot-environment-active.enum.ts

This file was deleted.

13 changes: 13 additions & 0 deletions src/app/enums/cloudsync-transfer-setting.enum.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { marker as T } from '@biesbjerg/ngx-translate-extract-marker';

export enum CloudsyncTransferSetting {
Default = 'DEFAULT',
Performance = 'PERFORMANCE',
FastStorage = 'FAST_STORAGE',
}

export const cloudsyncTransferSettingLabels = new Map<CloudsyncTransferSetting, string>([
[CloudsyncTransferSetting.Default, T('Default')],
[CloudsyncTransferSetting.Performance, T('Performance')],
[CloudsyncTransferSetting.FastStorage, T('Fast Storage')],
]);
2 changes: 1 addition & 1 deletion src/app/enums/virtualization.enum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export enum VirtualizationStatus {
Stopped = 'STOPPED',
}

export const virtualizationStatusMap = new Map<VirtualizationStatus, string>([
export const virtualizationStatusLabels = new Map<VirtualizationStatus, string>([
[VirtualizationStatus.Running, T('Running')],
[VirtualizationStatus.Stopped, T('Stopped')],
]);
Expand Down
21 changes: 9 additions & 12 deletions src/app/interfaces/api/api-call-directory.interface.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { AlertPolicy } from 'app/enums/alert-policy.enum';
import { CloudsyncTransferSetting } from 'app/enums/cloudsync-transfer-setting.enum';
import { DatasetRecordSize, DatasetType } from 'app/enums/dataset.enum';
import { DeviceType } from 'app/enums/device-type.enum';
import { DockerConfig, DockerStatusData } from 'app/enums/docker-config.interface';
Expand Down Expand Up @@ -36,12 +37,7 @@ import { AuditConfig, AuditEntry, AuditQueryParams } from 'app/interfaces/audit/
import { AuthSession } from 'app/interfaces/auth-session.interface';
import { LoginExOtpTokenQuery, LoginExQuery, LoginExResponse } from 'app/interfaces/auth.interface';
import { AvailableApp } from 'app/interfaces/available-app.interface';
import {
Bootenv,
CreateBootenvParams,
SetBootenvAttributeParams,
UpdateBootenvParams,
} from 'app/interfaces/bootenv.interface';
import { BootenvCloneParams, BootEnvironment, BootenvKeepParams } from 'app/interfaces/boot-environment.interface';
import {
CatalogConfig, CatalogApp,
CatalogUpdate, GetItemDetailsParams,
Expand Down Expand Up @@ -349,12 +345,12 @@ export interface ApiCallDirectory {
'boot.get_state': { params: void; response: PoolInstance };
'boot.set_scrub_interval': { params: [number]; response: number };

// Bootenv
'bootenv.activate': { params: [string]; response: boolean };
'bootenv.create': { params: CreateBootenvParams; response: string };
'bootenv.query': { params: QueryParams<Bootenv>; response: Bootenv[] };
'bootenv.set_attribute': { params: SetBootenvAttributeParams; response: boolean };
'bootenv.update': { params: UpdateBootenvParams; response: string };
// Boot Environment
'boot.environment.query': { params: QueryParams<BootEnvironment>; response: BootEnvironment[] };
'boot.environment.activate': { params: [{ id: string }]; response: unknown };
'boot.environment.destroy': { params: [{ id: string }]; response: unknown };
'boot.environment.clone': { params: BootenvCloneParams; response: unknown };
'boot.environment.keep': { params: BootenvKeepParams; response: unknown };

// Catalog
'catalog.get_app_details': { params: [name: string, params: GetItemDetailsParams]; response: CatalogApp };
Expand Down Expand Up @@ -384,6 +380,7 @@ export interface ApiCallDirectory {
'cloud_backup.delete': { params: [id: number]; response: boolean };
'cloud_backup.list_snapshots': { params: [id: number]; response: CloudBackupSnapshot[] };
'cloud_backup.list_snapshot_directory': { params: CloudBackupSnapshotDirectoryParams; response: CloudBackupSnapshotDirectoryListing[] };
'cloud_backup.transfer_setting_choices': { params: void; response: CloudsyncTransferSetting[] };
'cloud_backup.query': { params: [id?: QueryParams<CloudBackup>]; response: CloudBackup[] };
'cloud_backup.update': { params: [id: number, update: CloudBackupUpdate]; response: CloudBackup };

Expand Down
2 changes: 2 additions & 0 deletions src/app/interfaces/api/api-event-directory.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { DockerStatusData } from 'app/enums/docker-config.interface';
import { FailoverStatus } from 'app/enums/failover-status.enum';
import { Alert } from 'app/interfaces/alert.interface';
import { App, AppStats } from 'app/interfaces/app.interface';
import { BootEnvironment } from 'app/interfaces/boot-environment.interface';
import { ContainerImage } from 'app/interfaces/container-image.interface';
import { DirectoryServicesState } from 'app/interfaces/directory-services-state.interface';
import { Disk } from 'app/interfaces/disk.interface';
Expand Down Expand Up @@ -43,4 +44,5 @@ export interface ApiEventDirectory {
'vm.query': { response: VirtualMachine };
'zfs.pool.scan': { response: PoolScan };
'zfs.snapshot.query': { response: ZfsSnapshot };
'boot.environment.query': { response: BootEnvironment };
}
59 changes: 59 additions & 0 deletions src/app/interfaces/boot-environment.interface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { ApiTimestamp } from 'app/interfaces/api-date.interface';

export interface BootEnvironment {
/**
* The name of the boot environment.
*/
id: string;

/**
* The name of the dataset representing the boot environment.
*/
dataset: string;

/**
* If `true`, represents the `currently` running boot environment.
*/
active: boolean;

/**
* If `true`, represents the boot environment that will become the running boot environment at `next boot`.
*/
activated: boolean;

/**
* Represents when the boot environment was created.
*/
created: ApiTimestamp;

/**
* An integer representing the number of bytes used by the boot environment.
*/
used_bytes: number;

/**
* A human-readable string representing the total number of space used by the boot environment.
*/
used: string;

/**
* When set to `false`, will be automatically deleted during an upgrade procedure
* if there isn’t enough room on the boot drive to apply said update.
*/
keep: boolean;

/**
* If `true` indicates whether the boot environment may be `activated`.
*/
can_activate: boolean;
}

export type BootenvCloneParams = [{
id: string;
target: string;
}];

export type BootenvKeepParams = [{
id: string;
value: boolean;
}];
36 changes: 0 additions & 36 deletions src/app/interfaces/bootenv.interface.ts

This file was deleted.

9 changes: 4 additions & 5 deletions src/app/interfaces/cloud-backup.interface.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { marker as T } from '@biesbjerg/ngx-translate-extract-marker';
import { CloudsyncTransferSetting } from 'app/enums/cloudsync-transfer-setting.enum';
import { ApiTimestamp } from 'app/interfaces/api-date.interface';
import { Job } from 'app/interfaces/job.interface';
import { BwLimit, BwLimitUpdate, CloudCredential } from './cloud-sync-task.interface';
import { CloudCredential } from './cloud-sync-task.interface';
import { Schedule } from './schedule.interface';

export interface CloudBackup {
Expand All @@ -15,20 +16,18 @@ export interface CloudBackup {
snapshot: boolean;
include: string[];
exclude: string[];
transfers: number | null;
args: string;
enabled: boolean;
password: string;
credentials: CloudCredential;
job: Job | null;
locked: boolean;
keep_last?: number;
bwlimit?: BwLimit[];
transfer_setting: CloudsyncTransferSetting;
}

export interface CloudBackupUpdate extends Omit<CloudBackup, 'id' | 'job' | 'locked' | 'bwlimit' | 'credentials'> {
export interface CloudBackupUpdate extends Omit<CloudBackup, 'id' | 'job' | 'locked' | 'credentials'> {
credentials: number;
bwlimit: BwLimitUpdate[];
}

export interface CloudBackupSnapshot {
Expand Down
14 changes: 7 additions & 7 deletions src/app/modules/alerts/store/alert.effects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class AlertEffects {
loadAlerts$ = createEffect(() => this.actions$.pipe(
ofType(adminUiInitialized, alertIndicatorPressed, alertReceivedWhenPanelIsOpen),
switchMap(() => {
return this.ws.call('alert.list').pipe(
return this.api.call('alert.list').pipe(
map((alerts) => alertsLoaded({ alerts })),
catchError((error) => {
console.error(error);
Expand All @@ -51,7 +51,7 @@ export class AlertEffects {
subscribeToUpdates$ = createEffect(() => this.actions$.pipe(
ofType(adminUiInitialized),
switchMap(() => {
return this.ws.subscribe('alert.list').pipe(
return this.api.subscribe('alert.list').pipe(
switchMap((event) => {
return this.store$.select(selectIsAlertPanelOpen).pipe(
switchMap((isAlertsPanelOpen) => {
Expand Down Expand Up @@ -80,7 +80,7 @@ export class AlertEffects {
dismissAlert$ = createEffect(() => this.actions$.pipe(
ofType(dismissAlertPressed),
mergeMap(({ id }) => {
return this.ws.call('alert.dismiss', [id]).pipe(
return this.api.call('alert.dismiss', [id]).pipe(
catchError((error) => {
this.errorHandler.showErrorModal(error);
this.store$.dispatch(alertChanged({ alert: { id, dismissed: false } as Alert }));
Expand All @@ -93,7 +93,7 @@ export class AlertEffects {
reopenAlert$ = createEffect(() => this.actions$.pipe(
ofType(reopenAlertPressed),
mergeMap(({ id }) => {
return this.ws.call('alert.restore', [id]).pipe(
return this.api.call('alert.restore', [id]).pipe(
catchError((error) => {
this.errorHandler.showErrorModal(error);
this.store$.dispatch(alertChanged({ alert: { id, dismissed: true } as Alert }));
Expand All @@ -107,7 +107,7 @@ export class AlertEffects {
ofType(dismissAllAlertsPressed),
withLatestFrom(this.store$.select(selectUnreadAlerts).pipe(pairwise())),
mergeMap(([, [unreadAlerts]]) => {
const requests = unreadAlerts.map((alert) => this.ws.call('alert.dismiss', [alert.id]));
const requests = unreadAlerts.map((alert) => this.api.call('alert.dismiss', [alert.id]));
return forkJoin(requests).pipe(
catchError((error) => {
this.errorHandler.showErrorModal(error);
Expand All @@ -123,7 +123,7 @@ export class AlertEffects {
ofType(reopenAllAlertsPressed),
withLatestFrom(this.store$.select(selectDismissedAlerts).pipe(pairwise())),
mergeMap(([, [dismissedAlerts]]) => {
const requests = dismissedAlerts.map((alert) => this.ws.call('alert.restore', [alert.id]));
const requests = dismissedAlerts.map((alert) => this.api.call('alert.restore', [alert.id]));
return forkJoin(requests).pipe(
catchError((error) => {
this.errorHandler.showErrorModal(error);
Expand All @@ -136,7 +136,7 @@ export class AlertEffects {

constructor(
private actions$: Actions,
private ws: ApiService,
private api: ApiService,
private store$: Store<AlertSlice>,
private translate: TranslateService,
private errorHandler: ErrorHandlerService,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export class ExportButtonComponent<T, M extends ApiJobMethod> {
protected readonly isHaLicensed = toSignal(this.store$.select(selectIsHaLicensed));

constructor(
private ws: ApiService,
private api: ApiService,
private cdr: ChangeDetectorRef,
private errorHandler: ErrorHandlerService,
private dialogService: DialogService,
Expand All @@ -67,7 +67,7 @@ export class ExportButtonComponent<T, M extends ApiJobMethod> {

onExport(): void {
this.isLoading = true;
this.ws.job(this.jobMethod, this.getExportParams(
this.api.job(this.jobMethod, this.getExportParams(
this.getQueryFilters(this.searchQuery),
this.getQueryOptions(this.sorting),
)).pipe(
Expand All @@ -89,7 +89,7 @@ export class ExportButtonComponent<T, M extends ApiJobMethod> {
customArguments.report_name = url;
}

return this.ws.call('core.download', [downloadMethod, [customArguments], url]);
return this.api.call('core.download', [downloadMethod, [customArguments], url]);
}),
switchMap(([, url]) => this.download.downloadUrl(url, `${this.filename}.${this.fileType}`, this.fileMimeType)),
catchError((error) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
Component, output, ChangeDetectionStrategy,
} from '@angular/core';
import { MatButton } from '@angular/material/button';
import { TranslateModule } from '@ngx-translate/core';
import { IxIconComponent } from 'app/modules/ix-icon/ix-icon.component';
import { TestDirective } from 'app/modules/test-id/test.directive';
Expand All @@ -10,7 +9,6 @@ import { TestDirective } from 'app/modules/test-id/test.directive';
changeDetection: ChangeDetectionStrategy.OnPush,
standalone: true,
imports: [
MatButton,
IxIconComponent,
TranslateModule,
TestDirective,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { CdkScrollable } from '@angular/cdk/scrolling';
import {
ChangeDetectionStrategy,
Component, Inject,
Expand All @@ -22,7 +21,6 @@ import { TestDirective } from 'app/modules/test-id/test.directive';
standalone: true,
imports: [
MatDialogTitle,
CdkScrollable,
MatDialogContent,
MatCheckbox,
ReactiveFormsModule,
Expand Down
Loading

0 comments on commit 4da12ef

Please sign in to comment.