diff --git a/src/app/modules/alerts/store/alert.effects.ts b/src/app/modules/alerts/store/alert.effects.ts index 8239d32d492..42ba6cf6341 100644 --- a/src/app/modules/alerts/store/alert.effects.ts +++ b/src/app/modules/alerts/store/alert.effects.ts @@ -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); @@ -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) => { @@ -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 })); @@ -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 })); @@ -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); @@ -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); @@ -136,7 +136,7 @@ export class AlertEffects { constructor( private actions$: Actions, - private ws: ApiService, + private api: ApiService, private store$: Store, private translate: TranslateService, private errorHandler: ErrorHandlerService, diff --git a/src/app/modules/buttons/export-button/export-button.component.ts b/src/app/modules/buttons/export-button/export-button.component.ts index 209e6e9f50a..817df42d988 100644 --- a/src/app/modules/buttons/export-button/export-button.component.ts +++ b/src/app/modules/buttons/export-button/export-button.component.ts @@ -57,7 +57,7 @@ export class ExportButtonComponent { protected readonly isHaLicensed = toSignal(this.store$.select(selectIsHaLicensed)); constructor( - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private errorHandler: ErrorHandlerService, private dialogService: DialogService, @@ -67,7 +67,7 @@ export class ExportButtonComponent { 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( @@ -89,7 +89,7 @@ export class ExportButtonComponent { 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) => { diff --git a/src/app/modules/dialog/components/error-dialog/error-dialog.component.ts b/src/app/modules/dialog/components/error-dialog/error-dialog.component.ts index 45b3cab8113..8618adc9ef7 100644 --- a/src/app/modules/dialog/components/error-dialog/error-dialog.component.ts +++ b/src/app/modules/dialog/components/error-dialog/error-dialog.component.ts @@ -52,7 +52,7 @@ export class ErrorDialogComponent { constructor( public dialogRef: MatDialogRef, - private ws: ApiService, + private api: ApiService, private download: DownloadService, private errorHandler: ErrorHandlerService, private dialogService: DialogService, @@ -63,7 +63,7 @@ export class ErrorDialogComponent { } downloadLogs(): void { - this.ws.call('core.job_download_logs', [this.logs.id, `${this.logs.id}.log`]).pipe(untilDestroyed(this)).subscribe({ + this.api.call('core.job_download_logs', [this.logs.id, `${this.logs.id}.log`]).pipe(untilDestroyed(this)).subscribe({ next: (url) => { const mimetype = 'text/plain'; this.download.streamDownloadFile(url, `${this.logs.id}.log`, mimetype).pipe(untilDestroyed(this)).subscribe({ diff --git a/src/app/modules/dialog/components/job-progress/job-progress-dialog.component.ts b/src/app/modules/dialog/components/job-progress/job-progress-dialog.component.ts index 4c9151d88da..75383c6c0fe 100644 --- a/src/app/modules/dialog/components/job-progress/job-progress-dialog.component.ts +++ b/src/app/modules/dialog/components/job-progress/job-progress-dialog.component.ts @@ -109,7 +109,7 @@ export class JobProgressDialogComponent implements OnInit, AfterViewChecked { constructor( private dialogRef: MatDialogRef, MatDialogConfig>, @Inject(MAT_DIALOG_DATA) public data: JobProgressDialogConfig, - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private errorHandler: ErrorHandlerService, ) { } @@ -199,7 +199,7 @@ export class JobProgressDialogComponent implements OnInit, AfterViewChecked { } abortJob(): void { - this.ws.call('core.job_abort', [this.job.id]).pipe( + this.api.call('core.job_abort', [this.job.id]).pipe( this.errorHandler.catchError(), untilDestroyed(this), ) @@ -218,7 +218,7 @@ export class JobProgressDialogComponent implements OnInit, AfterViewChecked { this.realtimeLogsSubscribed = true; const subName = 'filesystem.file_tail_follow:' + this.job.logs_path; this.cdr.markForCheck(); - return this.ws.subscribeToLogs(subName) + return this.api.subscribeToLogs(subName) .pipe(map((apiEvent) => apiEvent.fields), untilDestroyed(this)) .subscribe((logs) => { if (logs?.data && typeof logs.data === 'string') { diff --git a/src/app/modules/dialog/components/multi-error-dialog/error-template/error-template.component.ts b/src/app/modules/dialog/components/multi-error-dialog/error-template/error-template.component.ts index 11cbf36fbe3..277e0e5b913 100644 --- a/src/app/modules/dialog/components/multi-error-dialog/error-template/error-template.component.ts +++ b/src/app/modules/dialog/components/multi-error-dialog/error-template/error-template.component.ts @@ -43,7 +43,7 @@ export class ErrorTemplateComponent { @Input() logs: Job; constructor( - private ws: ApiService, + private api: ApiService, private download: DownloadService, private errorHandler: ErrorHandlerService, private dialogService: DialogService, @@ -68,7 +68,7 @@ export class ErrorTemplateComponent { } downloadLogs(): void { - this.ws.call('core.job_download_logs', [this.logs.id, `${this.logs.id}.log`]) + this.api.call('core.job_download_logs', [this.logs.id, `${this.logs.id}.log`]) .pipe(this.errorHandler.catchError(), untilDestroyed(this)) .subscribe((url) => { const mimetype = 'text/plain'; diff --git a/src/app/modules/dialog/components/show-logs-dialog/show-logs-dialog.component.ts b/src/app/modules/dialog/components/show-logs-dialog/show-logs-dialog.component.ts index 1b33326eb95..27697bb27a2 100644 --- a/src/app/modules/dialog/components/show-logs-dialog/show-logs-dialog.component.ts +++ b/src/app/modules/dialog/components/show-logs-dialog/show-logs-dialog.component.ts @@ -34,7 +34,7 @@ import { ErrorHandlerService } from 'app/services/error-handler.service'; }) export class ShowLogsDialogComponent { constructor( - private ws: ApiService, + private api: ApiService, private errorHandler: ErrorHandlerService, private download: DownloadService, private dialogService: DialogService, @@ -42,7 +42,7 @@ export class ShowLogsDialogComponent { ) { } downloadLogs(): void { - this.ws.call('core.job_download_logs', [this.job.id, `${this.job.id}.log`]).pipe( + this.api.call('core.job_download_logs', [this.job.id, `${this.job.id}.log`]).pipe( switchMap((url) => this.download.downloadUrl(url, `${this.job.id}.log`, 'text/plain')), catchError((error: HttpErrorResponse | Job) => { this.dialogService.error(this.errorHandler.parseError(error)); diff --git a/src/app/modules/dialog/components/start-service-dialog/start-service-dialog.component.ts b/src/app/modules/dialog/components/start-service-dialog/start-service-dialog.component.ts index f3d5b6a228c..f2b34c972ff 100644 --- a/src/app/modules/dialog/components/start-service-dialog/start-service-dialog.component.ts +++ b/src/app/modules/dialog/components/start-service-dialog/start-service-dialog.component.ts @@ -63,7 +63,7 @@ export class StartServiceDialogComponent implements OnInit { } constructor( - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private translate: TranslateService, private snackbar: SnackbarService, @@ -94,11 +94,11 @@ export class StartServiceDialogComponent implements OnInit { }; if (result.start && result.startAutomatically && this.isDisabled) { - requests.push(this.ws.call('service.update', [this.service.id, { enable: result.startAutomatically }])); + requests.push(this.api.call('service.update', [this.service.id, { enable: result.startAutomatically }])); } if (result.start) { - requests.push(this.ws.call('service.start', [this.serviceName, { silent: false }])); + requests.push(this.api.call('service.start', [this.serviceName, { silent: false }])); } forkJoin(requests) diff --git a/src/app/modules/feedback/components/file-ticket-licensed/file-ticket-licensed.component.ts b/src/app/modules/feedback/components/file-ticket-licensed/file-ticket-licensed.component.ts index 5c4af0cc34f..eda2441b060 100644 --- a/src/app/modules/feedback/components/file-ticket-licensed/file-ticket-licensed.component.ts +++ b/src/app/modules/feedback/components/file-ticket-licensed/file-ticket-licensed.component.ts @@ -121,7 +121,7 @@ export class FileTicketLicensedComponent { private imageValidator: ImageValidatorService, private formErrorHandler: FormErrorHandlerService, @Inject(WINDOW) private window: Window, - private ws: ApiService, + private api: ApiService, ) { this.getSystemFileSizeLimit(); } @@ -154,7 +154,7 @@ export class FileTicketLicensedComponent { } private getSystemFileSizeLimit(): void { - this.ws.call('support.attach_ticket_max_size').pipe(untilDestroyed(this)).subscribe((size) => { + this.api.call('support.attach_ticket_max_size').pipe(untilDestroyed(this)).subscribe((size) => { this.form.controls.images.addAsyncValidators( this.imageValidator.getImagesValidator(size * MiB), ); diff --git a/src/app/modules/feedback/components/file-ticket/file-ticket.component.ts b/src/app/modules/feedback/components/file-ticket/file-ticket.component.ts index b7747b0c576..9a5c002d42c 100644 --- a/src/app/modules/feedback/components/file-ticket/file-ticket.component.ts +++ b/src/app/modules/feedback/components/file-ticket/file-ticket.component.ts @@ -83,7 +83,7 @@ export class FileTicketComponent { private feedbackService: FeedbackService, private imageValidator: ImageValidatorService, private formErrorHandler: FormErrorHandlerService, - private ws: ApiService, + private api: ApiService, ) { this.getSystemFileSizeLimit(); } @@ -106,7 +106,7 @@ export class FileTicketComponent { } private getSystemFileSizeLimit(): void { - this.ws.call('support.attach_ticket_max_size').pipe(untilDestroyed(this)).subscribe((size) => { + this.api.call('support.attach_ticket_max_size').pipe(untilDestroyed(this)).subscribe((size) => { this.form.controls.images.addAsyncValidators(this.imageValidator.getImagesValidator(size * MiB)); this.form.controls.images.updateValueAndValidity(); }); diff --git a/src/app/modules/feedback/services/feedback.service.ts b/src/app/modules/feedback/services/feedback.service.ts index fcd4cec7f42..ac55e714f00 100644 --- a/src/app/modules/feedback/services/feedback.service.ts +++ b/src/app/modules/feedback/services/feedback.service.ts @@ -47,7 +47,7 @@ export class FeedbackService { constructor( private httpClient: HttpClient, - private ws: ApiService, + private api: ApiService, private store$: Store, private systemGeneralService: SystemGeneralService, private sentryService: SentryService, @@ -157,7 +157,7 @@ export class FeedbackService { } getSimilarIssues(query: string): Observable { - return this.ws.call('support.similar_issues', [query]); + return this.api.call('support.similar_issues', [query]); } addDebugInfoToMessage(message: string): Observable { @@ -261,12 +261,12 @@ export class FeedbackService { filter((systemInfoState) => Boolean(systemInfoState.systemInfo)), take(1), ), - this.ws.call('system.host_id'), + this.api.call('system.host_id'), ]); } private addTicket(ticket: CreateNewTicket): Observable { - return this.ws.job('support.new_ticket', [ticket]).pipe( + return this.api.job('support.new_ticket', [ticket]).pipe( filter((job) => job.state === JobState.Success), map((job) => job.result), ); diff --git a/src/app/modules/forms/custom-selects/unused-disk-select/unused-disk-select.component.ts b/src/app/modules/forms/custom-selects/unused-disk-select/unused-disk-select.component.ts index 4fd955b7618..7e4589f96ca 100644 --- a/src/app/modules/forms/custom-selects/unused-disk-select/unused-disk-select.component.ts +++ b/src/app/modules/forms/custom-selects/unused-disk-select/unused-disk-select.component.ts @@ -73,7 +73,7 @@ export class UnusedDiskSelectComponent implements OnInit, AfterViewInit { return getNonUniqueSerialDisksWarning(this.nonUniqueSerialDisks(), this.translate); }); - private unusedDisks$ = this.ws.call('disk.details').pipe( + private unusedDisks$ = this.api.call('disk.details').pipe( map((diskDetails) => { return [ ...diskDetails.unused, @@ -105,7 +105,7 @@ export class UnusedDiskSelectComponent implements OnInit, AfterViewInit { constructor( private dialogService: DialogService, private translate: TranslateService, - private ws: ApiService, + private api: ApiService, ) {} ngOnInit(): void { diff --git a/src/app/modules/forms/ix-forms/components/ix-explorer/create-dataset-dialog/create-dataset-dialog.component.ts b/src/app/modules/forms/ix-forms/components/ix-explorer/create-dataset-dialog/create-dataset-dialog.component.ts index 1c0a2c76811..d5e6c5c625b 100644 --- a/src/app/modules/forms/ix-forms/components/ix-explorer/create-dataset-dialog/create-dataset-dialog.component.ts +++ b/src/app/modules/forms/ix-forms/components/ix-explorer/create-dataset-dialog/create-dataset-dialog.component.ts @@ -68,7 +68,7 @@ export class CreateDatasetDialogComponent implements OnInit { constructor( private fb: FormBuilder, private cdr: ChangeDetectorRef, - private ws: ApiService, + private api: ApiService, private dialog: DialogService, private errorHandler: ErrorHandlerService, private dialogRef: MatDialogRef, @@ -89,7 +89,7 @@ export class CreateDatasetDialogComponent implements OnInit { createDataset(): void { this.isLoading$.next(true); - this.ws.call('pool.dataset.create', [{ ...this.data.dataset, name: `${this.parent.name}/${this.form.value.name}` }]) + this.api.call('pool.dataset.create', [{ ...this.data.dataset, name: `${this.parent.name}/${this.form.value.name}` }]) .pipe(untilDestroyed(this)).subscribe({ next: (dataset) => { this.isLoading$.next(false); @@ -105,7 +105,7 @@ export class CreateDatasetDialogComponent implements OnInit { loadParentDataset(): void { this.isLoading$.next(true); const normalizedParentId = this.data.parentId.replace(/\/$/, ''); - this.ws.call('pool.dataset.query', [[['id', '=', normalizedParentId]]]).pipe( + this.api.call('pool.dataset.query', [[['id', '=', normalizedParentId]]]).pipe( tap((parent) => { if (!parent.length) { throw new Error(`Parent dataset ${normalizedParentId} not found`); diff --git a/src/app/modules/ix-table/classes/api-data-provider/api-data-provider.ts b/src/app/modules/ix-table/classes/api-data-provider/api-data-provider.ts index 8d8917ff98d..da14bf2174b 100644 --- a/src/app/modules/ix-table/classes/api-data-provider/api-data-provider.ts +++ b/src/app/modules/ix-table/classes/api-data-provider/api-data-provider.ts @@ -19,7 +19,7 @@ export class ApiDataProvider extends BaseDataProvider[] = []; constructor( - protected ws: ApiService, + protected api: ApiService, protected method: T, protected params: ApiCallParams = [], ) { @@ -38,7 +38,7 @@ export class ApiDataProvider extends BaseDataProvider { this.totalRows = count; - return this.ws.call(this.method, this.prepareParams(this.params)) as Observable[]>; + return this.api.call(this.method, this.prepareParams(this.params)) as Observable[]>; }), ).subscribe({ next: (rows: ApiCallResponseType[]) => { @@ -80,7 +80,7 @@ export class ApiDataProvider extends BaseDataProvider; - return this.ws.call(this.method, params) as unknown as Observable; + return this.api.call(this.method, params) as unknown as Observable; } protected prepareParams(params: ApiCallParams): ApiCallParams { diff --git a/src/app/modules/jobs/store/job.effects.ts b/src/app/modules/jobs/store/job.effects.ts index 70adf95d33b..59e94bb3473 100644 --- a/src/app/modules/jobs/store/job.effects.ts +++ b/src/app/modules/jobs/store/job.effects.ts @@ -19,8 +19,8 @@ export class JobEffects { loadJobs$ = createEffect(() => this.actions$.pipe( ofType(adminUiInitialized), switchMap(() => { - const getNotCompletedJobs$ = this.ws.call('core.get_jobs', [[['state', '!=', JobState.Success]]]); - const getCompletedJobs$ = this.ws.call('core.get_jobs', [[['state', '=', JobState.Success]], { order_by: ['-id'], limit: 30 }]); + const getNotCompletedJobs$ = this.api.call('core.get_jobs', [[['state', '!=', JobState.Success]]]); + const getCompletedJobs$ = this.api.call('core.get_jobs', [[['state', '=', JobState.Success]], { order_by: ['-id'], limit: 30 }]); return forkJoin([ getNotCompletedJobs$, @@ -43,7 +43,7 @@ export class JobEffects { subscribeToUpdates$ = createEffect(() => this.actions$.pipe( ofType(jobsLoaded), switchMap(() => { - return this.ws.subscribe('core.get_jobs').pipe( + return this.api.subscribe('core.get_jobs').pipe( filter((event) => event.msg !== IncomingApiMessageType.Removed), switchMap((event) => { switch (event.msg) { @@ -62,7 +62,7 @@ export class JobEffects { subscribeToRemoval$ = createEffect(() => this.actions$.pipe( ofType(jobsLoaded), switchMap(() => { - return this.ws.subscribe('core.get_jobs').pipe( + return this.api.subscribe('core.get_jobs').pipe( filter((event) => event.msg === IncomingApiMessageType.Removed), map((event) => jobRemoved({ id: event.id as number })), ); @@ -72,7 +72,7 @@ export class JobEffects { abortJob$ = createEffect(() => this.actions$.pipe( ofType(abortJobPressed), switchMap(({ job }) => { - return this.ws.call('core.job_abort', [job.id]).pipe( + return this.api.call('core.job_abort', [job.id]).pipe( map(() => jobAborted({ job })), ); }), @@ -80,7 +80,7 @@ export class JobEffects { constructor( private actions$: Actions, - private ws: ApiService, + private api: ApiService, private translate: TranslateService, ) {} } diff --git a/src/app/modules/layout/console-footer/console-messages.store.ts b/src/app/modules/layout/console-footer/console-messages.store.ts index 73522607da3..db7145057c5 100644 --- a/src/app/modules/layout/console-footer/console-messages.store.ts +++ b/src/app/modules/layout/console-footer/console-messages.store.ts @@ -33,13 +33,13 @@ export class ConsoleMessagesStore extends ComponentStore i }); constructor( - private ws: ApiService, + private api: ApiService, ) { super(initialConsoleMessagesState); } subscribeToMessageUpdates(): void { - this.ws.subscribeToLogs(this.logPath) + this.api.subscribeToLogs(this.logPath) .pipe( map((event) => event.fields), filter((log) => typeof log?.data === 'string'), diff --git a/src/app/modules/layout/topbar/change-password-dialog/change-password-dialog.component.ts b/src/app/modules/layout/topbar/change-password-dialog/change-password-dialog.component.ts index cd7595750df..d0421a30690 100644 --- a/src/app/modules/layout/topbar/change-password-dialog/change-password-dialog.component.ts +++ b/src/app/modules/layout/topbar/change-password-dialog/change-password-dialog.component.ts @@ -68,7 +68,7 @@ export class ChangePasswordDialogComponent { private translate: TranslateService, private dialogRef: MatDialogRef, private fb: FormBuilder, - private ws: ApiService, + private api: ApiService, private authService: AuthService, private loader: AppLoaderService, private formErrorHandler: FormErrorHandlerService, @@ -80,7 +80,7 @@ export class ChangePasswordDialogComponent { } onSubmit(): void { - this.ws.call('user.set_password', [{ + this.api.call('user.set_password', [{ old_password: this.form.value.old_password, new_password: this.form.value.new_password, username: this.loggedInUser.pw_name, diff --git a/src/app/modules/layout/topbar/directory-services-indicator/directory-services-indicator.component.ts b/src/app/modules/layout/topbar/directory-services-indicator/directory-services-indicator.component.ts index 4b56d00d68f..44795d6a0a3 100644 --- a/src/app/modules/layout/topbar/directory-services-indicator/directory-services-indicator.component.ts +++ b/src/app/modules/layout/topbar/directory-services-indicator/directory-services-indicator.component.ts @@ -41,7 +41,7 @@ export class DirectoryServicesIndicatorComponent implements OnInit, OnDestroy { private statusSubscription: Subscription; constructor( - private ws: ApiService, + private api: ApiService, private matDialog: MatDialog, private cdr: ChangeDetectorRef, ) { } @@ -72,10 +72,10 @@ export class DirectoryServicesIndicatorComponent implements OnInit, OnDestroy { private loadDirectoryServicesStatus(): void { // TODO: Sync endpoints - this.ws.call('directoryservices.get_state').pipe(untilDestroyed(this)).subscribe((state) => { + this.api.call('directoryservices.get_state').pipe(untilDestroyed(this)).subscribe((state) => { this.updateIconVisibility(state); }); - this.statusSubscription = this.ws.subscribe('directoryservices.status').pipe(untilDestroyed(this)).subscribe((event) => { + this.statusSubscription = this.api.subscribe('directoryservices.status').pipe(untilDestroyed(this)).subscribe((event) => { this.updateIconVisibility(event.fields); }); } diff --git a/src/app/modules/layout/topbar/directory-services-indicator/directory-services-monitor/directory-services-monitor.component.ts b/src/app/modules/layout/topbar/directory-services-indicator/directory-services-monitor/directory-services-monitor.component.ts index 2788e9605b4..4f057e4985f 100644 --- a/src/app/modules/layout/topbar/directory-services-indicator/directory-services-monitor/directory-services-monitor.component.ts +++ b/src/app/modules/layout/topbar/directory-services-indicator/directory-services-monitor/directory-services-monitor.component.ts @@ -46,7 +46,7 @@ export class DirectoryServicesMonitorComponent implements OnInit { protected readonly directoryServiceStateLabels = directoryServiceStateLabels; constructor( - private ws: ApiService, + private api: ApiService, private errorHandler: ErrorHandlerService, ) {} @@ -56,7 +56,7 @@ export class DirectoryServicesMonitorComponent implements OnInit { getStatus(): void { this.isLoading.set(true); - this.ws.call('directoryservices.get_state') + this.api.call('directoryservices.get_state') .pipe( this.errorHandler.catchError(), finalize(() => this.isLoading.set(false)), diff --git a/src/app/modules/layout/topbar/resilvering-indicator/resilver-progress/resilver-progress.component.ts b/src/app/modules/layout/topbar/resilvering-indicator/resilver-progress/resilver-progress.component.ts index e854ca35fc4..74c11c5d325 100644 --- a/src/app/modules/layout/topbar/resilvering-indicator/resilver-progress/resilver-progress.component.ts +++ b/src/app/modules/layout/topbar/resilvering-indicator/resilver-progress/resilver-progress.component.ts @@ -52,12 +52,12 @@ export class ResilverProgressDialogComponent implements OnInit { constructor( private translate: TranslateService, - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, ) {} ngOnInit(): void { - this.ws.subscribe('zfs.pool.scan').pipe(untilDestroyed(this)).subscribe((event) => { + this.api.subscribe('zfs.pool.scan').pipe(untilDestroyed(this)).subscribe((event) => { // eslint-disable-next-line @typescript-eslint/prefer-optional-chain if (!event || !event.fields.scan.function.includes(PoolScanFunction.Resilver)) { return; diff --git a/src/app/modules/layout/topbar/resilvering-indicator/resilvering-indicator.component.ts b/src/app/modules/layout/topbar/resilvering-indicator/resilvering-indicator.component.ts index 3b2c855d1e8..35aa6a0c695 100644 --- a/src/app/modules/layout/topbar/resilvering-indicator/resilvering-indicator.component.ts +++ b/src/app/modules/layout/topbar/resilvering-indicator/resilvering-indicator.component.ts @@ -31,7 +31,7 @@ import { ApiService } from 'app/services/api.service'; ], }) export class ResilveringIndicatorComponent { - protected isResilvering$ = this.ws.subscribe('zfs.pool.scan').pipe( + protected isResilvering$ = this.api.subscribe('zfs.pool.scan').pipe( map((event) => { const scan = event.fields.scan; return scan.function === PoolScanFunction.Resilver && scan.state !== PoolScanState.Finished; @@ -42,7 +42,7 @@ export class ResilveringIndicatorComponent { constructor( private matDialog: MatDialog, - private ws: ApiService, + private api: ApiService, ) {} showDetails(): void { diff --git a/src/app/modules/terminal/components/terminal/terminal.component.ts b/src/app/modules/terminal/components/terminal/terminal.component.ts index 4d0ef946b00..0b0bfd8ea7f 100644 --- a/src/app/modules/terminal/components/terminal/terminal.component.ts +++ b/src/app/modules/terminal/components/terminal/terminal.component.ts @@ -76,7 +76,7 @@ export class TerminalComponent implements OnInit, OnDestroy { Kill process shortcut is Ctrl+C.`); constructor( - private ws: ApiService, + private api: ApiService, private shellService: ShellService, private matDialog: MatDialog, private translate: TranslateService, @@ -187,7 +187,7 @@ export class TerminalComponent implements OnInit, OnDestroy { this.fitAddon.fit(); const size = this.fitAddon.proposeDimensions(); if (size) { - this.ws.call('core.resize_shell', [this.connectionId, size.cols, size.rows]).pipe(untilDestroyed(this)).subscribe(() => { + this.api.call('core.resize_shell', [this.connectionId, size.cols, size.rows]).pipe(untilDestroyed(this)).subscribe(() => { this.xterm.focus(); }); } diff --git a/src/app/modules/truecommand/components/truecommand-connect-modal/truecommand-connect-modal.component.spec.ts b/src/app/modules/truecommand/components/truecommand-connect-modal/truecommand-connect-modal.component.spec.ts index a9efb8e86cc..2a461a1b2a1 100644 --- a/src/app/modules/truecommand/components/truecommand-connect-modal/truecommand-connect-modal.component.spec.ts +++ b/src/app/modules/truecommand/components/truecommand-connect-modal/truecommand-connect-modal.component.spec.ts @@ -33,7 +33,7 @@ function getFakeConfig(overrides: Partial): TrueCommandConfig describe('TruecommandConnectModalComponent', () => { let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; function createComponentWithData( config: Partial, @@ -101,7 +101,7 @@ describe('TruecommandConnectModalComponent', () => { beforeEach(() => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it(`it has title '${expectedTitle}'`, () => { @@ -142,7 +142,7 @@ describe('TruecommandConnectModalComponent', () => { beforeEach(() => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('sends an update payload', async () => { @@ -156,7 +156,7 @@ describe('TruecommandConnectModalComponent', () => { expect(await submitButton.isDisabled()).toBeFalsy(); await submitButton.click(); - expect(ws.call).toHaveBeenCalledWith('truecommand.update', [{ + expect(api.call).toHaveBeenCalledWith('truecommand.update', [{ api_key: '1234567890123456', enabled: true, }]); @@ -182,7 +182,7 @@ describe('TruecommandConnectModalComponent', () => { beforeEach(() => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('sends an update payload', async () => { @@ -196,7 +196,7 @@ describe('TruecommandConnectModalComponent', () => { expect(await submitButton.isDisabled()).toBeFalsy(); await submitButton.click(); - expect(ws.call).toHaveBeenCalledWith('truecommand.update', [{ + expect(api.call).toHaveBeenCalledWith('truecommand.update', [{ api_key: 'qwertyuiopasdfgh', enabled: false, }]); @@ -228,7 +228,7 @@ describe('TruecommandConnectModalComponent', () => { jest.spyOn(dialogServiceMock, 'generalDialog').mockReturnValue(of(true)); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('sends an update payload', async () => { @@ -236,7 +236,7 @@ describe('TruecommandConnectModalComponent', () => { expect(await deregisterButton.isDisabled()).toBeFalsy(); await deregisterButton.click(); - expect(ws.call).toHaveBeenCalledWith('truecommand.update', [{ + expect(api.call).toHaveBeenCalledWith('truecommand.update', [{ api_key: null, enabled: false, }]); diff --git a/src/app/modules/truecommand/components/truecommand-connect-modal/truecommand-connect-modal.component.ts b/src/app/modules/truecommand/components/truecommand-connect-modal/truecommand-connect-modal.component.ts index 635910fc226..c06dd9f9bb1 100644 --- a/src/app/modules/truecommand/components/truecommand-connect-modal/truecommand-connect-modal.component.ts +++ b/src/app/modules/truecommand/components/truecommand-connect-modal/truecommand-connect-modal.component.ts @@ -71,7 +71,7 @@ export class TruecommandConnectModalComponent implements OnInit { private dialogRef: MatDialogRef, private fb: FormBuilder, private loader: AppLoaderService, - private ws: ApiService, + private api: ApiService, ) {} ngOnInit(): void { @@ -102,7 +102,7 @@ export class TruecommandConnectModalComponent implements OnInit { params.api_key = this.form.value.api_key; } - this.ws.call('truecommand.update', [params]).pipe(untilDestroyed(this)).subscribe({ + this.api.call('truecommand.update', [params]).pipe(untilDestroyed(this)).subscribe({ next: () => { this.loader.close(); this.dialogRef.close(); @@ -133,7 +133,7 @@ export class TruecommandConnectModalComponent implements OnInit { } this.loader.open(); - this.ws.call('truecommand.update', [{ api_key: null, enabled: false }]) + this.api.call('truecommand.update', [{ api_key: null, enabled: false }]) .pipe(untilDestroyed(this)) .subscribe({ next: () => { diff --git a/src/app/pages/apps/components/app-detail-view/app-details-header/app-details-header.component.ts b/src/app/pages/apps/components/app-detail-view/app-details-header/app-details-header.component.ts index 1de39be5cd4..dee571712d3 100644 --- a/src/app/pages/apps/components/app-detail-view/app-details-header/app-details-header.component.ts +++ b/src/app/pages/apps/components/app-detail-view/app-details-header/app-details-header.component.ts @@ -60,7 +60,7 @@ export class AppDetailsHeaderComponent { private authService: AuthService, private dialogService: DialogService, private translate: TranslateService, - private ws: ApiService, + private api: ApiService, private viewContainerRef: ViewContainerRef, ) { } @@ -108,7 +108,7 @@ export class AppDetailsHeaderComponent { disableClose: true, }).pipe( filter(Boolean), - switchMap(() => this.ws.call('auth.set_attribute', ['appsAgreement', true])), + switchMap(() => this.api.call('auth.set_attribute', ['appsAgreement', true])), switchMap(() => this.authService.refreshUser()), ); }), diff --git a/src/app/pages/apps/components/app-detail-view/app-resources-card/app-resources-card.component.ts b/src/app/pages/apps/components/app-detail-view/app-resources-card/app-resources-card.component.ts index 5c89d59fed8..d732244b2a8 100644 --- a/src/app/pages/apps/components/app-detail-view/app-resources-card/app-resources-card.component.ts +++ b/src/app/pages/apps/components/app-detail-view/app-resources-card/app-resources-card.component.ts @@ -32,11 +32,11 @@ export class AppResourcesCardComponent implements OnInit { readonly cpuPercentage = signal(0); readonly memoryUsed = signal(0); readonly memoryTotal = signal(0); - readonly availableSpace$ = this.ws.call('app.available_space'); + readonly availableSpace$ = this.api.call('app.available_space'); readonly selectedPool = toSignal(this.dockerStore.selectedPool$); constructor( - private ws: ApiService, + private api: ApiService, private dockerStore: DockerStore, ) {} @@ -45,7 +45,7 @@ export class AppResourcesCardComponent implements OnInit { } getResourcesUsageUpdates(): void { - this.ws.subscribe('reporting.realtime').pipe( + this.api.subscribe('reporting.realtime').pipe( map((event) => event.fields), throttleTime(2000), untilDestroyed(this), diff --git a/src/app/pages/apps/components/app-wizard/app-wizard.component.ts b/src/app/pages/apps/components/app-wizard/app-wizard.component.ts index 79064b8501c..63337e2abac 100644 --- a/src/app/pages/apps/components/app-wizard/app-wizard.component.ts +++ b/src/app/pages/apps/components/app-wizard/app-wizard.component.ts @@ -156,7 +156,7 @@ export class AppWizardComponent implements OnInit, OnDestroy { private router: Router, private errorHandler: ErrorHandlerService, private dockerStore: DockerStore, - private ws: ApiService, + private api: ApiService, private authService: AuthService, private matDialog: MatDialog, ) {} @@ -268,7 +268,7 @@ export class AppWizardComponent implements OnInit, OnDestroy { if (this.isNew) { const version = data.version; delete data.version; - job$ = this.ws.job('app.create', [ + job$ = this.api.job('app.create', [ { values: data, catalog_app: this.catalogApp.name, @@ -279,7 +279,7 @@ export class AppWizardComponent implements OnInit, OnDestroy { ]); } else { delete data.release_name; - job$ = this.ws.job('app.update', [ + job$ = this.api.job('app.update', [ this.config.release_name as string, { values: data }, ]); @@ -561,7 +561,7 @@ export class AppWizardComponent implements OnInit, OnDestroy { } private getDockerHubRateLimitInfo(): void { - this.ws.call('app.image.dockerhub_rate_limit').pipe(untilDestroyed(this)).subscribe((info) => { + this.api.call('app.image.dockerhub_rate_limit').pipe(untilDestroyed(this)).subscribe((info) => { if (info.remaining_pull_limit < 5) { this.matDialog.open(DockerHubRateInfoDialogComponent, { data: info, diff --git a/src/app/pages/apps/components/available-apps/available-apps-header/available-apps-header.component.ts b/src/app/pages/apps/components/available-apps/available-apps-header/available-apps-header.component.ts index 6263725c5f1..3150f0b8bb0 100644 --- a/src/app/pages/apps/components/available-apps/available-apps-header/available-apps-header.component.ts +++ b/src/app/pages/apps/components/available-apps/available-apps-header/available-apps-header.component.ts @@ -88,7 +88,7 @@ export class AvailableAppsHeaderComponent implements OnInit, AfterViewInit { constructor( private fb: FormBuilder, - private ws: ApiService, + private api: ApiService, private translate: TranslateService, private cdr: ChangeDetectorRef, private dialogService: DialogService, @@ -147,7 +147,7 @@ export class AvailableAppsHeaderComponent implements OnInit, AfterViewInit { refreshCatalog(): void { this.dialogService.jobDialog( - this.ws.job('catalog.sync'), + this.api.job('catalog.sync'), { title: this.translate.instant(helptextApps.refreshing), canMinimize: true, diff --git a/src/app/pages/apps/components/catalog-settings/apps-settings.component.ts b/src/app/pages/apps/components/catalog-settings/apps-settings.component.ts index f4dd90f41cc..f89d01d3531 100644 --- a/src/app/pages/apps/components/catalog-settings/apps-settings.component.ts +++ b/src/app/pages/apps/components/catalog-settings/apps-settings.component.ts @@ -82,7 +82,7 @@ export class AppsSettingsComponent implements OnInit { }>>([]), }); - protected allTrains$ = this.ws.call('catalog.trains').pipe( + protected allTrains$ = this.api.call('catalog.trains').pipe( singleArrayToOptions(), ); @@ -95,7 +95,7 @@ export class AppsSettingsComponent implements OnInit { constructor( private dockerStore: DockerStore, - private ws: ApiService, + private api: ApiService, private slideInRef: SlideInRef, private errorHandler: FormErrorHandlerService, private fb: FormBuilder, @@ -108,7 +108,7 @@ export class AppsSettingsComponent implements OnInit { setupForm(): void { combineLatest([ - this.ws.call('catalog.config'), + this.api.call('catalog.config'), this.dockerStore.dockerConfig$.pipe(filter(Boolean), take(1)), ]) .pipe(untilDestroyed(this)) @@ -149,8 +149,8 @@ export class AppsSettingsComponent implements OnInit { this.isFormLoading.set(true); forkJoin([ - this.ws.call('catalog.update', [{ preferred_trains: values.preferred_trains } as CatalogUpdate]), - this.ws.job('docker.update', [{ + this.api.call('catalog.update', [{ preferred_trains: values.preferred_trains } as CatalogUpdate]), + this.api.job('docker.update', [{ enable_image_updates: values.enable_image_updates, address_pools: values.address_pools, }]), diff --git a/src/app/pages/apps/components/custom-app-form/custom-app-form.component.ts b/src/app/pages/apps/components/custom-app-form/custom-app-form.component.ts index 33625712fb8..b55d9d8b126 100644 --- a/src/app/pages/apps/components/custom-app-form/custom-app-form.component.ts +++ b/src/app/pages/apps/components/custom-app-form/custom-app-form.component.ts @@ -65,7 +65,7 @@ export class CustomAppFormComponent implements OnInit { constructor( private fb: FormBuilder, private translate: TranslateService, - private ws: ApiService, + private api: ApiService, private errorHandler: ErrorHandlerService, private dialogService: DialogService, private appService: ApplicationsService, @@ -103,7 +103,7 @@ export class CustomAppFormComponent implements OnInit { this.isLoading.set(true); const data = this.form.value; - const appCreate$ = this.ws.job( + const appCreate$ = this.api.job( 'app.create', [{ custom_app: true, @@ -112,7 +112,7 @@ export class CustomAppFormComponent implements OnInit { } as AppCreate], ); - const appUpdate$ = this.ws.job('app.update', [ + const appUpdate$ = this.api.job('app.update', [ data.release_name, { custom_compose_config_string: data.custom_compose_config_string }, ]); diff --git a/src/app/pages/apps/components/docker-images/docker-image-delete-dialog/docker-image-delete-dialog.component.ts b/src/app/pages/apps/components/docker-images/docker-image-delete-dialog/docker-image-delete-dialog.component.ts index 3edef092327..e4896421faf 100644 --- a/src/app/pages/apps/components/docker-images/docker-image-delete-dialog/docker-image-delete-dialog.component.ts +++ b/src/app/pages/apps/components/docker-images/docker-image-delete-dialog/docker-image-delete-dialog.component.ts @@ -67,7 +67,7 @@ export class DockerImageDeleteDialogComponent { constructor( private fb: FormBuilder, - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private dialogRef: MatDialogRef, @Inject(MAT_DIALOG_DATA) public images: ContainerImage[], @@ -86,7 +86,7 @@ export class DockerImageDeleteDialogComponent { this.bulkItems.set(image.id, { state: BulkListItemState.Running, item: image }); }); - this.ws.job('core.bulk', ['app.image.delete', deleteParams]).pipe( + this.api.job('core.bulk', ['app.image.delete', deleteParams]).pipe( filter((job: Job[], DeleteContainerImageParams[]>) => !!job.result), untilDestroyed(this), ).subscribe((response) => { diff --git a/src/app/pages/apps/components/docker-images/docker-images-list/docker-images-list.component.ts b/src/app/pages/apps/components/docker-images/docker-images-list/docker-images-list.component.ts index b5391a3fade..90fa9a8a855 100644 --- a/src/app/pages/apps/components/docker-images/docker-images-list/docker-images-list.component.ts +++ b/src/app/pages/apps/components/docker-images/docker-images-list/docker-images-list.component.ts @@ -133,7 +133,7 @@ export class DockerImagesListComponent implements OnInit { constructor( public emptyService: EmptyService, public formatter: IxFormatterService, - private ws: ApiService, + private api: ApiService, private matDialog: MatDialog, private slideInService: SlideInService, private translate: TranslateService, @@ -142,7 +142,7 @@ export class DockerImagesListComponent implements OnInit { } ngOnInit(): void { - const containerImages$ = this.ws.call('app.image.query').pipe( + const containerImages$ = this.api.call('app.image.query').pipe( map((images) => images.map((image) => ({ ...image, selected: false }))), tap((images) => this.containerImages = images), ); diff --git a/src/app/pages/apps/components/docker-images/pull-image-form/pull-image-form.component.spec.ts b/src/app/pages/apps/components/docker-images/pull-image-form/pull-image-form.component.spec.ts index 89e05bf43bd..bb4c30936e3 100644 --- a/src/app/pages/apps/components/docker-images/pull-image-form/pull-image-form.component.spec.ts +++ b/src/app/pages/apps/components/docker-images/pull-image-form/pull-image-form.component.spec.ts @@ -18,7 +18,7 @@ import { SlideInService } from 'app/services/slide-in.service'; describe('PullImageFormComponent', () => { let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; const createComponent = createComponentFactory({ component: PullImageFormComponent, imports: [ @@ -44,7 +44,7 @@ describe('PullImageFormComponent', () => { beforeEach(() => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('pulls docker image when form is submitted', async () => { @@ -60,7 +60,7 @@ describe('PullImageFormComponent', () => { await saveButton.click(); expect(spectator.inject(DialogService).jobDialog).toHaveBeenCalled(); - expect(ws.job).toHaveBeenCalledWith('app.image.pull', [{ + expect(api.job).toHaveBeenCalledWith('app.image.pull', [{ auth_config: { username: 'john', password: '12345678', diff --git a/src/app/pages/apps/components/docker-images/pull-image-form/pull-image-form.component.ts b/src/app/pages/apps/components/docker-images/pull-image-form/pull-image-form.component.ts index dfab91ad1a5..e512e4c2a5c 100644 --- a/src/app/pages/apps/components/docker-images/pull-image-form/pull-image-form.component.ts +++ b/src/app/pages/apps/components/docker-images/pull-image-form/pull-image-form.component.ts @@ -60,7 +60,7 @@ export class PullImageFormComponent { }; constructor( - private ws: ApiService, + private api: ApiService, private slideInRef: SlideInRef, private cdr: ChangeDetectorRef, private errorHandler: ErrorHandlerService, @@ -88,7 +88,7 @@ export class PullImageFormComponent { this.isFormLoading = true; this.dialogService.jobDialog( - this.ws.job('app.image.pull', [params]), + this.api.job('app.image.pull', [params]), { title: this.translate.instant('Pulling...') }, ) .afterClosed() diff --git a/src/app/pages/apps/components/installed-apps/app-bulk-upgrade/app-bulk-upgrade.component.ts b/src/app/pages/apps/components/installed-apps/app-bulk-upgrade/app-bulk-upgrade.component.ts index d928661dd65..b167feb9002 100644 --- a/src/app/pages/apps/components/installed-apps/app-bulk-upgrade/app-bulk-upgrade.component.ts +++ b/src/app/pages/apps/components/installed-apps/app-bulk-upgrade/app-bulk-upgrade.component.ts @@ -82,7 +82,7 @@ export class AppBulkUpgradeComponent { constructor( private formBuilder: FormBuilder, - private ws: ApiService, + private api: ApiService, private translate: TranslateService, private dialogRef: MatDialogRef, private appService: ApplicationsService, @@ -154,7 +154,7 @@ export class AppBulkUpgradeComponent { return params; }); - this.ws + this.api .job('core.bulk', ['app.upgrade', payload]) .pipe(untilDestroyed(this)) .subscribe(() => { diff --git a/src/app/pages/apps/components/installed-apps/app-info-card/app-info-card.component.ts b/src/app/pages/apps/components/installed-apps/app-info-card/app-info-card.component.ts index ff979566896..427025a8ad3 100644 --- a/src/app/pages/apps/components/installed-apps/app-info-card/app-info-card.component.ts +++ b/src/app/pages/apps/components/installed-apps/app-info-card/app-info-card.component.ts @@ -91,7 +91,7 @@ export class AppInfoCardComponent { }); constructor( - private ws: ApiService, + private api: ApiService, private loader: AppLoaderService, private redirect: RedirectService, private errorHandler: ErrorHandlerService, @@ -133,7 +133,7 @@ export class AppInfoCardComponent { filter(Boolean), switchMap( (version: string) => this.dialogService.jobDialog( - this.ws.job('app.upgrade', [name, { app_version: version }]), + this.api.job('app.upgrade', [name, { app_version: version }]), { title: helptextApps.apps.upgrade_dialog.job }, ).afterClosed(), ), @@ -172,7 +172,7 @@ export class AppInfoCardComponent { executeDelete(name: string, removeIxVolumes = false): void { this.dialogService.jobDialog( - this.ws.job('app.delete', [name, { remove_images: true, remove_ix_volumes: removeIxVolumes }]), + this.api.job('app.delete', [name, { remove_images: true, remove_ix_volumes: removeIxVolumes }]), { title: helptextApps.apps.delete_dialog.job }, ) .afterClosed() @@ -202,7 +202,7 @@ export class AppInfoCardComponent { } private updateRollbackSetup(appName: string): void { - this.ws.call('app.rollback_versions', [appName]).pipe( + this.api.call('app.rollback_versions', [appName]).pipe( tap((versions) => this.isRollbackPossible.set(versions.length > 0)), untilDestroyed(this), ).subscribe(); diff --git a/src/app/pages/apps/components/installed-apps/app-rollback-modal/app-rollback-modal.component.ts b/src/app/pages/apps/components/installed-apps/app-rollback-modal/app-rollback-modal.component.ts index 328d1ae7d93..1bbaaaea8df 100644 --- a/src/app/pages/apps/components/installed-apps/app-rollback-modal/app-rollback-modal.component.ts +++ b/src/app/pages/apps/components/installed-apps/app-rollback-modal/app-rollback-modal.component.ts @@ -57,7 +57,7 @@ export class AppRollbackModalComponent { constructor( private dialogRef: MatDialogRef, - private ws: ApiService, + private api: ApiService, private dialogService: DialogService, private formBuilder: FormBuilder, private errorHandler: ErrorHandlerService, @@ -70,7 +70,7 @@ export class AppRollbackModalComponent { const rollbackParams = [this.app.name, this.form.value] as Required; this.dialogService.jobDialog( - this.ws.job('app.rollback', rollbackParams), + this.api.job('app.rollback', rollbackParams), { title: helptextApps.apps.rollback_dialog.job }, ) .afterClosed() @@ -79,7 +79,7 @@ export class AppRollbackModalComponent { } private setVersionOptions(): void { - this.ws.call('app.rollback_versions', [this.app.name]).pipe( + this.api.call('app.rollback_versions', [this.app.name]).pipe( tap((versions) => { const options = versions.map((version) => ({ label: version, diff --git a/src/app/pages/apps/components/installed-apps/container-logs/container-logs.component.ts b/src/app/pages/apps/components/installed-apps/container-logs/container-logs.component.ts index c555294cd92..696d210d1f4 100644 --- a/src/app/pages/apps/components/installed-apps/container-logs/container-logs.component.ts +++ b/src/app/pages/apps/components/installed-apps/container-logs/container-logs.component.ts @@ -61,7 +61,7 @@ export class ContainerLogsComponent implements OnInit { logs: ContainerLogEvent[] = []; constructor( - private ws: ApiService, + private api: ApiService, private dialogService: DialogService, protected aroute: ActivatedRoute, protected loader: AppLoaderService, @@ -105,7 +105,7 @@ export class ContainerLogsComponent implements OnInit { this.logs = []; this.isLoading = true; }), - switchMap(() => this.ws.subscribeToLogs(this.subscriptionMethod)), + switchMap(() => this.api.subscribeToLogs(this.subscriptionMethod)), map((apiEvent) => apiEvent.fields), untilDestroyed(this), ).subscribe({ diff --git a/src/app/pages/apps/components/installed-apps/installed-apps.component.ts b/src/app/pages/apps/components/installed-apps/installed-apps.component.ts index 2c753684f50..d30e23b5b29 100644 --- a/src/app/pages/apps/components/installed-apps/installed-apps.component.ts +++ b/src/app/pages/apps/components/installed-apps/installed-apps.component.ts @@ -200,7 +200,7 @@ export class InstalledAppsComponent implements OnInit, AfterViewInit { protected readonly requiredRoles = [Role.AppsWrite]; constructor( - private ws: ApiService, + private api: ApiService, private appService: ApplicationsService, private cdr: ChangeDetectorRef, private activatedRoute: ActivatedRoute, @@ -487,7 +487,7 @@ export class InstalledAppsComponent implements OnInit, AfterViewInit { ]); return this.dialogService.jobDialog( - this.ws.job('core.bulk', ['app.delete', bulkDeletePayload]), + this.api.job('core.bulk', ['app.delete', bulkDeletePayload]), { title: helptextApps.apps.delete_dialog.job }, ).afterClosed(); } diff --git a/src/app/pages/apps/services/applications.service.ts b/src/app/pages/apps/services/applications.service.ts index 7f3006ee5eb..91667b468e5 100644 --- a/src/app/pages/apps/services/applications.service.ts +++ b/src/app/pages/apps/services/applications.service.ts @@ -28,22 +28,25 @@ export function filterIgnoredApps(): OperatorFunction { - return this.ws.call('app.ix_volume.exists', [appName]); + return this.api.call('app.ix_volume.exists', [appName]); } getPoolList(): Observable { - return this.ws.call('pool.query'); + return this.api.call('pool.query'); } getCatalogAppDetails(name: string, train: string): Observable { - return this.ws.call('catalog.get_app_details', [name, { train }]); + return this.api.call('catalog.get_app_details', [name, { train }]); } getAllAppsCategories(): Observable { - return this.ws.call('app.categories'); + return this.api.call('app.categories'); } getLatestApps(filters?: AppsFiltersValues): Observable { @@ -55,15 +58,15 @@ export class ApplicationsService { } getSimilarApps(app: AvailableApp): Observable { - return this.ws.call('app.similar', [app.name, app.train]); + return this.api.call('app.similar', [app.name, app.train]); } getAllApps(): Observable { - return this.ws.call('app.query', [[], { extra: { retrieve_config: true } }]); + return this.api.call('app.query', [[], { extra: { retrieve_config: true } }]); } getApp(name: string): Observable { - return this.ws.call('app.query', [[['name', '=', name]], { + return this.api.call('app.query', [[['name', '=', name]], { extra: { include_app_schema: true, retrieve_config: true, @@ -72,11 +75,11 @@ export class ApplicationsService { } getInstalledAppsUpdates(): Observable> { - return this.ws.subscribe('app.query'); + return this.api.subscribe('app.query'); } getInstalledAppsStatusUpdates(): Observable>> { - return this.ws.subscribe('core.get_jobs').pipe( + return this.api.subscribe('core.get_jobs').pipe( filter((event: ApiEvent>) => { return ['app.start', 'app.stop'].includes(event.fields.method); }), @@ -88,19 +91,19 @@ export class ApplicationsService { if (version) { payload.push({ app_version: version }); } - return this.ws.call('app.upgrade_summary', payload); + return this.api.call('app.upgrade_summary', payload); } startApplication(name: string): Observable> { - return this.ws.job('app.start', [name]); + return this.api.job('app.start', [name]); } stopApplication(name: string): Observable> { - return this.ws.job('app.stop', [name]); + return this.api.job('app.stop', [name]); } restartApplication(name: string): Observable> { - return this.ws.job('app.redeploy', [name]); + return this.api.job('app.redeploy', [name]); } convertDateToRelativeDate(date: Date): string { @@ -127,7 +130,7 @@ export class ApplicationsService { delete filters.sort; } if (!filters || (filters && !Object.keys(filters).length)) { - return this.ws.call(endPoint).pipe(filterIgnoredApps()); + return this.api.call(endPoint).pipe(filterIgnoredApps()); } const firstOption: QueryFilters = []; @@ -146,6 +149,6 @@ export class ApplicationsService { const secondOption = filters.sort ? { order_by: [filters.sort] } : {}; - return this.ws.call(endPoint, [firstOption, secondOption]).pipe(filterIgnoredApps()); + return this.api.call(endPoint, [firstOption, secondOption]).pipe(filterIgnoredApps()); } } diff --git a/src/app/pages/apps/store/apps-stats.service.ts b/src/app/pages/apps/store/apps-stats.service.ts index 0f0ea02eddd..e283b2728cb 100644 --- a/src/app/pages/apps/store/apps-stats.service.ts +++ b/src/app/pages/apps/store/apps-stats.service.ts @@ -12,7 +12,7 @@ type State = Record; @Injectable() export class AppsStatsService extends ComponentStore { constructor( - private ws: ApiService, + private api: ApiService, ) { super({}); } @@ -22,7 +22,7 @@ export class AppsStatsService extends ComponentStore { } subscribeToUpdates(): void { - this.ws.subscribe('app.stats') + this.api.subscribe('app.stats') .pipe(untilDestroyed(this)) .subscribe((event) => this.onStatisticsReceived(event.fields)); } diff --git a/src/app/pages/apps/store/docker.store.ts b/src/app/pages/apps/store/docker.store.ts index e5b71d6e6e1..d5b58ec8641 100644 --- a/src/app/pages/apps/store/docker.store.ts +++ b/src/app/pages/apps/store/docker.store.ts @@ -49,7 +49,7 @@ export class DockerStore extends ComponentStore { readonly statusDescription$ = this.select((state) => state.statusData.description); constructor( - private ws: ApiService, + private api: ApiService, private dialogService: DialogService, private translate: TranslateService, private errorHandler: ErrorHandlerService, @@ -80,20 +80,20 @@ export class DockerStore extends ComponentStore { }); private getDockerConfig(): Observable { - return this.ws.call('docker.config'); + return this.api.call('docker.config'); } private getDockerNvidiaStatus(): Observable { - return this.ws.call('docker.nvidia_status').pipe(map(({ status }) => status)); + return this.api.call('docker.nvidia_status').pipe(map(({ status }) => status)); } private getDockerStatus(): Observable { - return this.ws.call('docker.status'); + return this.api.call('docker.status'); } setDockerPool(poolName: string): Observable> { return this.dialogService.jobDialog( - this.ws.job('docker.update', [{ pool: poolName }]), + this.api.job('docker.update', [{ pool: poolName }]), { title: this.translate.instant('Configuring...') }, ) .afterClosed() @@ -118,7 +118,7 @@ export class DockerStore extends ComponentStore { setDockerNvidia(nvidiaDriversInstalled: boolean): Observable> { return this.dialogService.jobDialog( - this.ws.job('docker.update', [{ nvidia: nvidiaDriversInstalled }]), + this.api.job('docker.update', [{ nvidia: nvidiaDriversInstalled }]), { title: this.translate.instant('Configuring...') }, ) .afterClosed() @@ -138,7 +138,7 @@ export class DockerStore extends ComponentStore { * stay alive until the component subscription stays alive i.e., until the component is destroyed */ dockerStatusEventUpdates(): Observable { - return this.ws.subscribe('docker.state').pipe( + return this.api.subscribe('docker.state').pipe( map((event) => event.fields), tap((statusData) => { this.patchState({ statusData }); @@ -147,7 +147,7 @@ export class DockerStore extends ComponentStore { } dockerConfigEventUpdates(): Observable { - return this.ws.subscribe('core.get_jobs') + return this.api.subscribe('core.get_jobs') .pipe( filter((event) => event.fields.method === 'docker.update' && !!event.fields.result), map((event) => event.fields.result), diff --git a/src/app/pages/audit/audit.component.ts b/src/app/pages/audit/audit.component.ts index 0de104c86c6..916913a4007 100644 --- a/src/app/pages/audit/audit.component.ts +++ b/src/app/pages/audit/audit.component.ts @@ -158,7 +158,7 @@ export class AuditComponent implements OnInit, OnDestroy { protected searchProperties: SearchProperty[] = []; - private userSuggestions$ = this.ws.call('user.query').pipe( + private userSuggestions$ = this.api.call('user.query').pipe( map((users) => this.mapUsersForSuggestions(users)), take(1), shareReplay({ refCount: true, bufferSize: 1 }), @@ -168,7 +168,7 @@ export class AuditComponent implements OnInit, OnDestroy { constructor( private translate: TranslateService, - private ws: ApiService, + private api: ApiService, protected emptyService: EmptyService, private breakpointObserver: BreakpointObserver, private cdr: ChangeDetectorRef, @@ -187,7 +187,7 @@ export class AuditComponent implements OnInit, OnDestroy { } ngOnInit(): void { - this.dataProvider = new AuditApiDataProvider(this.ws); + this.dataProvider = new AuditApiDataProvider(this.api); this.dataProvider.paginationStrategy = new PaginationServerSide(); this.dataProvider.sortingStrategy = new SortingServerSide(); this.setDefaultSort(); diff --git a/src/app/pages/audit/utils/audit-api-data-provider.ts b/src/app/pages/audit/utils/audit-api-data-provider.ts index b5a6b845f66..d93556ee0e5 100644 --- a/src/app/pages/audit/utils/audit-api-data-provider.ts +++ b/src/app/pages/audit/utils/audit-api-data-provider.ts @@ -20,8 +20,8 @@ export class AuditApiDataProvider extends ApiDataProvider<'audit.query'> { return this.totalRows && !this.isLastOffset && isEqual(this.lastParams, this.params[0]); } - constructor(ws: ApiService) { - super(ws, 'audit.query'); + constructor(api: ApiService) { + super(api, 'audit.query'); } protected override countRows(): Observable { @@ -39,7 +39,7 @@ export class AuditApiDataProvider extends ApiDataProvider<'audit.query'> { }), }]; - return this.ws.call(this.method, params) as unknown as Observable; + return this.api.call(this.method, params) as unknown as Observable; } protected override prepareParams(params: ApiCallParams<'audit.query'>): ApiCallParams<'audit.query'> { diff --git a/src/app/pages/credentials/backup-credentials/cloud-credentials-card/cloud-credentials-card.component.ts b/src/app/pages/credentials/backup-credentials/cloud-credentials-card/cloud-credentials-card.component.ts index 9d02d14ddb8..27487a8e30c 100644 --- a/src/app/pages/credentials/backup-credentials/cloud-credentials-card/cloud-credentials-card.component.ts +++ b/src/app/pages/credentials/backup-credentials/cloud-credentials-card/cloud-credentials-card.component.ts @@ -95,7 +95,7 @@ export class CloudCredentialsCardComponent implements OnInit { }); constructor( - private ws: ApiService, + private api: ApiService, private translate: TranslateService, protected emptyService: EmptyService, private chainedSlideinService: ChainedSlideInService, @@ -104,7 +104,7 @@ export class CloudCredentialsCardComponent implements OnInit { ) {} ngOnInit(): void { - const credentials$ = this.ws.call('cloudsync.credentials.query').pipe( + const credentials$ = this.api.call('cloudsync.credentials.query').pipe( tap((credentials) => this.credentials = credentials), untilDestroyed(this), ); @@ -164,7 +164,7 @@ export class CloudCredentialsCardComponent implements OnInit { }) .pipe( filter(Boolean), - switchMap(() => this.ws.call('cloudsync.credentials.delete', [credential.id])), + switchMap(() => this.api.call('cloudsync.credentials.delete', [credential.id])), untilDestroyed(this), ) .subscribe(() => { diff --git a/src/app/pages/credentials/backup-credentials/cloud-credentials-form/cloud-credentials-form.component.ts b/src/app/pages/credentials/backup-credentials/cloud-credentials-form/cloud-credentials-form.component.ts index 80cb6c55bf3..ca146d51049 100644 --- a/src/app/pages/credentials/backup-credentials/cloud-credentials-form/cloud-credentials-form.component.ts +++ b/src/app/pages/credentials/backup-credentials/cloud-credentials-form/cloud-credentials-form.component.ts @@ -90,7 +90,7 @@ export class CloudCredentialsFormComponent implements OnInit { readonly helptext = helptext; constructor( - private ws: ApiService, + private api: ApiService, private formBuilder: FormBuilder, private cdr: ChangeDetectorRef, private errorHandler: ErrorHandlerService, @@ -153,8 +153,8 @@ export class CloudCredentialsFormComponent implements OnInit { switchMap(() => { const payload = this.preparePayload(); return this.isNew - ? this.ws.call('cloudsync.credentials.create', [payload]) - : this.ws.call('cloudsync.credentials.update', [this.existingCredential.id, payload]); + ? this.api.call('cloudsync.credentials.create', [payload]) + : this.api.call('cloudsync.credentials.update', [this.existingCredential.id, payload]); }), untilDestroyed(this), ) @@ -188,7 +188,7 @@ export class CloudCredentialsFormComponent implements OnInit { switchMap(() => { const { name, ...payload } = this.preparePayload(); - return this.ws.call('cloudsync.credentials.verify', [payload]); + return this.api.call('cloudsync.credentials.verify', [payload]); }), untilDestroyed(this), ) diff --git a/src/app/pages/credentials/backup-credentials/cloud-credentials-form/provider-forms/sftp-provider-form/sftp-provider-form.component.ts b/src/app/pages/credentials/backup-credentials/cloud-credentials-form/provider-forms/sftp-provider-form/sftp-provider-form.component.ts index 203bf9c0cef..f45db69c1de 100644 --- a/src/app/pages/credentials/backup-credentials/cloud-credentials-form/provider-forms/sftp-provider-form/sftp-provider-form.component.ts +++ b/src/app/pages/credentials/backup-credentials/cloud-credentials-form/provider-forms/sftp-provider-form/sftp-provider-form.component.ts @@ -56,7 +56,7 @@ export class SftpProviderFormComponent extends BaseProviderFormComponent impleme override readonly helptext = helptext; constructor( - private ws: ApiService, + private api: ApiService, private formBuilder: FormBuilder, private translate: TranslateService, private cdr: ChangeDetectorRef, @@ -76,7 +76,7 @@ export class SftpProviderFormComponent extends BaseProviderFormComponent impleme } private loadPrivateKeys(): void { - this.privateKeys$ = this.ws.call('keychaincredential.query', [[['type', '=', KeychainCredentialType.SshKeyPair]]]) + this.privateKeys$ = this.api.call('keychaincredential.query', [[['type', '=', KeychainCredentialType.SshKeyPair]]]) .pipe( idNameArrayToOptions(), map((options) => { @@ -92,7 +92,7 @@ export class SftpProviderFormComponent extends BaseProviderFormComponent impleme } private makeNewKeypair(): Observable { - return this.ws.call('keychaincredential.generate_ssh_key_pair').pipe( + return this.api.call('keychaincredential.generate_ssh_key_pair').pipe( switchMap((keypair) => { const createCredential = { name: this.translate.instant('{key} Key', { @@ -102,7 +102,7 @@ export class SftpProviderFormComponent extends BaseProviderFormComponent impleme attributes: keypair, }; - return this.ws.call('keychaincredential.create', [createCredential]).pipe( + return this.api.call('keychaincredential.create', [createCredential]).pipe( tap((createdKey) => { this.loadPrivateKeys(); this.form.patchValue({ diff --git a/src/app/pages/credentials/backup-credentials/ssh-connection-card/ssh-connection-card.component.ts b/src/app/pages/credentials/backup-credentials/ssh-connection-card/ssh-connection-card.component.ts index cf87bc26dba..9863434a1ab 100644 --- a/src/app/pages/credentials/backup-credentials/ssh-connection-card/ssh-connection-card.component.ts +++ b/src/app/pages/credentials/backup-credentials/ssh-connection-card/ssh-connection-card.component.ts @@ -88,7 +88,7 @@ export class SshConnectionCardComponent implements OnInit { }); constructor( - private ws: ApiService, + private api: ApiService, private chainedSlideInService: ChainedSlideInService, private translate: TranslateService, protected emptyService: EmptyService, @@ -139,7 +139,7 @@ export class SshConnectionCardComponent implements OnInit { }) .pipe( filter(Boolean), - switchMap(() => this.ws.call('keychaincredential.delete', [credential.id])), + switchMap(() => this.api.call('keychaincredential.delete', [credential.id])), untilDestroyed(this), ) .subscribe(() => { diff --git a/src/app/pages/credentials/backup-credentials/ssh-connection-form/ssh-connection-form.component.ts b/src/app/pages/credentials/backup-credentials/ssh-connection-form/ssh-connection-form.component.ts index 0dca0346e4b..8f87dfde182 100644 --- a/src/app/pages/credentials/backup-credentials/ssh-connection-form/ssh-connection-form.component.ts +++ b/src/app/pages/credentials/backup-credentials/ssh-connection-form/ssh-connection-form.component.ts @@ -163,7 +163,7 @@ export class SshConnectionFormComponent implements OnInit { constructor( private formBuilder: FormBuilder, private translate: TranslateService, - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private formErrorHandler: FormErrorHandlerService, private errorHandler: ErrorHandlerService, @@ -205,7 +205,7 @@ export class SshConnectionFormComponent implements OnInit { connect_timeout: this.form.controls.connect_timeout.value, }; - this.ws.call('keychaincredential.remote_ssh_host_key_scan', [requestParams]) + this.api.call('keychaincredential.remote_ssh_host_key_scan', [requestParams]) .pipe(this.loader.withLoader(), untilDestroyed(this)) .subscribe({ next: (remoteHostKey) => { @@ -273,7 +273,7 @@ export class SshConnectionFormComponent implements OnInit { }; } - return this.ws.call('keychaincredential.setup_ssh_connection', [params]).pipe( + return this.api.call('keychaincredential.setup_ssh_connection', [params]).pipe( catchError((error: ApiError) => { if (error.errname.includes(sslCertificationError) || error.reason.includes(sslCertificationError)) { return this.dialogService.error(this.errorHandler.parseError(error)).pipe( @@ -286,7 +286,7 @@ export class SshConnectionFormComponent implements OnInit { switchMap((retry) => { if (retry) { params.semi_automatic_setup.verify_ssl = false; - return this.ws.call('keychaincredential.setup_ssh_connection', [params]); + return this.api.call('keychaincredential.setup_ssh_connection', [params]); } return throwError(() => error); }), @@ -311,6 +311,6 @@ export class SshConnectionFormComponent implements OnInit { } as SshCredentials, }; - return this.ws.call('keychaincredential.update', [this.existingConnection.id, params]); + return this.api.call('keychaincredential.update', [this.existingConnection.id, params]); } } diff --git a/src/app/pages/credentials/backup-credentials/ssh-keypair-card/ssh-keypair-card.component.ts b/src/app/pages/credentials/backup-credentials/ssh-keypair-card/ssh-keypair-card.component.ts index 2a0971322cb..b95a7261d47 100644 --- a/src/app/pages/credentials/backup-credentials/ssh-keypair-card/ssh-keypair-card.component.ts +++ b/src/app/pages/credentials/backup-credentials/ssh-keypair-card/ssh-keypair-card.component.ts @@ -96,7 +96,7 @@ export class SshKeypairCardComponent implements OnInit { }); constructor( - private ws: ApiService, + private api: ApiService, private slideInService: SlideInService, private translate: TranslateService, protected emptyService: EmptyService, @@ -152,7 +152,7 @@ export class SshKeypairCardComponent implements OnInit { }) .pipe( filter(Boolean), - switchMap(() => this.ws.call('keychaincredential.delete', [credential.id])), + switchMap(() => this.api.call('keychaincredential.delete', [credential.id])), untilDestroyed(this), ) .subscribe(() => { diff --git a/src/app/pages/credentials/backup-credentials/ssh-keypair-form/ssh-keypair-form.component.spec.ts b/src/app/pages/credentials/backup-credentials/ssh-keypair-form/ssh-keypair-form.component.spec.ts index bd65d6bae8a..4ec71486021 100644 --- a/src/app/pages/credentials/backup-credentials/ssh-keypair-form/ssh-keypair-form.component.spec.ts +++ b/src/app/pages/credentials/backup-credentials/ssh-keypair-form/ssh-keypair-form.component.spec.ts @@ -24,7 +24,7 @@ import { DownloadService } from 'app/services/download.service'; describe('SshKeypairFormComponent', () => { let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; const fakeSshKeyPair = { id: 23, name: 'existing key', @@ -61,7 +61,7 @@ describe('SshKeypairFormComponent', () => { beforeEach(() => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('sends a create payload to websocket and closes modal when save is pressed', async () => { @@ -75,7 +75,7 @@ describe('SshKeypairFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('keychaincredential.create', [{ + expect(api.call).toHaveBeenCalledWith('keychaincredential.create', [{ name: 'new', type: KeychainCredentialType.SshKeyPair, attributes: { @@ -93,7 +93,7 @@ describe('SshKeypairFormComponent', () => { const form = await loader.getHarness(IxFormHarness); const values = await form.getValues(); - expect(ws.call).toHaveBeenLastCalledWith('keychaincredential.generate_ssh_key_pair'); + expect(api.call).toHaveBeenLastCalledWith('keychaincredential.generate_ssh_key_pair'); expect(values).toMatchObject({ 'Private Key': 'Generated private key', 'Public Key': 'Generated public key', @@ -144,7 +144,7 @@ describe('SshKeypairFormComponent', () => { ], }); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); spectator.component.setKeypairForEditing(); }); @@ -170,7 +170,7 @@ describe('SshKeypairFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('keychaincredential.update', [ + expect(api.call).toHaveBeenCalledWith('keychaincredential.update', [ 23, { name: 'new', diff --git a/src/app/pages/credentials/backup-credentials/ssh-keypair-form/ssh-keypair-form.component.ts b/src/app/pages/credentials/backup-credentials/ssh-keypair-form/ssh-keypair-form.component.ts index c1927e39880..e42e154e197 100644 --- a/src/app/pages/credentials/backup-credentials/ssh-keypair-form/ssh-keypair-form.component.ts +++ b/src/app/pages/credentials/backup-credentials/ssh-keypair-form/ssh-keypair-form.component.ts @@ -89,7 +89,7 @@ export class SshKeypairFormComponent implements OnInit { constructor( private fb: FormBuilder, - private ws: ApiService, + private api: ApiService, private slideInRef: SlideInRef, private cdr: ChangeDetectorRef, private translate: TranslateService, @@ -116,7 +116,7 @@ export class SshKeypairFormComponent implements OnInit { } onGenerateButtonPressed(): void { - this.ws.call('keychaincredential.generate_ssh_key_pair') + this.api.call('keychaincredential.generate_ssh_key_pair') .pipe( this.loader.withLoader(), this.errorHandler.catchError(), @@ -151,12 +151,12 @@ export class SshKeypairFormComponent implements OnInit { this.isFormLoading = true; let request$: Observable; if (this.isNew) { - request$ = this.ws.call('keychaincredential.create', [{ + request$ = this.api.call('keychaincredential.create', [{ ...commonBody, type: KeychainCredentialType.SshKeyPair, }]); } else { - request$ = this.ws.call('keychaincredential.update', [ + request$ = this.api.call('keychaincredential.update', [ this.editingKeypair.id, commonBody, ]); diff --git a/src/app/pages/credentials/certificates-dash/acme-dns-authenticator-list/acme-dns-authenticator-list.component.ts b/src/app/pages/credentials/certificates-dash/acme-dns-authenticator-list/acme-dns-authenticator-list.component.ts index 9365a3db4b0..5b2072e7ecb 100644 --- a/src/app/pages/credentials/certificates-dash/acme-dns-authenticator-list/acme-dns-authenticator-list.component.ts +++ b/src/app/pages/credentials/certificates-dash/acme-dns-authenticator-list/acme-dns-authenticator-list.component.ts @@ -92,7 +92,7 @@ export class AcmeDnsAuthenticatorListComponent implements OnInit { }); constructor( - private ws: ApiService, + private api: ApiService, private slideInService: SlideInService, private translate: TranslateService, protected emptyService: EmptyService, @@ -100,7 +100,7 @@ export class AcmeDnsAuthenticatorListComponent implements OnInit { ) {} ngOnInit(): void { - const authenticators$ = this.ws.call('acme.dns.authenticator.query').pipe( + const authenticators$ = this.api.call('acme.dns.authenticator.query').pipe( tap((authenticators) => this.authenticators = authenticators), untilDestroyed(this), ); @@ -146,7 +146,7 @@ export class AcmeDnsAuthenticatorListComponent implements OnInit { }) .pipe( filter(Boolean), - switchMap(() => this.ws.call('acme.dns.authenticator.delete', [authenticator.id])), + switchMap(() => this.api.call('acme.dns.authenticator.delete', [authenticator.id])), untilDestroyed(this), ) .subscribe(() => { diff --git a/src/app/pages/credentials/certificates-dash/certificate-acme-add/certificate-acme-add.component.ts b/src/app/pages/credentials/certificates-dash/certificate-acme-add/certificate-acme-add.component.ts index 03a80afaeff..7059a753473 100644 --- a/src/app/pages/credentials/certificates-dash/certificate-acme-add/certificate-acme-add.component.ts +++ b/src/app/pages/credentials/certificates-dash/certificate-acme-add/certificate-acme-add.component.ts @@ -76,8 +76,8 @@ export class CertificateAcmeAddComponent { isLoading = false; domains: string[] = []; - readonly acmeDirectoryUris$ = this.ws.call('certificate.acme_server_choices').pipe(choicesToOptions()); - readonly authenticators$ = this.ws.call('acme.dns.authenticator.query').pipe(idNameArrayToOptions()); + readonly acmeDirectoryUris$ = this.api.call('certificate.acme_server_choices').pipe(choicesToOptions()); + readonly authenticators$ = this.api.call('acme.dns.authenticator.query').pipe(idNameArrayToOptions()); readonly helptext = helptextSystemCertificates; @@ -86,7 +86,7 @@ export class CertificateAcmeAddComponent { private validatorsService: IxValidatorsService, private translate: TranslateService, private errorHandler: ErrorHandlerService, - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private dialogService: DialogService, private slideInRef: SlideInRef, @@ -121,7 +121,7 @@ export class CertificateAcmeAddComponent { this.cdr.markForCheck(); this.dialogService.jobDialog( - this.ws.job('certificate.create', [payload]), + this.api.job('certificate.create', [payload]), { title: this.translate.instant('Creating ACME Certificate'), }, @@ -149,7 +149,7 @@ export class CertificateAcmeAddComponent { this.isLoading = true; this.cdr.markForCheck(); - this.ws.call('webui.crypto.get_certificate_domain_names', [this.csr.id]) + this.api.call('webui.crypto.get_certificate_domain_names', [this.csr.id]) .pipe(untilDestroyed(this)) .subscribe({ next: (domains) => { diff --git a/src/app/pages/credentials/certificates-dash/certificate-authority-add/certificate-authority-add.component.ts b/src/app/pages/credentials/certificates-dash/certificate-authority-add/certificate-authority-add.component.ts index 2663ef25b12..163efd12b11 100644 --- a/src/app/pages/credentials/certificates-dash/certificate-authority-add/certificate-authority-add.component.ts +++ b/src/app/pages/credentials/certificates-dash/certificate-authority-add/certificate-authority-add.component.ts @@ -97,7 +97,7 @@ export class CertificateAuthorityAddComponent implements AfterViewInit { summary: SummarySection[]; constructor( - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private translate: TranslateService, private snackbar: SnackbarService, @@ -155,7 +155,7 @@ export class CertificateAuthorityAddComponent implements AfterViewInit { this.cdr.markForCheck(); const payload = this.preparePayload(); - this.ws.call('certificateauthority.create', [payload]) + this.api.call('certificateauthority.create', [payload]) .pipe(untilDestroyed(this)) .subscribe({ complete: () => { diff --git a/src/app/pages/credentials/certificates-dash/certificate-authority-add/steps/ca-identifier-and-type/ca-identifier-and-type.component.ts b/src/app/pages/credentials/certificates-dash/certificate-authority-add/steps/ca-identifier-and-type/ca-identifier-and-type.component.ts index 961ccaf7546..39d55f8b727 100644 --- a/src/app/pages/credentials/certificates-dash/certificate-authority-add/steps/ca-identifier-and-type/ca-identifier-and-type.component.ts +++ b/src/app/pages/credentials/certificates-dash/certificate-authority-add/steps/ca-identifier-and-type/ca-identifier-and-type.component.ts @@ -74,7 +74,7 @@ export class CaIdentifierAndTypeComponent implements OnInit, SummaryProvider { private formBuilder: FormBuilder, private translate: TranslateService, private errorHandler: ErrorHandlerService, - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private validators: IxValidatorsService, ) {} @@ -93,7 +93,7 @@ export class CaIdentifierAndTypeComponent implements OnInit, SummaryProvider { } private loadProfiles(): void { - this.ws.call('webui.crypto.certificateauthority_profiles') + this.api.call('webui.crypto.certificateauthority_profiles') .pipe( this.errorHandler.catchError(), untilDestroyed(this), diff --git a/src/app/pages/credentials/certificates-dash/certificate-authority-edit/certificate-authority-edit.component.ts b/src/app/pages/credentials/certificates-dash/certificate-authority-edit/certificate-authority-edit.component.ts index 07658cfb307..96240bc5753 100644 --- a/src/app/pages/credentials/certificates-dash/certificate-authority-edit/certificate-authority-edit.component.ts +++ b/src/app/pages/credentials/certificates-dash/certificate-authority-edit/certificate-authority-edit.component.ts @@ -65,7 +65,7 @@ export class CertificateAuthorityEditComponent implements OnInit { readonly helptext = helptextSystemCertificates; constructor( - private ws: ApiService, + private api: ApiService, private formBuilder: FormBuilder, private matDialog: MatDialog, private errorHandler: FormErrorHandlerService, @@ -107,7 +107,7 @@ export class CertificateAuthorityEditComponent implements OnInit { onSubmit(): void { this.isLoading = true; - this.ws.call('certificateauthority.update', [this.certificateAuthority.id, this.form.value]) + this.api.call('certificateauthority.update', [this.certificateAuthority.id, this.form.value]) .pipe(untilDestroyed(this)) .subscribe({ next: () => { diff --git a/src/app/pages/credentials/certificates-dash/certificate-authority-list/certificate-authority-list.component.ts b/src/app/pages/credentials/certificates-dash/certificate-authority-list/certificate-authority-list.component.ts index bb5dc395dea..0a1f6301e59 100644 --- a/src/app/pages/credentials/certificates-dash/certificate-authority-list/certificate-authority-list.component.ts +++ b/src/app/pages/credentials/certificates-dash/certificate-authority-list/certificate-authority-list.component.ts @@ -146,7 +146,7 @@ export class CertificateAuthorityListComponent implements OnInit { constructor( private matDialog: MatDialog, - private ws: ApiService, + private api: ApiService, private slideInService: SlideInService, private translate: TranslateService, protected emptyService: EmptyService, @@ -156,7 +156,7 @@ export class CertificateAuthorityListComponent implements OnInit { ) {} ngOnInit(): void { - const authorities$ = this.ws.call('certificateauthority.query').pipe( + const authorities$ = this.api.call('certificateauthority.query').pipe( map((authorities) => { return authorities.map((authority) => { if (isObject(authority.issuer)) { @@ -219,7 +219,7 @@ export class CertificateAuthorityListComponent implements OnInit { }) .pipe( filter(Boolean), - switchMap(() => this.ws.call('certificateauthority.delete', [authority.id])), + switchMap(() => this.api.call('certificateauthority.delete', [authority.id])), untilDestroyed(this), ) .subscribe(() => { @@ -232,7 +232,7 @@ export class CertificateAuthorityListComponent implements OnInit { const isCsr = certificate.cert_type_CSR; const path = isCsr ? certificate.csr_path : certificate.certificate_path; const fileName = `${certificate.name}.${isCsr ? 'csr' : 'crt'}`; - this.ws + this.api .call('core.download', ['filesystem.get', [path], fileName]) .pipe(untilDestroyed(this)) .subscribe({ @@ -259,7 +259,7 @@ export class CertificateAuthorityListComponent implements OnInit { }, }); const keyName = `${certificate.name}.key`; - this.ws + this.api .call('core.download', ['filesystem.get', [certificate.privatekey_path], keyName]) .pipe(untilDestroyed(this)) .subscribe({ @@ -301,7 +301,7 @@ export class CertificateAuthorityListComponent implements OnInit { .pipe( filter(Boolean), switchMap(() => { - return this.ws.call('certificateauthority.update', [certificate.id, { revoked: true }]).pipe( + return this.api.call('certificateauthority.update', [certificate.id, { revoked: true }]).pipe( catchError((error) => { this.dialogService.error(this.errorHandler.parseError(error)); return EMPTY; diff --git a/src/app/pages/credentials/certificates-dash/certificate-edit/certificate-edit.component.ts b/src/app/pages/credentials/certificates-dash/certificate-edit/certificate-edit.component.ts index a8229fb141b..6629f61bcec 100644 --- a/src/app/pages/credentials/certificates-dash/certificate-edit/certificate-edit.component.ts +++ b/src/app/pages/credentials/certificates-dash/certificate-edit/certificate-edit.component.ts @@ -79,7 +79,7 @@ export class CertificateEditComponent implements OnInit { constructor( private formBuilder: FormBuilder, - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private slideInService: SlideInService, private slideInRef: SlideInRef, @@ -141,7 +141,7 @@ export class CertificateEditComponent implements OnInit { onSubmit(): void { this.isLoading = true; - this.ws.job('certificate.update', [this.certificate.id, this.form.value]) + this.api.job('certificate.update', [this.certificate.id, this.form.value]) .pipe(untilDestroyed(this)) .subscribe({ complete: () => { diff --git a/src/app/pages/credentials/certificates-dash/certificate-list/certificate-list.component.ts b/src/app/pages/credentials/certificates-dash/certificate-list/certificate-list.component.ts index 0429fc78b1f..5b066585d05 100644 --- a/src/app/pages/credentials/certificates-dash/certificate-list/certificate-list.component.ts +++ b/src/app/pages/credentials/certificates-dash/certificate-list/certificate-list.component.ts @@ -5,7 +5,6 @@ import { } from '@angular/core'; import { MatButton } from '@angular/material/button'; import { MatCard, MatCardContent } from '@angular/material/card'; -import { MatDialog } from '@angular/material/dialog'; import { MatToolbarRow } from '@angular/material/toolbar'; import { UntilDestroy, untilDestroyed } from '@ngneat/until-destroy'; import { TranslateService, TranslateModule } from '@ngx-translate/core'; @@ -137,8 +136,7 @@ export class CertificateListComponent implements OnInit { }); constructor( - private matDialog: MatDialog, - private ws: ApiService, + private api: ApiService, private slideInService: SlideInService, private translate: TranslateService, protected emptyService: EmptyService, @@ -148,7 +146,7 @@ export class CertificateListComponent implements OnInit { ) {} ngOnInit(): void { - const certificates$ = this.ws.call('certificate.query').pipe( + const certificates$ = this.api.call('certificate.query').pipe( map((certificates) => { return certificates .map((certificate) => { @@ -211,7 +209,7 @@ export class CertificateListComponent implements OnInit { const force = confirmation.secondaryCheckbox; const jobDialogRef = this.dialogService.jobDialog( - this.ws.job('certificate.delete', [certificate.id, force]), + this.api.job('certificate.delete', [certificate.id, force]), { title: this.translate.instant('Deleting...') }, ); @@ -229,7 +227,7 @@ export class CertificateListComponent implements OnInit { const isCsr = certificate.cert_type_CSR; const path = isCsr ? certificate.csr_path : certificate.certificate_path; const fileName = `${certificate.name}.${isCsr ? 'csr' : 'crt'}`; - this.ws + this.api .call('core.download', ['filesystem.get', [path], fileName]) .pipe(untilDestroyed(this)) .subscribe({ @@ -256,7 +254,7 @@ export class CertificateListComponent implements OnInit { }, }); const keyName = `${certificate.name}.key`; - this.ws + this.api .call('core.download', ['filesystem.get', [certificate.privatekey_path], keyName]) .pipe(untilDestroyed(this)) .subscribe({ @@ -299,7 +297,7 @@ export class CertificateListComponent implements OnInit { filter(Boolean), switchMap(() => { return this.dialogService.jobDialog( - this.ws.job('certificate.update', [certificate.id, { revoked: true }]), + this.api.job('certificate.update', [certificate.id, { revoked: true }]), { title: this.translate.instant('Revoking Certificate') }, ).afterClosed(); }), diff --git a/src/app/pages/credentials/certificates-dash/csr-add/csr-add.component.ts b/src/app/pages/credentials/certificates-dash/csr-add/csr-add.component.ts index 74c61bc8f0b..0239f676b9f 100644 --- a/src/app/pages/credentials/certificates-dash/csr-add/csr-add.component.ts +++ b/src/app/pages/credentials/certificates-dash/csr-add/csr-add.component.ts @@ -89,7 +89,7 @@ export class CsrAddComponent { summary: SummarySection[]; constructor( - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private translate: TranslateService, private errorHandler: ErrorHandlerService, @@ -143,7 +143,7 @@ export class CsrAddComponent { this.cdr.markForCheck(); const payload = this.preparePayload(); - this.ws.job('certificate.create', [payload]) + this.api.job('certificate.create', [payload]) .pipe(untilDestroyed(this)) .subscribe({ complete: () => { diff --git a/src/app/pages/credentials/certificates-dash/csr-add/steps/csr-identifier-and-type/csr-identifier-and-type.component.ts b/src/app/pages/credentials/certificates-dash/csr-add/steps/csr-identifier-and-type/csr-identifier-and-type.component.ts index e22bc6437c7..341bd7791d8 100644 --- a/src/app/pages/credentials/certificates-dash/csr-add/steps/csr-identifier-and-type/csr-identifier-and-type.component.ts +++ b/src/app/pages/credentials/certificates-dash/csr-add/steps/csr-identifier-and-type/csr-identifier-and-type.component.ts @@ -71,7 +71,7 @@ export class CsrIdentifierAndTypeComponent implements OnInit, SummaryProvider { constructor( private formBuilder: FormBuilder, private translate: TranslateService, - private ws: ApiService, + private api: ApiService, private errorHandler: ErrorHandlerService, private dialogService: DialogService, private cdr: ChangeDetectorRef, @@ -107,7 +107,7 @@ export class CsrIdentifierAndTypeComponent implements OnInit, SummaryProvider { } private loadProfiles(): void { - this.ws.call('webui.crypto.csr_profiles') + this.api.call('webui.crypto.csr_profiles') .pipe(this.errorHandler.catchError(), untilDestroyed(this)) .subscribe((profiles) => { this.profiles = profiles; diff --git a/src/app/pages/credentials/certificates-dash/csr-list/csr-list.component.ts b/src/app/pages/credentials/certificates-dash/csr-list/csr-list.component.ts index a823c4d269c..87d0e393c11 100644 --- a/src/app/pages/credentials/certificates-dash/csr-list/csr-list.component.ts +++ b/src/app/pages/credentials/certificates-dash/csr-list/csr-list.component.ts @@ -124,7 +124,7 @@ export class CertificateSigningRequestsListComponent implements OnInit { }); constructor( - private ws: ApiService, + private api: ApiService, private slideInService: SlideInService, private translate: TranslateService, protected emptyService: EmptyService, @@ -135,7 +135,7 @@ export class CertificateSigningRequestsListComponent implements OnInit { ) {} ngOnInit(): void { - const certificates$ = this.ws.call('certificate.query').pipe( + const certificates$ = this.api.call('certificate.query').pipe( map((certificates) => certificates.filter((certificate) => certificate.CSR !== null)), tap((certificates) => this.certificates = certificates), untilDestroyed(this), @@ -189,7 +189,7 @@ export class CertificateSigningRequestsListComponent implements OnInit { const force = confirmation.secondaryCheckbox; const jobDialogRef = this.dialogService.jobDialog( - this.ws.job('certificate.delete', [certificate.id, force]), + this.api.job('certificate.delete', [certificate.id, force]), { title: this.translate.instant('Deleting...') }, ); @@ -209,7 +209,7 @@ export class CertificateSigningRequestsListComponent implements OnInit { const isCsr = certificate.cert_type_CSR; const path = isCsr ? certificate.csr_path : certificate.certificate_path; const fileName = `${certificate.name}.${isCsr ? 'csr' : 'crt'}`; - this.ws + this.api .call('core.download', ['filesystem.get', [path], fileName]) .pipe(untilDestroyed(this)) .subscribe({ @@ -236,7 +236,7 @@ export class CertificateSigningRequestsListComponent implements OnInit { }, }); const keyName = `${certificate.name}.key`; - this.ws + this.api .call('core.download', ['filesystem.get', [certificate.privatekey_path], keyName]) .pipe(untilDestroyed(this)) .subscribe({ diff --git a/src/app/pages/credentials/certificates-dash/forms/acmedns-form/acmedns-form.component.ts b/src/app/pages/credentials/certificates-dash/forms/acmedns-form/acmedns-form.component.ts index 1cee5b74e21..e633a919ed1 100644 --- a/src/app/pages/credentials/certificates-dash/forms/acmedns-form/acmedns-form.component.ts +++ b/src/app/pages/credentials/certificates-dash/forms/acmedns-form/acmedns-form.component.ts @@ -91,7 +91,7 @@ export class AcmednsFormComponent implements OnInit { readonly helptext = helptext; getAuthenticatorSchemas(): Observable { - return this.ws.call('acme.dns.authenticator.authenticator_schemas'); + return this.api.call('acme.dns.authenticator.authenticator_schemas'); } authenticatorOptions$: Observable; @@ -103,7 +103,7 @@ export class AcmednsFormComponent implements OnInit { private slideInRef: SlideInRef, private errorHandler: FormErrorHandlerService, private cdr: ChangeDetectorRef, - private ws: ApiService, + private api: ApiService, private changeDetectorRef: ChangeDetectorRef, @Inject(SLIDE_IN_DATA) private acmedns: DnsAuthenticator, ) {} @@ -208,9 +208,9 @@ export class AcmednsFormComponent implements OnInit { let request$: Observable; if (this.isNew) { - request$ = this.ws.call('acme.dns.authenticator.create', [values]); + request$ = this.api.call('acme.dns.authenticator.create', [values]); } else { - request$ = this.ws.call('acme.dns.authenticator.update', [ + request$ = this.api.call('acme.dns.authenticator.update', [ this.editingAcmedns.id, values, ]); diff --git a/src/app/pages/credentials/certificates-dash/forms/certificate-add/certificate-add.component.ts b/src/app/pages/credentials/certificates-dash/forms/certificate-add/certificate-add.component.ts index 2917f22c9d8..21d5abd6878 100644 --- a/src/app/pages/credentials/certificates-dash/forms/certificate-add/certificate-add.component.ts +++ b/src/app/pages/credentials/certificates-dash/forms/certificate-add/certificate-add.component.ts @@ -89,7 +89,7 @@ export class CertificateAddComponent { summary: SummarySection[]; constructor( - private ws: ApiService, + private api: ApiService, private translate: TranslateService, private cdr: ChangeDetectorRef, private dialogService: DialogService, @@ -120,7 +120,7 @@ export class CertificateAddComponent { this.cdr.markForCheck(); const payload = this.preparePayload(); - this.ws.job('certificate.create', [payload]) + this.api.job('certificate.create', [payload]) .pipe(untilDestroyed(this)) .subscribe({ complete: () => { diff --git a/src/app/pages/credentials/certificates-dash/forms/certificate-add/steps/certificate-identifier-and-type/certificate-identifier-and-type.component.ts b/src/app/pages/credentials/certificates-dash/forms/certificate-add/steps/certificate-identifier-and-type/certificate-identifier-and-type.component.ts index 52f4768915e..cbeccf17a9d 100644 --- a/src/app/pages/credentials/certificates-dash/forms/certificate-add/steps/certificate-identifier-and-type/certificate-identifier-and-type.component.ts +++ b/src/app/pages/credentials/certificates-dash/forms/certificate-add/steps/certificate-identifier-and-type/certificate-identifier-and-type.component.ts @@ -13,7 +13,6 @@ import { mapToOptions } from 'app/helpers/options.helper'; import { helptextSystemCertificates } from 'app/helptext/system/certificates'; import { CertificateProfile, CertificateProfiles } from 'app/interfaces/certificate.interface'; import { Option } from 'app/interfaces/option.interface'; -import { DialogService } from 'app/modules/dialog/dialog.service'; import { FormActionsComponent } from 'app/modules/forms/ix-forms/components/form-actions/form-actions.component'; import { IxCheckboxComponent } from 'app/modules/forms/ix-forms/components/ix-checkbox/ix-checkbox.component'; import { IxInputComponent } from 'app/modules/forms/ix-forms/components/ix-input/ix-input.component'; @@ -74,8 +73,7 @@ export class CertificateIdentifierAndTypeComponent implements OnInit, SummaryPro private formBuilder: FormBuilder, private errorHandler: ErrorHandlerService, private translate: TranslateService, - private ws: ApiService, - private dialogService: DialogService, + private api: ApiService, private cdr: ChangeDetectorRef, private validators: IxValidatorsService, ) {} @@ -90,7 +88,7 @@ export class CertificateIdentifierAndTypeComponent implements OnInit, SummaryPro } private loadProfiles(): void { - this.ws.call('webui.crypto.certificate_profiles') + this.api.call('webui.crypto.certificate_profiles') .pipe(this.errorHandler.catchError(), untilDestroyed(this)) .subscribe((profiles) => { this.profiles = profiles; diff --git a/src/app/pages/credentials/certificates-dash/forms/certificate-add/steps/certificate-import/certificate-import.component.ts b/src/app/pages/credentials/certificates-dash/forms/certificate-add/steps/certificate-import/certificate-import.component.ts index bc22e2b470c..b1b5bc7c21e 100644 --- a/src/app/pages/credentials/certificates-dash/forms/certificate-add/steps/certificate-import/certificate-import.component.ts +++ b/src/app/pages/credentials/certificates-dash/forms/certificate-add/steps/certificate-import/certificate-import.component.ts @@ -71,7 +71,7 @@ export class CertificateImportComponent implements OnInit, SummaryProvider { private formBuilder: FormBuilder, private errorHandler: ErrorHandlerService, private translate: TranslateService, - private ws: ApiService, + private api: ApiService, private dialogService: DialogService, private cdr: ChangeDetectorRef, ) {} @@ -129,7 +129,7 @@ export class CertificateImportComponent implements OnInit, SummaryProvider { } private loadCsrs(): void { - this.ws.call('certificate.query', [[['CSR', '!=', null]]]) + this.api.call('certificate.query', [[['CSR', '!=', null]]]) .pipe(this.errorHandler.catchError(), untilDestroyed(this)) .subscribe((csrs) => { this.csrs = csrs; diff --git a/src/app/pages/credentials/certificates-dash/forms/common-steps/certificate-constraints/certificate-constraints.component.ts b/src/app/pages/credentials/certificates-dash/forms/common-steps/certificate-constraints/certificate-constraints.component.ts index f5843ce8245..bd74985ef92 100644 --- a/src/app/pages/credentials/certificates-dash/forms/common-steps/certificate-constraints/certificate-constraints.component.ts +++ b/src/app/pages/credentials/certificates-dash/forms/common-steps/certificate-constraints/certificate-constraints.component.ts @@ -92,7 +92,7 @@ export class CertificateConstraintsComponent implements OnInit, SummaryProvider constructor( private formBuilder: FormBuilder, private translate: TranslateService, - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, ) {} @@ -300,7 +300,7 @@ export class CertificateConstraintsComponent implements OnInit, SummaryProvider } private loadKeyUsageOptions(): void { - this.ws.call('certificate.extended_key_usage_choices') + this.api.call('certificate.extended_key_usage_choices') .pipe( choicesToOptions(), untilDestroyed(this), diff --git a/src/app/pages/credentials/certificates-dash/forms/common-steps/certificate-options/certificate-options.component.ts b/src/app/pages/credentials/certificates-dash/forms/common-steps/certificate-options/certificate-options.component.ts index aca2e0fc115..d5fe132a839 100644 --- a/src/app/pages/credentials/certificates-dash/forms/common-steps/certificate-options/certificate-options.component.ts +++ b/src/app/pages/credentials/certificates-dash/forms/common-steps/certificate-options/certificate-options.component.ts @@ -68,12 +68,12 @@ export class CertificateOptionsComponent implements OnInit, OnChanges, SummaryPr readonly keyTypes$ = of(mapToOptions(certificateKeyTypeLabels, this.translate)); readonly digestAlgorithms$ = of(mapToOptions(certificateDigestAlgorithmLabels, this.translate)); readonly keyLengths$ = of(certificateKeyLengths); - readonly ecCurves$ = this.ws.call('certificate.ec_curve_choices').pipe(choicesToOptions()); + readonly ecCurves$ = this.api.call('certificate.ec_curve_choices').pipe(choicesToOptions()); constructor( private formBuilder: FormBuilder, private translate: TranslateService, - private ws: ApiService, + private api: ApiService, private systemGeneralService: SystemGeneralService, private cdr: ChangeDetectorRef, ) { } diff --git a/src/app/pages/credentials/certificates-dash/sign-csr-dialog/sign-csr-dialog.component.ts b/src/app/pages/credentials/certificates-dash/sign-csr-dialog/sign-csr-dialog.component.ts index 5eb97907343..26cd88aab26 100644 --- a/src/app/pages/credentials/certificates-dash/sign-csr-dialog/sign-csr-dialog.component.ts +++ b/src/app/pages/credentials/certificates-dash/sign-csr-dialog/sign-csr-dialog.component.ts @@ -60,7 +60,7 @@ export class SignCsrDialogComponent { private loader: AppLoaderService, private snackbar: SnackbarService, private translate: TranslateService, - private ws: ApiService, + private api: ApiService, private errorHandler: FormErrorHandlerService, @Inject(MAT_DIALOG_DATA) private caId: number, ) {} @@ -71,7 +71,7 @@ export class SignCsrDialogComponent { ca_id: this.caId, }; - this.ws.call('certificateauthority.ca_sign_csr', [params as CertificateAuthoritySignRequest]) + this.api.call('certificateauthority.ca_sign_csr', [params as CertificateAuthoritySignRequest]) .pipe(this.loader.withLoader(), untilDestroyed(this)) .subscribe({ next: () => { diff --git a/src/app/pages/credentials/groups/group-details-row/delete-group-dialog/delete-group-dialog.component.ts b/src/app/pages/credentials/groups/group-details-row/delete-group-dialog/delete-group-dialog.component.ts index 70e4624c14d..ae0265d6ca5 100644 --- a/src/app/pages/credentials/groups/group-details-row/delete-group-dialog/delete-group-dialog.component.ts +++ b/src/app/pages/credentials/groups/group-details-row/delete-group-dialog/delete-group-dialog.component.ts @@ -52,7 +52,7 @@ export class DeleteGroupDialogComponent { constructor( private loader: AppLoaderService, - private ws: ApiService, + private api: ApiService, private snackbar: SnackbarService, private translate: TranslateService, private dialogRef: MatDialogRef, @@ -68,7 +68,7 @@ export class DeleteGroupDialogComponent { } onDelete(): void { - this.ws.call('group.delete', [this.group.id, { delete_users: this.deleteUsersCheckbox.value }]) + this.api.call('group.delete', [this.group.id, { delete_users: this.deleteUsersCheckbox.value }]) .pipe( this.loader.withLoader(), this.errorHandler.catchError(), diff --git a/src/app/pages/credentials/groups/group-form/group-form.component.spec.ts b/src/app/pages/credentials/groups/group-form/group-form.component.spec.ts index 5d8f82221b9..2417c7d8c66 100644 --- a/src/app/pages/credentials/groups/group-form/group-form.component.spec.ts +++ b/src/app/pages/credentials/groups/group-form/group-form.component.spec.ts @@ -23,7 +23,7 @@ import { ApiService } from 'app/services/api.service'; describe('GroupFormComponent', () => { let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; const fakePrivilegeDataSource: Privilege[] = [ { @@ -80,14 +80,14 @@ describe('GroupFormComponent', () => { beforeEach(() => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('loads names of existing groups and makes sure new name is unique', async () => { const nameInput = await loader.getHarness(IxInputHarness.with({ label: 'Name' })); await nameInput.setValue('existing'); - expect(ws.call).toHaveBeenCalledWith('group.query'); + expect(api.call).toHaveBeenCalledWith('group.query'); expect(await nameInput.getErrorText()).toBe('The name "existing" is already in use.'); }); @@ -95,7 +95,7 @@ describe('GroupFormComponent', () => { const gidInput = await loader.getHarness(IxInputHarness.with({ label: 'GID' })); const value = await gidInput.getValue(); - expect(ws.call).toHaveBeenCalledWith('group.get_next_gid'); + expect(api.call).toHaveBeenCalledWith('group.get_next_gid'); expect(value).toBe('1234'); }); @@ -111,7 +111,7 @@ describe('GroupFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('group.create', [{ + expect(api.call).toHaveBeenCalledWith('group.create', [{ gid: 1234, name: 'new', smb: true, @@ -129,7 +129,7 @@ describe('GroupFormComponent', () => { ], }); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('does not show Allow Duplicate Gid on edit', async () => { @@ -165,7 +165,7 @@ describe('GroupFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('group.update', [ + expect(api.call).toHaveBeenCalledWith('group.update', [ 13, { name: 'updated', @@ -175,7 +175,7 @@ describe('GroupFormComponent', () => { }, ]); - expect(ws.call).toHaveBeenCalledWith('privilege.update', [1, { + expect(api.call).toHaveBeenCalledWith('privilege.update', [1, { ds_groups: [1223], local_groups: [2222], name: 'Privilege 1', roles: ['SHARING_ADMIN'], web_shell: true, }]); }); @@ -192,7 +192,7 @@ describe('GroupFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('privilege.update', [1, { + expect(api.call).toHaveBeenCalledWith('privilege.update', [1, { ds_groups: [1223], local_groups: [2222], name: 'Privilege 1', roles: ['SHARING_ADMIN'], web_shell: true, }]); }); diff --git a/src/app/pages/credentials/groups/group-form/group-form.component.ts b/src/app/pages/credentials/groups/group-form/group-form.component.ts index 903e19c49ea..4afee64f819 100644 --- a/src/app/pages/credentials/groups/group-form/group-form.component.ts +++ b/src/app/pages/credentials/groups/group-form/group-form.component.ts @@ -92,13 +92,13 @@ export class GroupFormComponent implements OnInit { smb: helptextGroups.smb_tooltip, }; - readonly privilegeOptions$ = this.ws.call('privilege.query').pipe( + readonly privilegeOptions$ = this.api.call('privilege.query').pipe( map((privileges) => privileges.map((privilege) => ({ label: privilege.name, value: privilege.id }))), ); constructor( private fb: FormBuilder, - private ws: ApiService, + private api: ApiService, private slideInRef: SlideInRef, private cdr: ChangeDetectorRef, private errorHandler: FormErrorHandlerService, @@ -114,7 +114,7 @@ export class GroupFormComponent implements OnInit { } readonly privilegesProvider: ChipsProvider = (query: string) => { - return this.ws.call('privilege.query', []).pipe( + return this.api.call('privilege.query', []).pipe( map((privileges) => { const chips = privileges.map((privilege) => privilege.name); return chips.filter((item) => item.trim().toLowerCase().includes(query.trim().toLowerCase())); @@ -126,7 +126,7 @@ export class GroupFormComponent implements OnInit { this.setFormRelations(); if (this.isNew) { - this.ws.call('group.get_next_gid').pipe(untilDestroyed(this)).subscribe((nextId) => { + this.api.call('group.get_next_gid').pipe(untilDestroyed(this)).subscribe((nextId) => { this.form.patchValue({ gid: nextId, }); @@ -162,19 +162,19 @@ export class GroupFormComponent implements OnInit { this.isFormLoading = true; let request$: Observable; if (this.isNew) { - request$ = this.ws.call('group.create', [{ + request$ = this.api.call('group.create', [{ ...commonBody, gid: values.gid, }]); } else { - request$ = this.ws.call('group.update', [ + request$ = this.api.call('group.update', [ this.editingGroup.id, commonBody, ]); } request$.pipe( - switchMap((id) => this.ws.call('group.query', [[['id', '=', id]]])), + switchMap((id) => this.api.call('group.query', [[['id', '=', id]]])), map((groups) => groups[0]), switchMap((group) => this.togglePrivilegesForGroup(group.gid).pipe(map(() => group))), untilDestroyed(this), @@ -213,7 +213,7 @@ export class GroupFormComponent implements OnInit { privileges.forEach((privilege) => { requests$.push( - this.ws.call('privilege.update', [ + this.api.call('privilege.update', [ privilege.id, this.mapPrivilegeToPrivilegeUpdate( privilege, @@ -230,7 +230,7 @@ export class GroupFormComponent implements OnInit { privileges.forEach((privilege) => { requests$.push( - this.ws.call('privilege.update', [ + this.api.call('privilege.update', [ privilege.id, this.mapPrivilegeToPrivilegeUpdate( privilege, @@ -245,7 +245,7 @@ export class GroupFormComponent implements OnInit { } private getPrivilegesList(): void { - this.ws.call('privilege.query', []) + this.api.call('privilege.query', []) .pipe(untilDestroyed(this)).subscribe((privileges) => { this.initialGroupRelatedPrivilegesList = privileges.filter((privilege) => { return privilege.local_groups.map((group) => group.gid).includes(this.editingGroup?.gid); @@ -260,7 +260,7 @@ export class GroupFormComponent implements OnInit { } private setNamesInUseValidator(currentName?: string): void { - this.ws.call('group.query').pipe(untilDestroyed(this)).subscribe((groups) => { + this.api.call('group.query').pipe(untilDestroyed(this)).subscribe((groups) => { let forbiddenNames = groups.map((group) => group.group); if (currentName) { forbiddenNames = forbiddenNames.filter((name) => name !== currentName); diff --git a/src/app/pages/credentials/groups/group-members/group-members.component.spec.ts b/src/app/pages/credentials/groups/group-members/group-members.component.spec.ts index b7c1d912b7a..abc1dcb943d 100644 --- a/src/app/pages/credentials/groups/group-members/group-members.component.spec.ts +++ b/src/app/pages/credentials/groups/group-members/group-members.component.spec.ts @@ -27,7 +27,7 @@ const fakeGroupDataSource = [{ describe('GroupMembersComponent', () => { let spectator: SpectatorRouting; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; const createComponent = createRoutingFactory({ component: GroupMembersComponent, imports: [ @@ -51,7 +51,7 @@ describe('GroupMembersComponent', () => { beforeEach(() => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('shows current group values when form is being edited', async () => { @@ -63,8 +63,8 @@ describe('GroupMembersComponent', () => { expect(await userList.getItems()).toHaveLength(1); expect(await memberList.getItems()).toHaveLength(1); - expect(ws.call).toHaveBeenCalledWith('user.query'); - expect(ws.call).toHaveBeenCalledWith('group.query', [[['id', '=', 1]]]); + expect(api.call).toHaveBeenCalledWith('user.query'); + expect(api.call).toHaveBeenCalledWith('group.query', [[['id', '=', 1]]]); }); it('redirects to Group List page when Cancel button is pressed', async () => { @@ -95,7 +95,7 @@ describe('GroupMembersComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('group.update', [1, { users: [41, 42] }]); + expect(api.call).toHaveBeenCalledWith('group.update', [1, { users: [41, 42] }]); expect(spectator.inject(Router).navigate).toHaveBeenCalledWith(['/', 'credentials', 'groups']); }); }); diff --git a/src/app/pages/credentials/groups/group-members/group-members.component.ts b/src/app/pages/credentials/groups/group-members/group-members.component.ts index 6135ab3db57..44c044e59ab 100644 --- a/src/app/pages/credentials/groups/group-members/group-members.component.ts +++ b/src/app/pages/credentials/groups/group-members/group-members.component.ts @@ -68,7 +68,7 @@ export class GroupMembersComponent implements OnInit { } constructor( - private ws: ApiService, + private api: ApiService, private activatedRoute: ActivatedRoute, private router: Router, private dialog: DialogService, @@ -81,12 +81,12 @@ export class GroupMembersComponent implements OnInit { this.isFormLoading = true; this.activatedRoute.params.pipe( switchMap((params) => { - return this.ws.call('group.query', [[['id', '=', parseInt(params.pk as string)]]]); + return this.api.call('group.query', [[['id', '=', parseInt(params.pk as string)]]]); }), switchMap((groups) => { this.group = groups[0]; this.cdr.markForCheck(); - return this.ws.call('user.query'); + return this.api.call('user.query'); }), untilDestroyed(this), ).subscribe((users) => { @@ -106,7 +106,7 @@ export class GroupMembersComponent implements OnInit { this.cdr.markForCheck(); const userIds = this.selectedMembers.map((user) => user.id); - this.ws.call('group.update', [this.group.id, { users: userIds }]).pipe( + this.api.call('group.update', [this.group.id, { users: userIds }]).pipe( untilDestroyed(this), ).subscribe({ next: () => { diff --git a/src/app/pages/credentials/groups/privilege/privilege-form/privilege-form.component.spec.ts b/src/app/pages/credentials/groups/privilege/privilege-form/privilege-form.component.spec.ts index 8e318d97d22..3528f0be648 100644 --- a/src/app/pages/credentials/groups/privilege/privilege-form/privilege-form.component.spec.ts +++ b/src/app/pages/credentials/groups/privilege/privilege-form/privilege-form.component.spec.ts @@ -18,7 +18,7 @@ import { ApiService } from 'app/services/api.service'; describe('PrivilegeFormComponent', () => { let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; const fakeDataPrivilege = { id: 10, @@ -65,7 +65,7 @@ describe('PrivilegeFormComponent', () => { beforeEach(() => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('shows roles sorted alphabetically with compound (non-builtin) roles on top', async () => { @@ -91,7 +91,7 @@ describe('PrivilegeFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenLastCalledWith('privilege.create', [{ + expect(api.call).toHaveBeenLastCalledWith('privilege.create', [{ ds_groups: [], local_groups: [], name: 'new privilege', @@ -109,7 +109,7 @@ describe('PrivilegeFormComponent', () => { ], }); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('shows current privilege values when form is being edited', async () => { @@ -136,7 +136,7 @@ describe('PrivilegeFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenLastCalledWith('privilege.update', [10, { + expect(api.call).toHaveBeenLastCalledWith('privilege.update', [10, { ds_groups: [], local_groups: [111, 222], name: 'updated privilege', @@ -154,7 +154,7 @@ describe('PrivilegeFormComponent', () => { ], }); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('sends an update payload to websocket and closes modal when save is pressed', async () => { @@ -175,7 +175,7 @@ describe('PrivilegeFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenLastCalledWith('privilege.update', [10, { + expect(api.call).toHaveBeenLastCalledWith('privilege.update', [10, { ds_groups: [], local_groups: [111, 222], web_shell: false, diff --git a/src/app/pages/credentials/groups/privilege/privilege-form/privilege-form.component.ts b/src/app/pages/credentials/groups/privilege/privilege-form/privilege-form.component.ts index 902a8e18e88..981ba084065 100644 --- a/src/app/pages/credentials/groups/privilege/privilege-form/privilege-form.component.ts +++ b/src/app/pages/credentials/groups/privilege/privilege-form/privilege-form.component.ts @@ -77,7 +77,7 @@ export class PrivilegeFormComponent implements OnInit { : this.translate.instant('Edit Privilege'); } - readonly rolesOptions$ = this.ws.call('privilege.roles').pipe( + readonly rolesOptions$ = this.api.call('privilege.roles').pipe( map((roles) => { const sortedRoles = roles.toSorted((a, b) => { // Show compound roles first, then sort by name. @@ -96,7 +96,7 @@ export class PrivilegeFormComponent implements OnInit { ); readonly localGroupsProvider: ChipsProvider = (query: string) => { - return this.ws.call('group.query', [[['local', '=', true]]]).pipe( + return this.api.call('group.query', [[['local', '=', true]]]).pipe( map((groups) => { this.localGroups = groups; const chips = groups.map((group) => group.group); @@ -106,7 +106,7 @@ export class PrivilegeFormComponent implements OnInit { }; readonly dsGroupsProvider: ChipsProvider = (query: string) => { - return this.ws.call('group.query', [[['local', '=', false]]]).pipe( + return this.api.call('group.query', [[['local', '=', false]]]).pipe( map((groups) => { this.dsGroups = groups; const chips = groups.map((group) => group.group); @@ -118,7 +118,7 @@ export class PrivilegeFormComponent implements OnInit { constructor( private formBuilder: FormBuilder, private translate: TranslateService, - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private errorHandler: FormErrorHandlerService, private slideInRef: SlideInRef, @@ -156,9 +156,9 @@ export class PrivilegeFormComponent implements OnInit { this.isLoading = true; let request$: Observable; if (this.isNew) { - request$ = this.ws.call('privilege.create', [values]); + request$ = this.api.call('privilege.create', [values]); } else { - request$ = this.ws.call('privilege.update', [this.existingPrivilege.id, values]); + request$ = this.api.call('privilege.update', [this.existingPrivilege.id, values]); } request$.pipe(untilDestroyed(this)).subscribe({ diff --git a/src/app/pages/credentials/groups/privilege/privilege-list/privilege-list.component.ts b/src/app/pages/credentials/groups/privilege/privilege-list/privilege-list.component.ts index fbb943240eb..0e088b2cd47 100644 --- a/src/app/pages/credentials/groups/privilege/privilege-list/privilege-list.component.ts +++ b/src/app/pages/credentials/groups/privilege/privilege-list/privilege-list.component.ts @@ -126,7 +126,7 @@ export class PrivilegeListComponent implements OnInit { pageNumber: 1, }; - private groupsSuggestions$ = this.ws.call('group.query', [[['local', '=', true]]]).pipe( + private groupsSuggestions$ = this.api.call('group.query', [[['local', '=', true]]]).pipe( map((groups) => groups.map((group) => ({ label: group.group, value: `"${group.group}"`, @@ -144,7 +144,7 @@ export class PrivilegeListComponent implements OnInit { constructor( private slideInService: SlideInService, - private ws: ApiService, + private api: ApiService, private translate: TranslateService, private dialogService: DialogService, protected emptyService: EmptyService, @@ -152,7 +152,7 @@ export class PrivilegeListComponent implements OnInit { ) { } ngOnInit(): void { - this.dataProvider = new ApiDataProvider(this.ws, 'privilege.query'); + this.dataProvider = new ApiDataProvider(this.api, 'privilege.query'); this.dataProvider.paginationStrategy = new PaginationServerSide(); this.dataProvider.sortingStrategy = new SortingServerSide(); @@ -178,7 +178,7 @@ export class PrivilegeListComponent implements OnInit { }) .pipe( filter(Boolean), - switchMap(() => this.ws.call('privilege.delete', [privilege.id])), + switchMap(() => this.api.call('privilege.delete', [privilege.id])), untilDestroyed(this), ) .subscribe({ diff --git a/src/app/pages/credentials/groups/store/group.effects.ts b/src/app/pages/credentials/groups/store/group.effects.ts index 12eb1386b99..4bfd3fc6b38 100644 --- a/src/app/pages/credentials/groups/store/group.effects.ts +++ b/src/app/pages/credentials/groups/store/group.effects.ts @@ -30,7 +30,7 @@ export class GroupEffects { if (preferences.hideBuiltinGroups) { params = [[['builtin', '=', false]]]; } - return this.ws.call('group.query', params).pipe( + return this.api.call('group.query', params).pipe( map((groups) => groupsLoaded({ groups })), catchError((error) => { console.error(error); @@ -48,7 +48,7 @@ export class GroupEffects { subscribeToRemoval$ = createEffect(() => this.actions$.pipe( ofType(groupsLoaded), switchMap(() => { - return this.ws.subscribe('group.query').pipe( + return this.api.subscribe('group.query').pipe( filter((event) => event.msg === IncomingApiMessageType.Removed), map((event) => groupRemoved({ id: event.id as number })), ); @@ -57,7 +57,7 @@ export class GroupEffects { constructor( private actions$: Actions, - private ws: ApiService, + private api: ApiService, private store$: Store, private translate: TranslateService, ) {} diff --git a/src/app/pages/credentials/kmip/kmip.component.ts b/src/app/pages/credentials/kmip/kmip.component.ts index 4371088ba33..35cd1f64167 100644 --- a/src/app/pages/credentials/kmip/kmip.component.ts +++ b/src/app/pages/credentials/kmip/kmip.component.ts @@ -79,7 +79,7 @@ export class KmipComponent implements OnInit { readonly certificateAuthorities$ = this.systemGeneralService.getCertificateAuthorities().pipe(idNameArrayToOptions()); constructor( - private ws: ApiService, + private api: ApiService, private formBuilder: FormBuilder, private cdr: ChangeDetectorRef, private errorHandler: ErrorHandlerService, @@ -95,7 +95,7 @@ export class KmipComponent implements OnInit { onSyncKeysPressed(): void { this.isLoading = true; - this.ws.call('kmip.sync_keys').pipe(untilDestroyed(this)).subscribe({ + this.api.call('kmip.sync_keys').pipe(untilDestroyed(this)).subscribe({ next: () => { this.dialogService.info( helptextSystemKmip.syncInfoDialog.title, @@ -114,7 +114,7 @@ export class KmipComponent implements OnInit { onClearSyncKeysPressed(): void { this.isLoading = true; - this.ws.call('kmip.clear_sync_pending_keys').pipe(untilDestroyed(this)).subscribe({ + this.api.call('kmip.clear_sync_pending_keys').pipe(untilDestroyed(this)).subscribe({ next: () => { this.dialogService.info( helptextSystemKmip.clearSyncKeyInfoDialog.title, @@ -133,7 +133,7 @@ export class KmipComponent implements OnInit { onSubmit(): void { this.dialogService.jobDialog( - this.ws.job('kmip.update', [this.form.value as KmipConfigUpdate]), + this.api.job('kmip.update', [this.form.value as KmipConfigUpdate]), { title: this.translate.instant(helptextSystemKmip.jobDialog.title) }, ) .afterClosed() @@ -149,8 +149,8 @@ export class KmipComponent implements OnInit { private loadKmipConfig(): void { this.isLoading = true; forkJoin([ - this.ws.call('kmip.config'), - this.ws.call('kmip.kmip_sync_pending'), + this.api.call('kmip.config'), + this.api.call('kmip.kmip_sync_pending'), ]) .pipe(untilDestroyed(this)) .subscribe({ diff --git a/src/app/pages/credentials/users/store/user.effects.ts b/src/app/pages/credentials/users/store/user.effects.ts index 9aee297dff2..9634e2b0b39 100644 --- a/src/app/pages/credentials/users/store/user.effects.ts +++ b/src/app/pages/credentials/users/store/user.effects.ts @@ -30,7 +30,7 @@ export class UserEffects { if (preferences.hideBuiltinUsers) { params = [[['OR', [['builtin', '=', false], ['username', '=', 'root']]]]] as QueryParams; } - return this.ws.call('user.query', params).pipe( + return this.api.call('user.query', params).pipe( map((users) => usersLoaded({ users })), catchError((error) => { console.error(error); @@ -48,7 +48,7 @@ export class UserEffects { subscribeToRemoval$ = createEffect(() => this.actions$.pipe( ofType(usersLoaded), switchMap(() => { - return this.ws.subscribe('user.query').pipe( + return this.api.subscribe('user.query').pipe( filter((event) => event.msg === IncomingApiMessageType.Removed), map((event) => userRemoved({ id: event.id as number })), ); @@ -57,7 +57,7 @@ export class UserEffects { constructor( private actions$: Actions, - private ws: ApiService, + private api: ApiService, private store$: Store, private translate: TranslateService, ) {} diff --git a/src/app/pages/credentials/users/user-api-keys/components/api-key-form-dialog/api-key-form-dialog.component.ts b/src/app/pages/credentials/users/user-api-keys/components/api-key-form-dialog/api-key-form-dialog.component.ts index 80865bfbe21..ae5cf65b0fd 100644 --- a/src/app/pages/credentials/users/user-api-keys/components/api-key-form-dialog/api-key-form-dialog.component.ts +++ b/src/app/pages/credentials/users/user-api-keys/components/api-key-form-dialog/api-key-form-dialog.component.ts @@ -92,13 +92,13 @@ export class ApiKeyFormComponent implements OnInit { .setOptions({ select: ['username'], order_by: ['username'] }) .getParams(); - protected readonly usernames$ = this.ws.call('user.query', this.userQueryParams).pipe( + protected readonly usernames$ = this.api.call('user.query', this.userQueryParams).pipe( map((users) => users.map((user) => ({ label: user.username, value: user.username }))), ); protected readonly userProvider = new SimpleAsyncComboboxProvider(this.usernames$); - protected readonly forbiddenNames$ = this.ws.call('api_key.query', [ + protected readonly forbiddenNames$ = this.api.call('api_key.query', [ [], { select: ['name'], order_by: ['name'] }, ]).pipe(map((keys) => keys.map((key) => key.name))); @@ -108,7 +108,7 @@ export class ApiKeyFormComponent implements OnInit { private fb: FormBuilder, private slideInRef: SlideInRef, private matDialog: MatDialog, - private ws: ApiService, + private api: ApiService, private loader: AppLoaderService, private errorHandler: FormErrorHandlerService, private authService: AuthService, @@ -137,8 +137,8 @@ export class ApiKeyFormComponent implements OnInit { const expiresAtTimestamp = nonExpiring ? null : { $date: +expiresAt } as ApiTimestamp; const request$ = this.isNew() - ? this.ws.call('api_key.create', [{ name, username, expires_at: expiresAtTimestamp }]) - : this.ws.call('api_key.update', [this.editingRow().id, { name, reset, expires_at: expiresAtTimestamp }]); + ? this.api.call('api_key.create', [{ name, username, expires_at: expiresAtTimestamp }]) + : this.api.call('api_key.update', [this.editingRow().id, { name, reset, expires_at: expiresAtTimestamp }]); request$ .pipe(this.loader.withLoader(), untilDestroyed(this)) diff --git a/src/app/pages/credentials/users/user-api-keys/user-api-keys.component.ts b/src/app/pages/credentials/users/user-api-keys/user-api-keys.component.ts index 65c46d8d645..bead7c15470 100644 --- a/src/app/pages/credentials/users/user-api-keys/user-api-keys.component.ts +++ b/src/app/pages/credentials/users/user-api-keys/user-api-keys.component.ts @@ -140,7 +140,7 @@ export class UserApiKeysComponent implements OnInit { pageNumber: 1, }; - private readonly apiKeys$ = this.ws.call('api_key.query').pipe(shareReplay({ bufferSize: 1, refCount: true })); + private readonly apiKeys$ = this.api.call('api_key.query').pipe(shareReplay({ bufferSize: 1, refCount: true })); protected readonly nameSuggestions$ = this.apiKeys$.pipe( map((keys) => uniq(keys.map((key) => ({ label: key.name, value: key.name })))), @@ -153,7 +153,7 @@ export class UserApiKeysComponent implements OnInit { constructor( protected emptyService: EmptyService, private translate: TranslateService, - private ws: ApiService, + private api: ApiService, private dialog: DialogService, private loader: AppLoaderService, private errorHandler: ErrorHandlerService, @@ -163,7 +163,7 @@ export class UserApiKeysComponent implements OnInit { ) { } ngOnInit(): void { - this.dataProvider = new ApiDataProvider(this.ws, 'api_key.query'); + this.dataProvider = new ApiDataProvider(this.api, 'api_key.query'); this.dataProvider.paginationStrategy = new PaginationServerSide(); this.dataProvider.sortingStrategy = new SortingServerSide(); this.setDefaultSort(); @@ -197,7 +197,7 @@ export class UserApiKeysComponent implements OnInit { }).pipe( filter(Boolean), tap(() => this.loader.open()), - switchMap(() => this.ws.call('api_key.delete', [apiKey.id])), + switchMap(() => this.api.call('api_key.delete', [apiKey.id])), untilDestroyed(this), ).subscribe({ next: () => this.dataProvider.load(), diff --git a/src/app/pages/credentials/users/user-details-row/delete-user-dialog/delete-user-dialog.component.ts b/src/app/pages/credentials/users/user-details-row/delete-user-dialog/delete-user-dialog.component.ts index 78bf588ae0e..3a45d68edad 100644 --- a/src/app/pages/credentials/users/user-details-row/delete-user-dialog/delete-user-dialog.component.ts +++ b/src/app/pages/credentials/users/user-details-row/delete-user-dialog/delete-user-dialog.component.ts @@ -55,7 +55,7 @@ export class DeleteUserDialogComponent implements OnInit { constructor( private errorHandler: ErrorHandlerService, - private ws: ApiService, + private api: ApiService, private loader: AppLoaderService, @Inject(MAT_DIALOG_DATA) public user: User, private dialogRef: MatDialogRef, @@ -69,7 +69,7 @@ export class DeleteUserDialogComponent implements OnInit { } onDelete(): void { - this.ws.call('user.delete', [this.user.id, { delete_group: this.deleteGroupCheckbox.value }]) + this.api.call('user.delete', [this.user.id, { delete_group: this.deleteGroupCheckbox.value }]) .pipe( this.loader.withLoader(), this.errorHandler.catchError(), @@ -82,7 +82,7 @@ export class DeleteUserDialogComponent implements OnInit { } private checkIfLastGroupMember(): void { - this.ws.call('group.query', [[['id', '=', this.user.group.id]]]) + this.api.call('group.query', [[['id', '=', this.user.group.id]]]) .pipe( this.loader.withLoader(), this.errorHandler.catchError(), diff --git a/src/app/pages/credentials/users/user-form/user-form.component.spec.ts b/src/app/pages/credentials/users/user-form/user-form.component.spec.ts index c1f5706e7ac..246de34146f 100644 --- a/src/app/pages/credentials/users/user-form/user-form.component.spec.ts +++ b/src/app/pages/credentials/users/user-form/user-form.component.spec.ts @@ -63,7 +63,7 @@ describe('UserFormComponent', () => { const builtinUser = { ...mockUser, builtin: true, immutable: true }; let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; const createComponent = createComponentFactory({ component: UserFormComponent, imports: [ @@ -115,7 +115,7 @@ describe('UserFormComponent', () => { beforeEach(() => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); spectator.component.setupForm(); }); @@ -123,13 +123,13 @@ describe('UserFormComponent', () => { const uidInput = await loader.getHarness(IxInputHarness.with({ label: 'UID' })); const value = await uidInput.getValue(); - expect(ws.call).toHaveBeenCalledWith('user.get_next_uid'); + expect(api.call).toHaveBeenCalledWith('user.get_next_uid'); expect(value).toBe('1234'); }); it('loads home share path and puts it in home field', async () => { const homeInput = await loader.getHarness(IxExplorerHarness.with({ label: 'Home Directory' })); - expect(ws.call).toHaveBeenCalledWith('sharing.smb.query', [[['enabled', '=', true], ['home', '=', true]]]); + expect(api.call).toHaveBeenCalledWith('sharing.smb.query', [[['enabled', '=', true], ['home', '=', true]]]); expect(await homeInput.getValue()).toBe('/mnt/users'); const usernameInput = await loader.getHarness(IxInputHarness.with({ label: 'Username' })); @@ -153,7 +153,7 @@ describe('UserFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('user.create', [expect.objectContaining({ + expect(api.call).toHaveBeenCalledWith('user.create', [expect.objectContaining({ full_name: 'John Smith', group_create: true, password: 'test-pass', @@ -185,7 +185,7 @@ describe('UserFormComponent', () => { ], }); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); spectator.component.setupForm(); }); @@ -204,7 +204,7 @@ describe('UserFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('user.update', [69, expect.objectContaining({ + expect(api.call).toHaveBeenCalledWith('user.update', [69, expect.objectContaining({ password: 'changepwd', })]); }); @@ -278,11 +278,11 @@ describe('UserFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('user.update', [ + expect(api.call).toHaveBeenCalledWith('user.update', [ 69, { home: '/home/updated', home_create: true }, ]); - expect(ws.call).toHaveBeenLastCalledWith('user.update', [ + expect(api.call).toHaveBeenLastCalledWith('user.update', [ 69, { email: null, @@ -312,7 +312,7 @@ describe('UserFormComponent', () => { ], }); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); spectator.component.setupForm(); }); diff --git a/src/app/pages/credentials/users/user-form/user-form.component.ts b/src/app/pages/credentials/users/user-form/user-form.component.ts index 4a683155905..59e0eb2397b 100644 --- a/src/app/pages/credentials/users/user-form/user-form.component.ts +++ b/src/app/pages/credentials/users/user-form/user-form.component.ts @@ -172,7 +172,7 @@ export class UserFormComponent implements OnInit { smbBuiltin: helptextUsers.smbBuiltin, }; - readonly groupOptions$ = this.ws.call('group.query').pipe( + readonly groupOptions$ = this.api.call('group.query').pipe( map((groups) => groups.map((group) => ({ label: group.group, value: group.id }))), ); @@ -217,7 +217,7 @@ export class UserFormComponent implements OnInit { } constructor( - private ws: ApiService, + private api: ApiService, private errorHandler: FormErrorHandlerService, private cdr: ChangeDetectorRef, private fb: FormBuilder, @@ -353,7 +353,7 @@ export class UserFormComponent implements OnInit { let request$: Observable; let nextRequest$: Observable; if (this.isNewUser) { - request$ = this.ws.call('user.create', [{ + request$ = this.api.call('user.create', [{ ...body, group_create: values.group_create, password: values.password, @@ -365,19 +365,19 @@ export class UserFormComponent implements OnInit { body.password = values.password; } if (body.home_create) { - request$ = this.ws.call('user.update', [this.editingUser.id, { home_create: true, home: body.home }]); + request$ = this.api.call('user.update', [this.editingUser.id, { home_create: true, home: body.home }]); delete body.home_create; delete body.home; - nextRequest$ = this.ws.call('user.update', [this.editingUser.id, body]); + nextRequest$ = this.api.call('user.update', [this.editingUser.id, body]); } else { - request$ = this.ws.call('user.update', [this.editingUser.id, body]); + request$ = this.api.call('user.update', [this.editingUser.id, body]); } } request$.pipe( switchMap((id) => nextRequest$ || of(id)), filter(Boolean), - switchMap((id) => this.ws.call('user.query', [[['id', '=', id]]])), + switchMap((id) => this.api.call('user.query', [[['id', '=', id]]])), map((users) => users[0]), untilDestroyed(this), ).subscribe({ @@ -478,7 +478,7 @@ export class UserFormComponent implements OnInit { } private setHomeSharePath(): void { - this.ws.call('sharing.smb.query', [[ + this.api.call('sharing.smb.query', [[ ['enabled', '=', true], ['home', '=', true], ]]).pipe( @@ -491,13 +491,13 @@ export class UserFormComponent implements OnInit { } private setNextUserId(): void { - this.ws.call('user.get_next_uid').pipe(untilDestroyed(this)).subscribe((nextUid) => { + this.api.call('user.get_next_uid').pipe(untilDestroyed(this)).subscribe((nextUid) => { this.form.patchValue({ uid: nextUid }); }); } private setFirstShellOption(): void { - this.ws.call('user.shell_choices', [this.form.value.groups]).pipe( + this.api.call('user.shell_choices', [this.form.value.groups]).pipe( choicesToOptions(), filter((shells) => !!shells.length), map((shells) => shells[0].value), @@ -538,7 +538,7 @@ export class UserFormComponent implements OnInit { ids.add(group); } - this.ws.call('user.shell_choices', [Array.from(ids)]) + this.api.call('user.shell_choices', [Array.from(ids)]) .pipe(choicesToOptions(), take(1), untilDestroyed(this)) .subscribe((options) => { this.shellOptions$ = of(options); diff --git a/src/app/pages/dashboard/services/dashboard.store.ts b/src/app/pages/dashboard/services/dashboard.store.ts index 1a6689dcede..9f34dc6ea52 100644 --- a/src/app/pages/dashboard/services/dashboard.store.ts +++ b/src/app/pages/dashboard/services/dashboard.store.ts @@ -51,7 +51,7 @@ export class DashboardStore extends ComponentStore { constructor( private authService: AuthService, - private ws: ApiService, + private api: ApiService, private errorHandler: ErrorHandlerService, private store$: Store, ) { @@ -92,7 +92,7 @@ export class DashboardStore extends ComponentStore { save(groups: WidgetGroup[]): Observable { this.toggleLoadingState(true); - return this.ws.call('auth.set_attribute', ['dashState', groups]).pipe( + return this.api.call('auth.set_attribute', ['dashState', groups]).pipe( switchMap(() => this.authService.refreshUser()), finalize(() => this.toggleLoadingState(false)), ); diff --git a/src/app/pages/dashboard/services/widget-resources.service.ts b/src/app/pages/dashboard/services/widget-resources.service.ts index 15db6d7c873..fb22263c905 100644 --- a/src/app/pages/dashboard/services/widget-resources.service.ts +++ b/src/app/pages/dashboard/services/widget-resources.service.ts @@ -35,20 +35,20 @@ import { waitForSystemInfo } from 'app/store/system-info/system-info.selectors'; }) export class WidgetResourcesService { // TODO: nosub is emitted for some reason - readonly realtimeUpdates$ = this.ws.subscribe('reporting.realtime'); + readonly realtimeUpdates$ = this.api.subscribe('reporting.realtime'); readonly refreshInterval$ = timer(0, 5000); private readonly triggerRefreshSystemInfo$ = new Subject(); readonly backups$ = forkJoin([ - this.ws.call('replication.query'), - this.ws.call('rsynctask.query'), - this.ws.call('cloudsync.query'), + this.api.call('replication.query'), + this.api.call('rsynctask.query'), + this.api.call('cloudsync.query'), ]).pipe( shareReplay({ bufferSize: 1, refCount: true }), ); - readonly systemInfo$ = this.ws.call('webui.main.dashboard.sys_info').pipe( + readonly systemInfo$ = this.api.call('webui.main.dashboard.sys_info').pipe( repeat({ delay: () => this.triggerRefreshSystemInfo$ }), debounceTime(300), toLoadingState(), @@ -62,13 +62,13 @@ export class WidgetResourcesService { shareReplay({ bufferSize: 1, refCount: true }), ); - readonly networkInterfaces$ = this.ws.call('interface.query').pipe( + readonly networkInterfaces$ = this.api.call('interface.query').pipe( map((interfaces) => processNetworkInterfaces(interfaces)), toLoadingState(), shareReplay({ bufferSize: 1, refCount: true }), ); - readonly installedApps$ = this.ws.callAndSubscribe('app.query').pipe( + readonly installedApps$ = this.api.callAndSubscribe('app.query').pipe( shareReplay({ bufferSize: 1, refCount: true }), ); @@ -77,11 +77,11 @@ export class WidgetResourcesService { ); readonly volumesData$ = this.pools$.pipe( - switchMap(() => this.ws.call('pool.dataset.query', [[], { extra: { retrieve_children: false } }])), + switchMap(() => this.api.call('pool.dataset.query', [[], { extra: { retrieve_children: false } }])), map((datasets) => this.parseVolumeData(datasets)), ); - readonly updateAvailable$ = this.ws.call('update.check_available').pipe( + readonly updateAvailable$ = this.api.call('update.check_available').pipe( map((update) => update.status === SystemUpdateStatus.Available), catchError(() => of(false)), shareReplay({ refCount: false, bufferSize: 1 }), @@ -104,7 +104,7 @@ export class WidgetResourcesService { const end = Math.floor(serverTime.getTime() / 1000); const start = Math.floor(subMinutes(serverTime, minutes).getTime() / 1000); - return this.ws.call('reporting.netdata_get_data', [[{ name: 'cpu' }], { end, start }]); + return this.api.call('reporting.netdata_get_data', [[{ name: 'cpu' }], { end, start }]); }), shareReplay({ bufferSize: 1, refCount: true }), ); @@ -116,7 +116,7 @@ export class WidgetResourcesService { switchMap((serverTime) => { const end = Math.floor(serverTime.getTime() / 1000); const start = Math.floor(subHours(serverTime, 1).getTime() / 1000); - return this.ws.call('reporting.netdata_get_data', [[{ + return this.api.call('reporting.netdata_get_data', [[{ identifier: interfaceName, name: 'interface', }], { end, start }]); @@ -133,14 +133,14 @@ export class WidgetResourcesService { } getDatasetById(datasetId: string): Observable { - return this.ws.call('pool.dataset.query', [[['id', '=', datasetId]]]).pipe( + return this.api.call('pool.dataset.query', [[['id', '=', datasetId]]]).pipe( map((response) => response[0]), shareReplay({ bufferSize: 1, refCount: true }), ); } getDisksByPoolId(poolId: string): Observable { - return this.ws.call('disk.query', [[], { extra: { pools: true } }]).pipe( + return this.api.call('disk.query', [[], { extra: { pools: true } }]).pipe( map((response) => response.filter((disk: Disk) => disk.pool === poolId)), shareReplay({ bufferSize: 1, refCount: true }), ); @@ -161,7 +161,7 @@ export class WidgetResourcesService { } getAppStats(appName: string): Observable> { - return this.ws.subscribe('app.stats').pipe( + return this.api.subscribe('app.stats').pipe( filter(() => Boolean(appName)), map((event) => event.fields.find((stats) => stats.app_name === appName)), throttleTime(500), @@ -170,7 +170,7 @@ export class WidgetResourcesService { } getAppStatusUpdates(appName: string): Observable> { - return this.ws.subscribe('core.get_jobs').pipe( + return this.api.subscribe('core.get_jobs').pipe( filter((event) => ['app.start', 'app.stop'].includes(event.fields.method)), filter((event: ApiEvent>) => event.fields.arguments[0] === appName), map((event) => event.fields), @@ -179,7 +179,7 @@ export class WidgetResourcesService { } constructor( - private ws: ApiService, + private api: ApiService, private store$: Store, ) {} diff --git a/src/app/pages/data-protection/cloud-backup/cloud-backup-card/cloud-backup-card.component.ts b/src/app/pages/data-protection/cloud-backup/cloud-backup-card/cloud-backup-card.component.ts index 4b33ae7d97c..539c3debd5b 100644 --- a/src/app/pages/data-protection/cloud-backup/cloud-backup-card/cloud-backup-card.component.ts +++ b/src/app/pages/data-protection/cloud-backup/cloud-backup-card/cloud-backup-card.component.ts @@ -136,7 +136,7 @@ export class CloudBackupCardComponent implements OnInit { constructor( private cdr: ChangeDetectorRef, - private ws: ApiService, + private api: ApiService, private translate: TranslateService, private chainedSlideInService: ChainedSlideInService, private dialogService: DialogService, @@ -149,7 +149,7 @@ export class CloudBackupCardComponent implements OnInit { ) {} ngOnInit(): void { - const cloudBackups$ = this.ws.call('cloud_backup.query').pipe( + const cloudBackups$ = this.api.call('cloud_backup.query').pipe( tap((cloudBackups) => this.cloudBackups = cloudBackups), ); this.dataProvider = new AsyncDataProvider(cloudBackups$); @@ -179,7 +179,7 @@ export class CloudBackupCardComponent implements OnInit { tapOnce(() => { this.snackbar.success(this.translate.instant('Cloud Backup «{name}» has started.', { name: row.description })); }), - switchMap(() => this.ws.job('cloud_backup.sync', [row.id])), + switchMap(() => this.api.job('cloud_backup.sync', [row.id])), untilDestroyed(this), ).subscribe({ next: (job: Job) => { @@ -213,7 +213,7 @@ export class CloudBackupCardComponent implements OnInit { }), }).pipe( filter(Boolean), - switchMap(() => this.ws.call('cloud_backup.delete', [row.id]).pipe(this.appLoader.withLoader())), + switchMap(() => this.api.call('cloud_backup.delete', [row.id]).pipe(this.appLoader.withLoader())), untilDestroyed(this), ).subscribe({ next: () => { @@ -226,7 +226,7 @@ export class CloudBackupCardComponent implements OnInit { } private onChangeEnabledState(cloudBackup: CloudBackup): void { - this.ws + this.api .call('cloud_backup.update', [cloudBackup.id, { enabled: !cloudBackup.enabled } as CloudBackupUpdate]) .pipe(untilDestroyed(this)) .subscribe({ diff --git a/src/app/pages/data-protection/cloud-backup/cloud-backup-details/cloud-backup-restore-form-snapshot-form/cloud-backup-restore-from-snapshot-form.component.ts b/src/app/pages/data-protection/cloud-backup/cloud-backup-details/cloud-backup-restore-form-snapshot-form/cloud-backup-restore-from-snapshot-form.component.ts index 55bb3ca230b..ef33831f2fb 100644 --- a/src/app/pages/data-protection/cloud-backup/cloud-backup-details/cloud-backup-restore-form-snapshot-form/cloud-backup-restore-from-snapshot-form.component.ts +++ b/src/app/pages/data-protection/cloud-backup/cloud-backup-details/cloud-backup-restore-form-snapshot-form/cloud-backup-restore-from-snapshot-form.component.ts @@ -110,7 +110,7 @@ export class CloudBackupRestoreFromSnapshotFormComponent implements OnInit { constructor( private translate: TranslateService, private fb: FormBuilder, - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private snackbar: SnackbarService, private errorHandler: FormErrorHandlerService, @@ -133,7 +133,7 @@ export class CloudBackupRestoreFromSnapshotFormComponent implements OnInit { const params = this.prepareParams(); this.dialogService.jobDialog( - this.ws.job('cloud_backup.restore', params), + this.api.job('cloud_backup.restore', params), { title: this.translate.instant('Restoring backup'), canMinimize: true, @@ -157,7 +157,7 @@ export class CloudBackupRestoreFromSnapshotFormComponent implements OnInit { getSnapshotNodeProvider(): TreeNodeProvider { return (node: TreeNode) => { - return this.ws.call( + return this.api.call( 'cloud_backup.list_snapshot_directory', [this.data.backup.id, this.data.snapshot?.id, node.data.path], ).pipe( diff --git a/src/app/pages/data-protection/cloud-backup/cloud-backup-details/cloud-backup-snapshots/cloud-backup-snapshots.component.ts b/src/app/pages/data-protection/cloud-backup/cloud-backup-details/cloud-backup-snapshots/cloud-backup-snapshots.component.ts index 449d5cb5719..6c5577ac87f 100644 --- a/src/app/pages/data-protection/cloud-backup/cloud-backup-details/cloud-backup-snapshots/cloud-backup-snapshots.component.ts +++ b/src/app/pages/data-protection/cloud-backup/cloud-backup-details/cloud-backup-snapshots/cloud-backup-snapshots.component.ts @@ -99,7 +99,7 @@ export class CloudBackupSnapshotsComponent implements OnChanges { protected emptyService: EmptyService, private slideIn: SlideInService, private translate: TranslateService, - private ws: ApiService, + private api: ApiService, private dialog: DialogService, private errorHandler: ErrorHandlerService, private loader: AppLoaderService, @@ -111,7 +111,7 @@ export class CloudBackupSnapshotsComponent implements OnChanges { return; } - const cloudBackupSnapshots$ = this.ws.call('cloud_backup.list_snapshots', [this.backup.id]).pipe( + const cloudBackupSnapshots$ = this.api.call('cloud_backup.list_snapshots', [this.backup.id]).pipe( map((snapshots) => [...snapshots].sort((a, b) => b.time.$date - a.time.$date)), untilDestroyed(this), ); @@ -152,7 +152,7 @@ export class CloudBackupSnapshotsComponent implements OnChanges { }) .pipe( filter(Boolean), - switchMap(() => this.ws.job('cloud_backup.delete_snapshot', [this.backup.id, row.id])), + switchMap(() => this.api.job('cloud_backup.delete_snapshot', [this.backup.id, row.id])), tapOnce(() => this.loader.open()), catchError((error) => { this.dialog.error(this.errorHandler.parseError(error)); diff --git a/src/app/pages/data-protection/cloud-backup/cloud-backup-form/cloud-backup-form.component.ts b/src/app/pages/data-protection/cloud-backup/cloud-backup-form/cloud-backup-form.component.ts index 082768f53b9..234a85d0ac5 100644 --- a/src/app/pages/data-protection/cloud-backup/cloud-backup-form/cloud-backup-form.component.ts +++ b/src/app/pages/data-protection/cloud-backup/cloud-backup-form/cloud-backup-form.component.ts @@ -137,7 +137,7 @@ export class CloudBackupFormComponent implements OnInit { constructor( private translate: TranslateService, private fb: FormBuilder, - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private errorHandler: FormErrorHandlerService, private snackbar: SnackbarService, @@ -246,7 +246,7 @@ export class CloudBackupFormComponent implements OnInit { delete data.attributes.bucket; } - return this.ws.call('cloudsync.list_directory', [data]).pipe( + return this.api.call('cloudsync.list_directory', [data]).pipe( map((listing) => { const nodes: ExplorerNodeData[] = []; @@ -280,12 +280,12 @@ export class CloudBackupFormComponent implements OnInit { onSubmit(): void { const payload = this.prepareData(this.form.value); - let request$ = this.ws.call('cloud_backup.create', [payload]); + let request$ = this.api.call('cloud_backup.create', [payload]); this.isLoading = true; if (!this.isNew) { - request$ = this.ws.call('cloud_backup.update', [this.editingTask.id, payload]); + request$ = this.api.call('cloud_backup.update', [this.editingTask.id, payload]); } request$.pipe(untilDestroyed(this)).subscribe({ diff --git a/src/app/pages/data-protection/cloud-backup/cloud-backup-list/cloud-backup-list.component.ts b/src/app/pages/data-protection/cloud-backup/cloud-backup-list/cloud-backup-list.component.ts index df473a156ea..aed1d90b639 100644 --- a/src/app/pages/data-protection/cloud-backup/cloud-backup-list/cloud-backup-list.component.ts +++ b/src/app/pages/data-protection/cloud-backup/cloud-backup-list/cloud-backup-list.component.ts @@ -140,7 +140,7 @@ export class CloudBackupListComponent implements OnInit { constructor( private cdr: ChangeDetectorRef, - private ws: ApiService, + private api: ApiService, private translate: TranslateService, private chainedSlideInService: ChainedSlideInService, private dialogService: DialogService, @@ -191,7 +191,7 @@ export class CloudBackupListComponent implements OnInit { tapOnce(() => { this.snackbar.success(this.translate.instant('Cloud Backup «{name}» has started.', { name: row.description })); }), - switchMap(() => this.ws.job('cloud_backup.sync', [row.id])), + switchMap(() => this.api.job('cloud_backup.sync', [row.id])), untilDestroyed(this), ).subscribe({ next: (job: Job) => { @@ -229,7 +229,7 @@ export class CloudBackupListComponent implements OnInit { }), }).pipe( filter(Boolean), - switchMap(() => this.ws.call('cloud_backup.delete', [row.id]).pipe(this.appLoader.withLoader())), + switchMap(() => this.api.call('cloud_backup.delete', [row.id]).pipe(this.appLoader.withLoader())), untilDestroyed(this), ).subscribe({ next: () => { @@ -262,7 +262,7 @@ export class CloudBackupListComponent implements OnInit { } private loadCloudBackups(id?: string): void { - const cloudBackups$ = this.ws.call('cloud_backup.query').pipe( + const cloudBackups$ = this.api.call('cloud_backup.query').pipe( tap((cloudBackups) => { this.cloudBackups = cloudBackups; @@ -280,7 +280,7 @@ export class CloudBackupListComponent implements OnInit { } private onChangeEnabledState(cloudBackup: CloudBackup): void { - this.ws + this.api .call('cloud_backup.update', [cloudBackup.id, { enabled: !cloudBackup.enabled } as CloudBackupUpdate]) .pipe(untilDestroyed(this)) .subscribe({ diff --git a/src/app/pages/data-protection/cloudsync/cloudsync-form/cloudsync-form.component.ts b/src/app/pages/data-protection/cloudsync/cloudsync-form/cloudsync-form.component.ts index af1b206a79d..bb3f6719202 100644 --- a/src/app/pages/data-protection/cloudsync/cloudsync-form/cloudsync-form.component.ts +++ b/src/app/pages/data-protection/cloudsync/cloudsync-form/cloudsync-form.component.ts @@ -213,7 +213,7 @@ export class CloudSyncFormComponent implements OnInit { constructor( private translate: TranslateService, private formBuilder: FormBuilder, - private ws: ApiService, + private api: ApiService, protected router: Router, private cdr: ChangeDetectorRef, private errorHandler: FormErrorHandlerService, @@ -463,7 +463,7 @@ export class CloudSyncFormComponent implements OnInit { delete data.attributes.bucket; } - return this.ws.call('cloudsync.list_directory', [data]).pipe( + return this.api.call('cloudsync.list_directory', [data]).pipe( map((listing) => { const nodes: ExplorerNodeData[] = []; @@ -704,7 +704,7 @@ export class CloudSyncFormComponent implements OnInit { onDryRun(): void { const payload = this.prepareData(this.form.value); this.dialog.jobDialog( - this.ws.job('cloudsync.sync_onetime', [payload, { dry_run: true }]), + this.api.job('cloudsync.sync_onetime', [payload, { dry_run: true }]), { title: this.translate.instant(helptextCloudSync.job_dialog_title_dry_run) }, ) .afterClosed() @@ -721,9 +721,9 @@ export class CloudSyncFormComponent implements OnInit { let request$: Observable; if (this.isNew) { - request$ = this.ws.call('cloudsync.create', [payload]); + request$ = this.api.call('cloudsync.create', [payload]); } else { - request$ = this.ws.call('cloudsync.update', [this.editingTask.id, payload]); + request$ = this.api.call('cloudsync.update', [this.editingTask.id, payload]); } request$.pipe(untilDestroyed(this)).subscribe({ diff --git a/src/app/pages/data-protection/cloudsync/cloudsync-list/cloudsync-list.component.ts b/src/app/pages/data-protection/cloudsync/cloudsync-list/cloudsync-list.component.ts index 653a462af1e..42f844b499b 100644 --- a/src/app/pages/data-protection/cloudsync/cloudsync-list/cloudsync-list.component.ts +++ b/src/app/pages/data-protection/cloudsync/cloudsync-list/cloudsync-list.component.ts @@ -160,7 +160,7 @@ export class CloudSyncListComponent implements OnInit { constructor( private cdr: ChangeDetectorRef, - private ws: ApiService, + private api: ApiService, private translate: TranslateService, private taskService: TaskService, private chainedSlideIn: ChainedSlideInService, @@ -173,7 +173,7 @@ export class CloudSyncListComponent implements OnInit { ) {} ngOnInit(): void { - const cloudSyncTasks$ = this.ws.call('cloudsync.query').pipe( + const cloudSyncTasks$ = this.api.call('cloudsync.query').pipe( map((cloudSyncTasks) => this.transformCloudSyncData(cloudSyncTasks)), tap((cloudSyncTasks) => this.cloudSyncTasks = cloudSyncTasks), ); @@ -196,7 +196,7 @@ export class CloudSyncListComponent implements OnInit { }).pipe( filter(Boolean), tap(() => this.updateRowStateAndJob(row, JobState.Running, row.job)), - switchMap(() => this.ws.job('cloudsync.sync', [row.id])), + switchMap(() => this.api.job('cloudsync.sync', [row.id])), tapOnce(() => this.snackbar.success( this.translate.instant('Cloud Sync «{name}» has started.', { name: row.description }), )), @@ -222,7 +222,7 @@ export class CloudSyncListComponent implements OnInit { .pipe( filter(Boolean), switchMap(() => { - return this.ws.call('cloudsync.abort', [row.id]).pipe( + return this.api.call('cloudsync.abort', [row.id]).pipe( this.errorHandler.catchError(), ); }), @@ -242,7 +242,7 @@ export class CloudSyncListComponent implements OnInit { hideCheckbox: true, }).pipe( filter(Boolean), - switchMap(() => this.ws.job('cloudsync.sync', [row.id, { dry_run: true }])), + switchMap(() => this.api.job('cloudsync.sync', [row.id, { dry_run: true }])), tapOnce(() => this.snackbar.success( this.translate.instant('Cloud Sync «{name}» has started.', { name: row.description }), )), @@ -300,7 +300,7 @@ export class CloudSyncListComponent implements OnInit { }), }).pipe( filter(Boolean), - switchMap(() => this.ws.call('cloudsync.delete', [row.id])), + switchMap(() => this.api.call('cloudsync.delete', [row.id])), untilDestroyed(this), ).subscribe({ next: () => { diff --git a/src/app/pages/data-protection/cloudsync/cloudsync-restore-dialog/cloudsync-restore-dialog.component.ts b/src/app/pages/data-protection/cloudsync/cloudsync-restore-dialog/cloudsync-restore-dialog.component.ts index ae9372502cf..b5e7926e99e 100644 --- a/src/app/pages/data-protection/cloudsync/cloudsync-restore-dialog/cloudsync-restore-dialog.component.ts +++ b/src/app/pages/data-protection/cloudsync/cloudsync-restore-dialog/cloudsync-restore-dialog.component.ts @@ -71,7 +71,7 @@ export class CloudSyncRestoreDialogComponent { ]); constructor( - private ws: ApiService, + private api: ApiService, private formBuilder: FormBuilder, private filesystem: FilesystemService, private translate: TranslateService, @@ -82,7 +82,7 @@ export class CloudSyncRestoreDialogComponent { ) { } onSubmit(): void { - this.ws.call('cloudsync.restore', [this.parentTaskId, this.form.value] as CloudSyncRestoreParams) + this.api.call('cloudsync.restore', [this.parentTaskId, this.form.value] as CloudSyncRestoreParams) .pipe(this.loader.withLoader(), untilDestroyed(this)) .subscribe({ next: () => { diff --git a/src/app/pages/data-protection/cloudsync/cloudsync-task-card/cloudsync-task-card.component.ts b/src/app/pages/data-protection/cloudsync/cloudsync-task-card/cloudsync-task-card.component.ts index a5d283775d6..4b5a8eacf18 100644 --- a/src/app/pages/data-protection/cloudsync/cloudsync-task-card/cloudsync-task-card.component.ts +++ b/src/app/pages/data-protection/cloudsync/cloudsync-task-card/cloudsync-task-card.component.ts @@ -158,7 +158,7 @@ export class CloudSyncTaskCardComponent implements OnInit { constructor( private translate: TranslateService, private errorHandler: ErrorHandlerService, - private ws: ApiService, + private api: ApiService, private dialogService: DialogService, private slideIn: ChainedSlideInService, private cdr: ChangeDetectorRef, @@ -170,7 +170,7 @@ export class CloudSyncTaskCardComponent implements OnInit { ) {} ngOnInit(): void { - const cloudSyncTasks$ = this.ws.call('cloudsync.query').pipe( + const cloudSyncTasks$ = this.api.call('cloudsync.query').pipe( map((cloudSyncTasks: CloudSyncTaskUi[]) => this.transformCloudSyncTasks(cloudSyncTasks)), tap((cloudSyncTasks) => this.cloudSyncTasks = cloudSyncTasks), untilDestroyed(this), @@ -191,7 +191,7 @@ export class CloudSyncTaskCardComponent implements OnInit { }), }).pipe( filter(Boolean), - switchMap(() => this.ws.call('cloudsync.delete', [cloudsyncTask.id])), + switchMap(() => this.api.call('cloudsync.delete', [cloudsyncTask.id])), untilDestroyed(this), ).subscribe({ next: () => { @@ -232,7 +232,7 @@ export class CloudSyncTaskCardComponent implements OnInit { }).pipe( filter(Boolean), tap(() => this.updateRowStateAndJob(row, JobState.Running, row.job)), - switchMap(() => this.ws.job('cloudsync.sync', [row.id])), + switchMap(() => this.api.job('cloudsync.sync', [row.id])), tapOnce(() => this.snackbar.success( this.translate.instant('Cloud Sync «{name}» has started.', { name: row.description }), )), @@ -261,7 +261,7 @@ export class CloudSyncTaskCardComponent implements OnInit { .pipe( filter(Boolean), switchMap(() => { - return this.ws.call('cloudsync.abort', [row.id]).pipe( + return this.api.call('cloudsync.abort', [row.id]).pipe( this.errorHandler.catchError(), ); }), @@ -281,7 +281,7 @@ export class CloudSyncTaskCardComponent implements OnInit { hideCheckbox: true, }).pipe( filter(Boolean), - switchMap(() => this.ws.job('cloudsync.sync', [row.id, { dry_run: true }])), + switchMap(() => this.api.job('cloudsync.sync', [row.id, { dry_run: true }])), tapOnce(() => this.snackbar.success( this.translate.instant('Cloud Sync «{name}» has started.', { name: row.description }), )), @@ -337,7 +337,7 @@ export class CloudSyncTaskCardComponent implements OnInit { } private onChangeEnabledState(cloudsyncTask: CloudSyncTaskUi): void { - this.ws + this.api .call('cloudsync.update', [cloudsyncTask.id, { enabled: !cloudsyncTask.enabled } as CloudSyncTaskUpdate]) .pipe(untilDestroyed(this)) .subscribe({ diff --git a/src/app/pages/data-protection/cloudsync/cloudsync-wizard/cloudsync-wizard.component.ts b/src/app/pages/data-protection/cloudsync/cloudsync-wizard/cloudsync-wizard.component.ts index 6dd0aa1e780..c8e4897a1d8 100644 --- a/src/app/pages/data-protection/cloudsync/cloudsync-wizard/cloudsync-wizard.component.ts +++ b/src/app/pages/data-protection/cloudsync/cloudsync-wizard/cloudsync-wizard.component.ts @@ -55,7 +55,7 @@ export class CloudSyncWizardComponent { constructor( private chainedRef: ChainedRef, - private ws: ApiService, + private api: ApiService, private snackbarService: SnackbarService, private cdr: ChangeDetectorRef, private translate: TranslateService, @@ -64,7 +64,7 @@ export class CloudSyncWizardComponent { ) {} createTask(payload: CloudSyncTaskUpdate): Observable { - return this.ws.call('cloudsync.create', [payload]); + return this.api.call('cloudsync.create', [payload]); } onProviderSaved(credential: CloudSyncCredential): void { diff --git a/src/app/pages/data-protection/cloudsync/cloudsync-wizard/steps/cloudsync-provider/cloudsync-provider.component.ts b/src/app/pages/data-protection/cloudsync/cloudsync-wizard/steps/cloudsync-provider/cloudsync-provider.component.ts index e420b8d0fa7..1169b77b4a1 100644 --- a/src/app/pages/data-protection/cloudsync/cloudsync-wizard/steps/cloudsync-provider/cloudsync-provider.component.ts +++ b/src/app/pages/data-protection/cloudsync/cloudsync-wizard/steps/cloudsync-provider/cloudsync-provider.component.ts @@ -60,7 +60,7 @@ export class CloudSyncProviderComponent implements OnInit { readonly helptext = helptext; constructor( - private ws: ApiService, + private api: ApiService, private formBuilder: FormBuilder, private chainedComponentRef: ChainedRef, private cdr: ChangeDetectorRef, @@ -108,7 +108,7 @@ export class CloudSyncProviderComponent implements OnInit { provider: this.existingCredential.provider, attributes: { ...this.existingCredential.attributes }, }; - this.ws.call('cloudsync.credentials.verify', [payload]).pipe( + this.api.call('cloudsync.credentials.verify', [payload]).pipe( untilDestroyed(this), ).subscribe({ next: (response) => { diff --git a/src/app/pages/data-protection/cloudsync/cloudsync-wizard/steps/cloudsync-what-and-when/cloudsync-what-and-when.component.ts b/src/app/pages/data-protection/cloudsync/cloudsync-wizard/steps/cloudsync-what-and-when/cloudsync-what-and-when.component.ts index 25a30871aa1..42d275108a8 100644 --- a/src/app/pages/data-protection/cloudsync/cloudsync-wizard/steps/cloudsync-what-and-when/cloudsync-what-and-when.component.ts +++ b/src/app/pages/data-protection/cloudsync/cloudsync-wizard/steps/cloudsync-what-and-when/cloudsync-what-and-when.component.ts @@ -153,7 +153,7 @@ export class CloudSyncWhatAndWhenComponent implements OnInit, OnChanges { } constructor( - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private chainedRef: ChainedRef, private dialog: DialogService, @@ -519,7 +519,7 @@ export class CloudSyncWhatAndWhenComponent implements OnInit, OnChanges { delete data.attributes.bucket; } - return this.ws.call('cloudsync.list_directory', [data]).pipe( + return this.api.call('cloudsync.list_directory', [data]).pipe( map((listing) => { const nodes: ExplorerNodeData[] = []; diff --git a/src/app/pages/data-protection/cloudsync/create-storj-bucket-dialog/create-storj-bucket-dialog.component.ts b/src/app/pages/data-protection/cloudsync/create-storj-bucket-dialog/create-storj-bucket-dialog.component.ts index 81b0abab829..c3935fce6e0 100644 --- a/src/app/pages/data-protection/cloudsync/create-storj-bucket-dialog/create-storj-bucket-dialog.component.ts +++ b/src/app/pages/data-protection/cloudsync/create-storj-bucket-dialog/create-storj-bucket-dialog.component.ts @@ -50,14 +50,14 @@ export class CreateStorjBucketDialogComponent { constructor( private formBuilder: FormBuilder, private dialogRef: MatDialogRef, - private ws: ApiService, + private api: ApiService, private appLoader: AppLoaderService, @Optional() @Inject(MAT_DIALOG_DATA) public data: { credentialsId: number }, private formErrorHandler: FormErrorHandlerService, ) {} onSubmit(): void { - this.ws.call('cloudsync.create_bucket', [this.data.credentialsId, this.form.controls.bucket.value]) + this.api.call('cloudsync.create_bucket', [this.data.credentialsId, this.form.controls.bucket.value]) .pipe( this.appLoader.withLoader(), untilDestroyed(this), diff --git a/src/app/pages/data-protection/replication/replication-form/replication-form.component.ts b/src/app/pages/data-protection/replication/replication-form/replication-form.component.ts index f5f8654125a..7da9085ade3 100644 --- a/src/app/pages/data-protection/replication/replication-form/replication-form.component.ts +++ b/src/app/pages/data-protection/replication/replication-form/replication-form.component.ts @@ -96,7 +96,7 @@ export class ReplicationFormComponent implements OnInit { protected existingReplication: ReplicationTask; constructor( - private ws: ApiService, + private api: ApiService, private errorHandler: ErrorHandlerService, private translate: TranslateService, public formatter: IxFormatterService, @@ -167,8 +167,8 @@ export class ReplicationFormComponent implements OnInit { const payload = this.getPayload(); const operation$ = this.isNew - ? this.ws.call('replication.create', [payload]) - : this.ws.call('replication.update', [this.existingReplication.id, payload]); + ? this.api.call('replication.create', [payload]) + : this.api.call('replication.update', [this.existingReplication.id, payload]); this.isLoading = true; operation$ @@ -257,7 +257,7 @@ export class ReplicationFormComponent implements OnInit { this.authService.hasRole(this.requiredRoles).pipe( switchMap((hasRole) => { if (hasRole) { - return this.ws.call('replication.count_eligible_manual_snapshots', [payload]); + return this.api.call('replication.count_eligible_manual_snapshots', [payload]); } return of({ eligible: 0, total: 0 }); }), diff --git a/src/app/pages/data-protection/replication/replication-form/sections/source-section/source-section.component.ts b/src/app/pages/data-protection/replication/replication-form/sections/source-section/source-section.component.ts index 579bab97115..b1dd801cf86 100644 --- a/src/app/pages/data-protection/replication/replication-form/sections/source-section/source-section.component.ts +++ b/src/app/pages/data-protection/replication/replication-form/sections/source-section/source-section.component.ts @@ -77,7 +77,7 @@ export class SourceSectionComponent implements OnChanges { readonly timeOptions$ = of(this.taskService.getTimeOptions()); readonly snapshotNamingOptions$ = of(mapToOptions(snapshotNamingOptionNames, this.translate)); - readonly periodicSnapshotTasks$ = this.ws.call('pool.snapshottask.query').pipe(map((tasks) => { + readonly periodicSnapshotTasks$ = this.api.call('pool.snapshottask.query').pipe(map((tasks) => { return tasks.map((task) => { const enabledMessage = task.enabled ? this.translate.instant('Enabled') @@ -94,7 +94,7 @@ export class SourceSectionComponent implements OnChanges { protected readonly CronPresetValue = CronPresetValue; constructor( - private ws: ApiService, + private api: ApiService, private formBuilder: FormBuilder, private taskService: TaskService, private translate: TranslateService, diff --git a/src/app/pages/data-protection/replication/replication-list/replication-list.component.ts b/src/app/pages/data-protection/replication/replication-list/replication-list.component.ts index 6d8bdb45bf2..d3da3ae1948 100644 --- a/src/app/pages/data-protection/replication/replication-list/replication-list.component.ts +++ b/src/app/pages/data-protection/replication/replication-list/replication-list.component.ts @@ -172,7 +172,7 @@ export class ReplicationListComponent implements OnInit { constructor( private cdr: ChangeDetectorRef, - private ws: ApiService, + private api: ApiService, private translate: TranslateService, private chainedSlideIn: ChainedSlideInService, private dialogService: DialogService, @@ -185,7 +185,7 @@ export class ReplicationListComponent implements OnInit { ) {} ngOnInit(): void { - const replicationTasks$ = this.ws.call('replication.query', [[], { + const replicationTasks$ = this.api.call('replication.query', [[], { extra: { check_dataset_encryption_keys: true, }, @@ -217,7 +217,7 @@ export class ReplicationListComponent implements OnInit { }).pipe( filter(Boolean), tap(() => this.updateRowStateAndJob(row, JobState.Running, row.job)), - switchMap(() => this.ws.job('replication.run', [row.id])), + switchMap(() => this.api.job('replication.run', [row.id])), untilDestroyed(this), ).subscribe({ next: (job: Job) => { @@ -271,7 +271,7 @@ export class ReplicationListComponent implements OnInit { }), }).pipe( filter(Boolean), - switchMap(() => this.ws.call('replication.delete', [row.id]).pipe(this.appLoader.withLoader())), + switchMap(() => this.api.call('replication.delete', [row.id]).pipe(this.appLoader.withLoader())), untilDestroyed(this), ).subscribe({ next: () => { @@ -296,7 +296,7 @@ export class ReplicationListComponent implements OnInit { downloadKeys(row: ReplicationTask): void { const fileName = `${row.name}_encryption_keys.json`; - this.ws.call('core.download', ['pool.dataset.export_keys_for_replication', [row.id], fileName]) + this.api.call('core.download', ['pool.dataset.export_keys_for_replication', [row.id], fileName]) .pipe(this.appLoader.withLoader(), untilDestroyed(this)) .subscribe({ next: ([, url]) => { @@ -317,7 +317,7 @@ export class ReplicationListComponent implements OnInit { } private onChangeEnabledState(replicationTask: ReplicationTask): void { - this.ws + this.api .call('replication.update', [replicationTask.id, { enabled: !replicationTask.enabled }]) .pipe(untilDestroyed(this)) .subscribe({ diff --git a/src/app/pages/data-protection/replication/replication-restore-dialog/replication-restore-dialog.component.ts b/src/app/pages/data-protection/replication/replication-restore-dialog/replication-restore-dialog.component.ts index fd653df053b..af5f6210014 100644 --- a/src/app/pages/data-protection/replication/replication-restore-dialog/replication-restore-dialog.component.ts +++ b/src/app/pages/data-protection/replication/replication-restore-dialog/replication-restore-dialog.component.ts @@ -53,7 +53,7 @@ export class ReplicationRestoreDialogComponent { readonly helptext = helptextReplication; constructor( - private ws: ApiService, + private api: ApiService, private loader: AppLoaderService, private formBuilder: FormBuilder, private datasetService: DatasetService, @@ -63,7 +63,7 @@ export class ReplicationRestoreDialogComponent { ) {} onSubmit(): void { - this.ws.call('replication.restore', [this.parentTaskId, this.form.value]) + this.api.call('replication.restore', [this.parentTaskId, this.form.value]) .pipe(this.loader.withLoader(), untilDestroyed(this)) .subscribe({ next: () => { diff --git a/src/app/pages/data-protection/replication/replication-task-card/replication-task-card.component.spec.ts b/src/app/pages/data-protection/replication/replication-task-card/replication-task-card.component.spec.ts index b85954e8866..602998a471a 100644 --- a/src/app/pages/data-protection/replication/replication-task-card/replication-task-card.component.spec.ts +++ b/src/app/pages/data-protection/replication/replication-task-card/replication-task-card.component.spec.ts @@ -28,7 +28,7 @@ describe('ReplicationTaskCardComponent', () => { let spectator: Spectator; let loader: HarnessLoader; let table: IxTableHarness; - let ws: ApiService; + let api: ApiService; const replicationTasks = [ { @@ -108,7 +108,7 @@ describe('ReplicationTaskCardComponent', () => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); table = await loader.getHarness(IxTableHarness); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('should show table rows', async () => { @@ -170,7 +170,7 @@ describe('ReplicationTaskCardComponent', () => { const downloadButton = await table.getHarnessInCell(IxIconHarness.with({ name: 'mdi-download' }), 1, 5); await downloadButton.click(); - expect(ws.call).toHaveBeenCalledWith('core.download', [ + expect(api.call).toHaveBeenCalledWith('core.download', [ 'pool.dataset.export_keys_for_replication', [1], 'APPS/test2 - APPS/test3_encryption_keys.json', diff --git a/src/app/pages/data-protection/replication/replication-task-card/replication-task-card.component.ts b/src/app/pages/data-protection/replication/replication-task-card/replication-task-card.component.ts index 44a5cbc0541..573811cd283 100644 --- a/src/app/pages/data-protection/replication/replication-task-card/replication-task-card.component.ts +++ b/src/app/pages/data-protection/replication/replication-task-card/replication-task-card.component.ts @@ -157,7 +157,7 @@ export class ReplicationTaskCardComponent implements OnInit { private chainedSlideIn: ChainedSlideInService, private translate: TranslateService, private errorHandler: ErrorHandlerService, - private ws: ApiService, + private api: ApiService, private dialogService: DialogService, private snackbar: SnackbarService, private matDialog: MatDialog, @@ -166,7 +166,7 @@ export class ReplicationTaskCardComponent implements OnInit { ) {} ngOnInit(): void { - const replicationTasks$ = this.ws.call('replication.query', [[], { + const replicationTasks$ = this.api.call('replication.query', [[], { extra: { check_dataset_encryption_keys: true }, }]).pipe(untilDestroyed(this)); this.dataProvider = new AsyncDataProvider(replicationTasks$); @@ -185,7 +185,7 @@ export class ReplicationTaskCardComponent implements OnInit { }), }).pipe( filter(Boolean), - switchMap(() => this.ws.call('replication.delete', [replicationTask.id])), + switchMap(() => this.api.call('replication.delete', [replicationTask.id])), untilDestroyed(this), ).subscribe({ next: () => { @@ -220,7 +220,7 @@ export class ReplicationTaskCardComponent implements OnInit { }).pipe( filter(Boolean), tap(() => row.state.state = JobState.Running), - switchMap(() => this.ws.job('replication.run', [row.id])), + switchMap(() => this.api.job('replication.run', [row.id])), tapOnce(() => { this.snackbar.success( this.translate.instant('Replication «{name}» has started.', { name: row.name }), @@ -252,7 +252,7 @@ export class ReplicationTaskCardComponent implements OnInit { } downloadKeys(row: ReplicationTask): void { - this.ws.call('core.download', [ + this.api.call('core.download', [ 'pool.dataset.export_keys_for_replication', [row.id], `${row.name}_encryption_keys.json`, @@ -279,7 +279,7 @@ export class ReplicationTaskCardComponent implements OnInit { } private onChangeEnabledState(replicationTask: ReplicationTask): void { - this.ws + this.api .call('replication.update', [replicationTask.id, { enabled: !replicationTask.enabled }]) .pipe(untilDestroyed(this)) .subscribe({ diff --git a/src/app/pages/data-protection/replication/replication-wizard/replication-wizard.component.ts b/src/app/pages/data-protection/replication/replication-wizard/replication-wizard.component.ts index 997b36170ec..ae8fde9b093 100644 --- a/src/app/pages/data-protection/replication/replication-wizard/replication-wizard.component.ts +++ b/src/app/pages/data-protection/replication/replication-wizard/replication-wizard.component.ts @@ -86,7 +86,7 @@ export class ReplicationWizardComponent { createdReplication: ReplicationTask; constructor( - private ws: ApiService, + private api: ApiService, private replicationService: ReplicationService, private errorHandler: ErrorHandlerService, private dialogService: DialogService, @@ -109,11 +109,11 @@ export class ReplicationWizardComponent { const requests: Observable[] = []; this.createdSnapshots.forEach((snapshot) => { - requests.push(this.ws.call('zfs.snapshot.delete', [snapshot.name])); + requests.push(this.api.call('zfs.snapshot.delete', [snapshot.name])); }); this.createdSnapshotTasks.forEach((task) => { - requests.push(this.ws.call('pool.snapshottask.delete', [task.id])); + requests.push(this.api.call('pool.snapshottask.delete', [task.id])); }); if (requests.length) { @@ -171,7 +171,7 @@ export class ReplicationWizardComponent { private runReplicationOnce(createdReplication: ReplicationTask): Observable { this.appLoader.open(this.translate.instant('Starting task')); - return this.ws.startJob('replication.run', [createdReplication.id]).pipe( + return this.api.startJob('replication.run', [createdReplication.id]).pipe( switchMap(() => { this.appLoader.close(); return this.dialogService.info( @@ -200,7 +200,7 @@ export class ReplicationWizardComponent { ]).pipe( switchMap((hasRole) => { if (hasRole) { - return this.ws.call('replication.count_eligible_manual_snapshots', [payload]); + return this.api.call('replication.count_eligible_manual_snapshots', [payload]); } return of({ eligible: 0, total: 0 }); }), @@ -208,19 +208,19 @@ export class ReplicationWizardComponent { } getUnmatchedSnapshots(payload: TargetUnmatchedSnapshotsParams): Observable> { - return this.ws.call('replication.target_unmatched_snapshots', payload); + return this.api.call('replication.target_unmatched_snapshots', payload); } createPeriodicSnapshotTask(payload: PeriodicSnapshotTaskCreate): Observable { - return this.ws.call('pool.snapshottask.create', [payload]); + return this.api.call('pool.snapshottask.create', [payload]); } createSnapshot(payload: CreateZfsSnapshot): Observable { - return this.ws.call('zfs.snapshot.create', [payload]); + return this.api.call('zfs.snapshot.create', [payload]); } createReplication(payload: ReplicationCreate): Observable { - return this.ws.call('replication.create', [payload]); + return this.api.call('replication.create', [payload]); } getSnapshotsCountPayload(value: ReplicationWizardData): CountManualSnapshotsParams { @@ -352,7 +352,7 @@ export class ReplicationWizardComponent { schedule: Schedule; naming_schema?: string; }): Observable { - return this.ws.call('pool.snapshottask.query', [[ + return this.api.call('pool.snapshottask.query', [[ ['dataset', '=', payload.dataset], ['schedule.minute', '=', payload.schedule.minute], ['schedule.hour', '=', payload.schedule.hour], diff --git a/src/app/pages/data-protection/replication/replication-wizard/steps/replication-what-and-where/replication-what-and-where.component.ts b/src/app/pages/data-protection/replication/replication-wizard/steps/replication-what-and-where/replication-what-and-where.component.ts index 20a779975b9..4a321b7b4fd 100644 --- a/src/app/pages/data-protection/replication/replication-wizard/steps/replication-what-and-where/replication-what-and-where.component.ts +++ b/src/app/pages/data-protection/replication/replication-wizard/steps/replication-what-and-where/replication-what-and-where.component.ts @@ -112,7 +112,7 @@ export class ReplicationWhatAndWhereComponent implements OnInit, SummaryProvider sudo: [false], name: ['', [Validators.required], forbiddenAsyncValues( - this.ws.call('replication.query').pipe( + this.api.call('replication.query').pipe( map((replications) => replications.map((replication) => replication.name)), ), ), @@ -171,7 +171,7 @@ export class ReplicationWhatAndWhereComponent implements OnInit, SummaryProvider private authService: AuthService, private datasetService: DatasetService, private dialogService: DialogService, - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, ) {} @@ -420,7 +420,7 @@ export class ReplicationWhatAndWhereComponent implements OnInit, SummaryProvider ]).pipe( switchMap((hasRole) => { if (hasRole) { - return this.ws.call('replication.count_eligible_manual_snapshots', [payload]); + return this.api.call('replication.count_eligible_manual_snapshots', [payload]); } return of({ eligible: 0, total: 0 }); }), diff --git a/src/app/pages/data-protection/rsync-task/rsync-task-card/rsync-task-card.component.ts b/src/app/pages/data-protection/rsync-task/rsync-task-card/rsync-task-card.component.ts index fb8f773e124..ef51b3596b9 100644 --- a/src/app/pages/data-protection/rsync-task/rsync-task-card/rsync-task-card.component.ts +++ b/src/app/pages/data-protection/rsync-task/rsync-task-card/rsync-task-card.component.ts @@ -140,7 +140,7 @@ export class RsyncTaskCardComponent implements OnInit { constructor( private translate: TranslateService, private errorHandler: ErrorHandlerService, - private ws: ApiService, + private api: ApiService, private dialogService: DialogService, private taskService: TaskService, private store$: Store, @@ -150,7 +150,7 @@ export class RsyncTaskCardComponent implements OnInit { ) {} ngOnInit(): void { - const rsyncTasks$ = this.ws.call('rsynctask.query').pipe( + const rsyncTasks$ = this.api.call('rsynctask.query').pipe( map((rsyncTasks: RsyncTaskUi[]) => this.transformRsyncTasks(rsyncTasks)), tap((rsyncTasks) => this.rsyncTasks = rsyncTasks), untilDestroyed(this), @@ -171,7 +171,7 @@ export class RsyncTaskCardComponent implements OnInit { }), }).pipe( filter(Boolean), - switchMap(() => this.ws.call('rsynctask.delete', [row.id])), + switchMap(() => this.api.call('rsynctask.delete', [row.id])), untilDestroyed(this), ).subscribe({ next: () => { @@ -200,7 +200,7 @@ export class RsyncTaskCardComponent implements OnInit { }).pipe( filter(Boolean), tap(() => row.state = { state: JobState.Running }), - switchMap(() => this.ws.job('rsynctask.run', [row.id])), + switchMap(() => this.api.job('rsynctask.run', [row.id])), tapOnce(() => this.snackbar.success( this.translate.instant('Rsync task «{name}» has started.', { name: `${row.remotehost || row.path} ${row.remotemodule ? '- ' + row.remotemodule : ''}`, @@ -241,7 +241,7 @@ export class RsyncTaskCardComponent implements OnInit { } private onChangeEnabledState(rsyncTask: RsyncTaskUi): void { - this.ws + this.api .call('rsynctask.update', [rsyncTask.id, { enabled: !rsyncTask.enabled } as RsyncTaskUpdate]) .pipe(untilDestroyed(this)) .subscribe({ diff --git a/src/app/pages/data-protection/rsync-task/rsync-task-form/rsync-task-form.component.ts b/src/app/pages/data-protection/rsync-task/rsync-task-form/rsync-task-form.component.ts index 66f93bffb0d..ec4eedf9cbf 100644 --- a/src/app/pages/data-protection/rsync-task/rsync-task-form/rsync-task-form.component.ts +++ b/src/app/pages/data-protection/rsync-task/rsync-task-form/rsync-task-form.component.ts @@ -142,7 +142,7 @@ export class RsyncTaskFormComponent implements OnInit { constructor( private translate: TranslateService, private formBuilder: FormBuilder, - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private errorHandler: FormErrorHandlerService, private userService: UserService, @@ -208,9 +208,9 @@ export class RsyncTaskFormComponent implements OnInit { this.isLoading = true; let request$: Observable; if (this.isNew) { - request$ = this.ws.call('rsynctask.create', [values as RsyncTaskUpdate]); + request$ = this.api.call('rsynctask.create', [values as RsyncTaskUpdate]); } else { - request$ = this.ws.call('rsynctask.update', [ + request$ = this.api.call('rsynctask.update', [ this.editingTask.id, values as RsyncTaskUpdate, ]); diff --git a/src/app/pages/data-protection/rsync-task/rsync-task-list/rsync-task-list.component.ts b/src/app/pages/data-protection/rsync-task/rsync-task-list/rsync-task-list.component.ts index acb13b9208f..1ed22a8a7cc 100644 --- a/src/app/pages/data-protection/rsync-task/rsync-task-list/rsync-task-list.component.ts +++ b/src/app/pages/data-protection/rsync-task/rsync-task-list/rsync-task-list.component.ts @@ -189,7 +189,7 @@ export class RsyncTaskListComponent implements OnInit { constructor( private translate: TranslateService, - private ws: ApiService, + private api: ApiService, private chainedSlideIn: ChainedSlideInService, private dialogService: DialogService, private errorHandler: ErrorHandlerService, @@ -205,7 +205,7 @@ export class RsyncTaskListComponent implements OnInit { ngOnInit(): void { this.filterString = this.route.snapshot.paramMap.get('dataset') || ''; - const request$ = this.ws.call('rsynctask.query'); + const request$ = this.api.call('rsynctask.query'); this.dataProvider = new AsyncDataProvider(request$); this.refresh(); this.dataProvider.emptyType$.pipe(untilDestroyed(this)).subscribe(() => { @@ -239,7 +239,7 @@ export class RsyncTaskListComponent implements OnInit { this.translate.instant('Rsync task has started.'), ); }), - switchMap(() => this.ws.job('rsynctask.run', [row.id])), + switchMap(() => this.api.job('rsynctask.run', [row.id])), untilDestroyed(this), ) .subscribe(() => this.refresh()); @@ -266,7 +266,7 @@ export class RsyncTaskListComponent implements OnInit { .pipe( filter(Boolean), switchMap(() => { - return this.ws.call('rsynctask.delete', [row.id]).pipe( + return this.api.call('rsynctask.delete', [row.id]).pipe( this.loader.withLoader(), this.errorHandler.catchError(), ); diff --git a/src/app/pages/data-protection/scrub-task/resilver-config/resilver-config.component.spec.ts b/src/app/pages/data-protection/scrub-task/resilver-config/resilver-config.component.spec.ts index ff6e41c2efb..307d5f2fe1e 100644 --- a/src/app/pages/data-protection/scrub-task/resilver-config/resilver-config.component.spec.ts +++ b/src/app/pages/data-protection/scrub-task/resilver-config/resilver-config.component.spec.ts @@ -19,7 +19,7 @@ import { ResilverConfigComponent } from './resilver-config.component'; describe('ResilverConfigComponent', () => { let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; const createComponent = createComponentFactory({ component: ResilverConfigComponent, imports: [ @@ -48,7 +48,7 @@ describe('ResilverConfigComponent', () => { beforeEach(() => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('loads and shows current resilver settings when form is opened', async () => { @@ -75,7 +75,7 @@ describe('ResilverConfigComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith( + expect(api.call).toHaveBeenCalledWith( 'pool.resilver.update', [{ enabled: false, diff --git a/src/app/pages/data-protection/scrub-task/resilver-config/resilver-config.component.ts b/src/app/pages/data-protection/scrub-task/resilver-config/resilver-config.component.ts index 2f91dd42fe8..f50841f7ba6 100644 --- a/src/app/pages/data-protection/scrub-task/resilver-config/resilver-config.component.ts +++ b/src/app/pages/data-protection/scrub-task/resilver-config/resilver-config.component.ts @@ -83,7 +83,7 @@ export class ResilverConfigComponent implements OnInit { constructor( private errorHandler: ErrorHandlerService, - private ws: ApiService, + private api: ApiService, private formErrorHandler: FormErrorHandlerService, private cdr: ChangeDetectorRef, private fb: FormBuilder, @@ -98,7 +98,7 @@ export class ResilverConfigComponent implements OnInit { ngOnInit(): void { this.isFormLoading = true; - this.ws.call('pool.resilver.config') + this.api.call('pool.resilver.config') .pipe(untilDestroyed(this)) .subscribe({ next: (config) => { @@ -118,7 +118,7 @@ export class ResilverConfigComponent implements OnInit { const values = this.form.value; this.isFormLoading = true; - this.ws.call('pool.resilver.update', [values as ResilverConfigUpdate]) + this.api.call('pool.resilver.update', [values as ResilverConfigUpdate]) .pipe(untilDestroyed(this)) .subscribe({ next: () => { diff --git a/src/app/pages/data-protection/scrub-task/scrub-list/scrub-list.component.ts b/src/app/pages/data-protection/scrub-task/scrub-list/scrub-list.component.ts index f7729516952..c13365d17e0 100644 --- a/src/app/pages/data-protection/scrub-task/scrub-list/scrub-list.component.ts +++ b/src/app/pages/data-protection/scrub-task/scrub-list/scrub-list.component.ts @@ -129,7 +129,7 @@ export class ScrubListComponent implements OnInit { private translate: TranslateService, private crontabExplanation: CrontabExplanationPipe, private taskService: TaskService, - private ws: ApiService, + private api: ApiService, private slideIn: SlideInService, private dialogService: DialogService, private loader: AppLoaderService, @@ -139,7 +139,7 @@ export class ScrubListComponent implements OnInit { ) {} ngOnInit(): void { - this.dataProvider = new AsyncDataProvider(this.ws.call('pool.scrub.query')); + this.dataProvider = new AsyncDataProvider(this.api.call('pool.scrub.query')); this.dataProvider.load(); } @@ -172,7 +172,7 @@ export class ScrubListComponent implements OnInit { .pipe( filter(Boolean), switchMap(() => { - return this.ws.call('pool.scrub.delete', [row.id]).pipe( + return this.api.call('pool.scrub.delete', [row.id]).pipe( this.loader.withLoader(), this.errorHandler.catchError(), ); diff --git a/src/app/pages/data-protection/scrub-task/scrub-task-card/scrub-task-card.component.ts b/src/app/pages/data-protection/scrub-task/scrub-task-card/scrub-task-card.component.ts index 371e21caa36..d77e700009a 100644 --- a/src/app/pages/data-protection/scrub-task/scrub-task-card/scrub-task-card.component.ts +++ b/src/app/pages/data-protection/scrub-task/scrub-task-card/scrub-task-card.component.ts @@ -113,14 +113,14 @@ export class ScrubTaskCardComponent implements OnInit { private slideInService: SlideInService, private translate: TranslateService, private errorHandler: ErrorHandlerService, - private ws: ApiService, + private api: ApiService, private dialogService: DialogService, private taskService: TaskService, protected emptyService: EmptyService, ) {} ngOnInit(): void { - const scrubTasks$ = this.ws.call('pool.scrub.query'); + const scrubTasks$ = this.api.call('pool.scrub.query'); this.dataProvider = new AsyncDataProvider(scrubTasks$); this.getScrubTasks(); } @@ -135,7 +135,7 @@ export class ScrubTaskCardComponent implements OnInit { message: this.translate.instant('Delete Scrub Task "{name}"?', { name: scrubTask.pool_name }), }).pipe( filter(Boolean), - switchMap(() => this.ws.call('pool.scrub.delete', [scrubTask.id])), + switchMap(() => this.api.call('pool.scrub.delete', [scrubTask.id])), untilDestroyed(this), ).subscribe({ next: () => { @@ -156,7 +156,7 @@ export class ScrubTaskCardComponent implements OnInit { } private onChangeEnabledState(scrubTask: PoolScrubTask): void { - this.ws + this.api .call('pool.scrub.update', [scrubTask.id, { enabled: !scrubTask.enabled } as PoolScrubTask]) .pipe(untilDestroyed(this)) .subscribe({ diff --git a/src/app/pages/data-protection/scrub-task/scrub-task-form/scrub-task-form.component.ts b/src/app/pages/data-protection/scrub-task/scrub-task-form/scrub-task-form.component.ts index 886cd526888..e140856aa3a 100644 --- a/src/app/pages/data-protection/scrub-task/scrub-task-form/scrub-task-form.component.ts +++ b/src/app/pages/data-protection/scrub-task/scrub-task-form/scrub-task-form.component.ts @@ -76,7 +76,7 @@ export class ScrubTaskFormComponent implements OnInit { isLoading = false; - poolOptions$ = this.ws.call('pool.query').pipe( + poolOptions$ = this.api.call('pool.query').pipe( map((pools) => { return pools.map((pool) => ({ label: pool.name, value: pool.id })); }), @@ -93,7 +93,7 @@ export class ScrubTaskFormComponent implements OnInit { constructor( private translate: TranslateService, private fb: FormBuilder, - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private snackbar: SnackbarService, private errorHandler: FormErrorHandlerService, @@ -123,9 +123,9 @@ export class ScrubTaskFormComponent implements OnInit { this.isLoading = true; let request$: Observable; if (this.isNew) { - request$ = this.ws.call('pool.scrub.create', [values as CreatePoolScrubTask]); + request$ = this.api.call('pool.scrub.create', [values as CreatePoolScrubTask]); } else { - request$ = this.ws.call('pool.scrub.update', [ + request$ = this.api.call('pool.scrub.update', [ this.editingTask.id, values as CreatePoolScrubTask, ]); diff --git a/src/app/pages/data-protection/smart-task/smart-task-card/smart-task-card.component.ts b/src/app/pages/data-protection/smart-task/smart-task-card/smart-task-card.component.ts index eb1cd57fbf3..29d3bf3af7f 100644 --- a/src/app/pages/data-protection/smart-task/smart-task-card/smart-task-card.component.ts +++ b/src/app/pages/data-protection/smart-task/smart-task-card/smart-task-card.component.ts @@ -113,7 +113,7 @@ export class SmartTaskCardComponent implements OnInit { private slideInService: SlideInService, private translate: TranslateService, private errorHandler: ErrorHandlerService, - private ws: ApiService, + private api: ApiService, private dialogService: DialogService, private taskService: TaskService, private storageService: StorageService, @@ -125,7 +125,7 @@ export class SmartTaskCardComponent implements OnInit { } ngOnInit(): void { - const smartTasks$ = this.ws.call('smart.test.query').pipe( + const smartTasks$ = this.api.call('smart.test.query').pipe( map((smartTasks: SmartTestTaskUi[]) => this.transformSmartTasks(smartTasks)), tap((smartTasks) => this.smartTasks = smartTasks), untilDestroyed(this), @@ -154,7 +154,7 @@ export class SmartTaskCardComponent implements OnInit { }), }).pipe( filter(Boolean), - switchMap(() => this.ws.call('smart.test.delete', [smartTask.id])), + switchMap(() => this.api.call('smart.test.delete', [smartTask.id])), untilDestroyed(this), ).subscribe({ next: () => { diff --git a/src/app/pages/data-protection/smart-task/smart-task-form/smart-task-form.component.ts b/src/app/pages/data-protection/smart-task/smart-task-form/smart-task-form.component.ts index 6ac03cb2a18..a2cab0a7ded 100644 --- a/src/app/pages/data-protection/smart-task/smart-task-form/smart-task-form.component.ts +++ b/src/app/pages/data-protection/smart-task/smart-task-form/smart-task-form.component.ts @@ -90,12 +90,12 @@ export class SmartTaskFormComponent implements OnInit { schedule: helptextSmart.smarttest_picker_tooltip, }; - readonly diskOptions$ = this.ws.call('smart.test.disk_choices').pipe(choicesToOptions()); + readonly diskOptions$ = this.api.call('smart.test.disk_choices').pipe(choicesToOptions()); readonly typeOptions$ = of(mapToOptions(smartTestTypeLabels, this.translate)); constructor( private fb: FormBuilder, - private ws: ApiService, + private api: ApiService, private translate: TranslateService, private cdr: ChangeDetectorRef, private snackbar: SnackbarService, @@ -127,9 +127,9 @@ export class SmartTaskFormComponent implements OnInit { this.isLoading = true; let request$: Observable; if (this.isNew) { - request$ = this.ws.call('smart.test.create', [values]); + request$ = this.api.call('smart.test.create', [values]); } else { - request$ = this.ws.call('smart.test.update', [ + request$ = this.api.call('smart.test.update', [ this.editingTest.id, values, ]); diff --git a/src/app/pages/data-protection/smart-task/smart-task-list/smart-task-list.component.ts b/src/app/pages/data-protection/smart-task/smart-task-list/smart-task-list.component.ts index dbdb29dd863..f60fee91bbd 100644 --- a/src/app/pages/data-protection/smart-task/smart-task-list/smart-task-list.component.ts +++ b/src/app/pages/data-protection/smart-task/smart-task-list/smart-task-list.component.ts @@ -122,7 +122,7 @@ export class SmartTaskListComponent implements OnInit { private taskService: TaskService, private translate: TranslateService, private dialogService: DialogService, - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private errorHandler: ErrorHandlerService, ) { @@ -132,7 +132,7 @@ export class SmartTaskListComponent implements OnInit { } ngOnInit(): void { - const smartTasks$ = this.ws.call('smart.test.query').pipe( + const smartTasks$ = this.api.call('smart.test.query').pipe( map((smartTasks: SmartTestTaskUi[]) => this.transformSmartTasks(smartTasks)), tap((smartTasks) => this.smartTasks = smartTasks), untilDestroyed(this), @@ -175,7 +175,7 @@ export class SmartTaskListComponent implements OnInit { }), }).pipe( filter(Boolean), - switchMap(() => this.ws.call('smart.test.delete', [smartTask.id])), + switchMap(() => this.api.call('smart.test.delete', [smartTask.id])), untilDestroyed(this), ).subscribe({ next: () => { diff --git a/src/app/pages/data-protection/snapshot-task/snapshot-task-card/snapshot-task-card.component.ts b/src/app/pages/data-protection/snapshot-task/snapshot-task-card/snapshot-task-card.component.ts index 67a5b8c9143..be06e047839 100644 --- a/src/app/pages/data-protection/snapshot-task/snapshot-task-card/snapshot-task-card.component.ts +++ b/src/app/pages/data-protection/snapshot-task/snapshot-task-card/snapshot-task-card.component.ts @@ -128,14 +128,14 @@ export class SnapshotTaskCardComponent implements OnInit { private slideInService: SlideInService, private translate: TranslateService, private errorHandler: ErrorHandlerService, - private ws: ApiService, + private api: ApiService, private dialogService: DialogService, private taskService: TaskService, protected emptyService: EmptyService, ) {} ngOnInit(): void { - const snapshotTasks$ = this.ws.call('pool.snapshottask.query').pipe( + const snapshotTasks$ = this.api.call('pool.snapshottask.query').pipe( map((snapshotTasks) => snapshotTasks as PeriodicSnapshotTaskUi[]), untilDestroyed(this), ); @@ -155,7 +155,7 @@ export class SnapshotTaskCardComponent implements OnInit { }), }).pipe( filter(Boolean), - switchMap(() => this.ws.call('pool.snapshottask.delete', [snapshotTask.id])), + switchMap(() => this.api.call('pool.snapshottask.delete', [snapshotTask.id])), untilDestroyed(this), ).subscribe({ next: () => { @@ -176,7 +176,7 @@ export class SnapshotTaskCardComponent implements OnInit { } private onChangeEnabledState(snapshotTask: PeriodicSnapshotTaskUi): void { - this.ws + this.api .call('pool.snapshottask.update', [snapshotTask.id, { enabled: !snapshotTask.enabled } as PeriodicSnapshotTaskUi]) .pipe(untilDestroyed(this)) .subscribe({ diff --git a/src/app/pages/data-protection/snapshot-task/snapshot-task-form/snapshot-task-form.component.ts b/src/app/pages/data-protection/snapshot-task/snapshot-task-form/snapshot-task-form.component.ts index bf0e0077c05..73836f83f9e 100644 --- a/src/app/pages/data-protection/snapshot-task/snapshot-task-form/snapshot-task-form.component.ts +++ b/src/app/pages/data-protection/snapshot-task/snapshot-task-form/snapshot-task-form.component.ts @@ -122,7 +122,7 @@ export class SnapshotTaskFormComponent implements OnInit { constructor( private fb: FormBuilder, - private ws: ApiService, + private api: ApiService, private translate: TranslateService, private errorHandler: FormErrorHandlerService, private cdr: ChangeDetectorRef, @@ -171,9 +171,9 @@ export class SnapshotTaskFormComponent implements OnInit { this.isLoading = true; let request$: Observable; if (this.isNew) { - request$ = this.ws.call('pool.snapshottask.create', [params as PeriodicSnapshotTaskCreate]); + request$ = this.api.call('pool.snapshottask.create', [params as PeriodicSnapshotTaskCreate]); } else { - request$ = this.ws.call('pool.snapshottask.update', [ + request$ = this.api.call('pool.snapshottask.update', [ this.editingTask.id, params as PeriodicSnapshotTaskUpdate, ]); diff --git a/src/app/pages/data-protection/snapshot-task/snapshot-task-list/snapshot-task-list.component.ts b/src/app/pages/data-protection/snapshot-task/snapshot-task-list/snapshot-task-list.component.ts index e747c515af6..f1498b9b55c 100644 --- a/src/app/pages/data-protection/snapshot-task/snapshot-task-list/snapshot-task-list.component.ts +++ b/src/app/pages/data-protection/snapshot-task/snapshot-task-list/snapshot-task-list.component.ts @@ -169,7 +169,7 @@ export class SnapshotTaskListComponent implements OnInit { constructor( protected emptyService: EmptyService, private dialogService: DialogService, - private ws: ApiService, + private api: ApiService, private taskService: TaskService, private translate: TranslateService, private errorHandler: ErrorHandlerService, @@ -181,7 +181,7 @@ export class SnapshotTaskListComponent implements OnInit { } ngOnInit(): void { - const tasks$ = this.ws.call('pool.snapshottask.query').pipe( + const tasks$ = this.api.call('pool.snapshottask.query').pipe( tap((tasks) => { this.snapshotTasks = tasks as PeriodicSnapshotTaskUi[]; }), @@ -232,7 +232,7 @@ export class SnapshotTaskListComponent implements OnInit { }), }).pipe( filter(Boolean), - switchMap(() => this.ws.call('pool.snapshottask.delete', [snapshotTask.id])), + switchMap(() => this.api.call('pool.snapshottask.delete', [snapshotTask.id])), untilDestroyed(this), ).subscribe({ next: () => { diff --git a/src/app/pages/data-protection/vmware-snapshot/vmware-snapshot-form/vmware-snapshot-form.component.ts b/src/app/pages/data-protection/vmware-snapshot/vmware-snapshot-form/vmware-snapshot-form.component.ts index 2cb487e6db6..65d88e50c4c 100644 --- a/src/app/pages/data-protection/vmware-snapshot/vmware-snapshot-form/vmware-snapshot-form.component.ts +++ b/src/app/pages/data-protection/vmware-snapshot/vmware-snapshot-form/vmware-snapshot-form.component.ts @@ -96,7 +96,7 @@ export class VmwareSnapshotFormComponent implements OnInit { constructor( private errorHandler: ErrorHandlerService, private fb: FormBuilder, - private ws: ApiService, + private api: ApiService, private translate: TranslateService, private formErrorHandler: FormErrorHandlerService, private cdr: ChangeDetectorRef, @@ -136,7 +136,7 @@ export class VmwareSnapshotFormComponent implements OnInit { } this.isLoading = true; - this.ws.call('vmware.match_datastores_with_datasets', [{ + this.api.call('vmware.match_datastores_with_datasets', [{ hostname, username, password, @@ -183,9 +183,9 @@ export class VmwareSnapshotFormComponent implements OnInit { this.isLoading = true; let request$: Observable; if (this.isNew) { - request$ = this.ws.call('vmware.create', [values]); + request$ = this.api.call('vmware.create', [values]); } else { - request$ = this.ws.call('vmware.update', [ + request$ = this.api.call('vmware.update', [ this.editingSnapshot.id, values, ]); diff --git a/src/app/pages/data-protection/vmware-snapshot/vmware-snapshot-list/vmware-snapshot-list.component.ts b/src/app/pages/data-protection/vmware-snapshot/vmware-snapshot-list/vmware-snapshot-list.component.ts index 5816388c9d6..f49db834c8c 100644 --- a/src/app/pages/data-protection/vmware-snapshot/vmware-snapshot-list/vmware-snapshot-list.component.ts +++ b/src/app/pages/data-protection/vmware-snapshot/vmware-snapshot-list/vmware-snapshot-list.component.ts @@ -96,13 +96,13 @@ export class VmwareSnapshotListComponent implements OnInit { protected translate: TranslateService, private slideInService: SlideInService, protected emptyService: EmptyService, - private ws: ApiService, + private api: ApiService, private dialogService: DialogService, private errorHandler: ErrorHandlerService, ) {} ngOnInit(): void { - const snapshots$ = this.ws.call('vmware.query').pipe( + const snapshots$ = this.api.call('vmware.query').pipe( tap((snapshots) => this.snapshots = snapshots), untilDestroyed(this), ); @@ -142,7 +142,7 @@ export class VmwareSnapshotListComponent implements OnInit { hideCheckbox: true, }).pipe( filter(Boolean), - switchMap(() => this.ws.call('vmware.delete', [snapshot.id])), + switchMap(() => this.api.call('vmware.delete', [snapshot.id])), untilDestroyed(this), ).subscribe({ next: () => { diff --git a/src/app/pages/datasets/components/dataset-capacity-management-card/dataset-capacity-management-card.component.ts b/src/app/pages/datasets/components/dataset-capacity-management-card/dataset-capacity-management-card.component.ts index 6a70cc9e3ba..53e3ecda23f 100644 --- a/src/app/pages/datasets/components/dataset-capacity-management-card/dataset-capacity-management-card.component.ts +++ b/src/app/pages/datasets/components/dataset-capacity-management-card/dataset-capacity-management-card.component.ts @@ -91,7 +91,7 @@ export class DatasetCapacityManagementCardComponent implements OnChanges, OnInit } constructor( - private ws: ApiService, + private api: ApiService, private errorHandler: ErrorHandlerService, private cdr: ChangeDetectorRef, private datasetStore: DatasetTreeStore, @@ -121,8 +121,8 @@ export class DatasetCapacityManagementCardComponent implements OnChanges, OnInit this.cdr.markForCheck(); }), switchMap(() => forkJoin([ - this.ws.call('pool.dataset.get_quota', [this.dataset.id, DatasetQuotaType.User, []]), - this.ws.call('pool.dataset.get_quota', [this.dataset.id, DatasetQuotaType.Group, []]), + this.api.call('pool.dataset.get_quota', [this.dataset.id, DatasetQuotaType.User, []]), + this.api.call('pool.dataset.get_quota', [this.dataset.id, DatasetQuotaType.Group, []]), ])), untilDestroyed(this), ).subscribe({ diff --git a/src/app/pages/datasets/components/dataset-capacity-management-card/dataset-capacity-settings/dataset-capacity-settings.component.ts b/src/app/pages/datasets/components/dataset-capacity-management-card/dataset-capacity-settings/dataset-capacity-settings.component.ts index eae83b8b36e..fa1aa9f5c0b 100644 --- a/src/app/pages/datasets/components/dataset-capacity-management-card/dataset-capacity-settings/dataset-capacity-settings.component.ts +++ b/src/app/pages/datasets/components/dataset-capacity-management-card/dataset-capacity-settings/dataset-capacity-settings.component.ts @@ -103,7 +103,7 @@ export class DatasetCapacitySettingsComponent implements OnInit { } as const; constructor( - private ws: ApiService, + private api: ApiService, private formBuilder: FormBuilder, public formatter: IxFormatterService, private cdr: ChangeDetectorRef, @@ -165,7 +165,7 @@ export class DatasetCapacitySettingsComponent implements OnInit { this.cdr.markForCheck(); const payload = this.getChangedFormValues(); - this.ws.call('pool.dataset.update', [this.dataset.id, payload]) + this.api.call('pool.dataset.update', [this.dataset.id, payload]) .pipe(untilDestroyed(this)) .subscribe({ next: () => { diff --git a/src/app/pages/datasets/components/dataset-details-card/dataset-details-card.component.ts b/src/app/pages/datasets/components/dataset-details-card/dataset-details-card.component.ts index 553d6437fc1..f8c09b490f2 100644 --- a/src/app/pages/datasets/components/dataset-details-card/dataset-details-card.component.ts +++ b/src/app/pages/datasets/components/dataset-details-card/dataset-details-card.component.ts @@ -64,7 +64,7 @@ export class DatasetDetailsCardComponent { private slideInService: SlideInService, private errorHandler: ErrorHandlerService, private router: Router, - private ws: ApiService, + private api: ApiService, private snackbar: SnackbarService, ) { } @@ -100,7 +100,7 @@ export class DatasetDetailsCardComponent { } promoteDataset(): void { - this.ws.call('pool.dataset.promote', [this.dataset().id]) + this.api.call('pool.dataset.promote', [this.dataset().id]) .pipe(this.errorHandler.catchError(), untilDestroyed(this)) .subscribe(() => { this.snackbar.success(this.translate.instant('Dataset promoted successfully.')); diff --git a/src/app/pages/datasets/components/dataset-form/dataset-form.component.ts b/src/app/pages/datasets/components/dataset-form/dataset-form.component.ts index 43929af649a..d45651d5470 100644 --- a/src/app/pages/datasets/components/dataset-form/dataset-form.component.ts +++ b/src/app/pages/datasets/components/dataset-form/dataset-form.component.ts @@ -129,7 +129,7 @@ export class DatasetFormComponent implements OnInit, AfterViewInit { } constructor( - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private dialog: DialogService, private datasetFormService: DatasetFormService, @@ -223,8 +223,8 @@ export class DatasetFormComponent implements OnInit, AfterViewInit { const payload = this.preparePayload(); const request$ = this.isNew - ? this.ws.call('pool.dataset.create', [payload as DatasetCreate]) - : this.ws.call('pool.dataset.update', [this.existingDataset.id, payload as DatasetUpdate]); + ? this.api.call('pool.dataset.create', [payload as DatasetCreate]) + : this.api.call('pool.dataset.update', [this.existingDataset.id, payload as DatasetUpdate]); request$.pipe( switchMap((dataset) => this.createSmb(dataset)), @@ -283,7 +283,7 @@ export class DatasetFormComponent implements OnInit, AfterViewInit { } const parentPath = `/mnt/${this.parentDataset.id}`; - return this.ws.call('filesystem.stat', [parentPath]).pipe(map((stat) => stat.acl)); + return this.api.call('filesystem.stat', [parentPath]).pipe(map((stat) => stat.acl)); } private aclDialog(): Observable { @@ -301,7 +301,7 @@ export class DatasetFormComponent implements OnInit, AfterViewInit { if (!this.isNew || !datasetPresetFormValue.create_smb || !this.nameAndOptionsSection.canCreateSmb) { return of(dataset); } - return this.ws.call('sharing.smb.create', [{ + return this.api.call('sharing.smb.create', [{ name: datasetPresetFormValue.smb_name, path: `${mntPath}/${dataset.id}`, }]).pipe( @@ -315,7 +315,7 @@ export class DatasetFormComponent implements OnInit, AfterViewInit { if (!this.isNew || !datasetPresetFormValue.create_nfs || !this.nameAndOptionsSection.canCreateNfs) { return of(dataset); } - return this.ws.call('sharing.nfs.create', [{ + return this.api.call('sharing.nfs.create', [{ path: `${mntPath}/${dataset.id}`, }]).pipe( switchMap(() => of(dataset)), @@ -324,7 +324,7 @@ export class DatasetFormComponent implements OnInit, AfterViewInit { } private rollBack(dataset: Dataset, error: unknown): Observable { - return this.ws.call('pool.dataset.delete', [dataset.id, { recursive: true, force: true }]).pipe( + return this.api.call('pool.dataset.delete', [dataset.id, { recursive: true, force: true }]).pipe( switchMap(() => { throw error; }), diff --git a/src/app/pages/datasets/components/dataset-form/sections/encryption-section/encryption-section.component.ts b/src/app/pages/datasets/components/dataset-form/sections/encryption-section/encryption-section.component.ts index 8b2f42561ed..7aa536864bb 100644 --- a/src/app/pages/datasets/components/dataset-form/sections/encryption-section/encryption-section.component.ts +++ b/src/app/pages/datasets/components/dataset-form/sections/encryption-section/encryption-section.component.ts @@ -75,12 +75,12 @@ export class EncryptionSectionComponent implements OnChanges, OnInit { { label: T('Passphrase'), value: DatasetEncryptionType.Passphrase }, ]); - algorithmOptions$ = this.ws.call('pool.dataset.encryption_algorithm_choices').pipe(choicesToOptions()); + algorithmOptions$ = this.api.call('pool.dataset.encryption_algorithm_choices').pipe(choicesToOptions()); constructor( private formBuilder: FormBuilder, private translate: TranslateService, - private ws: ApiService, + private api: ApiService, ) {} get hasEncryption(): boolean { diff --git a/src/app/pages/datasets/components/dataset-form/sections/other-options-section/other-options-section.component.ts b/src/app/pages/datasets/components/dataset-form/sections/other-options-section/other-options-section.component.ts index b75ac39afd9..a926d62dee9 100644 --- a/src/app/pages/datasets/components/dataset-form/sections/other-options-section/other-options-section.component.ts +++ b/src/app/pages/datasets/components/dataset-form/sections/other-options-section/other-options-section.component.ts @@ -136,16 +136,16 @@ export class OtherOptionsSectionComponent implements OnInit, OnChanges { aclModeOptions$ = of(mapToOptions(aclModeLabels, this.translate)); private readonly defaultSyncOptions$ = of(mapToOptions(datasetSyncLabels, this.translate)); - private readonly defaultCompressionOptions$ = this.ws.call('pool.dataset.compression_choices').pipe(choicesToOptions()); + private readonly defaultCompressionOptions$ = this.api.call('pool.dataset.compression_choices').pipe(choicesToOptions()); private readonly defaultAtimeOptions$ = of(mapToOptions(onOffLabels, this.translate)); private defaultDeduplicationOptions$ = of(mapToOptions(deduplicationSettingLabels, this.translate)); - private defaultChecksumOptions$ = this.ws.call('pool.dataset.checksum_choices').pipe( + private defaultChecksumOptions$ = this.api.call('pool.dataset.checksum_choices').pipe( choicesToOptions(), ); private onOffOptions$ = of(mapToOptions(onOffLabels, this.translate)); private defaultSnapdevOptions$ = of(mapToOptions(datasetSnapdevLabels, this.translate)); - private defaultRecordSizeOptions$ = this.ws.call('pool.dataset.recordsize_choices').pipe( + private defaultRecordSizeOptions$ = this.api.call('pool.dataset.recordsize_choices').pipe( singleArrayToOptions(), ); @@ -161,7 +161,7 @@ export class OtherOptionsSectionComponent implements OnInit, OnChanges { private systemGeneralService: SystemGeneralService, private dialogService: DialogService, private formatter: IxFormatterService, - private ws: ApiService, + private api: ApiService, private datasetFormService: DatasetFormService, ) {} @@ -477,7 +477,7 @@ export class OtherOptionsSectionComponent implements OnInit, OnChanges { const root = this.parent.id.split('/')[0]; combineLatest([ this.form.controls.recordsize.valueChanges.pipe(startWith(this.form.controls.recordsize.value)), - this.ws.call('pool.dataset.recommended_zvol_blocksize', [root]), + this.api.call('pool.dataset.recommended_zvol_blocksize', [root]), ]) .pipe(untilDestroyed(this)) .subscribe(([recordsizeValue, recommendedAsString]) => { diff --git a/src/app/pages/datasets/components/dataset-form/utils/dataset-form.service.ts b/src/app/pages/datasets/components/dataset-form/utils/dataset-form.service.ts index 2c3156b6980..fbe87d6fc93 100644 --- a/src/app/pages/datasets/components/dataset-form/utils/dataset-form.service.ts +++ b/src/app/pages/datasets/components/dataset-form/utils/dataset-form.service.ts @@ -19,7 +19,7 @@ import { SlideInService } from 'app/services/slide-in.service'; export class DatasetFormService { constructor( private dialog: DialogService, - private ws: ApiService, + private api: ApiService, private translate: TranslateService, private slideInService: SlideInService, ) {} @@ -54,7 +54,7 @@ export class DatasetFormService { } loadDataset(datasetId: string): Observable { - return this.ws.call('pool.dataset.query', [[['id', '=', datasetId]]]).pipe( + return this.api.call('pool.dataset.query', [[['id', '=', datasetId]]]).pipe( map((response) => response[0]), ); } diff --git a/src/app/pages/datasets/components/dataset-management/dataset-management.component.ts b/src/app/pages/datasets/components/dataset-management/dataset-management.component.ts index 4785ffd8c18..a08f222c4ae 100644 --- a/src/app/pages/datasets/components/dataset-management/dataset-management.component.ts +++ b/src/app/pages/datasets/components/dataset-management/dataset-management.component.ts @@ -108,7 +108,7 @@ export class DatasetsManagementComponent implements OnInit, AfterViewInit, OnDes selectedDataset$ = this.datasetStore.selectedDataset$; @HostBinding('class.details-overlay') showMobileDetails = false; isMobileView = false; - systemDataset = toSignal(this.ws.call('systemdataset.config').pipe(map((config) => config.pool))); + systemDataset = toSignal(this.api.call('systemdataset.config').pipe(map((config) => config.pool))); isLoading = true; subscription = new Subscription(); ixTreeHeaderWidth: number | null = null; @@ -171,7 +171,7 @@ export class DatasetsManagementComponent implements OnInit, AfterViewInit, OnDes readonly hasChild = (_: number, dataset: DatasetDetails): boolean => dataset?.children?.length > 0; constructor( - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private activatedRoute: ActivatedRoute, private datasetStore: DatasetTreeStore, diff --git a/src/app/pages/datasets/components/dataset-quotas/dataset-quota-add-form/dataset-quota-add-form.component.spec.ts b/src/app/pages/datasets/components/dataset-quotas/dataset-quota-add-form/dataset-quota-add-form.component.spec.ts index 599e4ed854c..9f8dd17da99 100644 --- a/src/app/pages/datasets/components/dataset-quotas/dataset-quota-add-form/dataset-quota-add-form.component.spec.ts +++ b/src/app/pages/datasets/components/dataset-quotas/dataset-quota-add-form/dataset-quota-add-form.component.spec.ts @@ -20,7 +20,7 @@ import { UserService } from 'app/services/user.service'; describe('DatasetQuotaAddFormComponent', () => { let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; const createComponent = createComponentFactory({ component: DatasetQuotaAddFormComponent, @@ -59,7 +59,7 @@ describe('DatasetQuotaAddFormComponent', () => { }, ], }); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); loader = TestbedHarnessEnvironment.loader(spectator.fixture); }); @@ -77,7 +77,7 @@ describe('DatasetQuotaAddFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('pool.dataset.set_quota', [ + expect(api.call).toHaveBeenCalledWith('pool.dataset.set_quota', [ 'my-dataset', [ { id: 'john', quota_type: DatasetQuotaType.User, quota_value: 524288000 }, @@ -101,7 +101,7 @@ describe('DatasetQuotaAddFormComponent', () => { }, ], }); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); loader = TestbedHarnessEnvironment.loader(spectator.fixture); }); @@ -116,7 +116,7 @@ describe('DatasetQuotaAddFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('pool.dataset.set_quota', [ + expect(api.call).toHaveBeenCalledWith('pool.dataset.set_quota', [ 'my-dataset', [ { id: 'sys', quota_type: DatasetQuotaType.Group, quota_value: 524288000 }, diff --git a/src/app/pages/datasets/components/dataset-quotas/dataset-quota-add-form/dataset-quota-add-form.component.ts b/src/app/pages/datasets/components/dataset-quotas/dataset-quota-add-form/dataset-quota-add-form.component.ts index ef418262eaf..af97fa310ee 100644 --- a/src/app/pages/datasets/components/dataset-quotas/dataset-quota-add-form/dataset-quota-add-form.component.ts +++ b/src/app/pages/datasets/components/dataset-quotas/dataset-quota-add-form/dataset-quota-add-form.component.ts @@ -130,7 +130,7 @@ export class DatasetQuotaAddFormComponent implements OnInit { constructor( private authService: AuthService, private formBuilder: FormBuilder, - private ws: ApiService, + private api: ApiService, private snackbar: SnackbarService, private translate: TranslateService, public formatter: IxFormatterService, @@ -155,7 +155,7 @@ export class DatasetQuotaAddFormComponent implements OnInit { this.isLoading = true; const quotas = this.getQuotas(); - this.ws.call('pool.dataset.set_quota', [this.datasetId, quotas]) + this.api.call('pool.dataset.set_quota', [this.datasetId, quotas]) .pipe(untilDestroyed(this)) .subscribe({ next: () => { diff --git a/src/app/pages/datasets/components/dataset-quotas/dataset-quota-edit-form/dataset-quota-edit-form.component.spec.ts b/src/app/pages/datasets/components/dataset-quotas/dataset-quota-edit-form/dataset-quota-edit-form.component.spec.ts index abab4ff5488..bc03b673d35 100644 --- a/src/app/pages/datasets/components/dataset-quotas/dataset-quota-edit-form/dataset-quota-edit-form.component.spec.ts +++ b/src/app/pages/datasets/components/dataset-quotas/dataset-quota-edit-form/dataset-quota-edit-form.component.spec.ts @@ -19,7 +19,7 @@ import { SlideInService } from 'app/services/slide-in.service'; describe('DatasetQuotaEditFormComponent', () => { let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; const createComponent = createComponentFactory({ component: DatasetQuotaEditFormComponent, @@ -62,7 +62,7 @@ describe('DatasetQuotaEditFormComponent', () => { }, ], }); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); loader = TestbedHarnessEnvironment.loader(spectator.fixture); }); @@ -70,7 +70,7 @@ describe('DatasetQuotaEditFormComponent', () => { const form = await loader.getHarness(IxFormHarness); const values = await form.getValues(); - expect(ws.call).toHaveBeenCalledWith( + expect(api.call).toHaveBeenCalledWith( 'pool.dataset.get_quota', ['Test', DatasetQuotaType.User, [['id', '=', 1]]], ); @@ -92,7 +92,7 @@ describe('DatasetQuotaEditFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('pool.dataset.set_quota', ['Test', [ + expect(api.call).toHaveBeenCalledWith('pool.dataset.set_quota', ['Test', [ { quota_type: DatasetQuotaType.User, id: '1', @@ -122,7 +122,7 @@ describe('DatasetQuotaEditFormComponent', () => { }, ], }); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); loader = TestbedHarnessEnvironment.loader(spectator.fixture); }); @@ -130,7 +130,7 @@ describe('DatasetQuotaEditFormComponent', () => { const form = await loader.getHarness(IxFormHarness); const values = await form.getValues(); - expect(ws.call).toHaveBeenCalledWith( + expect(api.call).toHaveBeenCalledWith( 'pool.dataset.get_quota', ['Test', DatasetQuotaType.Group, [['id', '=', 1]]], ); @@ -152,7 +152,7 @@ describe('DatasetQuotaEditFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('pool.dataset.set_quota', ['Test', [ + expect(api.call).toHaveBeenCalledWith('pool.dataset.set_quota', ['Test', [ { quota_type: DatasetQuotaType.Group, id: '1', diff --git a/src/app/pages/datasets/components/dataset-quotas/dataset-quota-edit-form/dataset-quota-edit-form.component.ts b/src/app/pages/datasets/components/dataset-quotas/dataset-quota-edit-form/dataset-quota-edit-form.component.ts index 603b9289141..37396556a08 100644 --- a/src/app/pages/datasets/components/dataset-quotas/dataset-quota-edit-form/dataset-quota-edit-form.component.ts +++ b/src/app/pages/datasets/components/dataset-quotas/dataset-quota-edit-form/dataset-quota-edit-form.component.ts @@ -128,7 +128,7 @@ export class DatasetQuotaEditFormComponent implements OnInit { constructor( private formBuilder: FormBuilder, - private ws: ApiService, + private api: ApiService, private translate: TranslateService, public formatter: IxFormatterService, private cdr: ChangeDetectorRef, @@ -175,7 +175,7 @@ export class DatasetQuotaEditFormComponent implements OnInit { getQuota(id: number): Observable { const params = [['id', '=', id] as QueryFilter] as QueryParams; - return this.ws.call('pool.dataset.get_quota', [this.datasetId, this.quotaType, params]); + return this.api.call('pool.dataset.get_quota', [this.datasetId, this.quotaType, params]); } onSubmit(): void { @@ -207,7 +207,7 @@ export class DatasetQuotaEditFormComponent implements OnInit { filter(Boolean), switchMap(() => { this.isFormLoading = true; - return this.ws.call('pool.dataset.set_quota', [this.datasetId, payload]); + return this.api.call('pool.dataset.set_quota', [this.datasetId, payload]); }), untilDestroyed(this), ).subscribe({ diff --git a/src/app/pages/datasets/components/dataset-quotas/dataset-quotas-list/dataset-quotas-list.component.spec.ts b/src/app/pages/datasets/components/dataset-quotas/dataset-quotas-list/dataset-quotas-list.component.spec.ts index 885248f1da4..b096de5a7e7 100644 --- a/src/app/pages/datasets/components/dataset-quotas/dataset-quotas-list/dataset-quotas-list.component.spec.ts +++ b/src/app/pages/datasets/components/dataset-quotas/dataset-quotas-list/dataset-quotas-list.component.spec.ts @@ -46,7 +46,7 @@ const fakeQuotas = [{ describe('DatasetQuotasListComponent', () => { let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; let table: IxTableHarness; const createComponent = createComponentFactory({ @@ -96,17 +96,17 @@ describe('DatasetQuotasListComponent', () => { beforeEach(async () => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); table = await loader.getHarness(IxTableHarness); }); it('should show table rows', async () => { - expect(ws.call).toHaveBeenCalledWith( + expect(api.call).toHaveBeenCalledWith( 'pool.dataset.get_quota', ['Test', DatasetQuotaType.User, []], ); - expect(ws.call).toHaveBeenCalledWith( + expect(api.call).toHaveBeenCalledWith( 'pool.dataset.get_quota', ['Test', DatasetQuotaType.User, [['name', '=', null]]], ); @@ -131,7 +131,7 @@ describe('DatasetQuotasListComponent', () => { title: 'Delete User Quota', }), ); - expect(ws.call).toHaveBeenCalledWith( + expect(api.call).toHaveBeenCalledWith( 'pool.dataset.set_quota', ['Test', [{ id: '1', diff --git a/src/app/pages/datasets/components/dataset-quotas/dataset-quotas-list/dataset-quotas-list.component.ts b/src/app/pages/datasets/components/dataset-quotas/dataset-quotas-list/dataset-quotas-list.component.ts index cb140742539..eb7476a86a9 100644 --- a/src/app/pages/datasets/components/dataset-quotas/dataset-quotas-list/dataset-quotas-list.component.ts +++ b/src/app/pages/datasets/components/dataset-quotas/dataset-quotas-list/dataset-quotas-list.component.ts @@ -194,7 +194,7 @@ export class DatasetQuotasListComponent implements OnInit { } constructor( - protected ws: ApiService, + protected api: ApiService, protected formatter: IxFormatterService, protected dialogService: DialogService, private errorHandler: ErrorHandlerService, @@ -232,7 +232,7 @@ export class DatasetQuotasListComponent implements OnInit { getQuotas(): void { this.isLoading = true; - this.ws.call('pool.dataset.get_quota', [this.datasetId, this.quotaType, []]) + this.api.call('pool.dataset.get_quota', [this.datasetId, this.quotaType, []]) .pipe(untilDestroyed(this)).subscribe({ next: (quotas: DatasetQuota[]) => { this.isLoading = false; @@ -259,7 +259,7 @@ export class DatasetQuotasListComponent implements OnInit { }; checkInvalidQuotas(): void { - this.ws.call( + this.api.call( 'pool.dataset.get_quota', [this.datasetId, this.quotaType, this.invalidFilter], ).pipe(untilDestroyed(this)).subscribe({ @@ -313,7 +313,7 @@ export class DatasetQuotasListComponent implements OnInit { } setQuota(quotas: SetDatasetQuota[]): Observable { - return this.ws.call('pool.dataset.set_quota', [this.datasetId, quotas]); + return this.api.call('pool.dataset.set_quota', [this.datasetId, quotas]); } doAdd(): void { diff --git a/src/app/pages/datasets/components/delete-dataset-dialog/delete-dataset-dialog.component.ts b/src/app/pages/datasets/components/delete-dataset-dialog/delete-dataset-dialog.component.ts index f9e17eaf5fa..024b6e18118 100644 --- a/src/app/pages/datasets/components/delete-dataset-dialog/delete-dataset-dialog.component.ts +++ b/src/app/pages/datasets/components/delete-dataset-dialog/delete-dataset-dialog.component.ts @@ -73,7 +73,7 @@ export class DeleteDatasetDialogComponent implements OnInit { private loader: AppLoaderService, private fb: FormBuilder, private errorHandler: ErrorHandlerService, - private ws: ApiService, + private api: ApiService, private dialog: DialogService, private dialogRef: MatDialogRef, private translate: TranslateService, @@ -107,11 +107,11 @@ export class DeleteDatasetDialogComponent implements OnInit { } private deleteDataset(): Observable { - return this.ws.call('pool.dataset.delete', [this.dataset.id, { recursive: true }]); + return this.api.call('pool.dataset.delete', [this.dataset.id, { recursive: true }]); } private forceDeleteDataset(): Observable { - return this.ws.call('pool.dataset.delete', [this.dataset.id, { recursive: true, force: true }]); + return this.api.call('pool.dataset.delete', [this.dataset.id, { recursive: true, force: true }]); } private askToForceDelete(): Observable { @@ -146,8 +146,8 @@ export class DeleteDatasetDialogComponent implements OnInit { private loadDatasetRelatedEntities(): void { combineLatest([ - this.ws.call('pool.dataset.attachments', [this.dataset.id]), - this.ws.call('pool.dataset.processes', [this.dataset.id]), + this.api.call('pool.dataset.attachments', [this.dataset.id]), + this.api.call('pool.dataset.processes', [this.dataset.id]), ]).pipe(this.loader.withLoader(), untilDestroyed(this)) .subscribe({ next: ([attachments, processes]) => { diff --git a/src/app/pages/datasets/components/zvol-form/zvol-form.component.ts b/src/app/pages/datasets/components/zvol-form/zvol-form.component.ts index 8e1e048b2af..9427f307223 100644 --- a/src/app/pages/datasets/components/zvol-form/zvol-form.component.ts +++ b/src/app/pages/datasets/components/zvol-form/zvol-form.component.ts @@ -214,7 +214,7 @@ export class ZvolFormComponent implements OnInit { readonly snapdevOptions$ = of(this.snapdevOptions); readonly encryptionTypeOptions$ = of(this.encryptionTypeOptions); - readonly algorithmOptions$ = this.ws.call('pool.dataset.encryption_algorithm_choices').pipe( + readonly algorithmOptions$ = this.api.call('pool.dataset.encryption_algorithm_choices').pipe( map((algorithms) => Object.keys(algorithms).map((algorithm) => ({ label: algorithm, value: algorithm }))), ); @@ -222,7 +222,7 @@ export class ZvolFormComponent implements OnInit { public formatter: IxFormatterService, private translate: TranslateService, private formBuilder: FormBuilder, - private ws: ApiService, + private api: ApiService, private dialogService: DialogService, private cdr: ChangeDetectorRef, private formErrorHandler: FormErrorHandlerService, @@ -256,7 +256,7 @@ export class ZvolFormComponent implements OnInit { } this.isLoading = true; - this.ws.call('pool.dataset.query', [[['id', '=', this.parentId]]]).pipe(untilDestroyed(this)).subscribe({ + this.api.call('pool.dataset.query', [[['id', '=', this.parentId]]]).pipe(untilDestroyed(this)).subscribe({ next: (parents) => { const parent = parents[0]; if (parent.encrypted) { @@ -285,7 +285,7 @@ export class ZvolFormComponent implements OnInit { parentDatasetId.pop(); parentDatasetId = parentDatasetId.join('/'); - this.ws.call('pool.dataset.query', [[['id', '=', parentDatasetId]]]).pipe( + this.api.call('pool.dataset.query', [[['id', '=', parentDatasetId]]]).pipe( this.errorHandler.catchError(), untilDestroyed(this), ).subscribe({ @@ -626,7 +626,7 @@ export class ZvolFormComponent implements OnInit { delete data.encryption_type; delete data.algorithm; - this.ws.call('pool.dataset.create', [data as DatasetCreate]).pipe(untilDestroyed(this)).subscribe({ + this.api.call('pool.dataset.create', [data as DatasetCreate]).pipe(untilDestroyed(this)).subscribe({ next: (dataset) => this.handleZvolCreateUpdate(dataset), error: (error: unknown) => { this.isLoading = false; @@ -638,7 +638,7 @@ export class ZvolFormComponent implements OnInit { editSubmit(): void { this.isLoading = true; - this.ws.call('pool.dataset.query', [[['id', '=', this.parentId]]]).pipe(untilDestroyed(this)).subscribe({ + this.api.call('pool.dataset.query', [[['id', '=', this.parentId]]]).pipe(untilDestroyed(this)).subscribe({ next: (datasets) => { const data: ZvolFormData = this.sendAsBasicOrAdvanced(this.form.value); @@ -686,7 +686,7 @@ export class ZvolFormComponent implements OnInit { } if (!data.volsize || data.volsize >= roundedVolSize) { - this.ws.call('pool.dataset.update', [this.parentId, data as DatasetUpdate]).pipe(untilDestroyed(this)).subscribe({ + this.api.call('pool.dataset.update', [this.parentId, data as DatasetUpdate]).pipe(untilDestroyed(this)).subscribe({ next: (dataset) => this.handleZvolCreateUpdate(dataset), error: (error: unknown) => { this.isLoading = false; @@ -721,7 +721,7 @@ export class ZvolFormComponent implements OnInit { private loadRecommendedBlocksize(): void { const root = this.parentId.split('/')[0]; - this.ws.call('pool.dataset.recommended_zvol_blocksize', [root]).pipe( + this.api.call('pool.dataset.recommended_zvol_blocksize', [root]).pipe( this.errorHandler.catchError(), untilDestroyed(this), ).subscribe((recommendedSize) => { diff --git a/src/app/pages/datasets/modules/encryption/components/dataset-unlock/dataset-unlock.component.ts b/src/app/pages/datasets/modules/encryption/components/dataset-unlock/dataset-unlock.component.ts index d77c9ec61f9..fba03484c12 100644 --- a/src/app/pages/datasets/modules/encryption/components/dataset-unlock/dataset-unlock.component.ts +++ b/src/app/pages/datasets/modules/encryption/components/dataset-unlock/dataset-unlock.component.ts @@ -100,7 +100,7 @@ export class DatasetUnlockComponent implements OnInit { private apiEndPoint: string; constructor( - private ws: ApiService, + private api: ApiService, private formBuilder: FormBuilder, private aroute: ActivatedRoute, private authService: AuthService, @@ -143,7 +143,7 @@ export class DatasetUnlockComponent implements OnInit { getEncryptionSummary(): void { this.dialogService.jobDialog( - this.ws.job('pool.dataset.encryption_summary', [this.pk]), + this.api.job('pool.dataset.encryption_summary', [this.pk]), { title: this.translate.instant(helptextUnlock.fetching_encryption_summary_title), description: this.translate.instant(helptextUnlock.fetching_encryption_summary_message, { dataset: this.pk }), @@ -212,7 +212,7 @@ export class DatasetUnlockComponent implements OnInit { method: 'pool.dataset.unlock', params: [this.pk, payload], }) - : this.ws.job('pool.dataset.unlock', [this.pk, payload]); + : this.api.job('pool.dataset.unlock', [this.pk, payload]); this.dialogService.jobDialog(job$, { title: this.translate.instant(helptextUnlock.unlocking_datasets_title), @@ -254,7 +254,7 @@ export class DatasetUnlockComponent implements OnInit { method: 'pool.dataset.encryption_summary', params: [this.pk, payload], }) - : this.ws.job('pool.dataset.encryption_summary', [this.pk, payload]); + : this.api.job('pool.dataset.encryption_summary', [this.pk, payload]); this.dialogService.jobDialog(job$, { title: this.translate.instant(helptextUnlock.fetching_encryption_summary_title), diff --git a/src/app/pages/datasets/modules/encryption/components/encryption-options-dialog/encryption-options-dialog.component.ts b/src/app/pages/datasets/modules/encryption/components/encryption-options-dialog/encryption-options-dialog.component.ts index 9193d633761..43b25c665f7 100644 --- a/src/app/pages/datasets/modules/encryption/components/encryption-options-dialog/encryption-options-dialog.component.ts +++ b/src/app/pages/datasets/modules/encryption/components/encryption-options-dialog/encryption-options-dialog.component.ts @@ -108,7 +108,7 @@ export class EncryptionOptionsDialogComponent implements OnInit { constructor( private fb: FormBuilder, - private ws: ApiService, + private api: ApiService, private translate: TranslateService, private loader: AppLoaderService, private dialog: DialogService, @@ -157,7 +157,7 @@ export class EncryptionOptionsDialogComponent implements OnInit { } private setToInherit(): void { - this.ws.call('pool.dataset.inherit_parent_encryption_properties', [this.data.dataset.id]) + this.api.call('pool.dataset.inherit_parent_encryption_properties', [this.data.dataset.id]) .pipe(this.loader.withLoader(), untilDestroyed(this)) .subscribe({ next: () => { @@ -185,7 +185,7 @@ export class EncryptionOptionsDialogComponent implements OnInit { } this.dialog.jobDialog( - this.ws.job('pool.dataset.change_key', [this.data.dataset.id, body]), + this.api.job('pool.dataset.change_key', [this.data.dataset.id, body]), { title: this.translate.instant('Updating key type') }, ) .afterClosed() @@ -206,7 +206,7 @@ export class EncryptionOptionsDialogComponent implements OnInit { } private loadPbkdf2iters(): void { - this.ws.call('pool.dataset.query', [[['id', '=', this.data.dataset.id]]]) + this.api.call('pool.dataset.query', [[['id', '=', this.data.dataset.id]]]) .pipe(this.loader.withLoader(), untilDestroyed(this)) .subscribe({ next: (datasets: Dataset[]) => { diff --git a/src/app/pages/datasets/modules/encryption/components/export-all-keys-dialog/export-all-keys-dialog.component.ts b/src/app/pages/datasets/modules/encryption/components/export-all-keys-dialog/export-all-keys-dialog.component.ts index 148af703185..b3b88d4f989 100644 --- a/src/app/pages/datasets/modules/encryption/components/export-all-keys-dialog/export-all-keys-dialog.component.ts +++ b/src/app/pages/datasets/modules/encryption/components/export-all-keys-dialog/export-all-keys-dialog.component.ts @@ -35,7 +35,7 @@ import { ErrorHandlerService } from 'app/services/error-handler.service'; export class ExportAllKeysDialogComponent { constructor( private errorHandler: ErrorHandlerService, - private ws: ApiService, + private api: ApiService, private loader: AppLoaderService, private dialogRef: MatDialogRef, private download: DownloadService, @@ -45,7 +45,7 @@ export class ExportAllKeysDialogComponent { onDownload(): void { const fileName = 'dataset_' + this.dataset.name + '_keys.json'; const mimetype = 'application/json'; - this.ws.call('core.download', ['pool.dataset.export_keys', [this.dataset.name], fileName]) + this.api.call('core.download', ['pool.dataset.export_keys', [this.dataset.name], fileName]) .pipe( this.loader.withLoader(), this.errorHandler.catchError(), diff --git a/src/app/pages/datasets/modules/encryption/components/export-dataset-key-dialog/export-dataset-key-dialog.component.ts b/src/app/pages/datasets/modules/encryption/components/export-dataset-key-dialog/export-dataset-key-dialog.component.ts index c657b7ce256..33daeaadf09 100644 --- a/src/app/pages/datasets/modules/encryption/components/export-dataset-key-dialog/export-dataset-key-dialog.component.ts +++ b/src/app/pages/datasets/modules/encryption/components/export-dataset-key-dialog/export-dataset-key-dialog.component.ts @@ -43,7 +43,7 @@ export class ExportDatasetKeyDialogComponent implements OnInit { key: string; constructor( - private ws: ApiService, + private api: ApiService, private loader: AppLoaderService, private errorHandler: ErrorHandlerService, private dialogRef: MatDialogRef, @@ -61,7 +61,7 @@ export class ExportDatasetKeyDialogComponent implements OnInit { const fileName = `dataset_${this.dataset.name}_key.json`; const mimetype = 'application/json'; - this.ws.call('core.download', ['pool.dataset.export_key', [this.dataset.id, true], fileName]) + this.api.call('core.download', ['pool.dataset.export_key', [this.dataset.id, true], fileName]) .pipe( this.loader.withLoader(), switchMap(([, url]) => this.storageService.downloadUrl(url, fileName, mimetype)), @@ -78,7 +78,7 @@ export class ExportDatasetKeyDialogComponent implements OnInit { } private loadKey(): void { - this.ws.job('pool.dataset.export_key', [this.dataset.id]) + this.api.job('pool.dataset.export_key', [this.dataset.id]) .pipe(this.loader.withLoader(), untilDestroyed(this)) .subscribe({ next: (job) => { diff --git a/src/app/pages/datasets/modules/encryption/components/lock-dataset-dialog/lock-dataset-dialog.component.ts b/src/app/pages/datasets/modules/encryption/components/lock-dataset-dialog/lock-dataset-dialog.component.ts index 91928ac8f00..0a7bef031cd 100644 --- a/src/app/pages/datasets/modules/encryption/components/lock-dataset-dialog/lock-dataset-dialog.component.ts +++ b/src/app/pages/datasets/modules/encryption/components/lock-dataset-dialog/lock-dataset-dialog.component.ts @@ -45,7 +45,7 @@ export class LockDatasetDialogComponent { forceCheckbox = new FormControl(false); constructor( - private ws: ApiService, + private api: ApiService, private errorHandler: ErrorHandlerService, private translate: TranslateService, private snackbar: SnackbarService, @@ -59,7 +59,7 @@ export class LockDatasetDialogComponent { const force = this.forceCheckbox.value; this.dialogService.jobDialog( - this.ws.job('pool.dataset.lock', [this.dataset.id, { force_umount: force }]), + this.api.job('pool.dataset.lock', [this.dataset.id, { force_umount: force }]), { title: this.translate.instant(helptextVolumes.lock_dataset_dialog.locking_dataset) }, ) .afterClosed() diff --git a/src/app/pages/datasets/modules/permissions/components/save-as-preset-modal/save-as-preset-modal.component.ts b/src/app/pages/datasets/modules/permissions/components/save-as-preset-modal/save-as-preset-modal.component.ts index aaa8321d24d..34dc2d9dba0 100644 --- a/src/app/pages/datasets/modules/permissions/components/save-as-preset-modal/save-as-preset-modal.component.ts +++ b/src/app/pages/datasets/modules/permissions/components/save-as-preset-modal/save-as-preset-modal.component.ts @@ -68,7 +68,7 @@ export class SaveAsPresetModalComponent implements OnInit { constructor( private fb: FormBuilder, - private ws: ApiService, + private api: ApiService, private loader: AppLoaderService, private errorHandler: ErrorHandlerService, private dialogService: DialogService, @@ -96,7 +96,7 @@ export class SaveAsPresetModalComponent implements OnInit { } private loadOptions(): void { - this.ws.call('filesystem.acltemplate.by_path', [{ + this.api.call('filesystem.acltemplate.by_path', [{ path: this.data.datasetPath, 'format-options': { resolve_names: true, @@ -132,7 +132,7 @@ export class SaveAsPresetModalComponent implements OnInit { }) as NfsAclItem[] | PosixAclItem[], }; - return this.ws.call('filesystem.acltemplate.create', [payload]); + return this.api.call('filesystem.acltemplate.create', [payload]); }), this.loader.withLoader(), this.errorHandler.catchError(), @@ -143,7 +143,7 @@ export class SaveAsPresetModalComponent implements OnInit { } onRemovePreset(preset: AclTemplateByPath): void { - this.ws.call('filesystem.acltemplate.delete', [preset.id]) + this.api.call('filesystem.acltemplate.delete', [preset.id]) .pipe( this.errorHandler.catchError(), this.loader.withLoader(), diff --git a/src/app/pages/datasets/modules/permissions/components/select-preset-modal/select-preset-modal.component.ts b/src/app/pages/datasets/modules/permissions/components/select-preset-modal/select-preset-modal.component.ts index 1b39d020902..334033c165d 100644 --- a/src/app/pages/datasets/modules/permissions/components/select-preset-modal/select-preset-modal.component.ts +++ b/src/app/pages/datasets/modules/permissions/components/select-preset-modal/select-preset-modal.component.ts @@ -76,7 +76,7 @@ export class SelectPresetModalComponent implements OnInit { constructor( private dialogRef: MatDialogRef, - private ws: ApiService, + private api: ApiService, private errorHandler: ErrorHandlerService, private loader: AppLoaderService, private aclEditorStore: DatasetAclEditorStore, @@ -96,7 +96,7 @@ export class SelectPresetModalComponent implements OnInit { } private loadOptions(): void { - this.ws.call('filesystem.acltemplate.by_path', [{ + this.api.call('filesystem.acltemplate.by_path', [{ path: this.data.datasetPath, 'format-options': { resolve_names: true, diff --git a/src/app/pages/datasets/modules/permissions/components/strip-acl-modal/strip-acl-modal.component.ts b/src/app/pages/datasets/modules/permissions/components/strip-acl-modal/strip-acl-modal.component.ts index 42071f39260..4f015d90f72 100644 --- a/src/app/pages/datasets/modules/permissions/components/strip-acl-modal/strip-acl-modal.component.ts +++ b/src/app/pages/datasets/modules/permissions/components/strip-acl-modal/strip-acl-modal.component.ts @@ -48,7 +48,7 @@ export class StripAclModalComponent { readonly helptext = helptextAcl; constructor( - private ws: ApiService, + private api: ApiService, private dialog: DialogService, private errorHandler: ErrorHandlerService, private dialogRef: MatDialogRef, @@ -57,7 +57,7 @@ export class StripAclModalComponent { ) { } onStrip(): void { - const job$ = this.ws.job('filesystem.setacl', [{ + const job$ = this.api.job('filesystem.setacl', [{ path: this.data.path, dacl: [], options: { diff --git a/src/app/pages/datasets/modules/permissions/containers/dataset-acl-editor/acl-editor-save-controls/acl-editor-save-controls.component.ts b/src/app/pages/datasets/modules/permissions/containers/dataset-acl-editor/acl-editor-save-controls/acl-editor-save-controls.component.ts index 082736008bd..e46a5cb4422 100644 --- a/src/app/pages/datasets/modules/permissions/containers/dataset-acl-editor/acl-editor-save-controls/acl-editor-save-controls.component.ts +++ b/src/app/pages/datasets/modules/permissions/containers/dataset-acl-editor/acl-editor-save-controls/acl-editor-save-controls.component.ts @@ -55,7 +55,7 @@ export class AclEditorSaveControlsComponent implements OnInit { private formBuilder: FormBuilder, private store: DatasetAclEditorStore, private dialogService: DialogService, - private ws: ApiService, + private api: ApiService, ) {} ngOnInit(): void { @@ -63,7 +63,7 @@ export class AclEditorSaveControlsComponent implements OnInit { } // TODO: Move here and in other places to global store. - protected hasValidateAclCheckbox = toSignal(this.ws.call('directoryservices.get_state').pipe( + protected hasValidateAclCheckbox = toSignal(this.api.call('directoryservices.get_state').pipe( map((state) => { return state.activedirectory !== DirectoryServiceState.Disabled || state.ldap !== DirectoryServiceState.Disabled; diff --git a/src/app/pages/datasets/modules/permissions/containers/dataset-trivial-permissions/dataset-trivial-permissions.component.ts b/src/app/pages/datasets/modules/permissions/containers/dataset-trivial-permissions/dataset-trivial-permissions.component.ts index 3cbfa9ca483..3f4b67477ba 100644 --- a/src/app/pages/datasets/modules/permissions/containers/dataset-trivial-permissions/dataset-trivial-permissions.component.ts +++ b/src/app/pages/datasets/modules/permissions/containers/dataset-trivial-permissions/dataset-trivial-permissions.component.ts @@ -111,7 +111,7 @@ export class DatasetTrivialPermissionsComponent implements OnInit { private formBuilder: FormBuilder, private router: Router, private activatedRoute: ActivatedRoute, - private ws: ApiService, + private api: ApiService, private errorHandler: ErrorHandlerService, private storageService: StorageService, private translate: TranslateService, @@ -153,7 +153,7 @@ export class DatasetTrivialPermissionsComponent implements OnInit { const payload = this.preparePayload(); this.dialog.jobDialog( - this.ws.job('filesystem.setperm', [payload]), + this.api.job('filesystem.setperm', [payload]), { title: this.translate.instant('Saving Permissions') }, ) .afterClosed() @@ -172,7 +172,7 @@ export class DatasetTrivialPermissionsComponent implements OnInit { private loadPermissionsInformation(): void { this.isLoading.set(true); forkJoin([ - this.ws.call('pool.dataset.query', [[['id', '=', this.datasetId]]]), + this.api.call('pool.dataset.query', [[['id', '=', this.datasetId]]]), this.storageService.filesystemStat(this.datasetPath), ]) .pipe(untilDestroyed(this)) diff --git a/src/app/pages/datasets/modules/permissions/stores/dataset-acl-editor.store.ts b/src/app/pages/datasets/modules/permissions/stores/dataset-acl-editor.store.ts index eb1bea8db62..5ae18790c8b 100644 --- a/src/app/pages/datasets/modules/permissions/stores/dataset-acl-editor.store.ts +++ b/src/app/pages/datasets/modules/permissions/stores/dataset-acl-editor.store.ts @@ -25,7 +25,6 @@ import { newNfsAce, newPosixAce } from 'app/pages/datasets/modules/permissions/u import { ApiService } from 'app/services/api.service'; import { ErrorHandlerService } from 'app/services/error-handler.service'; import { StorageService } from 'app/services/storage.service'; -import { UserService } from 'app/services/user.service'; const initialState: DatasetAclEditorState = { isLoading: false, @@ -42,13 +41,12 @@ const initialState: DatasetAclEditorState = { }) export class DatasetAclEditorStore extends ComponentStore { constructor( - private ws: ApiService, + private api: ApiService, private errorHandler: ErrorHandlerService, private dialogService: DialogService, private router: Router, private translate: TranslateService, private storageService: StorageService, - private userService: UserService, ) { super(initialState); } @@ -64,8 +62,8 @@ export class DatasetAclEditorStore extends ComponentStore }), switchMap((mountpoint) => { return forkJoin([ - this.ws.call('filesystem.getacl', [mountpoint, true, true]), - this.ws.call('filesystem.stat', [mountpoint]), + this.api.call('filesystem.getacl', [mountpoint, true, true]), + this.api.call('filesystem.stat', [mountpoint]), ]).pipe( tap(([acl, stat]) => { this.patchState({ @@ -214,7 +212,7 @@ export class DatasetAclEditorStore extends ComponentStore }); }), switchMap(() => { - return this.ws.call('filesystem.acltemplate.by_path', [{ + return this.api.call('filesystem.acltemplate.by_path', [{ path: this.get().mountpoint, 'format-options': { resolve_names: true, @@ -243,7 +241,7 @@ export class DatasetAclEditorStore extends ComponentStore private makeSaveRequest(setAcl: SetAcl): Observable { return this.dialogService.jobDialog( - this.ws.job('filesystem.setacl', [setAcl]), + this.api.job('filesystem.setacl', [setAcl]), { title: this.translate.instant(helptextAcl.save_dialog.title), description: this.translate.instant(helptextAcl.save_dialog.message), diff --git a/src/app/pages/datasets/modules/permissions/stores/permissions-card.store.ts b/src/app/pages/datasets/modules/permissions/stores/permissions-card.store.ts index 53ffa58d8b6..0517c083bfa 100644 --- a/src/app/pages/datasets/modules/permissions/stores/permissions-card.store.ts +++ b/src/app/pages/datasets/modules/permissions/stores/permissions-card.store.ts @@ -20,7 +20,7 @@ const initialState: PermissionsCardState = { @Injectable() export class PermissionsCardStore extends ComponentStore { constructor( - private ws: ApiService, + private api: ApiService, private errorHandler: ErrorHandlerService, private dialogService: DialogService, ) { @@ -37,8 +37,8 @@ export class PermissionsCardStore extends ComponentStore { }), switchMap((mountpoint) => { return forkJoin([ - this.ws.call('filesystem.stat', [mountpoint]), - this.ws.call('filesystem.getacl', [mountpoint, true, true]), + this.api.call('filesystem.stat', [mountpoint]), + this.api.call('filesystem.getacl', [mountpoint, true, true]), ]).pipe( tap(([stat, acl]) => { this.patchState({ diff --git a/src/app/pages/datasets/modules/snapshots/snapshot-add-form/snapshot-add-form.component.ts b/src/app/pages/datasets/modules/snapshots/snapshot-add-form/snapshot-add-form.component.ts index 4c6e6574451..5b6e99ad17c 100644 --- a/src/app/pages/datasets/modules/snapshots/snapshot-add-form/snapshot-add-form.component.ts +++ b/src/app/pages/datasets/modules/snapshots/snapshot-add-form/snapshot-add-form.component.ts @@ -95,7 +95,7 @@ export class SnapshotAddFormComponent implements OnInit { constructor( private fb: FormBuilder, private cdr: ChangeDetectorRef, - private ws: ApiService, + private api: ApiService, private translate: TranslateService, private authService: AuthService, private errorHandler: FormErrorHandlerService, @@ -158,7 +158,7 @@ export class SnapshotAddFormComponent implements OnInit { } this.isFormLoading = true; - this.ws.call('zfs.snapshot.create', [params]).pipe( + this.api.call('zfs.snapshot.create', [params]).pipe( untilDestroyed(this), ).subscribe({ next: () => { @@ -181,7 +181,7 @@ export class SnapshotAddFormComponent implements OnInit { } private getDatasetOptions(): Observable { - return this.ws.call('pool.dataset.query', [ + return this.api.call('pool.dataset.query', [ snapshotExcludeBootQueryFilter as QueryFilters, { extra: { flat: true } }, ]).pipe( @@ -196,7 +196,7 @@ export class SnapshotAddFormComponent implements OnInit { return of([]); } - return this.ws.call('replication.list_naming_schemas').pipe( + return this.api.call('replication.list_naming_schemas').pipe( singleArrayToOptions(), ); }), @@ -205,7 +205,7 @@ export class SnapshotAddFormComponent implements OnInit { private checkForVmsInDataset(): void { this.isFormLoading = true; - this.ws.call('vmware.dataset_has_vms', [this.form.controls.dataset.value, this.form.controls.recursive.value]) + this.api.call('vmware.dataset_has_vms', [this.form.controls.dataset.value, this.form.controls.recursive.value]) .pipe(untilDestroyed(this)) .subscribe({ next: (hasVmsInDataset) => { diff --git a/src/app/pages/datasets/modules/snapshots/snapshot-clone-dialog/snapshot-clone-dialog.component.ts b/src/app/pages/datasets/modules/snapshots/snapshot-clone-dialog/snapshot-clone-dialog.component.ts index bd81dcf032a..ea6680c2b48 100644 --- a/src/app/pages/datasets/modules/snapshots/snapshot-clone-dialog/snapshot-clone-dialog.component.ts +++ b/src/app/pages/datasets/modules/snapshots/snapshot-clone-dialog/snapshot-clone-dialog.component.ts @@ -52,7 +52,7 @@ export class SnapshotCloneDialogComponent implements OnInit { }; constructor( - private ws: ApiService, + private api: ApiService, private loader: AppLoaderService, private fb: FormBuilder, private errorHandler: FormErrorHandlerService, @@ -69,7 +69,7 @@ export class SnapshotCloneDialogComponent implements OnInit { } onSubmit(): void { - this.ws.call('zfs.snapshot.clone', [{ + this.api.call('zfs.snapshot.clone', [{ snapshot: this.snapshotName, dataset_dst: this.datasetName, }]) diff --git a/src/app/pages/datasets/modules/snapshots/snapshot-details-row/snapshot-details-row.component.spec.ts b/src/app/pages/datasets/modules/snapshots/snapshot-details-row/snapshot-details-row.component.spec.ts index ff93b9ac0b8..fc8ee59cc3f 100644 --- a/src/app/pages/datasets/modules/snapshots/snapshot-details-row/snapshot-details-row.component.spec.ts +++ b/src/app/pages/datasets/modules/snapshots/snapshot-details-row/snapshot-details-row.component.spec.ts @@ -22,7 +22,7 @@ import { ApiService } from 'app/services/api.service'; describe('SnapshotDetailsRowComponent', () => { let spectator: SpectatorRouting; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; const createComponent = createRoutingFactory({ component: SnapshotDetailsRowComponent, @@ -55,7 +55,7 @@ describe('SnapshotDetailsRowComponent', () => { }, }); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('renders details rows', () => { @@ -93,11 +93,11 @@ describe('SnapshotDetailsRowComponent', () => { expect(await holdCheckbox.getValue()).toBeTruthy(); await holdCheckbox.toggle(); - expect(ws.call).toHaveBeenCalledWith('zfs.snapshot.release', [fakeZfsSnapshot.name]); + expect(api.call).toHaveBeenCalledWith('zfs.snapshot.release', [fakeZfsSnapshot.name]); expect(await holdCheckbox.getValue()).toBeFalsy(); await holdCheckbox.toggle(); - expect(ws.call).toHaveBeenCalledWith('zfs.snapshot.hold', [fakeZfsSnapshot.name]); + expect(api.call).toHaveBeenCalledWith('zfs.snapshot.hold', [fakeZfsSnapshot.name]); }); it('should delete snapshot when `Delete` button click', async () => { @@ -110,6 +110,6 @@ describe('SnapshotDetailsRowComponent', () => { message: `Delete snapshot ${fakeZfsSnapshot.name}?`, }), ); - expect(ws.call).toHaveBeenCalledWith('zfs.snapshot.delete', [fakeZfsSnapshot.name]); + expect(api.call).toHaveBeenCalledWith('zfs.snapshot.delete', [fakeZfsSnapshot.name]); }); }); diff --git a/src/app/pages/datasets/modules/snapshots/snapshot-details-row/snapshot-details-row.component.ts b/src/app/pages/datasets/modules/snapshots/snapshot-details-row/snapshot-details-row.component.ts index cacf9f1b26a..173c4112955 100644 --- a/src/app/pages/datasets/modules/snapshots/snapshot-details-row/snapshot-details-row.component.ts +++ b/src/app/pages/datasets/modules/snapshots/snapshot-details-row/snapshot-details-row.component.ts @@ -65,7 +65,7 @@ export class SnapshotDetailsRowComponent implements OnInit, OnDestroy { constructor( private dialogService: DialogService, - private ws: ApiService, + private api: ApiService, private translate: TranslateService, private loader: AppLoaderService, private errorHandler: ErrorHandlerService, @@ -86,7 +86,7 @@ export class SnapshotDetailsRowComponent implements OnInit, OnDestroy { } getSnapshotInfo(): void { - this.ws.call( + this.api.call( 'zfs.snapshot.query', [ [['id', '=', this.snapshot.name]], { @@ -118,7 +118,7 @@ export class SnapshotDetailsRowComponent implements OnInit, OnDestroy { doHoldOrRelease(): void { const holdOrRelease = this.holdControl.value ? 'zfs.snapshot.hold' : 'zfs.snapshot.release'; - this.ws.call(holdOrRelease, [this.snapshotInfo.name]) + this.api.call(holdOrRelease, [this.snapshotInfo.name]) .pipe(this.loader.withLoader(), untilDestroyed(this)) .subscribe({ error: (error: unknown) => { @@ -144,7 +144,7 @@ export class SnapshotDetailsRowComponent implements OnInit, OnDestroy { }).pipe( filter(Boolean), switchMap(() => { - return this.ws.call('zfs.snapshot.delete', [snapshot.name]).pipe( + return this.api.call('zfs.snapshot.delete', [snapshot.name]).pipe( this.loader.withLoader(), this.errorHandler.catchError(), tap(() => { diff --git a/src/app/pages/datasets/modules/snapshots/store/snapshot.effects.ts b/src/app/pages/datasets/modules/snapshots/store/snapshot.effects.ts index 3774d0d41d5..c489c0e618e 100644 --- a/src/app/pages/datasets/modules/snapshots/store/snapshot.effects.ts +++ b/src/app/pages/datasets/modules/snapshots/store/snapshot.effects.ts @@ -26,7 +26,7 @@ export class SnapshotEffects { switchMap(() => this.store$.pipe(waitForPreferences)), switchMap((preferences) => { const extraColumns = preferences.showSnapshotExtraColumns ? ['properties' as keyof ZfsSnapshot] : []; - return this.ws.call('zfs.snapshot.query', [ + return this.api.call('zfs.snapshot.query', [ snapshotExcludeBootQueryFilter as QueryFilters, { select: ['snapshot_name', 'dataset', 'name', ...extraColumns], @@ -48,7 +48,7 @@ export class SnapshotEffects { subscribeToUpdates$ = createEffect(() => this.actions$.pipe( ofType(snapshotsLoaded), switchMap(() => { - return this.ws.subscribe('zfs.snapshot.query').pipe( + return this.api.subscribe('zfs.snapshot.query').pipe( filter((event) => event.msg !== IncomingApiMessageType.Removed), switchMap((event) => { switch (event.msg) { @@ -67,7 +67,7 @@ export class SnapshotEffects { subscribeToRemoval$ = createEffect(() => this.actions$.pipe( ofType(snapshotsLoaded), switchMap(() => { - return this.ws.subscribe('zfs.snapshot.query').pipe( + return this.api.subscribe('zfs.snapshot.query').pipe( filter((event) => event.msg === IncomingApiMessageType.Removed), map((event) => snapshotRemoved({ id: event.id.toString() })), ); @@ -76,7 +76,7 @@ export class SnapshotEffects { constructor( private actions$: Actions, - private ws: ApiService, + private api: ApiService, private store$: Store, private translate: TranslateService, ) {} diff --git a/src/app/pages/datasets/store/dataset-store.service.ts b/src/app/pages/datasets/store/dataset-store.service.ts index 7149aa9d0bb..45a7a5c0511 100644 --- a/src/app/pages/datasets/store/dataset-store.service.ts +++ b/src/app/pages/datasets/store/dataset-store.service.ts @@ -63,7 +63,7 @@ export class DatasetTreeStore extends ComponentStore { }); }), switchMap(() => { - return this.ws.call('pool.dataset.details') + return this.api.call('pool.dataset.details') .pipe( tap((datasets: DatasetDetails[]) => { this.patchState({ @@ -110,7 +110,7 @@ export class DatasetTreeStore extends ComponentStore { }); constructor( - private ws: ApiService, + private api: ApiService, ) { super(initialState); } diff --git a/src/app/pages/directory-service/components/active-directory/active-directory.component.ts b/src/app/pages/directory-service/components/active-directory/active-directory.component.ts index b9641a982be..a7299fff720 100644 --- a/src/app/pages/directory-service/components/active-directory/active-directory.component.ts +++ b/src/app/pages/directory-service/components/active-directory/active-directory.component.ts @@ -92,7 +92,7 @@ export class ActiveDirectoryComponent implements OnInit { hasKerberosPrincipal$ = this.form.select((values) => values.kerberos_principal); readonly helptext = helptextActiveDirectory; - readonly kerberosRealms$ = this.ws.call('kerberos.realm.query').pipe( + readonly kerberosRealms$ = this.api.call('kerberos.realm.query').pipe( map((realms) => { return realms.map((realm) => ({ label: realm.realm, @@ -101,11 +101,11 @@ export class ActiveDirectoryComponent implements OnInit { }), ); - readonly kerberosPrincipals$ = this.ws.call('kerberos.keytab.kerberos_principal_choices').pipe(singleArrayToOptions()); - readonly nssOptions$ = this.ws.call('activedirectory.nss_info_choices').pipe(singleArrayToOptions()); + readonly kerberosPrincipals$ = this.api.call('kerberos.keytab.kerberos_principal_choices').pipe(singleArrayToOptions()); + readonly nssOptions$ = this.api.call('activedirectory.nss_info_choices').pipe(singleArrayToOptions()); constructor( - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private errorHandler: ErrorHandlerService, private formBuilder: FormBuilder, @@ -167,7 +167,7 @@ export class ActiveDirectoryComponent implements OnInit { }; this.dialogService.jobDialog( - this.ws.job('activedirectory.update', [values]), + this.api.job('activedirectory.update', [values]), { title: this.translate.instant('Active Directory') }, ) .afterClosed() @@ -206,7 +206,7 @@ export class ActiveDirectoryComponent implements OnInit { } private loadDirectoryState(): Observable { - return this.ws.call('directoryservices.get_state').pipe( + return this.api.call('directoryservices.get_state').pipe( map((adState) => { const isHealthy = adState.activedirectory === DirectoryServiceState.Healthy; this.canLeaveDomain = isHealthy; @@ -220,7 +220,7 @@ export class ActiveDirectoryComponent implements OnInit { } private loadDirectoryConfig(): Observable { - return this.ws.call('activedirectory.config').pipe( + return this.api.call('activedirectory.config').pipe( map((config) => { this.form.patchValue(config); }), diff --git a/src/app/pages/directory-service/components/idmap-form/idmap-form.component.ts b/src/app/pages/directory-service/components/idmap-form/idmap-form.component.ts index 363d02ec976..771b2a9015b 100644 --- a/src/app/pages/directory-service/components/idmap-form/idmap-form.component.ts +++ b/src/app/pages/directory-service/components/idmap-form/idmap-form.component.ts @@ -186,7 +186,7 @@ export class IdmapFormComponent implements OnInit { constructor( private formBuilder: FormBuilder, private translate: TranslateService, - private ws: ApiService, + private api: ApiService, private validationHelpers: IxValidatorsService, private idmapService: IdmapService, private dialogService: DialogService, @@ -236,8 +236,8 @@ export class IdmapFormComponent implements OnInit { const params = this.prepareSubmitParams(); const request$ = this.isNew - ? this.ws.call('idmap.create', [params]) - : this.ws.call('idmap.update', [this.existingIdmap.id, params]); + ? this.api.call('idmap.create', [params]) + : this.api.call('idmap.update', [this.existingIdmap.id, params]); request$ .pipe( @@ -347,7 +347,7 @@ export class IdmapFormComponent implements OnInit { } return this.dialogService.jobDialog( - this.ws.job('idmap.clear_idmap_cache'), + this.api.job('idmap.clear_idmap_cache'), { title: this.translate.instant(helptextIdmap.idmap.clear_cache_dialog.job_title), }, diff --git a/src/app/pages/directory-service/components/idmap-list/idmap-list.component.ts b/src/app/pages/directory-service/components/idmap-list/idmap-list.component.ts index 9d9aac35d48..42d42bf46bd 100644 --- a/src/app/pages/directory-service/components/idmap-list/idmap-list.component.ts +++ b/src/app/pages/directory-service/components/idmap-list/idmap-list.component.ts @@ -129,7 +129,7 @@ export class IdmapListComponent implements OnInit { hideCheckbox: true, }).pipe( filter(Boolean), - switchMap(() => this.ws.call('idmap.delete', [row.id])), + switchMap(() => this.api.call('idmap.delete', [row.id])), untilDestroyed(this), ).subscribe({ error: (error: unknown) => { @@ -150,7 +150,7 @@ export class IdmapListComponent implements OnInit { constructor( private translate: TranslateService, - private ws: ApiService, + private api: ApiService, protected idmapService: IdmapService, protected dialogService: DialogService, private errorHandler: ErrorHandlerService, @@ -159,15 +159,15 @@ export class IdmapListComponent implements OnInit { ) { } ngOnInit(): void { - const idmapsRows$ = this.ws.call('directoryservices.get_state').pipe( + const idmapsRows$ = this.api.call('directoryservices.get_state').pipe( switchMap((state) => { if (state.ldap !== DirectoryServiceState.Disabled) { - return this.ws.call('idmap.query', [[['name', '=', IdmapName.DsTypeLdap]]]); + return this.api.call('idmap.query', [[['name', '=', IdmapName.DsTypeLdap]]]); } if (state.activedirectory !== DirectoryServiceState.Disabled) { - return this.ws.call('idmap.query', [[['name', '!=', IdmapName.DsTypeLdap]]]); + return this.api.call('idmap.query', [[['name', '!=', IdmapName.DsTypeLdap]]]); } - return this.ws.call('idmap.query'); + return this.api.call('idmap.query'); }), map((idmaps) => { const transformed = [...idmaps] as IdmapRow[]; diff --git a/src/app/pages/directory-service/components/kerberos-keytabs/kerberos-keytabs-form/kerberos-keytabs-form.component.ts b/src/app/pages/directory-service/components/kerberos-keytabs/kerberos-keytabs-form/kerberos-keytabs-form.component.ts index 03ee000dd23..9a735dcea7f 100644 --- a/src/app/pages/directory-service/components/kerberos-keytabs/kerberos-keytabs-form/kerberos-keytabs-form.component.ts +++ b/src/app/pages/directory-service/components/kerberos-keytabs/kerberos-keytabs-form/kerberos-keytabs-form.component.ts @@ -70,7 +70,7 @@ export class KerberosKeytabsFormComponent implements OnInit { private formBuilder: FormBuilder, private errorHandler: FormErrorHandlerService, private cdr: ChangeDetectorRef, - private ws: ApiService, + private api: ApiService, private slideInRef: SlideInRef, @Inject(SLIDE_IN_DATA) private editingKerberosKeytab: KerberosKeytab, ) {} @@ -104,9 +104,9 @@ export class KerberosKeytabsFormComponent implements OnInit { this.isLoading = true; let request$: Observable; if (this.isNew) { - request$ = this.ws.call('kerberos.keytab.create', [payload]); + request$ = this.api.call('kerberos.keytab.create', [payload]); } else { - request$ = this.ws.call('kerberos.keytab.update', [ + request$ = this.api.call('kerberos.keytab.update', [ this.editingKerberosKeytab.id, payload, ]); diff --git a/src/app/pages/directory-service/components/kerberos-keytabs/kerberos-keytabs-list/kerberos-keytabs-list.component.ts b/src/app/pages/directory-service/components/kerberos-keytabs/kerberos-keytabs-list/kerberos-keytabs-list.component.ts index 5a5d92453a2..4016386074b 100644 --- a/src/app/pages/directory-service/components/kerberos-keytabs/kerberos-keytabs-list/kerberos-keytabs-list.component.ts +++ b/src/app/pages/directory-service/components/kerberos-keytabs/kerberos-keytabs-list/kerberos-keytabs-list.component.ts @@ -1,6 +1,6 @@ import { AsyncPipe } from '@angular/common'; import { - ChangeDetectionStrategy, ChangeDetectorRef, Component, Input, OnInit, + ChangeDetectionStrategy, Component, Input, OnInit, } from '@angular/core'; import { MatButton } from '@angular/material/button'; import { MatToolbarRow } from '@angular/material/toolbar'; @@ -98,7 +98,7 @@ export class KerberosKeytabsListComponent implements OnInit { message: this.translate.instant('Are you sure you want to delete this item?'), }).pipe( filter(Boolean), - switchMap(() => this.ws.call('kerberos.keytab.delete', [row.id])), + switchMap(() => this.api.call('kerberos.keytab.delete', [row.id])), untilDestroyed(this), ).subscribe({ error: (error: unknown) => { @@ -119,16 +119,15 @@ export class KerberosKeytabsListComponent implements OnInit { constructor( private translate: TranslateService, - private ws: ApiService, + private api: ApiService, protected dialogService: DialogService, - private cdr: ChangeDetectorRef, private errorHandler: ErrorHandlerService, protected emptyService: EmptyService, private slideInService: SlideInService, ) { } ngOnInit(): void { - const keytabsRows$ = this.ws.call('kerberos.keytab.query').pipe( + const keytabsRows$ = this.api.call('kerberos.keytab.query').pipe( tap((keytabsRows) => this.kerberosRealsm = keytabsRows), untilDestroyed(this), ); diff --git a/src/app/pages/directory-service/components/kerberos-realms-form/kerberos-realms-form.component.spec.ts b/src/app/pages/directory-service/components/kerberos-realms-form/kerberos-realms-form.component.spec.ts index bfae070f438..193fa4dfe61 100644 --- a/src/app/pages/directory-service/components/kerberos-realms-form/kerberos-realms-form.component.spec.ts +++ b/src/app/pages/directory-service/components/kerberos-realms-form/kerberos-realms-form.component.spec.ts @@ -17,7 +17,7 @@ import { SlideInService } from 'app/services/slide-in.service'; describe('KerberosRealmsFormComponent', () => { let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; const createComponent = createComponentFactory({ component: KerberosRealmsFormComponent, imports: [ @@ -40,7 +40,7 @@ describe('KerberosRealmsFormComponent', () => { beforeEach(() => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('sends a create payload to websocket and closes modal form is saved', async () => { @@ -55,7 +55,7 @@ describe('KerberosRealmsFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('kerberos.realm.create', [{ + expect(api.call).toHaveBeenCalledWith('kerberos.realm.create', [{ realm: 'new', kdc: ['kdc1', 'kdc2'], admin_server: ['10.10.12.1', '10.10.12.2'], @@ -81,7 +81,7 @@ describe('KerberosRealmsFormComponent', () => { ], }); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('shows current group values when form is being edited', async () => { @@ -108,7 +108,7 @@ describe('KerberosRealmsFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('kerberos.realm.update', [ + expect(api.call).toHaveBeenCalledWith('kerberos.realm.update', [ 13, { realm: 'updated', diff --git a/src/app/pages/directory-service/components/kerberos-realms-form/kerberos-realms-form.component.ts b/src/app/pages/directory-service/components/kerberos-realms-form/kerberos-realms-form.component.ts index beb7979f62d..ce1575cc179 100644 --- a/src/app/pages/directory-service/components/kerberos-realms-form/kerberos-realms-form.component.ts +++ b/src/app/pages/directory-service/components/kerberos-realms-form/kerberos-realms-form.component.ts @@ -73,7 +73,7 @@ export class KerberosRealmsFormComponent implements OnInit { } constructor( - private ws: ApiService, + private api: ApiService, private errorHandler: FormErrorHandlerService, private cdr: ChangeDetectorRef, private fb: FormBuilder, @@ -100,9 +100,9 @@ export class KerberosRealmsFormComponent implements OnInit { this.isFormLoading = true; let request$: Observable; if (this.isNew) { - request$ = this.ws.call('kerberos.realm.create', [values as KerberosRealmUpdate]); + request$ = this.api.call('kerberos.realm.create', [values as KerberosRealmUpdate]); } else { - request$ = this.ws.call('kerberos.realm.update', [ + request$ = this.api.call('kerberos.realm.update', [ this.editingRealm.id, values as KerberosRealmUpdate, ]); diff --git a/src/app/pages/directory-service/components/kerberos-realms/kerberos-realms-list.component.ts b/src/app/pages/directory-service/components/kerberos-realms/kerberos-realms-list.component.ts index 4b96655bfcc..eef3d3f8a67 100644 --- a/src/app/pages/directory-service/components/kerberos-realms/kerberos-realms-list.component.ts +++ b/src/app/pages/directory-service/components/kerberos-realms/kerberos-realms-list.component.ts @@ -113,7 +113,7 @@ export class KerberosRealmsListComponent implements OnInit { message: this.translate.instant('Are you sure you want to delete this item?'), }).pipe( filter(Boolean), - switchMap(() => this.ws.call('kerberos.realm.delete', [row.id])), + switchMap(() => this.api.call('kerberos.realm.delete', [row.id])), untilDestroyed(this), ).subscribe({ error: (error: unknown) => { @@ -134,7 +134,7 @@ export class KerberosRealmsListComponent implements OnInit { constructor( private translate: TranslateService, - private ws: ApiService, + private api: ApiService, protected dialogService: DialogService, private errorHandler: ErrorHandlerService, protected emptyService: EmptyService, @@ -142,7 +142,7 @@ export class KerberosRealmsListComponent implements OnInit { ) { } ngOnInit(): void { - const kerberosRealsm$ = this.ws.call('kerberos.realm.query').pipe( + const kerberosRealsm$ = this.api.call('kerberos.realm.query').pipe( map((realms) => { return realms.map((realm) => { return { diff --git a/src/app/pages/directory-service/components/kerberos-settings/kerberos-settings.component.spec.ts b/src/app/pages/directory-service/components/kerberos-settings/kerberos-settings.component.spec.ts index f05c2905d6d..ec174b7d321 100644 --- a/src/app/pages/directory-service/components/kerberos-settings/kerberos-settings.component.spec.ts +++ b/src/app/pages/directory-service/components/kerberos-settings/kerberos-settings.component.spec.ts @@ -18,7 +18,7 @@ import { SlideInService } from 'app/services/slide-in.service'; describe('KerberosSettingsComponent', () => { let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; const createComponent = createComponentFactory({ component: KerberosSettingsComponent, imports: [ @@ -44,14 +44,14 @@ describe('KerberosSettingsComponent', () => { beforeEach(() => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('loads current kerberos settings and show them', async () => { const form = await loader.getHarness(IxFormHarness); const values = await form.getValues(); - expect(ws.call).toHaveBeenCalledWith('kerberos.config'); + expect(api.call).toHaveBeenCalledWith('kerberos.config'); expect(values).toEqual({ 'Appdefaults Auxiliary Parameters': 'testparam', 'Libdefaults Auxiliary Parameters': 'clockskew=2', @@ -68,7 +68,7 @@ describe('KerberosSettingsComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('kerberos.update', [{ + expect(api.call).toHaveBeenCalledWith('kerberos.update', [{ appdefaults_aux: 'newparam', libdefaults_aux: 'clockskew=6', }]); diff --git a/src/app/pages/directory-service/components/kerberos-settings/kerberos-settings.component.ts b/src/app/pages/directory-service/components/kerberos-settings/kerberos-settings.component.ts index 595e3e10862..75727500873 100644 --- a/src/app/pages/directory-service/components/kerberos-settings/kerberos-settings.component.ts +++ b/src/app/pages/directory-service/components/kerberos-settings/kerberos-settings.component.ts @@ -57,7 +57,7 @@ export class KerberosSettingsComponent implements OnInit { }; constructor( - private ws: ApiService, + private api: ApiService, private slideInRef: SlideInRef, private formErrorHandler: FormErrorHandlerService, private cdr: ChangeDetectorRef, @@ -69,7 +69,7 @@ export class KerberosSettingsComponent implements OnInit { ngOnInit(): void { this.isFormLoading = true; - this.ws.call('kerberos.config').pipe(untilDestroyed(this)).subscribe({ + this.api.call('kerberos.config').pipe(untilDestroyed(this)).subscribe({ next: (config) => { this.form.patchValue(config); this.isFormLoading = false; @@ -87,7 +87,7 @@ export class KerberosSettingsComponent implements OnInit { const values = this.form.value; this.isFormLoading = true; - this.ws.call('kerberos.update', [values as KerberosConfigUpdate]).pipe(untilDestroyed(this)).subscribe({ + this.api.call('kerberos.update', [values as KerberosConfigUpdate]).pipe(untilDestroyed(this)).subscribe({ next: () => { this.isFormLoading = false; this.cdr.markForCheck(); diff --git a/src/app/pages/directory-service/components/ldap/ldap.component.ts b/src/app/pages/directory-service/components/ldap/ldap.component.ts index 0c4c449ca1d..5bff09fc90e 100644 --- a/src/app/pages/directory-service/components/ldap/ldap.component.ts +++ b/src/app/pages/directory-service/components/ldap/ldap.component.ts @@ -87,7 +87,7 @@ export class LdapComponent implements OnInit { }); readonly helptext = helptextLdap; - readonly kerberosRealms$ = this.ws.call('kerberos.realm.query').pipe( + readonly kerberosRealms$ = this.api.call('kerberos.realm.query').pipe( map((realms) => { return realms.map((realm) => ({ label: realm.realm, @@ -96,14 +96,14 @@ export class LdapComponent implements OnInit { }), ); - readonly kerberosPrincipals$ = this.ws.call('kerberos.keytab.kerberos_principal_choices').pipe(singleArrayToOptions()); - readonly sslOptions$ = this.ws.call('ldap.ssl_choices').pipe(singleArrayToOptions()); + readonly kerberosPrincipals$ = this.api.call('kerberos.keytab.kerberos_principal_choices').pipe(singleArrayToOptions()); + readonly sslOptions$ = this.api.call('ldap.ssl_choices').pipe(singleArrayToOptions()); readonly certificates$ = this.systemGeneralService.getCertificates().pipe(idNameArrayToOptions()); - readonly schemaOptions$ = this.ws.call('ldap.schema_choices').pipe(singleArrayToOptions()); + readonly schemaOptions$ = this.api.call('ldap.schema_choices').pipe(singleArrayToOptions()); readonly isEnabled$ = this.form.select((values) => values.enable); constructor( - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private formBuilder: FormBuilder, private systemGeneralService: SystemGeneralService, @@ -149,7 +149,7 @@ export class LdapComponent implements OnInit { const values = this.form.value; this.dialogService.jobDialog( - this.ws.job('ldap.update', [values]), + this.api.job('ldap.update', [values]), { title: 'LDAP', }, @@ -174,7 +174,7 @@ export class LdapComponent implements OnInit { private loadFormValues(): void { this.isLoading = true; - this.ws.call('ldap.config') + this.api.call('ldap.config') .pipe(untilDestroyed(this)) .subscribe({ next: (config) => { diff --git a/src/app/pages/directory-service/components/leave-domain-dialog/leave-domain-dialog.component.ts b/src/app/pages/directory-service/components/leave-domain-dialog/leave-domain-dialog.component.ts index 3e677f24b56..3c061436056 100644 --- a/src/app/pages/directory-service/components/leave-domain-dialog/leave-domain-dialog.component.ts +++ b/src/app/pages/directory-service/components/leave-domain-dialog/leave-domain-dialog.component.ts @@ -49,7 +49,7 @@ export class LeaveDomainDialogComponent { private errorHandler: ErrorHandlerService, private formBuilder: FormBuilder, private loader: AppLoaderService, - private ws: ApiService, + private api: ApiService, private dialogRef: MatDialogRef, private dialogService: DialogService, private snackbar: SnackbarService, @@ -59,7 +59,7 @@ export class LeaveDomainDialogComponent { onSubmit(): void { const params = this.form.value; - this.ws.job('activedirectory.leave', [params as LeaveActiveDirectory]) + this.api.job('activedirectory.leave', [params as LeaveActiveDirectory]) .pipe(this.loader.withLoader(), untilDestroyed(this)) .subscribe({ next: (job) => { diff --git a/src/app/pages/directory-service/directory-services.component.ts b/src/app/pages/directory-service/directory-services.component.ts index 9aff8e0193a..3f5b23b15af 100644 --- a/src/app/pages/directory-service/directory-services.component.ts +++ b/src/app/pages/directory-service/directory-services.component.ts @@ -90,7 +90,7 @@ export class DirectoryServicesComponent implements OnInit { }; constructor( - private ws: ApiService, + private api: ApiService, private slideInService: SlideInService, private dialog: DialogService, private loader: AppLoaderService, @@ -105,10 +105,10 @@ export class DirectoryServicesComponent implements OnInit { refreshCards(): void { forkJoin([ - this.ws.call('directoryservices.get_state'), - this.ws.call('activedirectory.config'), - this.ws.call('ldap.config'), - this.ws.call('kerberos.config'), + this.api.call('directoryservices.get_state'), + this.api.call('activedirectory.config'), + this.api.call('ldap.config'), + this.api.call('kerberos.config'), ]) .pipe(this.loader.withLoader(), untilDestroyed(this)) .subscribe(([servicesState, activeDirectoryConfig, ldapConfig, kerberosSettings]) => { diff --git a/src/app/pages/network/components/configuration/configuration.component.spec.ts b/src/app/pages/network/components/configuration/configuration.component.spec.ts index 138b6ec9276..84cdce37807 100644 --- a/src/app/pages/network/components/configuration/configuration.component.spec.ts +++ b/src/app/pages/network/components/configuration/configuration.component.spec.ts @@ -23,7 +23,7 @@ import { SystemGeneralService } from 'app/services/system-general.service'; describe('NetworkConfigurationComponent', () => { let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; const createComponent = createComponentFactory({ component: NetworkConfigurationComponent, imports: [ @@ -83,7 +83,7 @@ describe('NetworkConfigurationComponent', () => { beforeEach(() => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('loads and shows current network global configuration when form is opened', async () => { @@ -137,7 +137,7 @@ describe('NetworkConfigurationComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith( + expect(api.call).toHaveBeenCalledWith( 'network.configuration.update', [{ activity: { @@ -172,7 +172,7 @@ describe('NetworkConfigurationComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith( + expect(api.call).toHaveBeenCalledWith( 'network.configuration.update', [ expect.objectContaining({ diff --git a/src/app/pages/network/components/configuration/configuration.component.ts b/src/app/pages/network/components/configuration/configuration.component.ts index 7036de580bb..3c11f7d77de 100644 --- a/src/app/pages/network/components/configuration/configuration.component.ts +++ b/src/app/pages/network/components/configuration/configuration.component.ts @@ -203,7 +203,7 @@ export class NetworkConfigurationComponent implements OnInit { fcName: 'outbound_network_value', label: helptextNetworkConfiguration.outbound_network_value.placeholder, tooltip: helptextNetworkConfiguration.outbound_network_value.tooltip, - options: this.ws.call('network.configuration.activity_choices').pipe(arrayToOptions()), + options: this.api.call('network.configuration.activity_choices').pipe(arrayToOptions()), hidden: true, }; @@ -220,7 +220,7 @@ export class NetworkConfigurationComponent implements OnInit { }; constructor( - private ws: ApiService, + private api: ApiService, private errorHandler: ErrorHandlerService, private slideInRef: SlideInRef, private formErrorHandler: FormErrorHandlerService, @@ -264,7 +264,7 @@ export class NetworkConfigurationComponent implements OnInit { } private loadConfig(): void { - this.ws.call('network.configuration.config') + this.api.call('network.configuration.config') .pipe(untilDestroyed(this)) .subscribe({ next: (config: NetworkConfiguration) => { @@ -344,7 +344,7 @@ export class NetworkConfigurationComponent implements OnInit { }; this.isFormLoading = true; - this.ws.call('network.configuration.update', [params] as [NetworkConfigurationUpdate]) + this.api.call('network.configuration.update', [params] as [NetworkConfigurationUpdate]) .pipe(untilDestroyed(this)) .subscribe({ next: () => { diff --git a/src/app/pages/network/components/default-gateway-dialog/default-gateway-dialog.component.spec.ts b/src/app/pages/network/components/default-gateway-dialog/default-gateway-dialog.component.spec.ts index 1accc152aef..32d337570f6 100644 --- a/src/app/pages/network/components/default-gateway-dialog/default-gateway-dialog.component.spec.ts +++ b/src/app/pages/network/components/default-gateway-dialog/default-gateway-dialog.component.spec.ts @@ -15,7 +15,7 @@ import { ApiService } from 'app/services/api.service'; describe('DefaultGatewayDialogComponent', () => { let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; const createComponent = createComponentFactory({ component: DefaultGatewayDialogComponent, @@ -37,7 +37,7 @@ describe('DefaultGatewayDialogComponent', () => { beforeEach(() => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('checks the header', () => { @@ -53,6 +53,6 @@ describe('DefaultGatewayDialogComponent', () => { const registerGatewayButton = await loader.getHarness(MatButtonHarness.with({ text: 'Register' })); await registerGatewayButton.click(); - expect(ws.call).toHaveBeenCalledWith('interface.save_default_route', ['192.168.1.1']); + expect(api.call).toHaveBeenCalledWith('interface.save_default_route', ['192.168.1.1']); }); }); diff --git a/src/app/pages/network/components/default-gateway-dialog/default-gateway-dialog.component.ts b/src/app/pages/network/components/default-gateway-dialog/default-gateway-dialog.component.ts index 64cef800b0e..7959036257d 100644 --- a/src/app/pages/network/components/default-gateway-dialog/default-gateway-dialog.component.ts +++ b/src/app/pages/network/components/default-gateway-dialog/default-gateway-dialog.component.ts @@ -68,14 +68,14 @@ export class DefaultGatewayDialogComponent { ], }); - currentGateway$ = this.ws.call('network.general.summary').pipe( + currentGateway$ = this.api.call('network.general.summary').pipe( toLoadingState(), ); readonly helptext = helptextNetworkConfiguration; constructor( - private ws: ApiService, + private api: ApiService, private fb: FormBuilder, public cdr: ChangeDetectorRef, private dialogRef: MatDialogRef, @@ -88,7 +88,7 @@ export class DefaultGatewayDialogComponent { onSubmit(): void { this.dialogRef.close(); const formValues = this.form.value; - this.ws.call('interface.save_default_route', [formValues.defaultGateway]).pipe( + this.api.call('interface.save_default_route', [formValues.defaultGateway]).pipe( catchError((error: unknown) => { this.dialog.error(this.errorHandler.parseError(error)); return EMPTY; diff --git a/src/app/pages/network/components/interface-form/interface-form.component.spec.ts b/src/app/pages/network/components/interface-form/interface-form.component.spec.ts index a4a21d7acb6..ad2d81642e0 100644 --- a/src/app/pages/network/components/interface-form/interface-form.component.spec.ts +++ b/src/app/pages/network/components/interface-form/interface-form.component.spec.ts @@ -43,7 +43,7 @@ import { networkInterfacesChanged } from 'app/store/network-interfaces/network-i describe('InterfaceFormComponent', () => { let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; let form: IxFormHarness; let aliasesList: IxListHarness; const existingInterface = { @@ -144,7 +144,7 @@ describe('InterfaceFormComponent', () => { loader = TestbedHarnessEnvironment.loader(spectator.fixture); form = await loader.getHarness(IxFormHarness); aliasesList = await loader.getHarness(IxListHarness.with({ label: 'Aliases' })); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('saves a new bridge interface when form is submitted for bridge interface', async () => { @@ -166,7 +166,7 @@ describe('InterfaceFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('interface.create', [{ + expect(api.call).toHaveBeenCalledWith('interface.create', [{ type: NetworkInterfaceType.Bridge, name: 'br0', description: 'Bridge interface', @@ -186,7 +186,7 @@ describe('InterfaceFormComponent', () => { const store$ = spectator.inject(Store); expect(store$.dispatch).toHaveBeenCalledWith(networkInterfacesChanged({ commit: false, checkIn: false })); - expect(ws.call).toHaveBeenCalledWith('interface.default_route_will_be_removed'); + expect(api.call).toHaveBeenCalledWith('interface.default_route_will_be_removed'); expect(spectator.inject(MatDialog).open).toHaveBeenCalledWith( DefaultGatewayDialogComponent, @@ -215,7 +215,7 @@ describe('InterfaceFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('interface.create', [{ + expect(api.call).toHaveBeenCalledWith('interface.create', [{ type: NetworkInterfaceType.LinkAggregation, name: 'bond0', description: 'LAG', @@ -233,7 +233,7 @@ describe('InterfaceFormComponent', () => { expect(store$.dispatch).toHaveBeenCalledWith(networkInterfacesChanged({ commit: false, checkIn: false })); expect(spectator.inject(SlideInRef).close).toHaveBeenCalled(); - expect(ws.call).toHaveBeenCalledWith('interface.default_route_will_be_removed'); + expect(api.call).toHaveBeenCalledWith('interface.default_route_will_be_removed'); expect(spectator.inject(MatDialog).open).toHaveBeenCalledWith( DefaultGatewayDialogComponent, @@ -258,7 +258,7 @@ describe('InterfaceFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('interface.create', [{ + expect(api.call).toHaveBeenCalledWith('interface.create', [{ type: NetworkInterfaceType.Vlan, name: 'vlan1', description: 'New VLAN', @@ -270,7 +270,7 @@ describe('InterfaceFormComponent', () => { mtu: 1500, aliases: [], }]); - expect(ws.call).toHaveBeenCalledWith('interface.default_route_will_be_removed'); + expect(api.call).toHaveBeenCalledWith('interface.default_route_will_be_removed'); expect(spectator.inject(MatDialog).open).toHaveBeenCalledWith( DefaultGatewayDialogComponent, @@ -309,7 +309,7 @@ describe('InterfaceFormComponent', () => { loader = TestbedHarnessEnvironment.loader(spectator.fixture); form = await loader.getHarness(IxFormHarness); aliasesList = await loader.getHarness(IxListHarness.with({ label: 'Aliases' })); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('shows values for a network interface when it is opened for edit', async () => { @@ -342,7 +342,7 @@ describe('InterfaceFormComponent', () => { loader = TestbedHarnessEnvironment.loader(spectator.fixture); form = await loader.getHarness(IxFormHarness); aliasesList = await loader.getHarness(IxListHarness.with({ label: 'Aliases' })); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('disables parent interface fields when VLAN is opened for edit', async () => { @@ -369,7 +369,7 @@ describe('InterfaceFormComponent', () => { loader = TestbedHarnessEnvironment.loader(spectator.fixture); form = await loader.getHarness(IxFormHarness); aliasesList = await loader.getHarness(IxListHarness.with({ label: 'Aliases' })); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('reloads bridge member choices when bridge interface is opened for edit', () => { @@ -399,7 +399,7 @@ describe('InterfaceFormComponent', () => { loader = TestbedHarnessEnvironment.loader(spectator.fixture); form = await loader.getHarness(IxFormHarness); aliasesList = await loader.getHarness(IxListHarness.with({ label: 'Aliases' })); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('reloads lag ports when link aggregation is opened for edit', () => { @@ -413,7 +413,7 @@ describe('InterfaceFormComponent', () => { loader = TestbedHarnessEnvironment.loader(spectator.fixture); form = await loader.getHarness(IxFormHarness); aliasesList = await loader.getHarness(IxListHarness.with({ label: 'Aliases' })); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); beforeEach(() => { @@ -423,7 +423,7 @@ describe('InterfaceFormComponent', () => { }); it('checks whether failover is licensed for', () => { - expect(ws.call).toHaveBeenCalledWith('failover.node'); + expect(api.call).toHaveBeenCalledWith('failover.node'); }); it('shows and saves additional fields in Aliases when failover is licensed', async () => { @@ -439,13 +439,13 @@ describe('InterfaceFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('interface.create', [ + expect(api.call).toHaveBeenCalledWith('interface.create', [ expect.objectContaining({ failover_critical: true, failover_group: 1, }), ]); - expect(ws.call).toHaveBeenCalledWith('interface.default_route_will_be_removed'); + expect(api.call).toHaveBeenCalledWith('interface.default_route_will_be_removed'); expect(spectator.inject(MatDialog).open).toHaveBeenCalledWith( DefaultGatewayDialogComponent, @@ -468,7 +468,7 @@ describe('InterfaceFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('interface.create', [ + expect(api.call).toHaveBeenCalledWith('interface.create', [ expect.objectContaining({ aliases: [{ address: '10.2.3.4', @@ -479,7 +479,7 @@ describe('InterfaceFormComponent', () => { failover_virtual_aliases: [{ address: '192.168.1.3' }], }), ]); - expect(ws.call).toHaveBeenCalledWith('interface.default_route_will_be_removed'); + expect(api.call).toHaveBeenCalledWith('interface.default_route_will_be_removed'); expect(spectator.inject(MatDialog).open).toHaveBeenCalledWith( DefaultGatewayDialogComponent, diff --git a/src/app/pages/network/components/interface-form/interface-form.component.ts b/src/app/pages/network/components/interface-form/interface-form.component.ts index 8529b5b7a69..f469fd71ac0 100644 --- a/src/app/pages/network/components/interface-form/interface-form.component.ts +++ b/src/app/pages/network/components/interface-form/interface-form.component.ts @@ -149,8 +149,8 @@ export class InterfaceFormComponent implements OnInit { lagProtocols$ = this.networkService.getLaggProtocolChoices().pipe(singleArrayToOptions()); lagPorts$ = this.networkService.getLaggPortsChoices().pipe(choicesToOptions()); - xmitHashPolicies$ = this.ws.call('interface.xmit_hash_policy_choices').pipe(choicesToOptions()); - lacpduRates$ = this.ws.call('interface.lacpdu_rate_choices').pipe(choicesToOptions()); + xmitHashPolicies$ = this.api.call('interface.xmit_hash_policy_choices').pipe(choicesToOptions()); + lacpduRates$ = this.api.call('interface.lacpdu_rate_choices').pipe(choicesToOptions()); vlanPcpOptions$ = of([ { value: 0, label: this.translate.instant('Best effort (default)') }, @@ -172,7 +172,7 @@ export class InterfaceFormComponent implements OnInit { constructor( private formBuilder: FormBuilder, private cdr: ChangeDetectorRef, - private ws: ApiService, + private api: ApiService, private translate: TranslateService, private networkService: NetworkService, private errorHandler: FormErrorHandlerService, @@ -268,14 +268,14 @@ export class InterfaceFormComponent implements OnInit { const params = this.prepareSubmitParams(); const request$ = this.isNew - ? this.ws.call('interface.create', [params]) - : this.ws.call('interface.update', [this.existingInterface.id, params]); + ? this.api.call('interface.create', [params]) + : this.api.call('interface.update', [this.existingInterface.id, params]); request$.pipe(untilDestroyed(this)).subscribe({ next: () => { this.store$.dispatch(networkInterfacesChanged({ commit: false, checkIn: false })); - this.ws.call('interface.default_route_will_be_removed').pipe(untilDestroyed(this)).subscribe((approved) => { + this.api.call('interface.default_route_will_be_removed').pipe(untilDestroyed(this)).subscribe((approved) => { if (approved) { this.matDialog.open(DefaultGatewayDialogComponent, { width: '600px', @@ -323,8 +323,8 @@ export class InterfaceFormComponent implements OnInit { } forkJoin([ - this.ws.call('failover.licensed'), - this.ws.call('failover.node'), + this.api.call('failover.licensed'), + this.api.call('failover.node'), ]) .pipe(untilDestroyed(this)) .subscribe(([isHaLicensed, failoverNode]) => { diff --git a/src/app/pages/network/components/interfaces-card/interfaces-card.component.ts b/src/app/pages/network/components/interfaces-card/interfaces-card.component.ts index 2179315c1dc..83754ace6f6 100644 --- a/src/app/pages/network/components/interfaces-card/interfaces-card.component.ts +++ b/src/app/pages/network/components/interfaces-card/interfaces-card.component.ts @@ -139,7 +139,7 @@ export class InterfacesCardComponent implements OnInit, OnChanges { private translate: TranslateService, private slideInService: SlideInService, private dialogService: DialogService, - private ws: ApiService, + private api: ApiService, private loader: AppLoaderService, private errorHandler: ErrorHandlerService, private networkService: NetworkService, @@ -219,7 +219,7 @@ export class InterfacesCardComponent implements OnInit, OnChanges { } private makeDeleteCall(row: NetworkInterface): void { - this.ws.call('interface.delete', [row.id]) + this.api.call('interface.delete', [row.id]) .pipe( this.loader.withLoader(), this.errorHandler.catchError(), diff --git a/src/app/pages/network/components/ipmi-card/ipmi-card.component.ts b/src/app/pages/network/components/ipmi-card/ipmi-card.component.ts index 49474ac7958..2f918de6b01 100644 --- a/src/app/pages/network/components/ipmi-card/ipmi-card.component.ts +++ b/src/app/pages/network/components/ipmi-card/ipmi-card.component.ts @@ -77,10 +77,10 @@ export class IpmiCardComponent implements OnInit { ariaLabels: (row) => [row.ip_address, this.translate.instant('IPMI')], }); - protected readonly hasIpmi$ = this.ws.call('ipmi.is_loaded'); + protected readonly hasIpmi$ = this.api.call('ipmi.is_loaded'); constructor( - private ws: ApiService, + private api: ApiService, private slideInService: SlideInService, private matDialog: MatDialog, private translate: TranslateService, @@ -89,7 +89,7 @@ export class IpmiCardComponent implements OnInit { ) { } ngOnInit(): void { - const ipmi$ = this.ws.call('ipmi.lan.query').pipe(untilDestroyed(this)); + const ipmi$ = this.api.call('ipmi.lan.query').pipe(untilDestroyed(this)); this.dataProvider = new AsyncDataProvider(ipmi$); this.loadIpmiEntries(); } diff --git a/src/app/pages/network/components/ipmi-card/ipmi-events-dialog/ipmi-events-dialog.component.ts b/src/app/pages/network/components/ipmi-card/ipmi-events-dialog/ipmi-events-dialog.component.ts index 30671901ea0..1f16ecdad3c 100644 --- a/src/app/pages/network/components/ipmi-card/ipmi-events-dialog/ipmi-events-dialog.component.ts +++ b/src/app/pages/network/components/ipmi-card/ipmi-events-dialog/ipmi-events-dialog.component.ts @@ -54,7 +54,7 @@ export class IpmiEventsDialogComponent implements OnInit { }; constructor( - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private errorHandler: ErrorHandlerService, private dialogService: DialogService, @@ -68,7 +68,7 @@ export class IpmiEventsDialogComponent implements OnInit { onClear(): void { this.isLoading = true; this.cdr.markForCheck(); - this.ws.job('ipmi.sel.clear').pipe(untilDestroyed(this)).subscribe({ + this.api.job('ipmi.sel.clear').pipe(untilDestroyed(this)).subscribe({ next: (job) => { if (job.state !== JobState.Success) { return; @@ -97,7 +97,7 @@ export class IpmiEventsDialogComponent implements OnInit { private loadEvents(): void { this.isLoading = true; this.cdr.markForCheck(); - this.ws.job('ipmi.sel.elist').pipe(untilDestroyed(this)).subscribe({ + this.api.job('ipmi.sel.elist').pipe(untilDestroyed(this)).subscribe({ next: (job) => { if (job.state !== JobState.Success) { return; diff --git a/src/app/pages/network/components/ipmi-card/ipmi-form/ipmi-form.component.spec.ts b/src/app/pages/network/components/ipmi-card/ipmi-form/ipmi-form.component.spec.ts index fdfe6189a83..d6e91e9a47a 100644 --- a/src/app/pages/network/components/ipmi-card/ipmi-form/ipmi-form.component.spec.ts +++ b/src/app/pages/network/components/ipmi-card/ipmi-form/ipmi-form.component.spec.ts @@ -30,7 +30,7 @@ describe('IpmiFormComponent', () => { let spectator: Spectator; let loader: HarnessLoader; let form: IxFormHarness; - let ws: ApiService; + let api: ApiService; let productType: ProductType; const createComponent = createComponentFactory({ component: IpmiFormComponent, @@ -111,7 +111,7 @@ describe('IpmiFormComponent', () => { }); loader = TestbedHarnessEnvironment.loader(spectator.fixture); form = await loader.getHarness(IxFormHarness); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); } describe('product type is SCALE_ENTERPRISE', () => { @@ -175,7 +175,7 @@ describe('IpmiFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('ipmi.lan.update', [1, { + expect(api.call).toHaveBeenCalledWith('ipmi.lan.update', [1, { dhcp: false, ipaddress: '10.220.15.114', gateway: '10.220.0.1', @@ -198,7 +198,7 @@ describe('IpmiFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('ipmi.lan.update', [1, { + expect(api.call).toHaveBeenCalledWith('ipmi.lan.update', [1, { dhcp: false, ipaddress: '10.220.15.115', gateway: '10.220.0.2', @@ -238,7 +238,7 @@ describe('IpmiFormComponent', () => { const flashButton = await loader.getHarness(MatButtonHarness.with({ text: 'Flash Identify Light' })); await flashButton.click(); - expect(ws.call).toHaveBeenLastCalledWith('ipmi.chassis.identify', [OnOff.On]); + expect(api.call).toHaveBeenLastCalledWith('ipmi.chassis.identify', [OnOff.On]); }); it('stops flashing IPMI light when Flash Identify Light is pressed again', async () => { @@ -247,7 +247,7 @@ describe('IpmiFormComponent', () => { const stopFlashing = await loader.getHarness(MatButtonHarness.with({ text: 'Stop Flashing' })); await stopFlashing.click(); - expect(ws.call).toHaveBeenLastCalledWith('ipmi.chassis.identify', [OnOff.Off]); + expect(api.call).toHaveBeenLastCalledWith('ipmi.chassis.identify', [OnOff.Off]); }); }); }); diff --git a/src/app/pages/network/components/ipmi-card/ipmi-form/ipmi-form.component.ts b/src/app/pages/network/components/ipmi-card/ipmi-form/ipmi-form.component.ts index 80cd4f632d2..1012cda6f2b 100644 --- a/src/app/pages/network/components/ipmi-card/ipmi-form/ipmi-form.component.ts +++ b/src/app/pages/network/components/ipmi-card/ipmi-form/ipmi-form.component.ts @@ -110,7 +110,7 @@ export class IpmiFormComponent implements OnInit { }); constructor( - private ws: ApiService, + private api: ApiService, private translate: TranslateService, private redirect: RedirectService, private fb: FormBuilder, @@ -142,7 +142,7 @@ export class IpmiFormComponent implements OnInit { } toggleFlashing(): void { - this.ws.call('ipmi.chassis.identify', [this.isFlashing ? OnOff.Off : OnOff.On]) + this.api.call('ipmi.chassis.identify', [this.isFlashing ? OnOff.Off : OnOff.On]) .pipe(this.errorHandler.catchError(), untilDestroyed(this)) .subscribe(() => { this.snackbar.success( @@ -164,7 +164,7 @@ export class IpmiFormComponent implements OnInit { this.cdr.markForCheck(); forkJoin([ - this.ws.call('ipmi.lan.query', this.queryParams), + this.api.call('ipmi.lan.query', this.queryParams), this.loadFlashingStatus(), ]) .pipe( @@ -226,11 +226,11 @@ export class IpmiFormComponent implements OnInit { if (isUsingRemote) { return this.remoteControllerData ? of([this.remoteControllerData]) - : this.ws.call('ipmi.lan.query', this.queryParams); + : this.api.call('ipmi.lan.query', this.queryParams); } return this.defaultControllerData ? of([this.defaultControllerData]) - : this.ws.call('ipmi.lan.query', this.queryParams); + : this.api.call('ipmi.lan.query', this.queryParams); }), untilDestroyed(this), ) @@ -260,7 +260,7 @@ export class IpmiFormComponent implements OnInit { if (!updateParams.vlan) { delete updateParams.vlan; } - this.ws.call('ipmi.lan.update', [this.ipmiId, updateParams]) + this.api.call('ipmi.lan.update', [this.ipmiId, updateParams]) .pipe(untilDestroyed(this)) .subscribe({ next: () => { @@ -293,7 +293,7 @@ export class IpmiFormComponent implements OnInit { } private loadFlashingStatus(): Observable { - return this.ws.call('ipmi.chassis.info').pipe( + return this.api.call('ipmi.chassis.info').pipe( tap((ipmiStatus) => { this.isFlashing = ipmiStatus.chassis_identify_state !== IpmiChassisIdentifyState.Off; this.cdr.markForCheck(); @@ -313,7 +313,7 @@ export class IpmiFormComponent implements OnInit { return of(null); } - return this.ws.call('failover.node').pipe( + return this.api.call('failover.node').pipe( tap((node) => { this.createControllerOptions(node); this.loadDataOnRemoteControllerChange(); diff --git a/src/app/pages/network/components/network-configuration-card/network-configuration-card.component.ts b/src/app/pages/network/components/network-configuration-card/network-configuration-card.component.ts index ca9e34701ea..5a4a1ace45a 100644 --- a/src/app/pages/network/components/network-configuration-card/network-configuration-card.component.ts +++ b/src/app/pages/network/components/network-configuration-card/network-configuration-card.component.ts @@ -57,7 +57,7 @@ export class NetworkConfigurationCardComponent implements OnInit { isLoading = false; constructor( - private ws: ApiService, + private api: ApiService, private translate: TranslateService, private cdr: ChangeDetectorRef, private slideInService: SlideInService, @@ -154,8 +154,8 @@ export class NetworkConfigurationCardComponent implements OnInit { this.cdr.markForCheck(); combineLatest([ - this.ws.call('network.general.summary'), - this.ws.call('network.configuration.config'), + this.api.call('network.general.summary'), + this.api.call('network.configuration.config'), ]) .pipe(untilDestroyed(this)) .subscribe(([summary, config]) => { diff --git a/src/app/pages/network/components/static-route-delete-dialog/static-route-delete-dialog.component.ts b/src/app/pages/network/components/static-route-delete-dialog/static-route-delete-dialog.component.ts index 7a11102df73..b1f11743011 100644 --- a/src/app/pages/network/components/static-route-delete-dialog/static-route-delete-dialog.component.ts +++ b/src/app/pages/network/components/static-route-delete-dialog/static-route-delete-dialog.component.ts @@ -45,7 +45,7 @@ export class StaticRouteDeleteDialogComponent { constructor( private loader: AppLoaderService, - private ws: ApiService, + private api: ApiService, private snackbar: SnackbarService, private translate: TranslateService, private dialogRef: MatDialogRef, @@ -54,7 +54,7 @@ export class StaticRouteDeleteDialogComponent { ) { } onDelete(): void { - this.ws.call('staticroute.delete', [this.route.id]) + this.api.call('staticroute.delete', [this.route.id]) .pipe( this.loader.withLoader(), this.errorHandler.catchError(), diff --git a/src/app/pages/network/components/static-route-form/static-route-form.component.spec.ts b/src/app/pages/network/components/static-route-form/static-route-form.component.spec.ts index 43332c761f8..4365266914a 100644 --- a/src/app/pages/network/components/static-route-form/static-route-form.component.spec.ts +++ b/src/app/pages/network/components/static-route-form/static-route-form.component.spec.ts @@ -17,7 +17,7 @@ import { SlideInService } from 'app/services/slide-in.service'; describe('StaticRouteFormComponent', () => { let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; const createComponent = createComponentFactory({ component: StaticRouteFormComponent, imports: [ @@ -40,7 +40,7 @@ describe('StaticRouteFormComponent', () => { beforeEach(() => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('sends a create payload to websocket and closes modal when save is pressed', async () => { @@ -54,7 +54,7 @@ describe('StaticRouteFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('staticroute.create', [{ + expect(api.call).toHaveBeenCalledWith('staticroute.create', [{ destination: '10.24.12.13/16', gateway: '10.24.12.1', description: 'My route', @@ -78,7 +78,7 @@ describe('StaticRouteFormComponent', () => { ], }); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('shows current group values when form is being edited', async () => { @@ -103,7 +103,7 @@ describe('StaticRouteFormComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('staticroute.update', [ + expect(api.call).toHaveBeenCalledWith('staticroute.update', [ 13, { destination: '15.24.12.13/16', diff --git a/src/app/pages/network/components/static-route-form/static-route-form.component.ts b/src/app/pages/network/components/static-route-form/static-route-form.component.ts index 49f289f4696..12a1cdbbcc3 100644 --- a/src/app/pages/network/components/static-route-form/static-route-form.component.ts +++ b/src/app/pages/network/components/static-route-form/static-route-form.component.ts @@ -72,7 +72,7 @@ export class StaticRouteFormComponent implements OnInit { constructor( private fb: FormBuilder, - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private snackbar: SnackbarService, private errorHandler: FormErrorHandlerService, @@ -97,9 +97,9 @@ export class StaticRouteFormComponent implements OnInit { let request$: Observable; if (this.isNew) { - request$ = this.ws.call('staticroute.create', [values]); + request$ = this.api.call('staticroute.create', [values]); } else { - request$ = this.ws.call('staticroute.update', [ + request$ = this.api.call('staticroute.update', [ this.editingRoute.id, values, ]); diff --git a/src/app/pages/network/components/static-routes-card/static-routes-card.component.ts b/src/app/pages/network/components/static-routes-card/static-routes-card.component.ts index dc8c1504d07..349add05c59 100644 --- a/src/app/pages/network/components/static-routes-card/static-routes-card.component.ts +++ b/src/app/pages/network/components/static-routes-card/static-routes-card.component.ts @@ -95,14 +95,14 @@ export class StaticRoutesCardComponent implements OnInit { constructor( private matDialog: MatDialog, - private ws: ApiService, + private api: ApiService, private slideInService: SlideInService, private translate: TranslateService, protected emptyService: EmptyService, ) {} ngOnInit(): void { - const staticRoutes$ = this.ws.call('staticroute.query').pipe( + const staticRoutes$ = this.api.call('staticroute.query').pipe( tap((staticRoutes) => this.staticRoutes = staticRoutes), untilDestroyed(this), ); diff --git a/src/app/pages/network/network.component.ts b/src/app/pages/network/network.component.ts index d5d023ba3d6..226d9151494 100644 --- a/src/app/pages/network/network.component.ts +++ b/src/app/pages/network/network.component.ts @@ -96,7 +96,7 @@ export class NetworkComponent implements OnInit { } constructor( - private ws: ApiService, + private api: ApiService, private router: Router, private dialogService: DialogService, private loader: AppLoaderService, @@ -190,19 +190,19 @@ export class NetworkComponent implements OnInit { private getCheckInWaitingSeconds(): Promise { return lastValueFrom( - this.ws.call('interface.checkin_waiting'), + this.api.call('interface.checkin_waiting'), ); } private getPendingChanges(): Promise { return lastValueFrom( - this.ws.call('interface.has_pending_changes'), + this.api.call('interface.has_pending_changes'), ); } private async cancelCommit(): Promise { await lastValueFrom( - this.ws.call('interface.cancel_rollback'), + this.api.call('interface.cancel_rollback'), ); } @@ -242,7 +242,7 @@ export class NetworkComponent implements OnInit { } commitPendingChanges(): void { - this.ws + this.api .call('interface.services_restarted_on_sync') .pipe(untilDestroyed(this)) .subscribe((services) => { @@ -281,7 +281,7 @@ export class NetworkComponent implements OnInit { return; } - this.ws + this.api .call('interface.commit', [{ checkin_timeout: this.checkinTimeout }]) .pipe( this.loader.withLoader(), @@ -331,7 +331,7 @@ export class NetworkComponent implements OnInit { } finishCheckin(): void { - this.ws + this.api .call('interface.checkin') .pipe( this.loader.withLoader(), @@ -366,7 +366,7 @@ export class NetworkComponent implements OnInit { return; } - this.ws + this.api .call('interface.rollback') .pipe( this.loader.withLoader(), @@ -396,7 +396,7 @@ export class NetworkComponent implements OnInit { return; } - this.ws.call('interface.query', [[['id', '=', state.editInterface]]]) + this.api.call('interface.query', [[['id', '=', state.editInterface]]]) .pipe( this.loader.withLoader(), this.errorHandler.catchError(), diff --git a/src/app/pages/network/stores/interfaces.store.ts b/src/app/pages/network/stores/interfaces.store.ts index 732788134ea..689d410e12f 100644 --- a/src/app/pages/network/stores/interfaces.store.ts +++ b/src/app/pages/network/stores/interfaces.store.ts @@ -19,7 +19,7 @@ const initialState: InterfacesState = { @Injectable() export class InterfacesStore extends ComponentStore { constructor( - private ws: ApiService, + private api: ApiService, private dialogService: DialogService, private errorHandler: ErrorHandlerService, ) { @@ -30,7 +30,7 @@ export class InterfacesStore extends ComponentStore { return trigger$.pipe( tap(() => this.patchState({ isLoading: true })), switchMap(() => { - return this.ws.call('interface.query').pipe( + return this.api.call('interface.query').pipe( tap({ next: (interfaces) => this.patchState({ interfaces }), error: (error) => this.dialogService.error(this.errorHandler.parseError(error)), diff --git a/src/app/pages/reports-dashboard/components/exporters/reporting-exporters-form/reporting-exporters-form.component.ts b/src/app/pages/reports-dashboard/components/exporters/reporting-exporters-form/reporting-exporters-form.component.ts index 61bb69731aa..bcfb21a24a7 100644 --- a/src/app/pages/reports-dashboard/components/exporters/reporting-exporters-form/reporting-exporters-form.component.ts +++ b/src/app/pages/reports-dashboard/components/exporters/reporting-exporters-form/reporting-exporters-form.component.ts @@ -99,7 +99,7 @@ export class ReportingExportersFormComponent implements OnInit { private fb: FormBuilder, private slideInRef: SlideInRef, private translate: TranslateService, - private ws: ApiService, + private api: ApiService, private errorHandler: ErrorHandlerService, private formErrorHandler: FormErrorHandlerService, private cdr: ChangeDetectorRef, @@ -147,7 +147,7 @@ export class ReportingExportersFormComponent implements OnInit { } getExportersSchemas(): Observable { - return this.ws.call('reporting.exporters.exporter_schemas'); + return this.api.call('reporting.exporters.exporter_schemas'); } setExporterTypeOptions(schemas: ReportingExporterSchema[]): void { @@ -230,9 +230,9 @@ export class ReportingExportersFormComponent implements OnInit { let request$: Observable; if (this.isNew) { - request$ = this.ws.call('reporting.exporters.create', [values]); + request$ = this.api.call('reporting.exporters.create', [values]); } else { - request$ = this.ws.call('reporting.exporters.update', [ + request$ = this.api.call('reporting.exporters.update', [ this.editingExporter.id, values, ]); diff --git a/src/app/pages/reports-dashboard/components/exporters/reporting-exporters-list/reporting-exporters-list.component.ts b/src/app/pages/reports-dashboard/components/exporters/reporting-exporters-list/reporting-exporters-list.component.ts index adbc794a701..f08c68742f7 100644 --- a/src/app/pages/reports-dashboard/components/exporters/reporting-exporters-list/reporting-exporters-list.component.ts +++ b/src/app/pages/reports-dashboard/components/exporters/reporting-exporters-list/reporting-exporters-list.component.ts @@ -96,7 +96,7 @@ export class ReportingExporterListComponent implements OnInit { const exporter = { ...row }; delete exporter.type; delete exporter.id; - this.ws.call('reporting.exporters.update', [row.id, { ...exporter, enabled: checked }]).pipe( + this.api.call('reporting.exporters.update', [row.id, { ...exporter, enabled: checked }]).pipe( untilDestroyed(this), ).subscribe({ complete: () => this.appLoader.close(), @@ -148,7 +148,7 @@ export class ReportingExporterListComponent implements OnInit { constructor( private translate: TranslateService, - private ws: ApiService, + private api: ApiService, private cdr: ChangeDetectorRef, private slideInService: SlideInService, private dialogService: DialogService, @@ -179,7 +179,7 @@ export class ReportingExporterListComponent implements OnInit { } private getExporters(): void { - this.ws.call('reporting.exporters.query').pipe(untilDestroyed(this)).subscribe({ + this.api.call('reporting.exporters.query').pipe(untilDestroyed(this)).subscribe({ next: (exporters: ReportingExporter[]) => { this.exporters = exporters; this.onListFiltered(this.filterString); @@ -221,7 +221,7 @@ export class ReportingExporterListComponent implements OnInit { }).pipe( filter(Boolean), tap(() => this.appLoader.open(this.translate.instant('Deleting exporter'))), - switchMap(() => this.ws.call('reporting.exporters.delete', [exporter.id])), + switchMap(() => this.api.call('reporting.exporters.delete', [exporter.id])), untilDestroyed(this), ).subscribe({ next: (deleted) => { diff --git a/src/app/pages/reports-dashboard/components/reports-global-controls/netdata-dialog/netdata-dialog.component.ts b/src/app/pages/reports-dashboard/components/reports-global-controls/netdata-dialog/netdata-dialog.component.ts index e5f618950af..af48c535ca7 100644 --- a/src/app/pages/reports-dashboard/components/reports-global-controls/netdata-dialog/netdata-dialog.component.ts +++ b/src/app/pages/reports-dashboard/components/reports-global-controls/netdata-dialog/netdata-dialog.component.ts @@ -47,7 +47,7 @@ export class NetdataDialogComponent implements OnInit { protected readonly passwordControl = new FormControl(''); constructor( - private ws: ApiService, + private api: ApiService, private reportsService: ReportsService, private loader: AppLoaderService, private errorHandler: ErrorHandlerService, @@ -79,7 +79,7 @@ export class NetdataDialogComponent implements OnInit { } private generatePassword(): Observable { - return this.ws.call('reporting.netdataweb_generate_password') + return this.api.call('reporting.netdataweb_generate_password') .pipe( this.loader.withLoader(), this.errorHandler.catchError(), diff --git a/src/app/pages/reports-dashboard/reports.service.ts b/src/app/pages/reports-dashboard/reports.service.ts index 6b5bf115e75..eef7e862b65 100644 --- a/src/app/pages/reports-dashboard/reports.service.ts +++ b/src/app/pages/reports-dashboard/reports.service.ts @@ -31,16 +31,16 @@ export class ReportsService { constructor( private authService: AuthService, private errorHandler: ErrorHandlerService, - private ws: ApiService, + private api: ApiService, private http: HttpClient, @Inject(WINDOW) private window: Window, ) { - this.ws.call('reporting.netdata_graphs').subscribe((reportingGraphs) => { + this.api.call('reporting.netdata_graphs').subscribe((reportingGraphs) => { this.hasUps = reportingGraphs.some((graph) => graph.name.startsWith(ReportingGraphName.Ups)); this.reportingGraphs$.next(reportingGraphs); }); - this.ws.call('disk.temperatures').subscribe((values) => { + this.api.call('disk.temperatures').subscribe((values) => { this.hasDiskTemperature = Boolean(Object.values(values).filter(Boolean).length); }); } @@ -57,7 +57,7 @@ export class ReportsService { truncate: boolean; }, ): Observable { - return this.ws.call( + return this.api.call( 'reporting.netdata_get_data', [[queryData.params], queryData.timeFrame], ).pipe( @@ -111,7 +111,7 @@ export class ReportsService { } getDiskDevices(): Observable { - return this.ws.call('disk.query').pipe( + return this.api.call('disk.query').pipe( map((disks) => { return disks .filter((disk) => !disk.devname.includes('multipath')) diff --git a/src/app/pages/services/components/service-ftp/service-ftp.component.ts b/src/app/pages/services/components/service-ftp/service-ftp.component.ts index a26e533163e..8ec777c42d4 100644 --- a/src/app/pages/services/components/service-ftp/service-ftp.component.ts +++ b/src/app/pages/services/components/service-ftp/service-ftp.component.ts @@ -125,7 +125,7 @@ export class ServiceFtpComponent implements OnInit { constructor( private formBuilder: FormBuilder, - private ws: ApiService, + private api: ApiService, private formErrorHandler: FormErrorHandlerService, private cdr: ChangeDetectorRef, private errorHandler: ErrorHandlerService, @@ -159,7 +159,7 @@ export class ServiceFtpComponent implements OnInit { }; this.isFormLoading = true; - this.ws.call('ftp.update', [values]) + this.api.call('ftp.update', [values]) .pipe(untilDestroyed(this)) .subscribe({ next: () => { @@ -182,7 +182,7 @@ export class ServiceFtpComponent implements OnInit { private loadConfig(): void { this.isFormLoading = true; - this.ws.call('ftp.config') + this.api.call('ftp.config') .pipe(untilDestroyed(this)) .subscribe({ next: (config) => { diff --git a/src/app/pages/services/components/service-nfs/add-spn-dialog/add-spn-dialog.component.ts b/src/app/pages/services/components/service-nfs/add-spn-dialog/add-spn-dialog.component.ts index 18cc3a67554..796880b7959 100644 --- a/src/app/pages/services/components/service-nfs/add-spn-dialog/add-spn-dialog.component.ts +++ b/src/app/pages/services/components/service-nfs/add-spn-dialog/add-spn-dialog.component.ts @@ -43,7 +43,7 @@ export class AddSpnDialogComponent { }); constructor( - private ws: ApiService, + private api: ApiService, private errorHandler: ErrorHandlerService, private formBuilder: FormBuilder, private translate: TranslateService, @@ -58,7 +58,7 @@ export class AddSpnDialogComponent { password: this.form.value.password, }; - this.ws.call('nfs.add_principal', [payload]) + this.api.call('nfs.add_principal', [payload]) .pipe( this.errorHandler.catchError(), this.loader.withLoader(), diff --git a/src/app/pages/services/components/service-nfs/service-nfs.component.spec.ts b/src/app/pages/services/components/service-nfs/service-nfs.component.spec.ts index 451a7d85515..350d7b2cf75 100644 --- a/src/app/pages/services/components/service-nfs/service-nfs.component.spec.ts +++ b/src/app/pages/services/components/service-nfs/service-nfs.component.spec.ts @@ -28,7 +28,7 @@ import { selectIsEnterprise } from 'app/store/system-info/system-info.selectors' describe('ServiceNfsComponent', () => { let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; let form: IxFormHarness; const createComponent = createRoutingFactory({ component: ServiceNfsComponent, @@ -90,13 +90,13 @@ describe('ServiceNfsComponent', () => { beforeEach(async () => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); form = await loader.getHarness(IxFormHarness); }); it('shows current settings for NFS service when form is opened', async () => { const values = await form.getValues(); - expect(ws.call).toHaveBeenCalledWith('nfs.config'); + expect(api.call).toHaveBeenCalledWith('nfs.config'); expect(values).toEqual({ 'Bind IP Addresses': ['192.168.1.117', '192.168.1.118'], 'Calculate number of threads dynamically': false, @@ -129,7 +129,7 @@ describe('ServiceNfsComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('nfs.update', [{ + expect(api.call).toHaveBeenCalledWith('nfs.update', [{ allow_nonroot: true, bindip: ['192.168.1.119'], protocols: [NfsProtocol.V4], diff --git a/src/app/pages/services/components/service-nfs/service-nfs.component.ts b/src/app/pages/services/components/service-nfs/service-nfs.component.ts index f101010a9e8..aff8c19d51b 100644 --- a/src/app/pages/services/components/service-nfs/service-nfs.component.ts +++ b/src/app/pages/services/components/service-nfs/service-nfs.component.ts @@ -106,7 +106,7 @@ export class ServiceNfsComponent implements OnInit { userd_manage_gids: helptextServiceNfs.userd_manage_gids, }; - readonly ipChoices$ = this.ws.call('nfs.bindip_choices').pipe(choicesToOptions()); + readonly ipChoices$ = this.api.call('nfs.bindip_choices').pipe(choicesToOptions()); readonly protocolOptions$ = of(mapToOptions(nfsProtocolLabels, this.translate)); readonly requiredRoles = [Role.SharingNfsWrite, Role.SharingWrite]; @@ -114,7 +114,7 @@ export class ServiceNfsComponent implements OnInit { private readonly v4SpecificFields = ['v4_domain', 'v4_krb'] as const; constructor( - private ws: ApiService, + private api: ApiService, private errorHandler: ErrorHandlerService, private formErrorHandler: FormErrorHandlerService, private fb: FormBuilder, @@ -154,7 +154,7 @@ export class ServiceNfsComponent implements OnInit { delete params.servers_auto; this.isFormLoading.set(true); - this.ws.call('nfs.update', [params]) + this.api.call('nfs.update', [params]) .pipe(untilDestroyed(this)) .subscribe({ next: () => { @@ -170,7 +170,7 @@ export class ServiceNfsComponent implements OnInit { } private loadConfig(): Observable { - return this.ws.call('nfs.config') + return this.api.call('nfs.config') .pipe( tap((config) => { this.isAddSpnDisabled.set(!config.v4_krb); @@ -185,7 +185,7 @@ export class ServiceNfsComponent implements OnInit { private checkForRdmaSupport(): Observable { return forkJoin([ - this.ws.call('rdma.capable_protocols'), + this.api.call('rdma.capable_protocols'), this.store$.select(selectIsEnterprise).pipe(take(1)), ]).pipe( map(([capableProtocols, isEnterprise]) => { @@ -202,7 +202,7 @@ export class ServiceNfsComponent implements OnInit { } private loadActiveDirectoryState(): Observable { - return this.ws.call('directoryservices.get_state').pipe( + return this.api.call('directoryservices.get_state').pipe( tap(({ activedirectory }) => { this.activeDirectoryState.set(activedirectory); }), diff --git a/src/app/pages/services/components/service-smart/service-smart.component.spec.ts b/src/app/pages/services/components/service-smart/service-smart.component.spec.ts index 6c47d99e5b0..7e01c4e3af3 100644 --- a/src/app/pages/services/components/service-smart/service-smart.component.spec.ts +++ b/src/app/pages/services/components/service-smart/service-smart.component.spec.ts @@ -20,7 +20,7 @@ import { ServiceSmartComponent } from './service-smart.component'; describe('ServiceSmartComponent', () => { let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; const createComponent = createComponentFactory({ component: ServiceSmartComponent, imports: [ @@ -50,14 +50,14 @@ describe('ServiceSmartComponent', () => { beforeEach(() => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('shows current settings for SMART service when form is opened', async () => { const form = await loader.getHarness(IxFormHarness); const values = await form.getValues(); - expect(ws.call).toHaveBeenCalledWith('smart.config'); + expect(api.call).toHaveBeenCalledWith('smart.config'); expect(values).toEqual({ 'Check Interval': '30', 'Power Mode': 'Never', @@ -80,7 +80,7 @@ describe('ServiceSmartComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('smart.update', [{ + expect(api.call).toHaveBeenCalledWith('smart.update', [{ interval: 60, powermode: SmartPowerMode.Sleep, difference: 20, diff --git a/src/app/pages/services/components/service-smart/service-smart.component.ts b/src/app/pages/services/components/service-smart/service-smart.component.ts index 11b6a5924d7..6c317f3f4cb 100644 --- a/src/app/pages/services/components/service-smart/service-smart.component.ts +++ b/src/app/pages/services/components/service-smart/service-smart.component.ts @@ -76,7 +76,7 @@ export class ServiceSmartComponent implements OnInit { ]); constructor( - private ws: ApiService, + private api: ApiService, private formErrorHandler: FormErrorHandlerService, private cdr: ChangeDetectorRef, private errorHandler: ErrorHandlerService, @@ -89,7 +89,7 @@ export class ServiceSmartComponent implements OnInit { ngOnInit(): void { this.isFormLoading = true; - this.ws.call('smart.config') + this.api.call('smart.config') .pipe(untilDestroyed(this)) .subscribe({ next: (config) => { @@ -109,7 +109,7 @@ export class ServiceSmartComponent implements OnInit { const values = this.form.value; this.isFormLoading = true; - this.ws.call('smart.update', [values as SmartConfigUpdate]) + this.api.call('smart.update', [values as SmartConfigUpdate]) .pipe(untilDestroyed(this)) .subscribe({ next: () => { diff --git a/src/app/pages/services/components/service-smb/service-smb.component.spec.ts b/src/app/pages/services/components/service-smb/service-smb.component.spec.ts index 19537f2d4f3..e0c97025826 100644 --- a/src/app/pages/services/components/service-smb/service-smb.component.spec.ts +++ b/src/app/pages/services/components/service-smb/service-smb.component.spec.ts @@ -24,7 +24,7 @@ import { UserService } from 'app/services/user.service'; describe('ServiceSmbComponent', () => { let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; const createComponent = createRoutingFactory({ component: ServiceSmbComponent, @@ -98,14 +98,14 @@ describe('ServiceSmbComponent', () => { beforeEach(() => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('loads and shows current settings for Smb service when form is opened', async () => { const form = await loader.getHarness(IxFormHarness); const values = await form.getValues(); - expect(ws.call).toHaveBeenCalledWith('smb.config'); + expect(api.call).toHaveBeenCalledWith('smb.config'); expect(values).toEqual({ 'NetBIOS Name': 'truenas', 'NetBIOS Alias': [], @@ -159,7 +159,7 @@ describe('ServiceSmbComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenLastCalledWith('smb.update', [{ + expect(api.call).toHaveBeenLastCalledWith('smb.update', [{ // New basic options netbiosname: 'truenas-scale', netbiosalias: ['truenas-alias', 'truenas-alias2'], @@ -205,7 +205,7 @@ describe('ServiceSmbComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenLastCalledWith('smb.update', [{ + expect(api.call).toHaveBeenLastCalledWith('smb.update', [{ // Old basic options netbiosname: 'truenas', netbiosalias: [], diff --git a/src/app/pages/services/components/service-smb/service-smb.component.ts b/src/app/pages/services/components/service-smb/service-smb.component.ts index 51074c074e8..c6f831d6419 100644 --- a/src/app/pages/services/components/service-smb/service-smb.component.ts +++ b/src/app/pages/services/components/service-smb/service-smb.component.ts @@ -124,8 +124,8 @@ export class ServiceSmbComponent implements OnInit { { label: this.translate.instant('Debug'), value: LogLevel.Debug }, ]); - readonly unixCharsetOptions$ = this.ws.call('smb.unixcharset_choices').pipe(choicesToOptions()); - readonly guestAccountOptions$ = this.ws.call('user.query').pipe( + readonly unixCharsetOptions$ = this.api.call('smb.unixcharset_choices').pipe(choicesToOptions()); + readonly guestAccountOptions$ = this.api.call('user.query').pipe( map((users) => users.map((user) => ({ label: user.username, value: user.username }))), ); @@ -135,11 +135,11 @@ export class ServiceSmbComponent implements OnInit { ), ); - readonly bindIpAddressOptions$ = this.ws.call('smb.bindip_choices').pipe(choicesToOptions()); + readonly bindIpAddressOptions$ = this.api.call('smb.bindip_choices').pipe(choicesToOptions()); readonly encryptionOptions$ = of(mapToOptions(smbEncryptionLabels, this.translate)); constructor( - private ws: ApiService, + private api: ApiService, private formErrorHandler: FormErrorHandlerService, private cdr: ChangeDetectorRef, private errorHandler: ErrorHandlerService, @@ -155,7 +155,7 @@ export class ServiceSmbComponent implements OnInit { ngOnInit(): void { this.isFormLoading = true; - this.ws.call('smb.config').pipe(untilDestroyed(this)).subscribe({ + this.api.call('smb.config').pipe(untilDestroyed(this)).subscribe({ next: (config) => { this.form.patchValue(config); this.isFormLoading = false; @@ -177,7 +177,7 @@ export class ServiceSmbComponent implements OnInit { const values: SmbConfigUpdate = this.form.value; this.isFormLoading = true; - this.ws.call('smb.update', [values]) + this.api.call('smb.update', [values]) .pipe(untilDestroyed(this)) .subscribe({ next: () => { diff --git a/src/app/pages/services/components/service-snmp/service-snmp.component.ts b/src/app/pages/services/components/service-snmp/service-snmp.component.ts index 8c025e9ae3f..fc667604675 100644 --- a/src/app/pages/services/components/service-snmp/service-snmp.component.ts +++ b/src/app/pages/services/components/service-snmp/service-snmp.component.ts @@ -104,7 +104,7 @@ export class ServiceSnmpComponent implements OnInit { constructor( private fb: FormBuilder, - private ws: ApiService, + private api: ApiService, private dialogService: DialogService, private errorHandler: ErrorHandlerService, private cdr: ChangeDetectorRef, @@ -130,7 +130,7 @@ export class ServiceSnmpComponent implements OnInit { values.v3_privpassphrase = ''; } - this.ws.call('snmp.update', [values as SnmpConfigUpdate]).pipe(untilDestroyed(this)).subscribe({ + this.api.call('snmp.update', [values as SnmpConfigUpdate]).pipe(untilDestroyed(this)).subscribe({ next: () => { this.isFormLoading = false; this.snackbar.success(this.translate.instant('Service configuration saved')); @@ -147,7 +147,7 @@ export class ServiceSnmpComponent implements OnInit { private loadCurrentSettings(): void { this.isFormLoading = true; - this.ws.call('snmp.config').pipe(untilDestroyed(this)).subscribe({ + this.api.call('snmp.config').pipe(untilDestroyed(this)).subscribe({ next: (config) => { this.isFormLoading = false; this.form.patchValue(config); diff --git a/src/app/pages/services/components/service-ssh/service-ssh.component.spec.ts b/src/app/pages/services/components/service-ssh/service-ssh.component.spec.ts index 8f7e1ddcff0..fa723a3500f 100644 --- a/src/app/pages/services/components/service-ssh/service-ssh.component.spec.ts +++ b/src/app/pages/services/components/service-ssh/service-ssh.component.spec.ts @@ -29,7 +29,7 @@ const fakeGroupDataSource = [{ describe('ServiceSshComponent', () => { let spectator: Spectator; let loader: HarnessLoader; - let ws: ApiService; + let api: ApiService; const createComponent = createRoutingFactory({ component: ServiceSshComponent, imports: [ @@ -69,14 +69,14 @@ describe('ServiceSshComponent', () => { beforeEach(() => { spectator = createComponent(); loader = TestbedHarnessEnvironment.loader(spectator.fixture); - ws = spectator.inject(ApiService); + api = spectator.inject(ApiService); }); it('loads and shows current settings for S3 service when form is opened', async () => { const form = await loader.getHarness(IxFormHarness); const values = await form.getValues(); - expect(ws.call).toHaveBeenCalledWith('ssh.config'); + expect(api.call).toHaveBeenCalledWith('ssh.config'); expect(values).toEqual({ 'TCP Port': '22', 'Password Login Groups': ['dummy-group'], @@ -121,7 +121,7 @@ describe('ServiceSshComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('ssh.update', [{ + expect(api.call).toHaveBeenCalledWith('ssh.update', [{ // New basic options tcpport: 23, password_login_groups: ['dummy-group'], @@ -157,7 +157,7 @@ describe('ServiceSshComponent', () => { const saveButton = await loader.getHarness(MatButtonHarness.with({ text: 'Save' })); await saveButton.click(); - expect(ws.call).toHaveBeenCalledWith('ssh.update', [{ + expect(api.call).toHaveBeenCalledWith('ssh.update', [{ // Old basic options kerberosauth: false, passwordauth: true,