-import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
+import { Component, NgZone, OnDestroy, OnInit, ViewChild } from '@angular/core';
import { NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
import _ from 'lodash';
private notAvailablePipe: NotAvailablePipe,
private modalService: ModalService,
private taskWrapper: TaskWrapperService,
- public actionLabels: ActionLabelsI18n
+ public actionLabels: ActionLabelsI18n,
+ protected ngZone: NgZone
) {
- super();
+ super(ngZone);
this.permission = this.authStorageService.getPermissions().iscsi;
this.tableActions = [
this.iscsiService.status().subscribe((result: any) => {
this.available = result.available;
- if (result.available) {
- this.iscsiService.version().subscribe((res: any) => {
- this.cephIscsiConfigVersion = res['ceph_iscsi_config_version'];
- this.taskListService.init(
- () => this.iscsiService.listTargets(),
- (resp) => this.prepareResponse(resp),
- (targets) => (this.targets = targets),
- () => this.onFetchError(),
- this.taskFilter,
- this.itemFilter,
- this.builders
- );
- });
-
- this.iscsiService.settings().subscribe((settings: any) => {
- this.settings = settings;
- });
- } else {
+ if (!result.available) {
this.status = result.message;
}
});
}
+ getTargets() {
+ if (this.available) {
+ this.setTableRefreshTimeout();
+ this.iscsiService.version().subscribe((res: any) => {
+ this.cephIscsiConfigVersion = res['ceph_iscsi_config_version'];
+ });
+ this.taskListService.init(
+ () => this.iscsiService.listTargets(),
+ (resp) => this.prepareResponse(resp),
+ (targets) => (this.targets = targets),
+ () => this.onFetchError(),
+ this.taskFilter,
+ this.itemFilter,
+ this.builders
+ );
+
+ this.iscsiService.settings().subscribe((settings: any) => {
+ this.settings = settings;
+ });
+ }
+ }
+
ngOnDestroy() {
if (this.summaryDataSubscription) {
this.summaryDataSubscription.unsubscribe();