]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.ts
import ceph 16.2.6
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / block / iscsi-target-list / iscsi-target-list.component.ts
index 96b76d6b749e573a1f57ad5da43e3298b5e072b4..d0eed6a72c77ed11cf3f77badafdac443056bbb8 100644 (file)
@@ -1,4 +1,4 @@
-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';
@@ -64,9 +64,10 @@ export class IscsiTargetListComponent extends ListWithDetails implements OnInit,
     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 = [
@@ -124,29 +125,34 @@ export class IscsiTargetListComponent extends ListWithDetails implements OnInit,
     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();