]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Enable noImplicitAny TS compiler option
authorTiago Melo <tmelo@suse.com>
Mon, 30 Dec 2019 13:13:59 +0000 (12:13 -0100)
committerTiago Melo <tmelo@suse.com>
Fri, 31 Jan 2020 14:16:09 +0000 (13:16 -0100)
Fixes: https://tracker.ceph.com/issues/43525
Signed-off-by: Tiago Melo <tmelo@suse.com>
204 files changed:
src/pybind/mgr/dashboard/frontend/e2e/block/images.po.ts
src/pybind/mgr/dashboard/frontend/e2e/block/mirroring.po.ts
src/pybind/mgr/dashboard/frontend/e2e/cluster/configuration.po.ts
src/pybind/mgr/dashboard/frontend/e2e/cluster/crush-map.po.ts
src/pybind/mgr/dashboard/frontend/e2e/cluster/logs.po.ts
src/pybind/mgr/dashboard/frontend/e2e/cluster/mgr-modules.po.ts
src/pybind/mgr/dashboard/frontend/e2e/page-helper.po.ts
src/pybind/mgr/dashboard/frontend/e2e/rgw/buckets.po.ts
src/pybind/mgr/dashboard/frontend/e2e/rgw/users.po.ts
src/pybind/mgr/dashboard/frontend/e2e/ui/role-mgmt.po.ts
src/pybind/mgr/dashboard/frontend/e2e/ui/user-mgmt.po.ts
src/pybind/mgr/dashboard/frontend/package-lock.json
src/pybind/mgr/dashboard/frontend/package.json
src/pybind/mgr/dashboard/frontend/src/app/app.module.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-tabs/iscsi-tabs.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-details/iscsi-target-details.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-discovery-modal/iscsi-target-discovery-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-form/iscsi-target-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-image-settings-modal/iscsi-target-image-settings-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-iqn-settings-modal/iscsi-target-iqn-settings-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi-target-list/iscsi-target-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/iscsi/iscsi.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-create-modal/bootstrap-create-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/bootstrap-import-modal/bootstrap-import-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/image-list/image-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/overview/overview.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-edit-mode-modal/pool-edit-mode-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/mirroring/pool-list/pool-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-form/rbd-configuration-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-form/rbd-configuration-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-configuration-list/rbd-configuration-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-form/rbd-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-form/rbd-namespace-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-namespace-list/rbd-namespace-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-form/rbd-snapshot-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-list/rbd-trash-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-move-modal/rbd-trash-move-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-purge-modal/rbd-trash-purge-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-purge-modal/rbd-trash-purge-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-trash-restore-modal/rbd-trash-restore-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-chart/cephfs-chart.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-directories/cephfs-directories.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-tabs/cephfs-tabs.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-tabs/cephfs-tabs.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration-form/configuration-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/crushmap/crushmap.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory-devices/inventory-devices.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/logs/logs.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-form/mgr-module-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/monitor/monitor.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-devices-selection-groups/osd-devices-selection-groups.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-performance-histogram/osd-performance-histogram.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-recv-speed-modal/osd-recv-speed-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-scrub-modal/osd-scrub-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-form/silence-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-list/silence-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-matcher-modal/silence-matcher-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/prometheus/silence-matcher-modal/silence-matcher-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health-pie/health-pie.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-details/nfs-details.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form-client/nfs-form-client.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-form/nfs-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/nfs/nfs-list/nfs-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/erasure-code-profile-form/erasure-code-profile-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-bucket-form/rgw-bucket-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-details/rgw-daemon-details.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-capability-modal/rgw-user-capability-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-user-form/rgw-user-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/device-list/device-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/pg-category.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/pg-category.service.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/shared/smart-list/smart-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/core/auth/login/login.component.ts
src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-details/role-details.component.ts
src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-form/role-form.component.ts
src/pybind/mgr/dashboard/frontend/src/app/core/auth/role-list/role-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form-role.model.ts
src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-form/user-form.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/core/auth/user-tabs/user-tabs.component.ts
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/about/about.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/breadcrumbs/breadcrumbs.component.ts
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/dashboard-help/dashboard-help.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/cephfs.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/cephfs.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/configuration.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/host.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/iscsi.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/logging.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/logs.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/mgr-module.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/nfs.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/osd.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/performance-counter.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/pool.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/prometheus.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/prometheus.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd-mirroring.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd-mirroring.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/rbd.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/rgw-user.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/settings.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/settings.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/api/user.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/config-option/config-option.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/config-option/config-option.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/config-option/config-option.types.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/confirmation-modal/confirmation-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/form-modal/form-modal.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/grafana/grafana.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/language-selector/language-selector.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/language-selector/language-selector.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/notifications-sidebar/notifications-sidebar.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/select-badges/select-badges.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/sparkline/sparkline.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/submit-button/submit-button.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-key-value/table-key-value.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-key-value/table-key-value.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/decorators/cd-encode.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/directives/dimless-binary-per-second.directive.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/directives/dimless-binary.directive.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/directives/iops.directive.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/directives/milliseconds.directive.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/directives/trim.directive.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/forms/cd-form-group.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/forms/cd-form-group.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/forms/cd-validators.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/forms/cd-validators.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/models/cd-pwd-expiration-settings.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/models/chart-tooltip.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/models/task.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/empty.pipe.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/filter.pipe.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/filter.pipe.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/pipes/relative-date.pipe.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/auth-storage.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/device.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/feature-toggles-guard.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/feature-toggles.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/formatter.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/js-error-handler.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/notification.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-alert.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-notification.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/summary.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/summary.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-list.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-list.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-manager.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-manager.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-message.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-wrapper.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/time-diff.service.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/time-diff.service.ts
src/pybind/mgr/dashboard/frontend/src/jestGlobalMocks.ts
src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts
src/pybind/mgr/dashboard/frontend/tsconfig.json

index 1390ae6d41e1fb420a9de4d1eb276c274f91e102..85ed005cb91350994a34dc50499814c9b3f78618 100644 (file)
@@ -9,7 +9,7 @@ export class ImagesPageHelper extends PageHelper {
 
   // Creates a block image and fills in the name, pool, and size fields. Then checks
   // if the image is present in the Images table.
-  async createImage(name, pool, size) {
+  async createImage(name: string, pool: string, size: string) {
     await this.navigateTo('create');
 
     // Need the string '[value="<pool>"]' to find the pool in the dropdown menu
@@ -31,7 +31,7 @@ export class ImagesPageHelper extends PageHelper {
     return this.waitPresence(this.getFirstTableCellWithText(name));
   }
 
-  async editImage(name, pool, newName, newSize) {
+  async editImage(name: string, pool: string, newName: string, newSize: string) {
     const base_url = '/#/block/rbd/edit/';
     const editURL = base_url
       .concat(encodeURIComponent(pool))
@@ -59,7 +59,7 @@ export class ImagesPageHelper extends PageHelper {
 
   // Selects RBD image and moves it to the trash, checks that it is present in the
   // trash table
-  async moveToTrash(name) {
+  async moveToTrash(name: string) {
     await this.navigateTo();
     // wait for image to be created
     await this.waitTextNotPresent($$('.datatable-body').first(), '(Creating...)');
@@ -79,7 +79,7 @@ export class ImagesPageHelper extends PageHelper {
 
   // Checks trash tab table for image and then restores it to the RBD Images table
   // (could change name if new name is given)
-  async restoreImage(name, newName?: string) {
+  async restoreImage(name: string, newName?: string) {
     await this.navigateTo();
     // clicks on trash tab
     await element(by.cssContainingText('.nav-link', 'Trash')).click();
@@ -104,7 +104,7 @@ export class ImagesPageHelper extends PageHelper {
 
   // Enters trash tab and purges trash, thus emptying the trash table. Checks if
   // Image is still in the table.
-  async purgeTrash(name, pool?: string) {
+  async purgeTrash(name: string, pool?: string) {
     await this.navigateTo();
     // clicks trash tab
     await element(by.cssContainingText('.nav-link', 'Trash')).click();
index 22de6dcb8864d13984192ebb0eb12d03fc9c4441..d27a1dc6e3afee400f1c922748866298ddb25432 100644 (file)
@@ -11,7 +11,7 @@ export class MirroringPageHelper extends PageHelper {
    * pool and chooses an option (either pool, image, or disabled)
    */
   @PageHelper.restrictTo(pages.index)
-  async editMirror(name, option) {
+  async editMirror(name: string, option: string) {
     // Clicks the pool in the table
     await this.waitClickableAndClick(this.getFirstTableCellWithText(name));
 
index c92dbfcaae320097660d906a156a638d78f971e7..2354f07bffa07bb1b14896fa24d957e9fb121ec5 100644 (file)
@@ -6,7 +6,7 @@ export class ConfigurationPageHelper extends PageHelper {
     index: '/#/configuration'
   };
 
-  async configClear(name) {
+  async configClear(name: string) {
     // Clears out all the values in a config to reset before and after testing
     // Does not work for configs with checkbox only, possible future PR
 
@@ -45,7 +45,7 @@ export class ConfigurationPageHelper extends PageHelper {
     }
   }
 
-  async edit(name, ...values: [string, string][]) {
+  async edit(name: string, ...values: [string, string][]) {
     // Clicks the designated config, then inputs the values passed into the edit function.
     // Then checks if the edit is reflected in the config table. Takes in name of config and
     // a list of tuples of values the user wants edited, each tuple having the desired value along
index 279fd85621e2b0495b385109170bee404422a69f..20790fa3fe602d9b7c1a074eba742b3a530d5c8f 100644 (file)
@@ -8,7 +8,7 @@ export class CrushMapPageHelper extends PageHelper {
     return $('cd-crushmap .card-header').getText();
   }
 
-  getCrushNode(idx) {
+  getCrushNode(idx: number) {
     return $$('.node-name.type-osd').get(idx);
   }
 }
index e25e76644baa90184a739de5203a77ba7a43c0d7..5fd18abd8dea50e8958746d7950a27582fd3cf28 100644 (file)
@@ -4,7 +4,12 @@ import { PageHelper } from '../page-helper.po';
 export class LogsPageHelper extends PageHelper {
   pages = { index: '/#/logs' };
 
-  async checkAuditForPoolFunction(poolname, poolfunction, hour, minute) {
+  async checkAuditForPoolFunction(
+    poolname: string,
+    poolfunction: string,
+    hour: number,
+    minute: number
+  ) {
     await this.navigateTo();
 
     // sometimes the modal from deleting pool is still present at this point.
@@ -64,7 +69,12 @@ export class LogsPageHelper extends PageHelper {
     await expect(logs.getText()).toMatch(`pool ${poolfunction}`);
   }
 
-  async checkAuditForConfigChange(configname, setting, hour, minute) {
+  async checkAuditForConfigChange(
+    configname: string,
+    setting: string,
+    hour: number,
+    minute: number
+  ) {
     await this.navigateTo();
 
     // go to audit logs tab
index f9ff2690fa5ec2e01d819efc60e5269d47daf882..9d001db5748e094dcd0db987dcd53f675dc4e455 100644 (file)
@@ -92,7 +92,7 @@ export class ManagerModulesPageHelper extends PageHelper {
     await this.waitVisibility(this.getFirstTableCellWithText('devicehealth'));
     // Checks for visibility of devicehealth in table
     await this.getFirstTableCellWithText('devicehealth').click();
-    for (let i = 0, devHealthTuple; (devHealthTuple = devHealthArray[i]); i++) {
+    for (let i = 0, devHealthTuple: [string, string]; (devHealthTuple = devHealthArray[i]); i++) {
       if (devHealthTuple[0] !== undefined) {
         await this.waitFn(async () => {
           // Repeatedly reclicks the module to check if edits has been done
@@ -132,7 +132,7 @@ export class ManagerModulesPageHelper extends PageHelper {
     await this.navigateTo();
     await this.waitVisibility(this.getFirstTableCellWithText('devicehealth'));
     await this.getFirstTableCellWithText('devicehealth').click();
-    for (let i = 0, devHealthTuple; (devHealthTuple = devHealthArray[i]); i++) {
+    for (let i = 0, devHealthTuple: [string, string]; (devHealthTuple = devHealthArray[i]); i++) {
       if (devHealthTuple[0] !== undefined) {
         await this.waitFn(async () => {
           // Repeatedly reclicks the module to check if clearing has been done
index 45bbd7e6edef2469d50ab5fde6a5fcbb4cb0fecb..5f6204d415be10b417b03af8d09971510521add4 100644 (file)
@@ -45,10 +45,10 @@ export abstract class PageHelper {
    * help developers to prevent and highlight mistakes.  It also reduces boilerplate code and by
    * thus, increases readability.
    */
-  static restrictTo(page): Function {
+  static restrictTo(page: string): Function {
     return (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {
       const fn: Function = descriptor.value;
-      descriptor.value = function(...args) {
+      descriptor.value = function(...args: any) {
         return browser
           .getCurrentUrl()
           .then((url) =>
@@ -70,7 +70,7 @@ export abstract class PageHelper {
     return $('.breadcrumb-item.active');
   }
 
-  async getTabText(index): Promise<string> {
+  async getTabText(index: number): Promise<string> {
     return $$('.nav.nav-tabs li')
       .get(index)
       .getText();
@@ -96,7 +96,7 @@ export abstract class PageHelper {
     return element.all(by.cssContainingText('.datatable-body-cell-label', content)).first();
   }
 
-  getTableRow(content) {
+  getTableRow(content: string) {
     return element(by.cssContainingText('.datatable-body-row', content));
   }
 
@@ -206,7 +206,7 @@ export abstract class PageHelper {
     }
   }
 
-  async navigateTo(page = null) {
+  async navigateTo(page: string = null) {
     page = page || 'index';
     const url = this.pages[page];
     await browser.get(url);
index 13be04baefcb527f1b8a77c53f02946618ad9606..430fe850b9719e89739e54da267ddbb5e2a6b86f 100644 (file)
@@ -177,7 +177,7 @@ export class BucketsPageHelper extends PageHelper {
     return element(by.cssContainingText('button', 'Cancel')).click();
   }
 
-  async testInvalidEdit(name) {
+  async testInvalidEdit(name: string) {
     await this.navigateTo();
 
     await this.waitClickableAndClick(this.getFirstTableCellWithText(name)); // wait for table to load and click
index b742aa84a0eb2c42ff191b5e948707eb009ca07a..96f9c537a2fe5d5768d7d5338431efe9719b2464 100644 (file)
@@ -11,7 +11,7 @@ export class UsersPageHelper extends PageHelper {
   pages = pages;
 
   @PageHelper.restrictTo(pages.create)
-  async create(username, fullname, email, maxbuckets) {
+  async create(username: string, fullname: string, email: string, maxbuckets: string) {
     // Enter in  username
     await element(by.id('uid')).sendKeys(username);
 
@@ -34,7 +34,7 @@ export class UsersPageHelper extends PageHelper {
   }
 
   @PageHelper.restrictTo(pages.index)
-  async edit(name, new_fullname, new_email, new_maxbuckets) {
+  async edit(name: string, new_fullname: string, new_email: string, new_maxbuckets: string) {
     await this.waitClickableAndClick(this.getFirstTableCellWithText(name)); // wait for table to load and click
     await element(by.cssContainingText('button', 'Edit')).click(); // click button to move to edit page
 
index 552285af8dbe28090323f307ad3420ebb1242bdf..dbec067ed0a7f74c44bb94a94018dc858faca9c8 100644 (file)
@@ -7,7 +7,7 @@ export class RoleMgmtPageHelper extends PageHelper {
     create: '/#/user-management/roles/create'
   };
 
-  async create(name, description): Promise<void> {
+  async create(name: string, description: string): Promise<void> {
     await this.navigateTo('create');
 
     // fill in fields
@@ -21,7 +21,7 @@ export class RoleMgmtPageHelper extends PageHelper {
     await this.waitPresence(this.getFirstTableCellWithText(name));
   }
 
-  async edit(name, description): Promise<void> {
+  async edit(name: string, description: string): Promise<void> {
     await this.navigateTo();
 
     await this.getFirstTableCellWithText(name).click(); // select role from table
index 2c38bf16d048cd4a3fce849d7c436ea47dc93630..d59eddb39af967fee1717599b7b7b657b01ab000 100644 (file)
@@ -7,7 +7,7 @@ export class UserMgmtPageHelper extends PageHelper {
     create: '/#/user-management/users/create'
   };
 
-  async create(username, password, name, email): Promise<void> {
+  async create(username: string, password: string, name: string, email: string): Promise<void> {
     await this.navigateTo('create');
 
     // fill in fields
@@ -23,7 +23,7 @@ export class UserMgmtPageHelper extends PageHelper {
     await this.waitPresence(this.getFirstTableCellWithText(username));
   }
 
-  async edit(username, password, name, email): Promise<void> {
+  async edit(username: string, password: string, name: string, email: string): Promise<void> {
     await this.navigateTo();
 
     await this.getFirstTableCellWithText(username).click(); // select user from table
index 9c12cbe4dd544a637d0d270ea480c1b5d4487ca8..2e9506f0d58e58afade7aa6ef0678534349655df 100644 (file)
       "integrity": "sha512-lMC2G0ItF2xv4UCiwbJGbnJlIuUixHrioOhNGHSCsYCJ8l4t9hMCUimCytvFv7qy6AfSzRxhRHoGa+UqaqwyeA==",
       "dev": true
     },
+    "@types/simplebar": {
+      "version": "2.4.2",
+      "resolved": "https://registry.npmjs.org/@types/simplebar/-/simplebar-2.4.2.tgz",
+      "integrity": "sha512-omSnWgcQ5hGANK8MijABHDNtj7bM2GH80g8wVqeRmaePJ2lPN4RmbrVihEbYtnovW2aS51a0joITsb6+Q1HnnA=="
+    },
     "@types/source-list-map": {
       "version": "0.1.2",
       "resolved": "https://registry.npmjs.org/@types/source-list-map/-/source-list-map-0.1.2.tgz",
index 96f6be8c2250f2bbf58a710a1eb5ea9fe307da69..1d77fef928af136b4d292b82d9c5f5bcd7d54770 100644 (file)
     "@types/jest": "24.0.23",
     "@types/lodash": "4.14.141",
     "@types/node": "12.7.8",
+    "@types/simplebar": "2.4.2",
     "codelyzer": "5.1.2",
     "html-linter": "1.1.1",
     "htmllint-cli": "0.0.7",
index a2bed3306e93c0c7c3533f3b577c3abb63d59576..3152a1233e3ef11991328ba214a838e6d09f30d8 100644 (file)
@@ -72,7 +72,7 @@ export function jwtTokenGetter() {
     },
     {
       provide: TRANSLATIONS,
-      useFactory: (locale) => {
+      useFactory: (locale: string) => {
         locale = locale || environment.default_lang;
         try {
           return require(`raw-loader!locale/messages.${locale}.xlf`).default;
index b5dc3cff3649571d0eccb26a08290ec331d7b3f2..06835d3c8278c2448a7ae968a9737d13f1919714 100644 (file)
@@ -16,7 +16,7 @@ export class IscsiTabsComponent implements OnInit {
     this.url = this.router.url;
   }
 
-  navigateTo(url) {
+  navigateTo(url: string) {
     this.router.navigate([url]);
   }
 }
index d1504afb916b4a24773c5a76cb6749f55a34a428..929340a15b6ece7049b094a714ec701911320efd 100644 (file)
@@ -115,7 +115,7 @@ export class IscsiTargetDetailsComponent implements OnChanges, OnInit {
       }
     };
 
-    const disks = [];
+    const disks: any[] = [];
     _.forEach(this.selectedItem.disks, (disk) => {
       const id = 'disk_' + disk.pool + '_' + disk.image;
       this.metadata[id] = {
@@ -133,12 +133,12 @@ export class IscsiTargetDetailsComponent implements OnChanges, OnInit {
       });
     });
 
-    const portals = [];
+    const portals: any[] = [];
     _.forEach(this.selectedItem.portals, (portal) => {
       portals.push({ value: `${portal.host}:${portal.ip}` });
     });
 
-    const clients = [];
+    const clients: any[] = [];
     _.forEach(this.selectedItem.clients, (client) => {
       const client_metadata = _.cloneDeep(client.auth);
       if (client.info) {
@@ -150,8 +150,8 @@ export class IscsiTargetDetailsComponent implements OnChanges, OnInit {
       }
       this.metadata['client_' + client.client_iqn] = client_metadata;
 
-      const luns = [];
-      client.luns.forEach((lun) => {
+      const luns: any[] = [];
+      client.luns.forEach((lun: Record<string, any>) => {
         luns.push({
           value: `${lun.pool}/${lun.image}`,
           id: 'disk_' + lun.pool + '_' + lun.image,
@@ -173,18 +173,18 @@ export class IscsiTargetDetailsComponent implements OnChanges, OnInit {
       });
     });
 
-    const groups = [];
+    const groups: any[] = [];
     _.forEach(this.selectedItem.groups, (group) => {
-      const luns = [];
-      group.disks.forEach((disk) => {
+      const luns: any[] = [];
+      group.disks.forEach((disk: Record<string, any>) => {
         luns.push({
           value: `${disk.pool}/${disk.image}`,
           id: 'disk_' + disk.pool + '_' + disk.image
         });
       });
 
-      const initiators = [];
-      group.members.forEach((member) => {
+      const initiators: any[] = [];
+      group.members.forEach((member: string) => {
         initiators.push({
           value: member,
           id: 'client_' + member
@@ -258,7 +258,7 @@ export class IscsiTargetDetailsComponent implements OnChanges, OnInit {
     };
   }
 
-  private format(value) {
+  private format(value: any) {
     if (typeof value === 'boolean') {
       return this.booleanTextPipe.transform(value);
     }
index f6236e707f070cfe41243c3c556ed84887458690..ff683b9c87c8b75d2fbf0db079f555b807d21f51 100644 (file)
@@ -22,8 +22,8 @@ describe('IscsiTargetDiscoveryModalComponent', () => {
   let httpTesting: HttpTestingController;
   let req: TestRequest;
 
-  const elem = (css) => fixture.debugElement.query(By.css(css));
-  const elemDisabled = (css) => elem(css).nativeElement.disabled;
+  const elem = (css: string) => fixture.debugElement.query(By.css(css));
+  const elemDisabled = (css: string) => elem(css).nativeElement.disabled;
 
   configureTestBed({
     declarations: [IscsiTargetDiscoveryModalComponent],
index e95f5dc2065555d861e6c1343cea8ab15af4429e..47c61ad120ba11f77e278e3f04e0d5fd2b02ab68 100644 (file)
@@ -46,7 +46,7 @@ describe('IscsiTargetFormComponent', () => {
     api_version: 1
   };
 
-  const LIST_TARGET = [
+  const LIST_TARGET: any[] = [
     {
       target_iqn: 'iqn.2003-01.com.redhat.iscsi-gw:iscsi-igw',
       portals: [{ host: 'node1', ip: '192.168.100.201' }],
@@ -85,7 +85,7 @@ describe('IscsiTargetFormComponent', () => {
     ceph_iscsi_config_version: 11
   };
 
-  const RBD_LIST = [
+  const RBD_LIST: any[] = [
     { status: 0, value: [], pool_name: 'ganesha' },
     {
       status: 0,
index ea0eaf030ac0eb224956f0a513dcbd5ff61e2d70..ca2168ddd01e1cc2d5e3423758420b6f91f47f43 100644 (file)
@@ -166,8 +166,8 @@ export class IscsiTargetFormComponent implements OnInit {
 
       // iscsiService.portals()
       const portals: SelectOption[] = [];
-      data[2].forEach((portal) => {
-        portal.ip_addresses.forEach((ip) => {
+      data[2].forEach((portal: Record<string, any>) => {
+        portal.ip_addresses.forEach((ip: string) => {
           portals.push(new SelectOption(false, portal.name + ':' + ip, ''));
         });
       });
@@ -193,7 +193,7 @@ export class IscsiTargetFormComponent implements OnInit {
       target_controls: new FormControl({}),
       portals: new FormControl([], {
         validators: [
-          CdValidators.custom('minGateways', (value) => {
+          CdValidators.custom('minGateways', (value: any[]) => {
             const gateways = _.uniq(value.map((elem) => elem.split(':')[0]));
             return gateways.length < Math.max(1, this.minimum_gateways);
           })
@@ -201,11 +201,11 @@ export class IscsiTargetFormComponent implements OnInit {
       }),
       disks: new FormControl([], {
         validators: [
-          CdValidators.custom('dupLunId', (value) => {
+          CdValidators.custom('dupLunId', (value: any[]) => {
             const lunIds = this.getLunIds(value);
             return lunIds.length !== _.uniq(lunIds).length;
           }),
-          CdValidators.custom('dupWwn', (value) => {
+          CdValidators.custom('dupWwn', (value: any[]) => {
             const wwns = this.getWwns(value);
             return wwns.length !== _.uniq(wwns).length;
           })
@@ -228,7 +228,7 @@ export class IscsiTargetFormComponent implements OnInit {
     }
   }
 
-  resolveModel(res) {
+  resolveModel(res: Record<string, any>) {
     this.targetForm.patchValue({
       target_iqn: res.target_iqn,
       target_controls: res.target_controls,
@@ -240,7 +240,7 @@ export class IscsiTargetFormComponent implements OnInit {
         auth: res.auth
       });
     }
-    const portals = [];
+    const portals: any[] = [];
     _.forEach(res.portals, (portal) => {
       const id = `${portal.host}:${portal.ip}`;
       portals.push(id);
@@ -249,7 +249,7 @@ export class IscsiTargetFormComponent implements OnInit {
       portals: portals
     });
 
-    const disks = [];
+    const disks: any[] = [];
     _.forEach(res.disks, (disk) => {
       const id = `${disk.pool}/${disk.image}`;
       disks.push(id);
@@ -329,14 +329,14 @@ export class IscsiTargetFormComponent implements OnInit {
     return false;
   }
 
-  removeImageRefs(name) {
+  removeImageRefs(name: string) {
     this.initiators.controls.forEach((element) => {
-      const newImages = element.value.luns.filter((item) => item !== name);
+      const newImages = element.value.luns.filter((item: string) => item !== name);
       element.get('luns').setValue(newImages);
     });
 
     this.groups.controls.forEach((element) => {
-      const newDisks = element.value.disks.filter((item) => item !== name);
+      const newDisks = element.value.disks.filter((item: string) => item !== name);
       element.get('disks').setValue(newDisks);
     });
 
@@ -348,7 +348,7 @@ export class IscsiTargetFormComponent implements OnInit {
     });
   }
 
-  getDefaultBackstore(imageId) {
+  getDefaultBackstore(imageId: string) {
     let result = this.default_backstore;
     const image = this.getImageById(imageId);
     if (!this.validFeatures(image, this.default_backstore)) {
@@ -363,17 +363,17 @@ export class IscsiTargetFormComponent implements OnInit {
     return result;
   }
 
-  isLunIdInUse(lunId, imageId) {
-    const images = this.disks.value.filter((currentImageId) => currentImageId !== imageId);
+  isLunIdInUse(lunId: string, imageId: string) {
+    const images = this.disks.value.filter((currentImageId: string) => currentImageId !== imageId);
     return this.getLunIds(images).includes(lunId);
   }
 
-  getLunIds(images) {
+  getLunIds(images: object) {
     return _.map(images, (image) => this.imagesSettings[image]['lun']);
   }
 
-  nextLunId(imageId) {
-    const images = this.disks.value.filter((currentImageId) => currentImageId !== imageId);
+  nextLunId(imageId: string) {
+    const images = this.disks.value.filter((currentImageId: string) => currentImageId !== imageId);
     const lunIdsInUse = this.getLunIds(images);
     let lunIdCandidate = 0;
     while (lunIdsInUse.includes(lunIdCandidate)) {
@@ -382,12 +382,12 @@ export class IscsiTargetFormComponent implements OnInit {
     return lunIdCandidate;
   }
 
-  getWwns(images) {
+  getWwns(images: object) {
     const wwns = _.map(images, (image) => this.imagesSettings[image]['wwn']);
     return wwns.filter((wwn) => _.isString(wwn) && wwn !== '');
   }
 
-  onImageSelection($event) {
+  onImageSelection($event: any) {
     const option = $event.option;
 
     if (option.selected) {
@@ -428,7 +428,7 @@ export class IscsiTargetFormComponent implements OnInit {
       client_iqn: new FormControl('', {
         validators: [
           Validators.required,
-          CdValidators.custom('notUnique', (client_iqn) => {
+          CdValidators.custom('notUnique', (client_iqn: string) => {
             const flattened = this.initiators.controls.reduce(function(accumulator, currentValue) {
               return accumulator.concat(currentValue.value.client_iqn);
             }, []);
@@ -500,7 +500,7 @@ export class IscsiTargetFormComponent implements OnInit {
     );
   }
 
-  removeInitiator(index) {
+  removeInitiator(index: number) {
     const removed = this.initiators.value[index];
 
     this.initiators.removeAt(index);
@@ -511,7 +511,9 @@ export class IscsiTargetFormComponent implements OnInit {
     });
 
     this.groups.controls.forEach((element) => {
-      const newMembers = element.value.members.filter((item) => item !== removed.client_iqn);
+      const newMembers = element.value.members.filter(
+        (item: string) => item !== removed.client_iqn
+      );
       element.get('members').setValue(newMembers);
     });
 
@@ -544,12 +546,12 @@ export class IscsiTargetFormComponent implements OnInit {
     });
   }
 
-  removeInitiatorImage(initiator: any, lun_index: number, initiator_index: string, image: string) {
+  removeInitiatorImage(initiator: any, lun_index: number, initiator_index: number, image: string) {
     const luns = initiator.getValue('luns');
     luns.splice(lun_index, 1);
     initiator.patchValue({ luns: luns });
 
-    this.imagesInitiatorSelections[initiator_index].forEach((value) => {
+    this.imagesInitiatorSelections[initiator_index].forEach((value: Record<string, any>) => {
       if (value.name === image) {
         value.selected = false;
       }
@@ -587,12 +589,12 @@ export class IscsiTargetFormComponent implements OnInit {
     return fg;
   }
 
-  removeGroup(index) {
+  removeGroup(index: number) {
     this.groups.removeAt(index);
     this.groupDiskSelections.splice(index, 1);
   }
 
-  onGroupMemberSelection($event) {
+  onGroupMemberSelection($event: any) {
     const option = $event.option;
 
     let initiator_index: number;
@@ -611,7 +613,7 @@ export class IscsiTargetFormComponent implements OnInit {
     });
   }
 
-  removeGroupInitiator(group, member_index, group_index) {
+  removeGroupInitiator(group: CdFormGroup, member_index: number, group_index: number) {
     const name = group.getValue('members')[member_index];
     group.getValue('members').splice(member_index, 1);
 
@@ -625,7 +627,7 @@ export class IscsiTargetFormComponent implements OnInit {
     this.onGroupMemberSelection({ option: new SelectOption(false, name, '') });
   }
 
-  removeGroupDisk(group, disk_index, group_index) {
+  removeGroupDisk(group: CdFormGroup, disk_index: number, group_index: number) {
     const name = group.getValue('disks')[disk_index];
     group.getValue('disks').splice(disk_index, 1);
 
@@ -640,7 +642,7 @@ export class IscsiTargetFormComponent implements OnInit {
   submit() {
     const formValue = _.cloneDeep(this.targetForm.value);
 
-    const request = {
+    const request: Record<string, any> = {
       target_iqn: this.targetForm.getValue('target_iqn'),
       target_controls: this.targetForm.getValue('target_controls'),
       acl_enabled: this.targetForm.getValue('acl_enabled'),
@@ -675,7 +677,7 @@ export class IscsiTargetFormComponent implements OnInit {
     }
 
     // Disks
-    formValue.disks.forEach((disk) => {
+    formValue.disks.forEach((disk: string) => {
       const imageSplit = disk.split('/');
       const backstore = this.imagesSettings[disk].backstore;
       request.disks.push({
@@ -689,7 +691,7 @@ export class IscsiTargetFormComponent implements OnInit {
     });
 
     // Portals
-    formValue.portals.forEach((portal) => {
+    formValue.portals.forEach((portal: string) => {
       const index = portal.indexOf(':');
       request.portals.push({
         host: portal.substring(0, index),
@@ -699,7 +701,7 @@ export class IscsiTargetFormComponent implements OnInit {
 
     // Clients
     if (request.acl_enabled) {
-      formValue.initiators.forEach((initiator) => {
+      formValue.initiators.forEach((initiator: Record<string, any>) => {
         if (!initiator.auth.user) {
           initiator.auth.user = '';
         }
@@ -714,8 +716,8 @@ export class IscsiTargetFormComponent implements OnInit {
         }
         delete initiator.cdIsInGroup;
 
-        const newLuns = [];
-        initiator.luns.forEach((lun) => {
+        const newLuns: any[] = [];
+        initiator.luns.forEach((lun: string) => {
           const imageSplit = lun.split('/');
           newLuns.push({
             pool: imageSplit[0],
@@ -730,9 +732,9 @@ export class IscsiTargetFormComponent implements OnInit {
 
     // Groups
     if (request.acl_enabled) {
-      formValue.groups.forEach((group) => {
-        const newDisks = [];
-        group.disks.forEach((disk) => {
+      formValue.groups.forEach((group: Record<string, any>) => {
+        const newDisks: any[] = [];
+        group.disks.forEach((disk: string) => {
           const imageSplit = disk.split('/');
           newDisks.push({
             pool: imageSplit[0],
@@ -783,7 +785,7 @@ export class IscsiTargetFormComponent implements OnInit {
     this.modalRef = this.modalService.show(IscsiTargetIqnSettingsModalComponent, { initialState });
   }
 
-  imageSettingsModal(image) {
+  imageSettingsModal(image: string) {
     const initialState = {
       imagesSettings: this.imagesSettings,
       image: image,
@@ -799,7 +801,7 @@ export class IscsiTargetFormComponent implements OnInit {
     });
   }
 
-  validFeatures(image, backstore) {
+  validFeatures(image: Record<string, any>, backstore: string) {
     const imageFeatures = image.features;
     const requiredFeatures = this.required_rbd_features[backstore];
     const unsupportedFeatures = this.unsupported_rbd_features[backstore];
@@ -810,11 +812,11 @@ export class IscsiTargetFormComponent implements OnInit {
     return validRequiredFeatures && validSupportedFeatures;
   }
 
-  getImageById(imageId) {
+  getImageById(imageId: string) {
     return this.imagesAll.find((image) => imageId === `${image.pool_name}/${image.name}`);
   }
 
-  getValidBackstores(image) {
+  getValidBackstores(image: object) {
     return this.backstores.filter((backstore) => this.validFeatures(image, backstore));
   }
 }
index b8b527623fc1e9521a1f810aa44348af3e56e612..f238d3b4c698cb5f474431d682777ac6f7b88911 100644 (file)
@@ -26,7 +26,7 @@ export class IscsiTargetImageSettingsModalComponent implements OnInit {
   constructor(public modalRef: BsModalRef, public iscsiService: IscsiService) {}
 
   ngOnInit() {
-    const fg = {
+    const fg: Record<string, FormControl> = {
       backstore: new FormControl(this.imagesSettings[this.image]['backstore']),
       lun: new FormControl(this.imagesSettings[this.image]['lun']),
       wwn: new FormControl(this.imagesSettings[this.image]['wwn'])
@@ -41,7 +41,7 @@ export class IscsiTargetImageSettingsModalComponent implements OnInit {
     this.settingsForm = new CdFormGroup(fg);
   }
 
-  getDiskControlLimits(backstore, setting) {
+  getDiskControlLimits(backstore: string, setting: string) {
     if (this.disk_controls_limits) {
       return this.disk_controls_limits[backstore][setting];
     }
index 26e3cb0f3c9b9f90563a1e70fb044339d15b193c..8e92f707ce07f1e7712e860eaed153920015db02 100644 (file)
@@ -22,7 +22,7 @@ export class IscsiTargetIqnSettingsModalComponent implements OnInit {
   constructor(public modalRef: BsModalRef, public iscsiService: IscsiService) {}
 
   ngOnInit() {
-    const fg = {};
+    const fg: Record<string, FormControl> = {};
     _.forIn(this.target_default_controls, (_value, key) => {
       fg[key] = new FormControl(this.target_controls.value[key]);
     });
@@ -42,7 +42,7 @@ export class IscsiTargetIqnSettingsModalComponent implements OnInit {
     this.modalRef.hide();
   }
 
-  getTargetControlLimits(setting) {
+  getTargetControlLimits(setting: string) {
     if (this.target_controls_limits) {
       return this.target_controls_limits[setting];
     }
index 3c4a7227d481f4f9ebe5d7dd74cb743d74133c5c..c1413f96a7ef25df6a352f52e34610144f91a9f6 100644 (file)
@@ -29,7 +29,7 @@ describe('IscsiTargetListComponent', () => {
   let summaryService: SummaryService;
   let iscsiService: IscsiService;
 
-  const refresh = (data) => {
+  const refresh = (data: any) => {
     summaryService['summaryDataSource'].next(data);
   };
 
@@ -91,7 +91,7 @@ describe('IscsiTargetListComponent', () => {
   describe('handling of executing tasks', () => {
     let targets: any[];
 
-    const addTarget = (name) => {
+    const addTarget = (name: string) => {
       const model: any = {
         target_iqn: name,
         portals: [{ host: 'node1', ip: '192.168.100.201' }],
index 12a8b3be7c55e2cc40b1fa8b34fb45cee2c41158..f3911d58a9dc889f095724d56e9971e1cce0f717 100644 (file)
@@ -16,6 +16,7 @@ import { CdTableColumn } from '../../../shared/models/cd-table-column';
 import { CdTableSelection } from '../../../shared/models/cd-table-selection';
 import { FinishedTask } from '../../../shared/models/finished-task';
 import { Permission } from '../../../shared/models/permissions';
+import { Task } from '../../../shared/models/task';
 import { CephReleaseNamePipe } from '../../../shared/pipes/ceph-release-name.pipe';
 import { NotAvailablePipe } from '../../../shared/pipes/not-available.pipe';
 import { AuthStorageService } from '../../../shared/services/auth-storage.service';
@@ -45,11 +46,11 @@ export class IscsiTargetListComponent implements OnInit, OnDestroy {
   status: string;
   summaryDataSubscription: Subscription;
   tableActions: CdTableAction[];
-  targets = [];
+  targets: any[] = [];
   icons = Icons;
 
   builders = {
-    'iscsi/target/create': (metadata) => {
+    'iscsi/target/create': (metadata: object) => {
       return {
         target_iqn: metadata['target_iqn']
       };
@@ -185,9 +186,13 @@ export class IscsiTargetListComponent implements OnInit, OnDestroy {
   }
 
   prepareResponse(resp: any): any[] {
-    resp.forEach((element) => {
-      element.cdPortals = element.portals.map((portal) => `${portal.host}:${portal.ip}`);
-      element.cdImages = element.disks.map((disk) => `${disk.pool}/${disk.image}`);
+    resp.forEach((element: Record<string, any>) => {
+      element.cdPortals = element.portals.map(
+        (portal: Record<string, any>) => `${portal.host}:${portal.ip}`
+      );
+      element.cdImages = element.disks.map(
+        (disk: Record<string, any>) => `${disk.pool}/${disk.image}`
+      );
     });
 
     return resp;
@@ -197,11 +202,11 @@ export class IscsiTargetListComponent implements OnInit, OnDestroy {
     this.table.reset(); // Disable loading indicator.
   }
 
-  itemFilter(entry, task) {
+  itemFilter(entry: Record<string, any>, task: Task) {
     return entry.target_iqn === task.metadata['target_iqn'];
   }
 
-  taskFilter(task) {
+  taskFilter(task: Task) {
     return ['iscsi/target/create', 'iscsi/target/edit', 'iscsi/target/delete'].includes(task.name);
   }
 
index 528f0a77a4f8a1c93d349967ccf2280361fd64f9..f599c7f00a975222021896a9b4d21cf4023e65ff 100644 (file)
@@ -17,7 +17,7 @@ describe('IscsiComponent', () => {
   let component: IscsiComponent;
   let fixture: ComponentFixture<IscsiComponent>;
   let iscsiService: IscsiService;
-  let tcmuiscsiData;
+  let tcmuiscsiData: Record<string, any>;
 
   const fakeService = {
     overview: () => {
index 014e0911b2495af8c9352c9ffc5d9dd3c77fcc20..a8dc711a832f5851a7c8ef60e5e0d0579f3d392a 100644 (file)
@@ -20,9 +20,9 @@ export class IscsiComponent implements OnInit {
   @ViewChild('iscsiRelativeDateTpl', { static: true })
   iscsiRelativeDateTpl: TemplateRef<any>;
 
-  gateways = [];
+  gateways: any[] = [];
   gatewaysColumns: any;
-  images = [];
+  images: any[] = [];
   imagesColumns: any;
 
   constructor(
@@ -104,13 +104,13 @@ export class IscsiComponent implements OnInit {
   }
 
   refresh() {
-    this.iscsiService.overview().subscribe((overview: Array<any>) => {
+    this.iscsiService.overview().subscribe((overview: object) => {
       this.gateways = overview['gateways'];
       this.images = overview['images'];
       this.images.map((image) => {
         if (image.stats_history) {
-          image.stats_history.rd_bytes = image.stats_history.rd_bytes.map((i) => i[1]);
-          image.stats_history.wr_bytes = image.stats_history.wr_bytes.map((i) => i[1]);
+          image.stats_history.rd_bytes = image.stats_history.rd_bytes.map((i: any) => i[1]);
+          image.stats_history.wr_bytes = image.stats_history.wr_bytes.map((i: any) => i[1]);
         }
         image.cdIsBinary = true;
         return image;
index ce573f820bb866a1a7ab2e20eeecd2a024a82c4b..b2130f8b515760b6c947655bce509b3a318a05e2 100644 (file)
@@ -10,6 +10,7 @@ import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.servic
 import { CdFormGroup } from '../../../../shared/forms/cd-form-group';
 import { FinishedTask } from '../../../../shared/models/finished-task';
 import { TaskWrapperService } from '../../../../shared/services/task-wrapper.service';
+import { Pool } from '../../../pool/pool';
 
 @Component({
   selector: 'cd-bootstrap-create-modal',
@@ -60,7 +61,7 @@ export class BootstrapCreateModalComponent implements OnDestroy, OnInit {
       }
 
       const pools = data.content_data.pools;
-      this.pools = pools.reduce((acc, pool) => {
+      this.pools = pools.reduce((acc: any[], pool: Pool) => {
         acc.push({
           name: pool['name'],
           mirror_mode: pool['mirror_mode']
@@ -139,7 +140,7 @@ export class BootstrapCreateModalComponent implements OnDestroy, OnInit {
       ),
       this.rbdMirroringService
         .createBootstrapToken(bootstrapPoolName)
-        .pipe(tap((data) => this.createBootstrapForm.get('token').setValue(data['token'])))
+        .pipe(tap((data: any) => this.createBootstrapForm.get('token').setValue(data['token'])))
     ).pipe(last());
 
     const finishHandler = () => {
index 9effef71d0cd270a5fcf1bb7df8245b64993397a..0e7d56d408730123709b17103010a780a69da23f 100644 (file)
@@ -10,6 +10,7 @@ import { RbdMirroringService } from '../../../../shared/api/rbd-mirroring.servic
 import { CdFormGroup } from '../../../../shared/forms/cd-form-group';
 import { FinishedTask } from '../../../../shared/models/finished-task';
 import { TaskWrapperService } from '../../../../shared/services/task-wrapper.service';
+import { Pool } from '../../../pool/pool';
 
 @Component({
   selector: 'cd-bootstrap-import-modal',
@@ -67,7 +68,7 @@ export class BootstrapImportModalComponent implements OnInit, OnDestroy {
       }
 
       const pools = data.content_data.pools;
-      this.pools = pools.reduce((acc, pool) => {
+      this.pools = pools.reduce((acc: any[], pool: Pool) => {
         acc.push({
           name: pool['name'],
           mirror_mode: pool['mirror_mode']
index b2aaecb2486bc837ab358289ca1c04f38c52d914..5acdd1ea29d21cfb123b2d5d298c375c59a57078 100644 (file)
@@ -20,15 +20,15 @@ export class ImageListComponent implements OnInit, OnDestroy {
 
   subs: Subscription;
 
-  image_error = {
+  image_error: Record<string, any> = {
     data: [],
     columns: {}
   };
-  image_syncing = {
+  image_syncing: Record<string, any> = {
     data: [],
     columns: {}
   };
-  image_ready = {
+  image_ready: Record<string, any> = {
     data: [],
     columns: {}
   };
index 5e2297082c910c3c65a396f50a90dbe1bd1b9545..6a3c7ef210ed1f7d40d8178960cda49d92245c4b 100644 (file)
@@ -11,6 +11,7 @@ import { CdTableAction } from '../../../../shared/models/cd-table-action';
 import { CdTableSelection } from '../../../../shared/models/cd-table-selection';
 import { Permission } from '../../../../shared/models/permissions';
 import { AuthStorageService } from '../../../../shared/services/auth-storage.service';
+import { Pool } from '../../../pool/pool';
 import { BootstrapCreateModalComponent } from '../bootstrap-create-modal/bootstrap-create-modal.component';
 import { BootstrapImportModalComponent } from '../bootstrap-import-modal/bootstrap-import-modal.component';
 import { EditSiteNameModalComponent } from '../edit-site-name-modal/edit-site-name-modal.component';
@@ -74,7 +75,7 @@ export class OverviewComponent implements OnInit, OnDestroy {
       this.status = data.content_data.status;
       this.siteName = data.site_name;
 
-      this.peersExist = !!data.content_data.pools.find((o) => o['peer_uuids'].length > 0);
+      this.peersExist = !!data.content_data.pools.find((o: Pool) => o['peer_uuids'].length > 0);
     });
   }
 
index 443b71f41331a7f3b02f20dd59e874fb4fcf5d44..3a393170b87f59ab540954f8a593039cbffc780d 100644 (file)
@@ -66,7 +66,7 @@ export class PoolEditModeModalComponent implements OnInit, OnDestroy {
       }
 
       const poolData = data.content_data.pools;
-      const pool = poolData.find((o) => this.poolName === o['name']);
+      const pool = poolData.find((o: any) => this.poolName === o['name']);
       this.peerExists = pool && pool['peer_uuids'].length;
     });
   }
index 7c0830ce1cdc388377e535807187f24349f5a70a..efa0beba8c75be31743f18ef7de94249afa87fa8 100644 (file)
@@ -117,7 +117,7 @@ export class PoolListComponent implements OnInit, OnDestroy {
     this.modalRef = this.modalService.show(PoolEditModeModalComponent, { initialState });
   }
 
-  editPeersModal(mode) {
+  editPeersModal(mode: string) {
     const initialState = {
       poolName: this.selection.first().name,
       mode: mode
@@ -158,7 +158,7 @@ export class PoolListComponent implements OnInit, OnDestroy {
     });
   }
 
-  getPeerUUID() {
+  getPeerUUID(): any {
     const selection = this.selection.first();
     const pool = this.data.find((o) => selection && selection.name === o['name']);
     if (pool && pool['peer_uuids']) {
index dbce86384d251c415762a2ae14572d40d1fd7189..60926a043ed520d432e6419eeec3068d6b758220 100644 (file)
@@ -56,7 +56,7 @@ describe('RbdConfigurationFormComponent', () => {
     const expected = sections
       .map((section) => section.options)
       .reduce((a, b) => a.concat(b))
-      .map((option) => option.name);
+      .map((option: Record<string, any>) => option.name);
     expect(actual).toEqual(expected);
 
     /* Test form creation on a template level */
@@ -85,7 +85,7 @@ describe('RbdConfigurationFormComponent', () => {
 
     it('should return dirty values without any units', () => {
       let dirtyValues = {};
-      component.changes.subscribe((getDirtyValues) => {
+      component.changes.subscribe((getDirtyValues: Function) => {
         dirtyValues = getDirtyValues();
       });
 
@@ -213,7 +213,7 @@ describe('RbdConfigurationFormComponent', () => {
   });
 
   describe('should verify that getDirtyValues() returns correctly', () => {
-    let data;
+    let data: any;
 
     beforeEach(() => {
       component.initializeData = new EventEmitter<any>();
@@ -280,7 +280,7 @@ describe('RbdConfigurationFormComponent', () => {
 
     it('should also return all local values if they do not contain their initial values', () => {
       // Change value for all options
-      data.initialData = data.initialData.map((o) => {
+      data.initialData = data.initialData.map((o: Record<string, any>) => {
         o.value = 22;
         return o;
       });
index c92f2453f92fe40e3ae13b540223c45ee4a720af..67c64117359857fcffba1f1ad76ec1a473efee9d 100644 (file)
@@ -49,12 +49,14 @@ export class RbdConfigurationFormComponent implements OnInit {
     });
 
     if (this.initializeData) {
-      this.initializeData.subscribe((data) => {
+      this.initializeData.subscribe((data: Record<string, any>) => {
         this.initialData = data.initialData;
         const dataType = data.sourceType;
 
         this.rbdConfigurationService.getWritableOptionFields().forEach((option) => {
-          const optionData = data.initialData.filter((entry) => entry.name === option.name).pop();
+          const optionData = data.initialData
+            .filter((entry: Record<string, any>) => entry.name === option.name)
+            .pop();
           if (optionData && optionData['source'] === dataType) {
             this.form.get(`configuration.${option.name}`).setValue(optionData['value']);
           }
@@ -77,7 +79,7 @@ export class RbdConfigurationFormComponent implements OnInit {
     const result = {};
 
     this.rbdConfigurationService.getWritableOptionFields().forEach((config) => {
-      const control = this.form.get('configuration').get(config.name);
+      const control: any = this.form.get('configuration').get(config.name);
       const dirty = control.dirty;
 
       if (this.initialData && this.initialData[config.name] === control.value) {
@@ -131,7 +133,7 @@ export class RbdConfigurationFormComponent implements OnInit {
    * Reset the value. The inherited value will be used instead.
    */
   reset(optionName: string) {
-    const formControl = this.form.get('configuration').get(optionName);
+    const formControl: any = this.form.get('configuration').get(optionName);
     if (formControl.disabled) {
       formControl.setValue(formControl['previousValue'] || 0);
       formControl.enable();
@@ -150,7 +152,7 @@ export class RbdConfigurationFormComponent implements OnInit {
     return this.form.get('configuration').get(optionName).disabled;
   }
 
-  toggleSectionVisibility(className) {
+  toggleSectionVisibility(className: string) {
     this.sectionVisibility[className] = !this.sectionVisibility[className];
   }
 }
index e0cc67d97855e71c1f1c68fa7ea5feed5cd730da..27b5650a397cb1b28c9a041d15c87e26d43711b3 100644 (file)
@@ -88,7 +88,7 @@ describe('RbdConfigurationListComponent', () => {
         value: '100'
       }
     ];
-    const filter = (keyword) => {
+    const filter = (keyword: string) => {
       poolConfTable.search = keyword;
       poolConfTable.updateFilter();
       return poolConfTable.rows;
index e9d9e1f24a0d569f63b3943087d16a6895e3240f..77330e648d670d615f25f9dda814158ca15e2ac3 100644 (file)
@@ -17,6 +17,7 @@ import { RbdService } from '../../../shared/api/rbd.service';
 import { ImageSpec } from '../../../shared/models/image-spec';
 import { SharedModule } from '../../../shared/shared.module';
 import { RbdConfigurationFormComponent } from '../rbd-configuration-form/rbd-configuration-form.component';
+import { RbdImageFeature } from './rbd-feature.interface';
 import { RbdFormMode } from './rbd-form-mode.enum';
 import { RbdFormComponent } from './rbd-form.component';
 
@@ -25,7 +26,7 @@ describe('RbdFormComponent', () => {
   let fixture: ComponentFixture<RbdFormComponent>;
   let activatedRoute: ActivatedRouteStub;
 
-  const queryNativeElement = (cssSelector) =>
+  const queryNativeElement = (cssSelector: string) =>
     fixture.debugElement.query(By.css(cssSelector)).nativeElement;
 
   configureTestBed({
@@ -59,11 +60,11 @@ describe('RbdFormComponent', () => {
   });
 
   describe('create/edit/clone/copy image', () => {
-    let createAction;
-    let editAction;
-    let cloneAction;
-    let copyAction;
-    let rbdServiceGetSpy;
+    let createAction: jasmine.Spy;
+    let editAction: jasmine.Spy;
+    let cloneAction: jasmine.Spy;
+    let copyAction: jasmine.Spy;
+    let rbdServiceGetSpy: jasmine.Spy;
 
     beforeEach(() => {
       createAction = spyOn(component, 'createAction').and.stub();
@@ -211,7 +212,12 @@ describe('RbdFormComponent', () => {
   });
 
   describe('tests for feature flags', () => {
-    let deepFlatten, layering, exclusiveLock, objectMap, journaling, fastDiff;
+    let deepFlatten: any,
+      layering: any,
+      exclusiveLock: any,
+      objectMap: any,
+      journaling: any,
+      fastDiff: any;
     const defaultFeatures = [
       // Supposed to be enabled by default
       'deep-flatten',
@@ -228,7 +234,7 @@ describe('RbdFormComponent', () => {
       'journaling',
       'fast-diff'
     ];
-    const setFeatures = (features) => {
+    const setFeatures = (features: Record<string, RbdImageFeature>) => {
       component.features = features;
       component.featuresList = component.objToArray(features);
       component.createForm();
index 82dbe49bdd6bec494b558effdee3a1b0eecc1407..967796c89e6e9485ed96e9a3534f48aa79687d95 100644 (file)
@@ -24,6 +24,7 @@ import { DimlessBinaryPipe } from '../../../shared/pipes/dimless-binary.pipe';
 import { AuthStorageService } from '../../../shared/services/auth-storage.service';
 import { FormatterService } from '../../../shared/services/formatter.service';
 import { TaskWrapperService } from '../../../shared/services/task-wrapper.service';
+import { Pool } from '../../pool/pool';
 import { RbdImageFeature } from './rbd-feature.interface';
 import { RbdFormCloneRequestModel } from './rbd-form-clone-request.model';
 import { RbdFormCopyRequestModel } from './rbd-form-copy-request.model';
@@ -47,8 +48,8 @@ export class RbdFormComponent implements OnInit {
 
   namespaces: Array<string> = [];
   namespacesByPoolCache = {};
-  pools: Array<string> = null;
-  allPools: Array<string> = null;
+  pools: Array<Pool> = null;
+  allPools: Array<Pool> = null;
   dataPools: Array<string> = null;
   allDataPools: Array<string> = null;
   features: { [key: string]: RbdImageFeature };
@@ -174,7 +175,7 @@ export class RbdFormComponent implements OnInit {
         }),
         obj_size: new FormControl(this.defaultObjectSize),
         features: new CdFormGroup(
-          this.featuresList.reduce((acc, e) => {
+          this.featuresList.reduce((acc: object, e) => {
             acc[e.key] = new FormControl({ value: false, disabled: !!e.initDisabled });
             return acc;
           }, {})
@@ -260,7 +261,7 @@ export class RbdFormComponent implements OnInit {
     forkJoin(promisses).subscribe((data: object) => {
       // poolService.list
       if (data[Promisse.PoolServiceList]) {
-        const pools = [];
+        const pools: Pool[] = [];
         const dataPools = [];
         for (const pool of data[Promisse.PoolServiceList]) {
           if (this.rbdService.isRBDPool(pool)) {
@@ -280,7 +281,7 @@ export class RbdFormComponent implements OnInit {
         this.dataPools = dataPools;
         this.allDataPools = dataPools;
         if (this.pools.length === 1) {
-          const poolName = this.pools[0]['pool_name'];
+          const poolName = this.pools[0].pool_name;
           this.rbdForm.get('pool').setValue(poolName);
           this.onPoolChange(poolName);
         }
@@ -302,7 +303,7 @@ export class RbdFormComponent implements OnInit {
     });
   }
 
-  onPoolChange(selectedPoolName) {
+  onPoolChange(selectedPoolName: string) {
     const newDataPools = this.allDataPools
       ? this.allDataPools.filter((dataPool: any) => {
           return dataPool.pool_name !== selectedPoolName;
@@ -332,8 +333,8 @@ export class RbdFormComponent implements OnInit {
     }
   }
 
-  onDataPoolChange(selectedDataPoolName) {
-    const newPools = this.allPools.filter((pool: any) => {
+  onDataPoolChange(selectedDataPoolName: string) {
+    const newPools = this.allPools.filter((pool: Pool) => {
       return pool.pool_name !== selectedDataPoolName;
     });
     if (this.rbdForm.getValue('pool') === selectedDataPoolName) {
@@ -398,7 +399,7 @@ export class RbdFormComponent implements OnInit {
     return _.filter(this.features, (f) => f.requires === featureKey) || [];
   }
 
-  deepBoxCheck(key, checked) {
+  deepBoxCheck(key: string, checked: boolean) {
     const childFeatures = this.getDependendChildFeatures(key);
     childFeatures.forEach((feature) => {
       const featureControl = this.rbdForm.get(feature.key);
@@ -424,7 +425,7 @@ export class RbdFormComponent implements OnInit {
     });
   }
 
-  interlockCheck(key, checked) {
+  interlockCheck(key: string, checked: boolean) {
     // Adds a compatibility layer for Ceph cluster where the feature interlock of features hasn't
     // been implemented yet. It disables the feature interlock for images which only have one of
     // both interlocked features (at the time of this writing: object-map and fast-diff) enabled.
@@ -471,7 +472,7 @@ export class RbdFormComponent implements OnInit {
     }
   }
 
-  featureFormUpdate(key, checked) {
+  featureFormUpdate(key: string, checked: boolean) {
     if (checked) {
       const required = this.features[key].requires;
       if (required && !this.rbdForm.getValue(required)) {
index 8a8b6a5c94c424d66af3a0a193647bd0b97a5d2e..5710164d3185f339a1b091ddcad2bdd9ecfd84a4 100644 (file)
@@ -35,7 +35,7 @@ describe('RbdListComponent', () => {
   let summaryService: SummaryService;
   let rbdService: RbdService;
 
-  const refresh = (data) => {
+  const refresh = (data: any) => {
     summaryService['summaryDataSource'].next(data);
   };
 
@@ -102,7 +102,7 @@ describe('RbdListComponent', () => {
   describe('handling of executing tasks', () => {
     let images: RbdModel[];
 
-    const addImage = (name) => {
+    const addImage = (name: string) => {
       const model = new RbdModel();
       model.id = '-1';
       model.name = name;
@@ -159,7 +159,7 @@ describe('RbdListComponent', () => {
 
     it('should gets all images without tasks', () => {
       expect(component.images.length).toBe(3);
-      expect(component.images.every((image) => !image.cdExecuting)).toBeTruthy();
+      expect(component.images.every((image: any) => !image.cdExecuting)).toBeTruthy();
     });
 
     it('should add a new image from a task', () => {
index 4e178f3fb7cbdc90b6f5dfd548e63b698f25fee4..56187a69e51246489961dbf6a8e0cd7119fadd4b 100644 (file)
@@ -18,6 +18,7 @@ import { CdTableSelection } from '../../../shared/models/cd-table-selection';
 import { FinishedTask } from '../../../shared/models/finished-task';
 import { ImageSpec } from '../../../shared/models/image-spec';
 import { Permission } from '../../../shared/models/permissions';
+import { Task } from '../../../shared/models/task';
 import { DimlessBinaryPipe } from '../../../shared/pipes/dimless-binary.pipe';
 import { DimlessPipe } from '../../../shared/pipes/dimless.pipe';
 import { AuthStorageService } from '../../../shared/services/auth-storage.service';
@@ -62,16 +63,16 @@ export class RbdListComponent implements OnInit {
   modalRef: BsModalRef;
 
   builders = {
-    'rbd/create': (metadata) =>
+    'rbd/create': (metadata: object) =>
       this.createRbdFromTask(metadata['pool_name'], metadata['namespace'], metadata['image_name']),
-    'rbd/delete': (metadata) => this.createRbdFromTaskImageSpec(metadata['image_spec']),
-    'rbd/clone': (metadata) =>
+    'rbd/delete': (metadata: object) => this.createRbdFromTaskImageSpec(metadata['image_spec']),
+    'rbd/clone': (metadata: object) =>
       this.createRbdFromTask(
         metadata['child_pool_name'],
         metadata['child_namespace'],
         metadata['child_image_name']
       ),
-    'rbd/copy': (metadata) =>
+    'rbd/copy': (metadata: object) =>
       this.createRbdFromTask(
         metadata['dest_pool_name'],
         metadata['dest_namespace'],
@@ -226,7 +227,7 @@ export class RbdListComponent implements OnInit {
       }
     ];
 
-    const itemFilter = (entry, task) => {
+    const itemFilter = (entry: Record<string, any>, task: Task) => {
       let taskImageSpec: string;
       switch (task.name) {
         case 'rbd/copy':
@@ -259,7 +260,7 @@ export class RbdListComponent implements OnInit {
       );
     };
 
-    const taskFilter = (task) => {
+    const taskFilter = (task: Task) => {
       return [
         'rbd/clone',
         'rbd/copy',
@@ -288,7 +289,7 @@ export class RbdListComponent implements OnInit {
   }
 
   prepareResponse(resp: any[]): any[] {
-    let images = [];
+    let images: any[] = [];
     const viewCacheStatusMap = {};
     resp.forEach((pool) => {
       if (_.isUndefined(viewCacheStatusMap[pool.status])) {
@@ -297,7 +298,7 @@ export class RbdListComponent implements OnInit {
       viewCacheStatusMap[pool.status].push(pool.pool_name);
       images = images.concat(pool.value);
     });
-    const viewCacheStatusList = [];
+    const viewCacheStatusList: any[] = [];
     _.forEach(viewCacheStatusMap, (value: any, key) => {
       viewCacheStatusList.push({
         status: parseInt(key, 10),
index 023dc7faa1eea045e1d8eab70ee6e2a2233d8e70..acaf334a203d2d070f64483e7809cff079be035e 100644 (file)
@@ -19,6 +19,7 @@ import { FinishedTask } from '../../../shared/models/finished-task';
 import { Permission } from '../../../shared/models/permissions';
 import { AuthStorageService } from '../../../shared/services/auth-storage.service';
 import { NotificationService } from '../../../shared/services/notification.service';
+import { Pool } from '../../pool/pool';
 
 @Component({
   selector: 'cd-rbd-namespace-form',
@@ -27,7 +28,7 @@ import { NotificationService } from '../../../shared/services/notification.servi
 })
 export class RbdNamespaceFormComponent implements OnInit {
   poolPermission: Permission;
-  pools: Array<string> = null;
+  pools: Array<Pool> = null;
   pool: string;
   namespace: string;
 
@@ -101,7 +102,7 @@ export class RbdNamespaceFormComponent implements OnInit {
 
     if (this.poolPermission.read) {
       this.poolService.list(['pool_name', 'type', 'application_metadata']).then((resp) => {
-        const pools = [];
+        const pools: Pool[] = [];
         for (const pool of resp) {
           if (this.rbdService.isRBDPool(pool) && pool.type === 'replicated') {
             pools.push(pool);
index 36a241eb8322d350863fba68a650c36325141b8a..3dd514ee46166b905f5773e4a97340242c269a95 100644 (file)
@@ -4,7 +4,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill';
 import { BsModalRef, BsModalService } from 'ngx-bootstrap/modal';
 
 import * as _ from 'lodash';
-import { forkJoin } from 'rxjs';
+import { forkJoin, Observable } from 'rxjs';
 import { PoolService } from '../../../shared/api/pool.service';
 import { RbdService } from '../../../shared/api/rbd.service';
 import { CriticalConfirmationModalComponent } from '../../../shared/components/critical-confirmation-modal/critical-confirmation-modal.component';
@@ -84,14 +84,16 @@ export class RbdNamespaceListComponent implements OnInit {
 
   refresh() {
     this.poolService.list(['pool_name', 'type', 'application_metadata']).then((pools: any) => {
-      pools = pools.filter((pool) => this.rbdService.isRBDPool(pool) && pool.type === 'replicated');
-      const promisses = [];
-      pools.forEach((pool) => {
+      pools = pools.filter(
+        (pool: any) => this.rbdService.isRBDPool(pool) && pool.type === 'replicated'
+      );
+      const promisses: Observable<any>[] = [];
+      pools.forEach((pool: any) => {
         promisses.push(this.rbdService.listNamespaces(pool['pool_name']));
       });
       if (promisses.length > 0) {
         forkJoin(promisses).subscribe((data: Array<Array<string>>) => {
-          const result = [];
+          const result: any[] = [];
           for (let i = 0; i < data.length; i++) {
             const namespaces = data[i];
             const pool_name = pools[i]['pool_name'];
index 8b267a187390b749b25faa42130a67db0d0b4446..0dcb9ad1f3ff532fe8a6c65e60b06039f95990af 100644 (file)
@@ -57,7 +57,7 @@ export class RbdSnapshotFormComponent implements OnInit {
     this.onSubmit = new Subject();
   }
 
-  setSnapName(snapName) {
+  setSnapName(snapName: string) {
     this.snapName = snapName;
     this.snapshotForm.get('snapshotName').setValue(snapName);
   }
index 37b09c6378011d5c728bd2e6330d0bb2be65656a..b85d15d92091cc85adb058c13a2c8aecfb0d0afe 100644 (file)
@@ -75,7 +75,7 @@ describe('RbdSnapshotListComponent', () => {
   });
 
   describe('api delete request', () => {
-    let called;
+    let called: boolean;
     let rbdService: RbdService;
     let notificationService: NotificationService;
     let authStorageService: AuthStorageService;
@@ -121,7 +121,7 @@ describe('RbdSnapshotListComponent', () => {
   describe('handling of executing tasks', () => {
     let snapshots: RbdSnapshotModel[];
 
-    const addSnapshot = (name) => {
+    const addSnapshot = (name: string) => {
       const model = new RbdSnapshotModel();
       model.id = 1;
       model.name = name;
@@ -138,7 +138,7 @@ describe('RbdSnapshotListComponent', () => {
       summaryService.addRunningTask(task);
     };
 
-    const refresh = (data) => {
+    const refresh = (data: any) => {
       summaryService['summaryDataSource'].next(data);
     };
 
index f228eef4f5bccc2790a4e8ecca6baf3cf4460f89..6dfc82423b50ebf7d84ea970305ce1306cec6f82 100644 (file)
@@ -17,6 +17,7 @@ import { ExecutingTask } from '../../../shared/models/executing-task';
 import { FinishedTask } from '../../../shared/models/finished-task';
 import { ImageSpec } from '../../../shared/models/image-spec';
 import { Permission } from '../../../shared/models/permissions';
+import { Task } from '../../../shared/models/task';
 import { CdDatePipe } from '../../../shared/pipes/cd-date.pipe';
 import { DimlessBinaryPipe } from '../../../shared/pipes/dimless-binary.pipe';
 import { AuthStorageService } from '../../../shared/services/auth-storage.service';
@@ -61,7 +62,7 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges {
   modalRef: BsModalRef;
 
   builders = {
-    'rbd/snap/create': (metadata) => {
+    'rbd/snap/create': (metadata: any) => {
       const model = new RbdSnapshotModel();
       model.name = metadata['snapshot_name'];
       return model;
@@ -144,11 +145,11 @@ export class RbdSnapshotListComponent implements OnInit, OnChanges {
     actions.deleteSnap.click = () => this.deleteSnapshotModal();
     this.tableActions = actions.ordering;
 
-    const itemFilter = (entry, task) => {
+    const itemFilter = (entry: any, task: Task) => {
       return entry.name === task.metadata['snapshot_name'];
     };
 
-    const taskFilter = (task) => {
+    const taskFilter = (task: Task) => {
       return (
         ['rbd/snap/create', 'rbd/snap/delete', 'rbd/snap/edit', 'rbd/snap/rollback'].includes(
           task.name
index 136b3aa4443f9143222fca656e04a00324866b8b..d98d338683877086ff59d12738127d845626db12 100644 (file)
@@ -59,7 +59,7 @@ describe('RbdTrashListComponent', () => {
   describe('handling of executing tasks', () => {
     let images: any[];
 
-    const addImage = (id) => {
+    const addImage = (id: string) => {
       images.push({
         id: id,
         pool_name: 'pl'
@@ -89,7 +89,9 @@ describe('RbdTrashListComponent', () => {
 
     it('should gets all images without tasks', () => {
       expect(component.images.length).toBe(2);
-      expect(component.images.every((image) => !image.cdExecuting)).toBeTruthy();
+      expect(
+        component.images.every((image: Record<string, any>) => !image.cdExecuting)
+      ).toBeTruthy();
     });
 
     it('should show when an existing image is being modified', () => {
index 6813c3507e5734f91105251c61bfabf45484247c..90f37facd054d1f1bea5d4fac199a6ff7ac60734 100644 (file)
@@ -19,6 +19,7 @@ import { ExecutingTask } from '../../../shared/models/executing-task';
 import { FinishedTask } from '../../../shared/models/finished-task';
 import { ImageSpec } from '../../../shared/models/image-spec';
 import { Permission } from '../../../shared/models/permissions';
+import { Task } from '../../../shared/models/task';
 import { CdDatePipe } from '../../../shared/pipes/cd-date.pipe';
 import { AuthStorageService } from '../../../shared/services/auth-storage.service';
 import { TaskListService } from '../../../shared/services/task-list.service';
@@ -115,12 +116,12 @@ export class RbdTrashListComponent implements OnInit {
       }
     ];
 
-    const itemFilter = (entry, task) => {
+    const itemFilter = (entry: any, task: Task) => {
       const imageSpec = new ImageSpec(entry.pool_name, entry.namespace, entry.id);
       return imageSpec.toString() === task.metadata['image_id_spec'];
     };
 
-    const taskFilter = (task) => {
+    const taskFilter = (task: Task) => {
       return ['rbd/trash/remove', 'rbd/trash/restore'].includes(task.name);
     };
 
@@ -136,9 +137,9 @@ export class RbdTrashListComponent implements OnInit {
   }
 
   prepareResponse(resp: any[]): any[] {
-    let images = [];
+    let images: any[] = [];
     const viewCacheStatusMap = {};
-    resp.forEach((pool) => {
+    resp.forEach((pool: Record<string, any>) => {
       if (_.isUndefined(viewCacheStatusMap[pool.status])) {
         viewCacheStatusMap[pool.status] = [];
       }
@@ -146,7 +147,7 @@ export class RbdTrashListComponent implements OnInit {
       images = images.concat(pool.value);
     });
 
-    const viewCacheStatusList = [];
+    const viewCacheStatusList: any[] = [];
     _.forEach(viewCacheStatusMap, (value: any, key) => {
       viewCacheStatusList.push({
         status: parseInt(key, 10),
@@ -208,7 +209,7 @@ export class RbdTrashListComponent implements OnInit {
     });
   }
 
-  isExpired(expiresAt): boolean {
+  isExpired(expiresAt: string): boolean {
     return moment().isAfter(expiresAt);
   }
 
index b02e3b73ebc82efbb6c8589573df54eb054160bb..458e3852d9104116223ba556a5c881b88d06e506 100644 (file)
@@ -52,7 +52,7 @@ describe('RbdTrashMoveModalComponent', () => {
   });
 
   describe('should call moveImage', () => {
-    let notificationService;
+    let notificationService: NotificationService;
 
     beforeEach(() => {
       notificationService = TestBed.get(NotificationService);
index 7ec5fe5b96ecc4e283006991285b32520dde1507..a968fe55698eb2c6ecbbea7a422c23afd98f5eb6 100644 (file)
@@ -47,11 +47,11 @@ export class RbdTrashMoveModalComponent implements OnInit {
       expiresAt: [
         '',
         [
-          CdValidators.custom('format', (expiresAt) => {
+          CdValidators.custom('format', (expiresAt: string) => {
             const result = expiresAt === '' || moment(expiresAt, 'YYYY-MM-DD HH:mm:ss').isValid();
             return !result;
           }),
-          CdValidators.custom('expired', (expiresAt) => {
+          CdValidators.custom('expired', (expiresAt: string) => {
             const result = moment().isAfter(expiresAt);
             return result;
           })
index 32969f10d7c5e48406c839711e274a7dcd28effa..0202b080a2e30f7fd27e95bb04f28b727c9961b3 100644 (file)
@@ -1,4 +1,8 @@
-import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
+import {
+  HttpClientTestingModule,
+  HttpTestingController,
+  TestRequest
+} from '@angular/common/http/testing';
 import { ComponentFixture, fakeAsync, TestBed, tick } from '@angular/core/testing';
 import { ReactiveFormsModule } from '@angular/forms';
 import { RouterTestingModule } from '@angular/router/testing';
@@ -69,7 +73,7 @@ describe('RbdTrashPurgeModalComponent', () => {
   describe('should call purge', () => {
     let notificationService: NotificationService;
     let modalRef: BsModalRef;
-    let req;
+    let req: TestRequest;
 
     beforeEach(() => {
       fixture.detectChanges();
index 730ee62f2530e7f363eaba817046d733aac0553c..fdb629c6f539161f42cc77a64d1f1e4723a5aa99 100644 (file)
@@ -10,6 +10,7 @@ import { FinishedTask } from '../../../shared/models/finished-task';
 import { Permission } from '../../../shared/models/permissions';
 import { AuthStorageService } from '../../../shared/services/auth-storage.service';
 import { TaskWrapperService } from '../../../shared/services/task-wrapper.service';
+import { Pool } from '../../pool/pool';
 
 @Component({
   selector: 'cd-rbd-trash-purge-modal',
@@ -42,8 +43,8 @@ export class RbdTrashPurgeModalComponent implements OnInit {
     if (this.poolPermission.read) {
       this.poolService.list(['pool_name', 'application_metadata']).then((resp) => {
         this.pools = resp
-          .filter((pool) => pool.application_metadata.includes('rbd'))
-          .map((pool) => pool.pool_name);
+          .filter((pool: Pool) => pool.application_metadata.includes('rbd'))
+          .map((pool: Pool) => pool.pool_name);
       });
     }
 
index 9dbab72e98cdc4f078f23b9627357af664281f28..79d800279b4da55259a62c9fb60ce7c1dbd819ca 100644 (file)
@@ -1,4 +1,8 @@
-import { HttpClientTestingModule, HttpTestingController } from '@angular/common/http/testing';
+import {
+  HttpClientTestingModule,
+  HttpTestingController,
+  TestRequest
+} from '@angular/common/http/testing';
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { ReactiveFormsModule } from '@angular/forms';
 import { RouterTestingModule } from '@angular/router/testing';
@@ -41,7 +45,7 @@ describe('RbdTrashRestoreModalComponent', () => {
     let httpTesting: HttpTestingController;
     let notificationService: NotificationService;
     let modalRef: BsModalRef;
-    let req;
+    let req: TestRequest;
 
     beforeEach(() => {
       httpTesting = TestBed.get(HttpTestingController);
index 976cdb0b9ba1ec489808e40396853485ca3f51a7..8255b442713a53474ab348222c37b2b3a4999088 100644 (file)
@@ -123,8 +123,8 @@ export class CephfsChartComponent implements OnChanges, OnInit {
     const chartTooltip = new ChartTooltip(
       this.chartCanvas,
       this.chartTooltip,
-      (tooltip) => tooltip.caretX + 'px',
-      (tooltip) => tooltip.caretY - tooltip.height - 23 + 'px'
+      (tooltip: any) => tooltip.caretX + 'px',
+      (tooltip: any) => tooltip.caretY - tooltip.height - 23 + 'px'
     );
     chartTooltip.getTitle = (ts) => moment(ts, 'x').format('LTS');
     chartTooltip.checkOffset = true;
@@ -160,8 +160,8 @@ export class CephfsChartComponent implements OnChanges, OnInit {
    * can handle (list of objects with millisecs-since-epoch
    * timestamps)
    */
-  private convertTimeSeries(sourceSeries) {
-    const data = [];
+  private convertTimeSeries(sourceSeries: any) {
+    const data: any[] = [];
     _.each(sourceSeries, (dp) => {
       data.push({
         x: dp[0] * 1000,
@@ -179,7 +179,7 @@ export class CephfsChartComponent implements OnChanges, OnInit {
     return data;
   }
 
-  private deltaTimeSeries(sourceSeries) {
+  private deltaTimeSeries(sourceSeries: any) {
     let i;
     let prev = sourceSeries[0];
     const result = [];
index 9a593d86f2c00ace9fb9c2c9c184a0211e23aeeb..1d80097c92bbffa39bf46c4220625caf11499497 100644 (file)
@@ -15,7 +15,13 @@ describe('CephfsDetailComponent', () => {
   let component: CephfsDetailComponent;
   let fixture: ComponentFixture<CephfsDetailComponent>;
 
-  const updateDetails = (standbys, pools, ranks, mdsCounters, name) => {
+  const updateDetails = (
+    standbys: string,
+    pools: any[],
+    ranks: any[],
+    mdsCounters: object,
+    name: string
+  ) => {
     component.data = {
       standbys,
       pools,
index 2261c0727fe61f97333bff330e5530ed1fd62207..d45fb70bf9c0fa966749bfaa4e911288741d64aa 100644 (file)
@@ -31,7 +31,7 @@ export class CephfsDetailComponent implements OnChanges, OnInit {
     ranks: CdTableColumn[];
     pools: CdTableColumn[];
   };
-  standbys = [];
+  standbys: any[] = [];
 
   objectValues = Object.values;
 
@@ -71,7 +71,7 @@ export class CephfsDetailComponent implements OnChanges, OnInit {
         {
           name: this.i18n('Usage'),
           cellTemplate: this.poolUsageTpl,
-          comparator: (_valueA, _valueB, rowA, rowB) => {
+          comparator: (_valueA: any, _valueB: any, rowA: any, rowB: any) => {
             const valA = rowA.used / rowA.avail;
             const valB = rowB.used / rowB.avail;
 
@@ -90,7 +90,7 @@ export class CephfsDetailComponent implements OnChanges, OnInit {
     };
   }
 
-  trackByFn(_index, item) {
+  trackByFn(_index: any, item: any) {
     return item.name;
   }
 }
index ed277400548e42a375c6f8dda2a372501cafff89..92d583b24f43089a08deb164bc3197b68b581025 100644 (file)
@@ -35,15 +35,15 @@ describe('CephfsDirectoriesComponent', () => {
   let component: CephfsDirectoriesComponent;
   let fixture: ComponentFixture<CephfsDirectoriesComponent>;
   let cephfsService: CephfsService;
-  let lsDirSpy;
-  let modalShowSpy;
-  let notificationShowSpy;
-  let minValidator;
-  let maxValidator;
-  let minBinaryValidator;
-  let maxBinaryValidator;
-  let originalDate;
-  let modal;
+  let lsDirSpy: jasmine.Spy;
+  let modalShowSpy: jasmine.Spy;
+  let notificationShowSpy: jasmine.Spy;
+  let minValidator: jasmine.Spy;
+  let maxValidator: jasmine.Spy;
+  let minBinaryValidator: jasmine.Spy;
+  let maxBinaryValidator: jasmine.Spy;
+  let originalDate: any;
+  let modal: any;
 
   // Get's private attributes or functions
   const get = {
@@ -123,7 +123,7 @@ describe('CephfsDirectoriesComponent', () => {
       });
       return of(data);
     },
-    mkSnapshot: (_id, path, name) => {
+    mkSnapshot: (_id: any, path: string, name: string) => {
       mockData.createdSnaps.push({
         name,
         path,
@@ -131,7 +131,7 @@ describe('CephfsDirectoriesComponent', () => {
       });
       return of(name);
     },
-    rmSnapshot: (_id, path, name) => {
+    rmSnapshot: (_id: any, path: string, name: string) => {
       mockData.deletedSnaps.push({
         name,
         path,
@@ -139,15 +139,15 @@ describe('CephfsDirectoriesComponent', () => {
       });
       return of(name);
     },
-    updateQuota: (_id, path, updated: CephfsQuotas) => {
+    updateQuota: (_id: any, path: string, updated: CephfsQuotas) => {
       mockData.updatedQuotas[path] = Object.assign(mockData.updatedQuotas[path] || {}, updated);
       return of('Response');
     },
-    modalShow: (comp, init) => {
+    modalShow: (comp: any, init: any) => {
       modal = modalServiceShow(comp, init);
       return modal.ref;
     },
-    date: (arg) => (arg ? new originalDate(arg) : new Date('2022-02-22T00:00:00')),
+    date: (arg: string) => (arg ? new originalDate(arg) : new Date('2022-02-22T00:00:00')),
     getControllerByPath: (path: string) => {
       return {
         expand: () => mockLib.expand(path),
@@ -251,12 +251,12 @@ describe('CephfsDirectoriesComponent', () => {
     noQuota: (key: 'bytes' | 'files') => {
       assert.quotaRow(key, '', 0, '');
     },
-    quotaIsNotInherited: (key: 'bytes' | 'files', shownValue, nextMaximum) => {
+    quotaIsNotInherited: (key: 'bytes' | 'files', shownValue: any, nextMaximum: number) => {
       const dir = component.selectedDir;
       const path = dir.path;
       assert.quotaRow(key, shownValue, nextMaximum, path);
     },
-    quotaIsInherited: (key: 'bytes' | 'files', shownValue, path) => {
+    quotaIsInherited: (key: 'bytes' | 'files', shownValue: any, path: string) => {
       const isBytes = key === 'bytes';
       const nextMaximum = get.nodeIds()[path].quotas[isBytes ? 'max_bytes' : 'max_files'];
       assert.quotaRow(key, shownValue, nextMaximum, path);
@@ -282,7 +282,7 @@ describe('CephfsDirectoriesComponent', () => {
         }
       });
     },
-    quotaUnsetModalTexts: (titleText, message, notificationMsg) => {
+    quotaUnsetModalTexts: (titleText: string, message: string, notificationMsg: string) => {
       expect(modalShowSpy).toHaveBeenCalledWith(ConfirmationModalComponent, {
         initialState: expect.objectContaining({
           titleText,
@@ -292,7 +292,7 @@ describe('CephfsDirectoriesComponent', () => {
       });
       expect(notificationShowSpy).toHaveBeenCalledWith(NotificationType.success, notificationMsg);
     },
-    quotaUpdateModalTexts: (titleText, message, notificationMsg) => {
+    quotaUpdateModalTexts: (titleText: string, message: string, notificationMsg: string) => {
       expect(modalShowSpy).toHaveBeenCalledWith(FormModalComponent, {
         initialState: expect.objectContaining({
           titleText,
index 5c90d143ee2a61791fbe27327439ee6d08110b3a..97debd6e40c0e2e536d1db5430779a9cb4bde249 100644 (file)
@@ -271,7 +271,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
     return this.dirs.filter((d) => d.parent.startsWith(path));
   }
 
-  selectOrigin(path) {
+  selectOrigin(path: string) {
     this.treeComponent.getControllerByNodeId(path).select();
   }
 
@@ -284,7 +284,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
   }
 
   private setSettings(node: Tree) {
-    const readable = (value: number, fn?: (number) => number | string): number | string =>
+    const readable = (value: number, fn?: (number: number) => number | string): number | string =>
       value ? (fn ? fn(value) : value) : '';
 
     this.settings = [
@@ -298,7 +298,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
   private getQuota(
     tree: Tree,
     quotaKey: string,
-    valueConvertFn: (number) => number | string
+    valueConvertFn: (number: number) => number | string
   ): QuotaSetting {
     // Get current maximum
     const currentPath = tree.id;
@@ -374,7 +374,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
           : undefined,
         fields: [this.getQuotaFormField(selection.row.name, key, value, nextMax.value)],
         submitButtonText: this.i18n('Save'),
-        onSubmit: (values) => this.updateQuota(values)
+        onSubmit: (values: CephfsQuotas) => this.updateQuota(values)
       }
     });
   }
@@ -498,7 +498,7 @@ export class CephfsDirectoriesComponent implements OnInit, OnChanges {
           }
         ],
         submitButtonText: this.i18n('Create Snapshot'),
-        onSubmit: (values) => {
+        onSubmit: (values: CephfsSnapshot) => {
           this.cephfsService.mkSnapshot(this.id, path, values.name).subscribe((name) => {
             this.notificationService.show(
               NotificationType.success,
index bb394e2424115a4caf2b9143a10fd38a68d1cff1..4d5c4c171ec9a0d3574c0bfdceba0ef4cff5e58d 100644 (file)
@@ -32,8 +32,8 @@ describe('CephfsTabsComponent', () => {
   };
 
   let old: any;
-  const getReload = () => component['reloadSubscriber'];
-  const setReload = (sth?) => (component['reloadSubscriber'] = sth);
+  const getReload: any = () => component['reloadSubscriber'];
+  const setReload = (sth?: any) => (component['reloadSubscriber'] = sth);
   const mockRunOutside = () => {
     component['subscribeInterval'] = () => {
       // It's mocked because the rxjs timer subscription ins't called through the use of 'tick'.
@@ -143,14 +143,14 @@ describe('CephfsTabsComponent', () => {
   });
 
   it('should set default values on id change before api request', () => {
-    const defaultDetails = {
+    const defaultDetails: Record<string, any> = {
       standbys: '',
       pools: [],
       ranks: [],
       mdsCounters: {},
       name: ''
     };
-    const defaultClients = {
+    const defaultClients: Record<string, any> = {
       data: [],
       status: ViewCacheStatus.ValueNone
     };
index 56132b969b9ad014655c6750fd0c3f58ef441327..9d606ae6af12b660027d87b90713a392e960f68f 100644 (file)
@@ -1,7 +1,7 @@
 import { Component, Input, NgZone, OnChanges, OnDestroy } from '@angular/core';
 
 import * as _ from 'lodash';
-import { timer } from 'rxjs';
+import { Subscription, timer } from 'rxjs';
 
 import { CephfsService } from '../../../shared/api/cephfs.service';
 import { ViewCacheStatus } from '../../../shared/enum/view-cache-status.enum';
@@ -25,13 +25,13 @@ export class CephfsTabsComponent implements OnChanges, OnDestroy {
 
   // Client tab
   id: number;
-  clients = {
+  clients: Record<string, any> = {
     data: [],
     status: ViewCacheStatus.ValueNone
   };
 
   // Details tab
-  details = {
+  details: Record<string, any> = {
     standbys: '',
     pools: [],
     ranks: [],
@@ -40,7 +40,7 @@ export class CephfsTabsComponent implements OnChanges, OnDestroy {
   };
 
   private data: any;
-  private reloadSubscriber;
+  private reloadSubscriber: Subscription;
 
   constructor(
     private ngZone: NgZone,
@@ -61,9 +61,9 @@ export class CephfsTabsComponent implements OnChanges, OnDestroy {
     }
   }
 
-  private setupSelected(id, mdsInfo) {
+  private setupSelected(id: number, mdsInfo: any) {
     this.id = id;
-    const firstMds = _.first(Object.values(mdsInfo));
+    const firstMds: any = _.first(Object.values(mdsInfo));
     this.grafanaId = firstMds && firstMds['name'];
     this.details = {
       standbys: '',
index d0652cb00beba1a80647cb14f98091d3a8115e2e..e99ff3cee971f7bb2709f3eb4d785d3774d24851 100644 (file)
@@ -133,7 +133,7 @@ export class ConfigurationFormComponent implements OnInit {
   }
 
   createRequest(): ConfigFormCreateRequestModel | null {
-    const values = [];
+    const values: any[] = [];
 
     this.availSections.forEach((section) => {
       const sectionValue = this.configForm.getValue(section);
index 712d0d8a064cb31cb27d4e788707f63a5ed1a5b9..63d1ee750fed1a519ba8dd5b0d8227ce662c1d70 100644 (file)
@@ -21,7 +21,7 @@ import { AuthStorageService } from '../../../shared/services/auth-storage.servic
 export class ConfigurationComponent implements OnInit {
   permission: Permission;
   tableActions: CdTableAction[];
-  data = [];
+  data: any[] = [];
   icons = Icons;
   columns: CdTableColumn[];
   selection = new CdTableSelection();
index 6f488f8932e44686fbc45a5f42dcbc279ae334bb..52359f269d6f80bfdd1668d849cff56f218b53ae 100644 (file)
@@ -13,7 +13,7 @@ export class CrushmapComponent implements OnInit {
   tree: TreeModel;
   metadata: any;
   metadataTitle: string;
-  metadataKeyMap: { [key: number]: number } = {};
+  metadataKeyMap: { [key: number]: any } = {};
 
   constructor(private healthService: HealthService) {}
 
@@ -34,8 +34,8 @@ export class CrushmapComponent implements OnInit {
       };
     }
 
-    const roots = [];
-    nodes.reverse().forEach((node) => {
+    const roots: any[] = [];
+    nodes.reverse().forEach((node: any) => {
       if (node.type === 'root') {
         roots.push(node.id);
       }
@@ -52,7 +52,7 @@ export class CrushmapComponent implements OnInit {
     };
   }
 
-  private generateTreeLeaf(node: any, treeNodeMap) {
+  private generateTreeLeaf(node: any, treeNodeMap: any) {
     const id = node.id;
     this.metadataKeyMap[id] = node;
     const settings = { static: true };
@@ -63,7 +63,7 @@ export class CrushmapComponent implements OnInit {
     const children: any[] = [];
     const resultNode = { value, status, settings, id, type: node.type };
     if (node.children) {
-      node.children.sort().forEach((childId) => {
+      node.children.sort().forEach((childId: any) => {
         children.push(treeNodeMap[childId]);
       });
 
index b2247f90b9ad974a87122ad89c13c4939319dc4d..889f60610ba789ad6778786e3fae3625e0de66a6 100644 (file)
@@ -20,7 +20,7 @@ import { HostsComponent } from './hosts.component';
 describe('HostsComponent', () => {
   let component: HostsComponent;
   let fixture: ComponentFixture<HostsComponent>;
-  let hostListSpy;
+  let hostListSpy: jasmine.Spy;
 
   const fakeAuthStorageService = {
     getPermissions: () => {
index 40ccb8b8ddc224825f8d6f2afeef0b9366f9a931..6af6eff886f679c74cb39335a79660badf34a99d 100644 (file)
@@ -136,7 +136,7 @@ export class HostsComponent implements OnInit {
     this.hostService.list().subscribe(
       (resp: any[]) => {
         resp.map((host) => {
-          host.services.map((service) => {
+          host.services.map((service: any) => {
             service.cdLink = `/perf_counters/${service.type}/${encodeURIComponent(service.id)}`;
             const permission = this.permissions[typeToPermissionKey[service.type]];
             service.canRead = permission ? permission.read : false;
index fcaf0400eda463fc42df62a7b83521938fe29838..ce5d3c2cfe32682a95bde573f5dafcfccf57d760 100644 (file)
@@ -179,7 +179,7 @@ export class InventoryDevicesComponent implements OnInit, OnChanges {
           }
         ],
         submitButtonText: this.i18n('Execute'),
-        onSubmit: (values) => {
+        onSubmit: (values: any) => {
           this.orchService.identifyDevice(hostname, device, values.duration).subscribe(() => {
             this.notificationService.show(
               NotificationType.success,
index 8b4436cc7ef47981ba1267edb8b59fd88e497d62..e4f69fc920dae200d4aea260212a0824f1d534a0 100644 (file)
@@ -57,7 +57,7 @@ describe('LogsComponent', () => {
   });
 
   describe('filterLogs', () => {
-    const contentData = {
+    const contentData: Record<string, any> = {
       clog: [
         {
           name: 'priority',
index 71424b84e99b168c17f74b14cdb2b7e6564e43e5..4810c5f8f8fbdb4da9ba7fdcdada4e8a10d7f518 100644 (file)
@@ -23,7 +23,7 @@ export class MgrModuleFormComponent implements OnInit {
   error = false;
   loading = false;
   moduleName = '';
-  moduleOptions = [];
+  moduleOptions: any[] = [];
 
   constructor(
     private route: ActivatedRoute,
@@ -58,7 +58,7 @@ export class MgrModuleFormComponent implements OnInit {
     });
   }
 
-  getValidators(moduleOption): ValidatorFn[] {
+  getValidators(moduleOption: any): ValidatorFn[] {
     const result = [];
     switch (moduleOption.type) {
       case 'addr':
index b3f4ee53901a4f72d0c47116d813f8b9dd786d6b..b7ade11d31dd28a7adf7d69fc0fbf4c52d0404e2 100644 (file)
@@ -23,7 +23,7 @@ describe('MonitorComponent', () => {
   beforeEach(() => {
     fixture = TestBed.createComponent(MonitorComponent);
     component = fixture.componentInstance;
-    const getMonitorPayload = {
+    const getMonitorPayload: Record<string, any> = {
       in_quorum: [
         {
           stats: { num_sessions: [[1, 5]] }
index d53f8626168758de50c8c4eba5e41926300f990f..c9a95592224abb002f06632e18aba59d9fb0f1cc 100644 (file)
@@ -28,7 +28,7 @@ export class MonitorComponent {
           prop: 'cdOpenSessions',
           name: this.i18n('Open Sessions'),
           cellTransformation: CellTemplate.sparkline,
-          comparator: (dataA, dataB) => {
+          comparator: (dataA: any, dataB: any) => {
             // We get the last value of time series to compare:
             const lastValueA = _.last(dataA);
             const lastValueB = _.last(dataB);
@@ -56,14 +56,14 @@ export class MonitorComponent {
 
   refresh() {
     this.monitorService.getMonitor().subscribe((data: any) => {
-      data.in_quorum.map((row) => {
-        row.cdOpenSessions = row.stats.num_sessions.map((i) => i[1]);
+      data.in_quorum.map((row: any) => {
+        row.cdOpenSessions = row.stats.num_sessions.map((i: string) => i[1]);
         row.cdLink = '/perf_counters/mon/' + row.name;
         row.cdParams = { fromLink: '/monitor' };
         return row;
       });
 
-      data.out_quorum.map((row) => {
+      data.out_quorum.map((row: any) => {
         row.cdLink = '/perf_counters/mon/' + row.name;
         row.cdParams = { fromLink: '/monitor' };
         return row;
index b372dde17fa4f283a86f801d62c2ed810e3b5055..16b7f20e331a1719a8486a382c67b5e2c8744f46 100644 (file)
@@ -20,7 +20,7 @@ describe('OsdDetailsComponent', () => {
   let fixture: ComponentFixture<OsdDetailsComponent>;
   let debugElement: DebugElement;
   let osdService: OsdService;
-  let getDetailsSpy;
+  let getDetailsSpy: jasmine.Spy;
 
   configureTestBed({
     imports: [HttpClientTestingModule, TabsModule.forRoot(), SharedModule],
index 6895a4bd85d3aa1abfa6250612bf868462917ac7..d454899c549d086f9fd7629c9a0d2ac7dd89331c 100644 (file)
@@ -10,6 +10,7 @@ import {
   i18nProviders
 } from '../../../../../testing/unit-test-helper';
 import { SharedModule } from '../../../../shared/shared.module';
+import { InventoryDevice } from '../../inventory/inventory-devices/inventory-device.model';
 import { InventoryDevicesComponent } from '../../inventory/inventory-devices/inventory-devices.component';
 import { OsdDevicesSelectionGroupsComponent } from './osd-devices-selection-groups.component';
 
@@ -17,7 +18,7 @@ describe('OsdDevicesSelectionGroupsComponent', () => {
   let component: OsdDevicesSelectionGroupsComponent;
   let fixture: ComponentFixture<OsdDevicesSelectionGroupsComponent>;
   let fixtureHelper: FixtureHelper;
-  const devices = [
+  const devices: InventoryDevice[] = [
     {
       hostname: 'node0',
       uid: '1',
@@ -126,7 +127,7 @@ describe('OsdDevicesSelectionGroupsComponent', () => {
       spyOn(component.cleared, 'emit');
       fixtureHelper.clickElement(clearTextSelector);
       fixtureHelper.expectElementVisible('cd-inventory-devices', false);
-      const event = {
+      const event: Record<string, any> = {
         type: undefined,
         clearedDevices: devices
       };
index fffd7db565989bb8e6ce91f10efe148630cea3bd..dd3e711d72f75de20d00b0fe8a54d32ce81a897c 100644 (file)
@@ -36,7 +36,7 @@ export class OsdDevicesSelectionGroupsComponent {
 
   icons = Icons;
   devices: InventoryDevice[] = [];
-  appliedFilters = [];
+  appliedFilters: any[] = [];
 
   constructor(private bsModalService: BsModalService) {}
 
index 24049bd8c9d35f0e1ad766b6574189d2929864eb..82e5a0b24d1331b66486173338cd60d5ef969df4 100644 (file)
@@ -49,9 +49,9 @@ export class OsdFormComponent implements OnInit {
   allDevices: InventoryDevice[] = [];
 
   availDevices: InventoryDevice[] = [];
-  dataDeviceFilters = [];
-  dbDeviceFilters = [];
-  walDeviceFilters = [];
+  dataDeviceFilters: any[] = [];
+  dbDeviceFilters: any[] = [];
+  walDeviceFilters: any[] = [];
   hostname = '';
   driveGroup = new DriveGroup();
 
@@ -129,7 +129,7 @@ export class OsdFormComponent implements OnInit {
         validators: [Validators.min(0)]
       }),
       features: new CdFormGroup(
-        this.featureList.reduce((acc, e) => {
+        this.featureList.reduce((acc: object, e) => {
           // disable initially because no data devices are selected
           acc[e.key] = new FormControl({ value: false, disabled: true });
           return acc;
index e747c66416ff8042e43e0dc59a692d6410c2d688..7064628e38dd27317c6a3bc3529bbc564b0b187a 100644 (file)
@@ -45,7 +45,8 @@ describe('OsdListComponent', () => {
     }
   };
 
-  const getTableAction = (name) => component.tableActions.find((action) => action.name === name);
+  const getTableAction = (name: string) =>
+    component.tableActions.find((action) => action.name === name);
 
   const setFakeSelection = () => {
     // Default data and selection
@@ -59,7 +60,7 @@ describe('OsdListComponent', () => {
     component.permissions = fakeAuthStorageService.getPermissions();
   };
 
-  const openActionModal = (actionName) => {
+  const openActionModal = (actionName: string) => {
     setFakeSelection();
     getTableAction(actionName).click();
   };
@@ -118,24 +119,25 @@ describe('OsdListComponent', () => {
   });
 
   describe('getOsdList', () => {
-    let osds;
-
-    const createOsd = (n: number) => ({
-      in: 'in',
-      up: 'up',
-      tree: {
-        device_class: 'ssd'
-      },
-      stats_history: {
-        op_out_bytes: [[n, n], [n * 2, n * 2]],
-        op_in_bytes: [[n * 3, n * 3], [n * 4, n * 4]]
-      },
-      stats: {
-        stat_bytes_used: n * n,
-        stat_bytes: n * n * n
-      },
-      state: []
-    });
+    let osds: any[];
+
+    const createOsd = (n: number) =>
+      <Record<string, any>>{
+        in: 'in',
+        up: 'up',
+        tree: {
+          device_class: 'ssd'
+        },
+        stats_history: {
+          op_out_bytes: [[n, n], [n * 2, n * 2]],
+          op_in_bytes: [[n * 3, n * 3], [n * 4, n * 4]]
+        },
+        stats: {
+          stat_bytes_used: n * n,
+          stat_bytes: n * n * n
+        },
+        state: []
+      };
 
     const expectAttributeOnEveryOsd = (attr: string) =>
       expect(component.osds.every((osd) => Boolean(_.get(osd, attr)))).toBeTruthy();
@@ -354,7 +356,7 @@ describe('OsdListComponent', () => {
      *
      * @param modalClass - The expected class of the modal
      */
-    const expectOpensModal = (actionName: string, modalClass): void => {
+    const expectOpensModal = (actionName: string, modalClass: any): void => {
       openActionModal(actionName);
 
       // @TODO: check why tsc is complaining when passing 'expectationFailOutput' param.
index 025615e496edbdcc278e53956f4f268e5dfe31c0..0c77fdcf94f1d0b491a06d180c48f455717b2a07 100644 (file)
@@ -58,9 +58,9 @@ export class OsdListComponent implements OnInit {
   icons = Icons;
 
   selection = new CdTableSelection();
-  osds = [];
+  osds: any[] = [];
 
-  protected static collectStates(osd) {
+  protected static collectStates(osd: any) {
     const states = [osd['in'] ? 'in' : 'out'];
     if (osd['up']) {
       states.push('up');
@@ -325,8 +325,8 @@ export class OsdListComponent implements OnInit {
     this.osdService.getList().subscribe((data: any[]) => {
       this.osds = data.map((osd) => {
         osd.collectedStates = OsdListComponent.collectStates(osd);
-        osd.stats_history.out_bytes = osd.stats_history.op_out_bytes.map((i) => i[1]);
-        osd.stats_history.in_bytes = osd.stats_history.op_in_bytes.map((i) => i[1]);
+        osd.stats_history.out_bytes = osd.stats_history.op_out_bytes.map((i: string) => i[1]);
+        osd.stats_history.in_bytes = osd.stats_history.op_in_bytes.map((i: string) => i[1]);
         osd.stats.usage = osd.stats.stat_bytes_used / osd.stats.stat_bytes;
         osd.cdIsBinary = true;
         return osd;
@@ -352,7 +352,7 @@ export class OsdListComponent implements OnInit {
           }
         ],
         submitButtonText: this.i18n('Edit OSD'),
-        onSubmit: (values) => {
+        onSubmit: (values: any) => {
           this.osdService.update(selectedOsd.id, values.deviceClass).subscribe(() => {
             this.notificationService.show(
               NotificationType.success,
@@ -367,7 +367,7 @@ export class OsdListComponent implements OnInit {
     });
   }
 
-  scrubAction(deep) {
+  scrubAction(deep: boolean) {
     if (!this.hasOsdSelected) {
       return;
     }
index 584446f9202ef01752d6faf0b452db7b1300503c..f81d51c2c0055884ee21fa27d23e79fa023cf9ce 100644 (file)
@@ -19,12 +19,12 @@ export class OsdPerformanceHistogramComponent implements OnChanges {
     this.render();
   }
 
-  hexdigits(v): string {
+  hexdigits(v: number): string {
     const i = Math.floor(v * 255).toString(16);
     return i.length === 1 ? '0' + i : i;
   }
 
-  hexcolor(r, g, b) {
+  hexcolor(r: number, g: number, b: number) {
     return '#' + this.hexdigits(r) + this.hexdigits(g) + this.hexdigits(b);
   }
 
@@ -46,8 +46,8 @@ export class OsdPerformanceHistogramComponent implements OnChanges {
       });
     });
 
-    this.valuesStyle = this.histogram.values.map((row, i) => {
-      return row.map((col, j) => {
+    this.valuesStyle = this.histogram.values.map((row: any, i: number) => {
+      return row.map((col: any, j: number) => {
         const val = this.last && this.last[i] && this.last[i][j] ? col - this.last[i][j] : col;
         const g = max ? val / max : 0;
         const r = 1 - g;
index 57855adbddcbd37059d9e76dc33a18823a308ef3..bae23227ada34c001040b11fc068872b3bdf9e7c 100755 (executable)
@@ -31,7 +31,7 @@ describe('OsdRecvSpeedModalComponent', () => {
     providers: [BsModalRef, i18nProviders]
   });
 
-  let configOptions = [];
+  let configOptions: any[] = [];
 
   beforeEach(() => {
     fixture = TestBed.createComponent(OsdRecvSpeedModalComponent);
@@ -72,8 +72,8 @@ describe('OsdRecvSpeedModalComponent', () => {
   });
 
   describe('ngOnInit', () => {
-    let setPriority;
-    let setValidators;
+    let setPriority: jasmine.Spy;
+    let setValidators: jasmine.Spy;
 
     beforeEach(() => {
       setPriority = spyOn(component, 'setPriority').and.callThrough();
@@ -192,35 +192,35 @@ describe('OsdRecvSpeedModalComponent', () => {
     };
 
     it('should return priority "low" if the config option values have been set accordingly', () => {
-      component.detectPriority(configOptionsLow, (priority) => {
+      component.detectPriority(configOptionsLow, (priority: Record<string, any>) => {
         expect(priority.name).toBe('low');
       });
       expect(component.osdRecvSpeedForm.getValue('customizePriority')).toBeFalsy();
     });
 
     it('should return priority "default" if the config option values have been set accordingly', () => {
-      component.detectPriority(configOptionsDefault, (priority) => {
+      component.detectPriority(configOptionsDefault, (priority: Record<string, any>) => {
         expect(priority.name).toBe('default');
       });
       expect(component.osdRecvSpeedForm.getValue('customizePriority')).toBeFalsy();
     });
 
     it('should return priority "high" if the config option values have been set accordingly', () => {
-      component.detectPriority(configOptionsHigh, (priority) => {
+      component.detectPriority(configOptionsHigh, (priority: Record<string, any>) => {
         expect(priority.name).toBe('high');
       });
       expect(component.osdRecvSpeedForm.getValue('customizePriority')).toBeFalsy();
     });
 
     it('should return priority "custom" if the config option values do not match any priority', () => {
-      component.detectPriority(configOptionsCustom, (priority) => {
+      component.detectPriority(configOptionsCustom, (priority: Record<string, any>) => {
         expect(priority.name).toBe('custom');
       });
       expect(component.osdRecvSpeedForm.getValue('customizePriority')).toBeTruthy();
     });
 
     it('should return no priority if the config option values are incomplete', () => {
-      component.detectPriority(configOptionsIncomplete, (priority) => {
+      component.detectPriority(configOptionsIncomplete, (priority: Record<string, any>) => {
         expect(priority.name).toBeNull();
       });
       expect(component.osdRecvSpeedForm.getValue('customizePriority')).toBeFalsy();
index d98ea39a855392f225c5f6037ded1fff821830ac..f23430800e01a4d4478fcc2340b504368d891eb5 100755 (executable)
@@ -23,7 +23,7 @@ export class OsdRecvSpeedModalComponent implements OnInit {
   osdRecvSpeedForm: CdFormGroup;
   permissions: Permissions;
 
-  priorities = [];
+  priorities: any[] = [];
   priorityAttrs = {};
 
   constructor(
@@ -82,7 +82,7 @@ export class OsdRecvSpeedModalComponent implements OnInit {
   ngOnInit() {
     this.configService.filter(Object.keys(this.priorityAttrs)).subscribe((data: any) => {
       const config_option_values = this.getCurrentValues(data);
-      this.detectPriority(config_option_values.values, (priority) => {
+      this.detectPriority(config_option_values.values, (priority: any) => {
         this.setPriority(priority);
       });
       this.setDescription(config_option_values.configOptions);
@@ -112,12 +112,12 @@ export class OsdRecvSpeedModalComponent implements OnInit {
   }
 
   getCurrentValues(configOptions: any) {
-    const currentValues = { values: {}, configOptions: [] };
-    configOptions.forEach((configOption) => {
+    const currentValues: Record<string, any> = { values: {}, configOptions: [] };
+    configOptions.forEach((configOption: any) => {
       currentValues.configOptions.push(configOption);
 
       if ('value' in configOption) {
-        configOption.value.forEach((value) => {
+        configOption.value.forEach((value: any) => {
           if (value.section === 'osd') {
             currentValues.values[configOption.name] = Number(value.value);
           }
@@ -194,13 +194,13 @@ export class OsdRecvSpeedModalComponent implements OnInit {
       };
       this.setPriority(customPriority);
     } else {
-      this.detectPriority(values, (priority) => {
+      this.detectPriority(values, (priority: any) => {
         this.setPriority(priority);
       });
     }
   }
 
-  onPriorityChange(selectedPriorityName) {
+  onPriorityChange(selectedPriorityName: string) {
     const selectedPriority =
       _.find(this.priorities, (p) => {
         return p.name === selectedPriorityName;
index 340dff9e615c1e3ab9a569a7b255e5b4e9b6e494..c19e523744527e3e542c9e463914c513c5df80a3 100644 (file)
@@ -18,7 +18,7 @@ import { NotificationService } from '../../../../shared/services/notification.se
 export class OsdScrubModalComponent implements OnInit {
   deep: boolean;
   scrubForm: FormGroup;
-  selected = [];
+  selected: any[] = [];
 
   constructor(
     public bsModalRef: BsModalRef,
index 73d5fd8a620ca9976aeed15a8f21cc5f0bfc636d..b160a67caa20116c02a5c43693a6076636705e8b 100644 (file)
@@ -41,15 +41,15 @@ describe('SilenceFormComponent', () => {
   let notificationService: NotificationService;
   let router: Router;
   // Spies
-  let rulesSpy;
-  let ifPrometheusSpy;
+  let rulesSpy: jasmine.Spy;
+  let ifPrometheusSpy: jasmine.Spy;
   // Helper
   let prometheus: PrometheusHelper;
   let formHelper: FormHelper;
   let fixtureH: FixtureHelper;
-  let params;
+  let params: Record<string, any>;
   // Date mocking related
-  let originalDate;
+  let originalDate: any;
   const baseTime = new Date('2022-02-22T00:00:00');
   const beginningDate = new Date('2022-02-22T00:00:12.35');
 
@@ -69,14 +69,14 @@ describe('SilenceFormComponent', () => {
       i18nProviders,
       {
         provide: ActivatedRoute,
-        useValue: { params: { subscribe: (fn) => fn(params) } }
+        useValue: { params: { subscribe: (fn: Function) => fn(params) } }
       }
     ]
   });
 
-  const createMatcher = (name, value, isRegex) => ({ name, value, isRegex });
+  const createMatcher = (name: string, value: any, isRegex: boolean) => ({ name, value, isRegex });
 
-  const addMatcher = (name, value, isRegex) =>
+  const addMatcher = (name: string, value: any, isRegex: boolean) =>
     component['setMatcher'](createMatcher(name, value, isRegex));
 
   const callInit = () =>
@@ -160,7 +160,7 @@ describe('SilenceFormComponent', () => {
   });
 
   it('should remind user if prometheus is not set when it is not configured', () => {
-    ifPrometheusSpy.and.callFake((_x, fn) => fn());
+    ifPrometheusSpy.and.callFake((_x: any, fn: Function) => fn());
     callInit();
     expect(component.rules).toEqual([]);
     expect(notificationService.show).toHaveBeenCalledWith(
@@ -174,7 +174,7 @@ describe('SilenceFormComponent', () => {
 
   describe('redirect not allowed users', () => {
     let prometheusPermissions: Permission;
-    let navigateSpy;
+    let navigateSpy: jasmine.Spy;
 
     const expectRedirect = (action: string, redirected: boolean) => {
       changeAction(action);
@@ -300,13 +300,13 @@ describe('SilenceFormComponent', () => {
   describe('time', () => {
     // Can't be used to set accurate UTC dates in unit tests as Date uses timezones,
     // this means the UTC time changes depending on the timezone you are in.
-    const changeDatePicker = (el, text) => {
+    const changeDatePicker = (el: any, text: string) => {
       el.triggerEventHandler('change', { target: { value: text } });
     };
-    const getDatePicker = (i) =>
+    const getDatePicker = (i: number) =>
       fixture.debugElement.queryAll(By.directive(BsDatepickerDirective))[i];
-    const changeEndDate = (text) => changeDatePicker(getDatePicker(1), text);
-    const changeStartDate = (text) => changeDatePicker(getDatePicker(0), text);
+    const changeEndDate = (text: string) => changeDatePicker(getDatePicker(1), text);
+    const changeStartDate = (text: string) => changeDatePicker(getDatePicker(0), text);
 
     it('have all dates set at beginning', () => {
       expect(form.getValue('startsAt')).toEqual(baseTime);
@@ -390,7 +390,7 @@ describe('SilenceFormComponent', () => {
   });
 
   describe('matchers', () => {
-    const expectMatch = (helpText) => {
+    const expectMatch = (helpText: string) => {
       expect(fixtureH.getText('#match-state')).toBe(helpText);
     };
 
@@ -464,7 +464,7 @@ describe('SilenceFormComponent', () => {
       spyOn(modalService, 'show').and.callFake(() => {
         return {
           content: {
-            preFillControls: (matcher) => {
+            preFillControls: (matcher: any) => {
               expect(matcher).toBe(component.matchers[0]);
             },
             submitAction: of({ name: 'alertname', value: 'alert0', isRegex: false })
@@ -514,7 +514,7 @@ describe('SilenceFormComponent', () => {
     let silence: AlertmanagerSilence;
     const silenceId = '50M3-10N6-1D';
 
-    const expectSuccessNotification = (titleStartsWith) =>
+    const expectSuccessNotification = (titleStartsWith: string) =>
       expect(notificationService.show).toHaveBeenCalledWith(
         NotificationType.success,
         `${titleStartsWith} silence ${silenceId}`,
index d063b7309c1a5975265994d2dd8c92edba35b5e5..4573d71b2fe5c406a7489713eca1bef15d1f9c3f 100644 (file)
@@ -105,7 +105,7 @@ describe('SilenceListComponent', () => {
       deletion.callSubmitAction();
     };
 
-    const expectSilenceToExpire = (silenceId) => {
+    const expectSilenceToExpire = (silenceId: string) => {
       setSelectedSilence(silenceId);
       expireSilence();
       expect(prometheusService.expireSilence).toHaveBeenCalledWith(silenceId);
index cd8fa2802117afac829e8be45d826f1343ad02a9..d7d9a86ab7bb4762bef1f58dff3fc34348335de6 100644 (file)
@@ -78,7 +78,7 @@ describe('SilenceMatcherModalComponent', () => {
   });
 
   describe('test rule matching', () => {
-    const expectMatch = (name, value, helpText) => {
+    const expectMatch = (name: string, value: string, helpText: string) => {
       component.preFillControls({
         name: name,
         value: value,
@@ -154,7 +154,7 @@ describe('SilenceMatcherModalComponent', () => {
       isRegex: false
     };
     component.preFillControls(controlValues);
-    component.submitAction.subscribe((resp) => {
+    component.submitAction.subscribe((resp: object) => {
       expect(resp).toEqual(controlValues);
       done();
     });
index d04537fca1e364830c8081bdb8c83ab0e4d6256b..139a3ee23a87dd0648d99423bfe72cf63c240968 100644 (file)
@@ -62,7 +62,7 @@ export class SilenceMatcherModalComponent {
     });
   }
 
-  private setPossibleValues(name) {
+  private setPossibleValues(name: string) {
     this.possibleValues = _.sortedUniq(
       this.rules.map((r) => _.get(r, this.silenceMatcher.getAttributePath(name))).filter((x) => x)
     );
index 4a3eb707609ec138c92e33eca1113f342c2d18d9..6dce33439b2f259168ed305af35a2ae4ba5767af 100644 (file)
@@ -54,7 +54,7 @@ export class HealthPieComponent implements OnChanges, OnInit {
         display: true,
         position: 'right',
         labels: { usePointStyle: true },
-        onClick: (event, legendItem) => {
+        onClick: (event: any, legendItem: any) => {
           this.onLegendClick(event, legendItem);
         }
       },
@@ -67,7 +67,7 @@ export class HealthPieComponent implements OnChanges, OnInit {
       }
     }
   };
-  private hiddenSlices = [];
+  private hiddenSlices: any[] = [];
 
   constructor(private dimlessBinary: DimlessBinaryPipe, private dimless: DimlessPipe) {}
 
@@ -98,11 +98,11 @@ export class HealthPieComponent implements OnChanges, OnInit {
       }
     });
 
-    const getStyleTop = (tooltip, positionY) => {
+    const getStyleTop = (tooltip: any, positionY: number) => {
       return positionY + tooltip.caretY - tooltip.height - 10 + 'px';
     };
 
-    const getStyleLeft = (tooltip, positionX) => {
+    const getStyleLeft = (tooltip: any, positionX: number) => {
       return positionX + tooltip.caretX + 'px';
     };
 
@@ -113,13 +113,13 @@ export class HealthPieComponent implements OnChanges, OnInit {
       getStyleTop
     );
 
-    const getBody = (body) => {
+    const getBody = (body: any) => {
       return this.getChartTooltipBody(body);
     };
 
     chartTooltip.getBody = getBody;
 
-    this.chartConfig.options.tooltips.custom = (tooltip) => {
+    this.chartConfig.options.tooltips.custom = (tooltip: any) => {
       chartTooltip.customTooltips(tooltip);
     };
 
@@ -146,7 +146,7 @@ export class HealthPieComponent implements OnChanges, OnInit {
     this.setChartSliceBorderWidth();
   }
 
-  private getChartTooltipBody(body) {
+  private getChartTooltipBody(body: string[]) {
     const bodySplit = body[0].split(': ');
 
     if (this.showLabelAsTooltip) {
@@ -171,14 +171,14 @@ export class HealthPieComponent implements OnChanges, OnInit {
     this.chartConfig.dataset[0].borderWidth = nonZeroValueSlices > 1 ? 1 : 0;
   }
 
-  private onLegendClick(event, legendItem) {
+  private onLegendClick(event: any, legendItem: any) {
     event.stopPropagation();
     this.hiddenSlices[legendItem.index] = !legendItem.hidden;
     this.ngOnChanges();
   }
 
   private hideSlices() {
-    _.forEach(this.chartConfig.dataset[0].data, (_slice, sliceIndex) => {
+    _.forEach(this.chartConfig.dataset[0].data, (_slice, sliceIndex: number) => {
       if (this.hiddenSlices[sliceIndex]) {
         this.chartConfig.dataset[0].data[sliceIndex] = undefined;
       }
index de7892a07a682f6715c1278972edd56ae349800f..17bc30b9f6afeab306f0dda64f09cb7583761673 100644 (file)
@@ -25,8 +25,8 @@ import { HealthComponent } from './health.component';
 describe('HealthComponent', () => {
   let component: HealthComponent;
   let fixture: ComponentFixture<HealthComponent>;
-  let getHealthSpy;
-  const healthPayload = {
+  let getHealthSpy: jasmine.Spy;
+  const healthPayload: Record<string, any> = {
     health: { status: 'HEALTH_OK' },
     mon_status: { monmap: { mons: [] }, quorum: [] },
     osd_map: { osds: [] },
@@ -46,7 +46,7 @@ describe('HealthComponent', () => {
       return new Permissions({ log: ['read'] });
     }
   };
-  let fakeFeatureTogglesService;
+  let fakeFeatureTogglesService: jasmine.Spy;
 
   configureTestBed({
     imports: [SharedModule, HttpClientTestingModule, PopoverModule.forRoot()],
@@ -176,7 +176,7 @@ describe('HealthComponent', () => {
   });
 
   it('should render all groups and 1 card per group', () => {
-    const payload = { hosts: 0, scrub_status: 'Inactive', pools: [] };
+    const payload: Record<string, any> = { hosts: 0, scrub_status: 'Inactive', pools: [] };
 
     getHealthSpy.and.returnValue(of(payload));
     fixture.detectChanges();
@@ -256,7 +256,7 @@ describe('HealthComponent', () => {
   });
 
   describe('preparePgStatus', () => {
-    const calcPercentage = (data) => Math.round((data / 10) * 100) || 0;
+    const calcPercentage = (data: number) => Math.round((data / 10) * 100) || 0;
 
     const expectedChart = (data: number[]) => ({
       labels: [
index 3906e559cf87886b362cf6018e74072a74725e42..7b6e5f8a0fbc92210348902c78f9f75bc20be9f5 100644 (file)
@@ -94,7 +94,7 @@ export class HealthComponent implements OnInit, OnDestroy {
     });
   }
 
-  prepareReadWriteRatio(chart) {
+  prepareReadWriteRatio(chart: Record<string, any>) {
     const ratioLabels = [];
     const ratioData = [];
 
@@ -120,7 +120,7 @@ export class HealthComponent implements OnInit, OnDestroy {
     chart.labels = ratioLabels;
   }
 
-  prepareRawUsage(chart, data) {
+  prepareRawUsage(chart: Record<string, any>, data: Record<string, any>) {
     const percentAvailable = this.calcPercentage(
       data.df.stats.total_bytes - data.df.stats.total_used_raw_bytes,
       data.df.stats.total_bytes
@@ -146,8 +146,8 @@ export class HealthComponent implements OnInit, OnDestroy {
     )} ${this.i18n('total')}`;
   }
 
-  preparePgStatus(chart, data) {
-    const categoryPgAmount = {};
+  preparePgStatus(chart: Record<string, any>, data: Record<string, any>) {
+    const categoryPgAmount: Record<string, number> = {};
     let totalPgs = 0;
 
     _.forEach(data.pg_info.statuses, (pgAmount, pgStatesText) => {
@@ -172,7 +172,7 @@ export class HealthComponent implements OnInit, OnDestroy {
     ];
   }
 
-  prepareObjects(chart, data) {
+  prepareObjects(chart: Record<string, any>, data: Record<string, any>) {
     const totalReplicas = data.pg_info.object_stats.num_object_copies;
     const healthy =
       totalReplicas -
index 98e903ec96371a45dd693f1924dd2414d6f407a3..159438c7776a797d276e83aeb80cc5a7d290e57b 100644 (file)
@@ -46,7 +46,7 @@ describe('MdsSummaryPipe', () => {
   });
 
   it('transforms with 0 filesystems', () => {
-    const payload = {
+    const payload: Record<string, any> = {
       standbys: [0],
       filesystems: []
     };
index 689f9da44b79cefc0277bd4d93c2d1281ae69921..ffa58d918768f152344ed69a4befa23d2d8eb93e 100644 (file)
@@ -24,7 +24,7 @@ describe('MgrSummaryPipe', () => {
   });
 
   it('transforms with active_name undefined', () => {
-    const payload = {
+    const payload: Record<string, any> = {
       active_name: undefined,
       standbys: []
     };
index f3f2829414803ae8777d12de5a00b23dd7b9110c..a1d1c6d349b80c0b5e59187e3c4103481dc8d862 100644 (file)
@@ -14,7 +14,7 @@ describe('NfsDetailsComponent', () => {
   let component: NfsDetailsComponent;
   let fixture: ComponentFixture<NfsDetailsComponent>;
 
-  const elem = (css) => fixture.debugElement.query(By.css(css));
+  const elem = (css: string) => fixture.debugElement.query(By.css(css));
 
   configureTestBed({
     declarations: [NfsDetailsComponent],
index 0219585c3bb8ac1f06656efc804d5d22b73512c8..db91c7d53388c267419f97edbee2fd171db721a8 100644 (file)
@@ -19,7 +19,7 @@ export class NfsDetailsComponent implements OnChanges {
   data: any;
 
   clientsColumns: CdTableColumn[];
-  clients = [];
+  clients: any[] = [];
 
   constructor(private i18n: I18n) {
     this.clientsColumns = [
@@ -51,7 +51,7 @@ export class NfsDetailsComponent implements OnChanges {
       this.data[this.i18n('Cluster')] = this.selectedItem.cluster_id;
       this.data[this.i18n('Daemons')] = this.selectedItem.daemons;
       this.data[this.i18n('NFS Protocol')] = this.selectedItem.protocols.map(
-        (protocol) => 'NFSv' + protocol
+        (protocol: string) => 'NFSv' + protocol
       );
       this.data[this.i18n('Pseudo')] = this.selectedItem.pseudo;
       this.data[this.i18n('Access Type')] = this.selectedItem.access_type;
index 5067f5a2ba7430ad4629962548c49713962f0552..0c9bc088dc50cbd9dffaaddd6155f01609bb21f9 100644 (file)
@@ -1,5 +1,5 @@
 import { Component, Input } from '@angular/core';
-import { FormArray, FormControl, Validators } from '@angular/forms';
+import { FormArray, FormControl, NgForm, Validators } from '@angular/forms';
 
 import { I18n } from '@ngx-translate/i18n-polyfill';
 import * as _ from 'lodash';
@@ -30,7 +30,7 @@ export class NfsFormClientComponent {
     return this.i18n('-- Select the access type --');
   }
 
-  getAccessTypeHelp(index) {
+  getAccessTypeHelp(index: number) {
     const accessTypeItem = this.nfsAccessType.find((currentAccessTypeItem) => {
       return this.getValue(index, 'access_type') === currentAccessTypeItem.value;
     });
@@ -62,16 +62,16 @@ export class NfsFormClientComponent {
     return fg;
   }
 
-  removeClient(index) {
+  removeClient(index: number) {
     const clients = this.form.get('clients') as FormArray;
     clients.removeAt(index);
   }
 
-  showError(index, control, formDir, x) {
+  showError(index: number, control: string, formDir: NgForm, x: string) {
     return (<any>this.form.controls.clients).controls[index].showError(control, formDir, x);
   }
 
-  getValue(index, control) {
+  getValue(index: number, control: string) {
     const clients = this.form.get('clients') as FormArray;
     const client = clients.at(index) as CdFormGroup;
     return client.getValue(control);
@@ -84,7 +84,7 @@ export class NfsFormClientComponent {
     });
   }
 
-  trackByFn(index) {
+  trackByFn(index: number) {
     return index;
   }
 }
index 5a4dbaf20058eaddf994dbae1541a09b98a57aa6..d152eaa96e611de847ba0e76fc8aa64e9d9141da 100644 (file)
@@ -37,8 +37,8 @@ export class NfsFormComponent implements OnInit {
   nfsForm: CdFormGroup;
   isEdit = false;
 
-  cluster_id = null;
-  export_id = null;
+  cluster_id: string = null;
+  export_id: string = null;
 
   isNewDirectory = false;
   isNewBucket = false;
@@ -98,7 +98,7 @@ export class NfsFormComponent implements OnInit {
   }
 
   ngOnInit() {
-    const promises: any[] = [
+    const promises: Observable<any>[] = [
       this.nfsService.daemon(),
       this.nfsService.fsals(),
       this.nfsService.clients(),
@@ -128,7 +128,7 @@ export class NfsFormComponent implements OnInit {
     this.docsUrl = `http://docs.ceph.com/docs/${releaseName}/radosgw/nfs/`;
   }
 
-  getData(promises) {
+  getData(promises: Observable<any>[]) {
     forkJoin(promises).subscribe((data: any[]) => {
       this.resolveDaemons(data[0]);
       this.resolvefsals(data[1]);
@@ -175,14 +175,14 @@ export class NfsFormComponent implements OnInit {
       path: new FormControl(''),
       protocolNfsv3: new FormControl(true, {
         validators: [
-          CdValidators.requiredIf({ protocolNfsv4: false }, (value) => {
+          CdValidators.requiredIf({ protocolNfsv4: false }, (value: boolean) => {
             return !value;
           })
         ]
       }),
       protocolNfsv4: new FormControl(true, {
         validators: [
-          CdValidators.requiredIf({ protocolNfsv3: false }, (value) => {
+          CdValidators.requiredIf({ protocolNfsv3: false }, (value: boolean) => {
             return !value;
           })
         ]
@@ -202,14 +202,14 @@ export class NfsFormComponent implements OnInit {
       }),
       transportUDP: new FormControl(true, {
         validators: [
-          CdValidators.requiredIf({ transportTCP: false }, (value) => {
+          CdValidators.requiredIf({ transportTCP: false }, (value: boolean) => {
             return !value;
           })
         ]
       }),
       transportTCP: new FormControl(true, {
         validators: [
-          CdValidators.requiredIf({ transportUDP: false }, (value) => {
+          CdValidators.requiredIf({ transportUDP: false }, (value: boolean) => {
             return !value;
           })
         ]
@@ -223,7 +223,7 @@ export class NfsFormComponent implements OnInit {
     });
   }
 
-  resolveModel(res) {
+  resolveModel(res: any) {
     if (res.fsal.name === 'CEPH') {
       res.sec_label_xattr = res.fsal.sec_label_xattr;
     }
@@ -242,9 +242,9 @@ export class NfsFormComponent implements OnInit {
     res.transportUDP = res.transports.indexOf('UDP') !== -1;
     delete res.transports;
 
-    res.clients.forEach((client) => {
+    res.clients.forEach((client: any) => {
       let addressStr = '';
-      client.addresses.forEach((address) => {
+      client.addresses.forEach((address: string) => {
         addressStr += address + ', ';
       });
       if (addressStr.length >= 2) {
@@ -258,7 +258,7 @@ export class NfsFormComponent implements OnInit {
     this.nfsClients.resolveModel(res.clients);
   }
 
-  resolveDaemons(daemons) {
+  resolveDaemons(daemons: Record<string, any>) {
     daemons = _.sortBy(daemons, ['daemon_id']);
 
     this.allClusters = _(daemons)
@@ -294,7 +294,7 @@ export class NfsFormComponent implements OnInit {
         this.allFsals.push(fsalItem);
         if (fsalItem.value === 'RGW') {
           this.rgwUserService.list().subscribe((result: any) => {
-            result.forEach((user) => {
+            result.forEach((user: Record<string, any>) => {
               if (user.suspended === 0 && user.keys.length > 0) {
                 this.allRgwUsers.push(user.user_id);
               }
@@ -311,11 +311,11 @@ export class NfsFormComponent implements OnInit {
     }
   }
 
-  resolveClients(clients) {
+  resolveClients(clients: any[]) {
     this.allCephxClients = clients;
   }
 
-  resolveFilesystems(filesystems) {
+  resolveFilesystems(filesystems: any[]) {
     this.allFsNames = filesystems;
     if (filesystems.length === 1) {
       this.nfsForm.patchValue({
@@ -362,7 +362,7 @@ export class NfsFormComponent implements OnInit {
     });
   }
 
-  getAccessTypeHelp(accessType) {
+  getAccessTypeHelp(accessType: string) {
     const accessTypeItem = this.nfsAccessType.find((currentAccessTypeItem) => {
       if (accessType === currentAccessTypeItem.value) {
         return currentAccessTypeItem;
@@ -381,7 +381,7 @@ export class NfsFormComponent implements OnInit {
     return '';
   }
 
-  getPathTypeahead(path) {
+  getPathTypeahead(path: any) {
     if (!_.isString(path) || path === '/') {
       return of([]);
     }
@@ -475,7 +475,7 @@ export class NfsFormComponent implements OnInit {
     this.nfsForm.patchValue({ daemons: [] });
   }
 
-  removeDaemon(index, daemon) {
+  removeDaemon(index: number, daemon: string) {
     this.daemonsSelections.forEach((value) => {
       if (value.name === daemon) {
         value.selected = false;
@@ -566,7 +566,7 @@ export class NfsFormComponent implements OnInit {
     }
     delete requestModel.transportUDP;
 
-    requestModel.clients.forEach((client) => {
+    requestModel.clients.forEach((client: any) => {
       if (_.isString(client.addresses)) {
         client.addresses = _(client.addresses)
           .split(/[ ,]+/)
index ffda63de6298fb463105070960dcee00d2378405..cbf38d72b5d3f9f73f4c5d3c395284f2b5ee2549 100644 (file)
@@ -28,7 +28,7 @@ describe('NfsListComponent', () => {
   let nfsService: NfsService;
   let httpTesting: HttpTestingController;
 
-  const refresh = (data) => {
+  const refresh = (data: object) => {
     summaryService['summaryDataSource'].next(data);
   };
 
@@ -96,7 +96,7 @@ describe('NfsListComponent', () => {
   describe('handling of executing tasks', () => {
     let exports: any[];
 
-    const addExport = (export_id) => {
+    const addExport = (export_id: string) => {
       const model = {
         export_id: export_id,
         path: 'path_' + export_id,
index ea5740f1c9876f66d3e17a67e7dd2be44e5c815e..2a5c874051d88d5467e0db6f9ba7273a4236c395 100644 (file)
@@ -17,6 +17,7 @@ import { CdTableColumn } from '../../../shared/models/cd-table-column';
 import { CdTableSelection } from '../../../shared/models/cd-table-selection';
 import { FinishedTask } from '../../../shared/models/finished-task';
 import { Permission } from '../../../shared/models/permissions';
+import { Task } from '../../../shared/models/task';
 import { AuthStorageService } from '../../../shared/services/auth-storage.service';
 import { TaskListService } from '../../../shared/services/task-list.service';
 import { TaskWrapperService } from '../../../shared/services/task-wrapper.service';
@@ -48,7 +49,7 @@ export class NfsListComponent implements OnInit, OnDestroy {
   modalRef: BsModalRef;
 
   builders = {
-    'nfs/create': (metadata) => {
+    'nfs/create': (metadata: any) => {
       return {
         path: metadata['path'],
         cluster_id: metadata['cluster_id'],
@@ -170,8 +171,8 @@ export class NfsListComponent implements OnInit, OnDestroy {
   }
 
   prepareResponse(resp: any): any[] {
-    let result = [];
-    resp.forEach((nfs) => {
+    let result: any[] = [];
+    resp.forEach((nfs: any) => {
       nfs.id = `${nfs.cluster_id}:${nfs.export_id}`;
       nfs.state = 'LOADING';
       result = result.concat(nfs);
@@ -185,14 +186,14 @@ export class NfsListComponent implements OnInit, OnDestroy {
     this.viewCacheStatus = { status: ViewCacheStatus.ValueException };
   }
 
-  itemFilter(entry, task) {
+  itemFilter(entry: any, task: Task) {
     return (
       entry.cluster_id === task.metadata['cluster_id'] &&
       entry.export_id === task.metadata['export_id']
     );
   }
 
-  taskFilter(task) {
+  taskFilter(task: Task) {
     return ['nfs/create', 'nfs/delete', 'nfs/edit'].includes(task.name);
   }
 
index 1bfcd20f624a474a8ccbb3a0ab5ef44ec5842b8a..0ef4e37184dd1ae480e2298fd31fc198307280c8 100644 (file)
@@ -87,7 +87,7 @@ describe('ErasureCodeProfileFormComponent', () => {
     });
 
     it(`should show all default form controls`, () => {
-      const showDefaults = (plugin) => {
+      const showDefaults = (plugin: string) => {
         formHelper.setValue('plugin', plugin);
         fixtureHelper.expectIdElementsVisible(
           [
index d707bf901e6f0f43c5c8556563eae34e5e35eb30..614902e0c8bed25679e934e27ccfa5ddd7d749f7 100644 (file)
@@ -64,7 +64,7 @@ export class ErasureCodeProfileFormComponent implements OnInit {
           Validators.pattern('[A-Za-z0-9_-]+'),
           CdValidators.custom(
             'uniqueName',
-            (value) => this.names && this.names.indexOf(value) !== -1
+            (value: string) => this.names && this.names.indexOf(value) !== -1
           )
         ]
       ],
@@ -88,7 +88,7 @@ export class ErasureCodeProfileFormComponent implements OnInit {
     this.form.get('plugin').valueChanges.subscribe((plugin) => this.onPluginChange(plugin));
   }
 
-  onPluginChange(plugin) {
+  onPluginChange(plugin: string) {
     this.plugin = plugin;
     if (plugin === this.PLUGIN.JERASURE) {
       this.setJerasureDefaults();
index d8c4624d4ee75e6118c1d2c36b77efdfdc9d29f2..adcc50b51828e5eac41adda6235a7ca5290f63d0 100644 (file)
@@ -45,13 +45,13 @@ describe('PoolFormComponent', () => {
   let router: Router;
   let ecpService: ErasureCodeProfileService;
 
-  const setPgNum = (pgs): AbstractControl => {
+  const setPgNum = (pgs: number): AbstractControl => {
     const control = formHelper.setValue('pgNum', pgs);
     fixture.debugElement.query(By.css('#pgNum')).nativeElement.dispatchEvent(new Event('blur'));
     return control;
   };
 
-  const testPgUpdate = (pgs, jump, returnValue) => {
+  const testPgUpdate = (pgs: number, jump: number, returnValue: number) => {
     if (pgs) {
       setPgNum(pgs);
     }
@@ -278,7 +278,7 @@ describe('PoolFormComponent', () => {
       component.ngOnInit(); // Switches form into edit mode
       formHelper.setValue('poolType', 'erasure');
       fixture.detectChanges();
-      formHelper.expectValid(setPgNum('8'));
+      formHelper.expectValid(setPgNum(8));
     });
 
     it('is valid if pgNum, poolType and name are valid', () => {
@@ -379,7 +379,7 @@ describe('PoolFormComponent', () => {
       });
 
       it('validates that odd size validator works as expected', () => {
-        const odd = (min, max) => component['oddBlobSize'](min, max);
+        const odd = (min: string, max: string) => component['oddBlobSize'](min, max);
         expect(odd('10', '8')).toBe(true);
         expect(odd('8', '-')).toBe(false);
         expect(odd('8', '10')).toBe(false);
@@ -683,7 +683,7 @@ describe('PoolFormComponent', () => {
         expected: 256
       });
 
-      const testPgCalc = ({ type, osds, size, ecp, expected }) => {
+      const testPgCalc = ({ type, osds, size, ecp, expected }: Record<string, any>) => {
         component.info.osd_count = osds;
         formHelper.setValue('poolType', type);
         if (type === 'replicated') {
@@ -813,7 +813,7 @@ describe('PoolFormComponent', () => {
         deletion.submitActionObservable();
       };
 
-      const testPoolDeletion = (name) => {
+      const testPoolDeletion = (name: string) => {
         setSelectedEcp(name);
         callDeletion();
         expect(ecpService.delete).toHaveBeenCalledWith(name);
@@ -848,12 +848,12 @@ describe('PoolFormComponent', () => {
   });
 
   describe('submit - create', () => {
-    const setMultipleValues = (settings: {}) => {
+    const setMultipleValues = (settings: object) => {
       Object.keys(settings).forEach((name) => {
         formHelper.setValue(name, settings[name]);
       });
     };
-    const testCreate = (pool) => {
+    const testCreate = (pool: object) => {
       expectValidSubmit(pool, 'pool/create', 'create');
     };
 
@@ -1006,7 +1006,7 @@ describe('PoolFormComponent', () => {
   });
 
   describe('edit mode', () => {
-    const setUrl = (url) => {
+    const setUrl = (url: string) => {
       Object.defineProperty(router, 'url', { value: url });
       setUpPoolComponent(); // Renew of component needed because the constructor has to be called
     };
@@ -1071,12 +1071,9 @@ describe('PoolFormComponent', () => {
       });
 
       it('should include the custom app as valid option', () => {
-        expect(component.data.applications.available.map((app) => app.name)).toEqual([
-          'cephfs',
-          'ownApp',
-          'rbd',
-          'rgw'
-        ]);
+        expect(
+          component.data.applications.available.map((app: Record<string, any>) => app.name)
+        ).toEqual(['cephfs', 'ownApp', 'rbd', 'rgw']);
       });
 
       it('set all control values to the given pool', () => {
@@ -1105,7 +1102,8 @@ describe('PoolFormComponent', () => {
       });
 
       describe('submit', () => {
-        const markControlAsPreviouslySet = (controlName) => form.get(controlName).markAsPristine();
+        const markControlAsPreviouslySet = (controlName: string) =>
+          form.get(controlName).markAsPristine();
 
         beforeEach(() => {
           ['algorithm', 'maxBlobSize', 'minBlobSize', 'mode', 'pgNum', 'ratio', 'name'].forEach(
index 78784867983dcb9932a2caf61e9e270d5c9c2ca7..34500296125e89a5c12e88bd10bad29a7822d5a3 100644 (file)
@@ -58,7 +58,7 @@ export class PoolFormComponent implements OnInit {
   data = new PoolFormData(this.i18n);
   externalPgChange = false;
   private modalSubscription: Subscription;
-  current = {
+  current: Record<string, any> = {
     rules: []
   };
   initializeConfigData = new EventEmitter<{
@@ -141,7 +141,7 @@ export class PoolFormComponent implements OnInit {
           validators: [
             CdValidators.custom(
               'tooFewOsds',
-              (rule) => this.info && rule && this.info.osd_count < rule.min_size
+              (rule: any) => this.info && rule && this.info.osd_count < rule.min_size
             )
           ]
         }),
@@ -160,7 +160,7 @@ export class PoolFormComponent implements OnInit {
           validators: [Validators.min(0)]
         })
       },
-      [CdValidators.custom('form', () => null)]
+      [CdValidators.custom('form', (): null => null)]
     );
   }
 
@@ -411,7 +411,7 @@ export class PoolFormComponent implements OnInit {
     }
   }
 
-  private replicatedPgCalc(pgs): number {
+  private replicatedPgCalc(pgs: number): number {
     const sizeControl = this.form.get('size');
     const size = sizeControl.value;
     if (sizeControl.valid && size > 0) {
@@ -421,7 +421,7 @@ export class PoolFormComponent implements OnInit {
     return undefined;
   }
 
-  private erasurePgCalc(pgs): number {
+  private erasurePgCalc(pgs: number): number {
     const ecpControl = this.form.get('erasureProfile');
     const ecp = ecpControl.value;
     if ((ecpControl.valid || ecpControl.disabled) && ecp) {
@@ -443,7 +443,7 @@ export class PoolFormComponent implements OnInit {
           this.form.get('name').validator,
           CdValidators.custom(
             'uniqueName',
-            (name) =>
+            (name: string) =>
               this.data.pool &&
               this.info &&
               this.info.pool_names.indexOf(name) !== -1 &&
@@ -458,11 +458,11 @@ export class PoolFormComponent implements OnInit {
         [
           CdValidators.custom(
             'min',
-            (value) => this.form.getValue('size') && value < this.getMinSize()
+            (value: number) => this.form.getValue('size') && value < this.getMinSize()
           ),
           CdValidators.custom(
             'max',
-            (value) => this.form.getValue('size') && this.getMaxSize() < value
+            (value: number) => this.form.getValue('size') && this.getMaxSize() < value
           )
         ]
       );
@@ -472,7 +472,7 @@ export class PoolFormComponent implements OnInit {
           this.form.get('name').validator,
           CdValidators.custom(
             'uniqueName',
-            (name) => this.info && this.info.pool_names.indexOf(name) !== -1
+            (name: string) => this.info && this.info.pool_names.indexOf(name) !== -1
           )
         ]);
     }
@@ -482,13 +482,13 @@ export class PoolFormComponent implements OnInit {
   private setCompressionValidators() {
     CdValidators.validateIf(this.form.get('minBlobSize'), () => this.hasCompressionEnabled(), [
       Validators.min(0),
-      CdValidators.custom('maximum', (size) =>
+      CdValidators.custom('maximum', (size: string) =>
         this.oddBlobSize(size, this.form.getValue('maxBlobSize'))
       )
     ]);
     CdValidators.validateIf(this.form.get('maxBlobSize'), () => this.hasCompressionEnabled(), [
       Validators.min(0),
-      CdValidators.custom('minimum', (size) =>
+      CdValidators.custom('minimum', (size: string) =>
         this.oddBlobSize(this.form.getValue('minBlobSize'), size)
       )
     ]);
@@ -498,10 +498,10 @@ export class PoolFormComponent implements OnInit {
     ]);
   }
 
-  private oddBlobSize(minimum, maximum) {
-    minimum = this.formatter.toBytes(minimum);
-    maximum = this.formatter.toBytes(maximum);
-    return Boolean(minimum && maximum && minimum >= maximum);
+  private oddBlobSize(minimum: string, maximum: string) {
+    const min = this.formatter.toBytes(minimum);
+    const max = this.formatter.toBytes(maximum);
+    return Boolean(min && max && min >= max);
   }
 
   hasCompressionEnabled() {
@@ -564,7 +564,7 @@ export class PoolFormComponent implements OnInit {
       {
         externalFieldName: 'pg_num',
         formControlName: 'pgNum',
-        replaceFn: (value) => (this.form.getValue('pgAutoscaleMode') === 'on' ? 1 : value),
+        replaceFn: (value: number) => (this.form.getValue('pgAutoscaleMode') === 'on' ? 1 : value),
         editable: true
       },
       this.form.getValue('poolType') === 'replicated'
@@ -603,7 +603,7 @@ export class PoolFormComponent implements OnInit {
             externalFieldName: 'compression_mode',
             formControlName: 'mode',
             editable: true,
-            replaceFn: (value) => this.hasCompressionEnabled() && value
+            replaceFn: (value: boolean) => this.hasCompressionEnabled() && value
           },
           {
             externalFieldName: 'compression_algorithm',
@@ -706,7 +706,7 @@ export class PoolFormComponent implements OnInit {
     pool[externalFieldName] = apiValue;
   }
 
-  private triggerApiTask(pool) {
+  private triggerApiTask(pool: Record<string, any>) {
     this.taskWrapper
       .wrapTaskAroundCall({
         task: new FinishedTask('pool/' + (this.editing ? URLVerbs.EDIT : URLVerbs.CREATE), {
index e38ca50e881bbbf4b3ea88eec8672a41e60ee77c..d31eed16658f975444e4942b8e9b1188683aa719 100644 (file)
@@ -32,7 +32,7 @@ describe('PoolListComponent', () => {
   let fixture: ComponentFixture<PoolListComponent>;
   let poolService: PoolService;
 
-  const createPool = (name, id): Pool => {
+  const createPool = (name: string, id: number): Pool => {
     return _.merge(new Pool(name), {
       pool: id,
       pg_num: 256,
@@ -149,7 +149,7 @@ describe('PoolListComponent', () => {
       deletion.submitActionObservable();
     };
 
-    const testPoolDeletion = (poolName) => {
+    const testPoolDeletion = (poolName: string) => {
       setSelectedPool(poolName);
       callDeletion();
       expect(poolService.delete).toHaveBeenCalledWith(poolName);
@@ -243,7 +243,7 @@ describe('PoolListComponent', () => {
   });
 
   describe('getPgStatusCellClass', () => {
-    const testMethod = (value, expected) =>
+    const testMethod = (value: string, expected: string) =>
       expect(component.getPgStatusCellClass('', '', value)).toEqual({
         'text-right': true,
         [expected]: true
@@ -271,7 +271,7 @@ describe('PoolListComponent', () => {
 
   describe('custom row comparators', () => {
     const expectCorrectComparator = (statsAttribute: string) => {
-      const mockPool = (v) => ({ stats: { [statsAttribute]: { latest: v } } });
+      const mockPool = (v: number) => ({ stats: { [statsAttribute]: { latest: v } } });
       const columnDefinition = _.find(
         component.columns,
         (column) => column.prop === `stats.${statsAttribute}.rates`
@@ -292,7 +292,7 @@ describe('PoolListComponent', () => {
   describe('transformPoolsData', () => {
     let pool: Pool;
 
-    const getPoolData = (o) => [
+    const getPoolData = (o: object) => [
       _.merge(
         _.merge(createPool('a', 0), {
           cdIsBinary: true,
@@ -411,7 +411,7 @@ describe('PoolListComponent', () => {
     });
 
     it('returns empty string', () => {
-      const pgStatus = undefined;
+      const pgStatus: any = undefined;
       const expected = '';
 
       expect(component.transformPgStatus(pgStatus)).toEqual(expected);
index ee7cfe7a4619d82ddccb5fd8f7d6246b2fb2bd74..df27218ddcea6df7ce1a558d0f052b81b0411dd6 100644 (file)
@@ -25,7 +25,7 @@ import { TaskWrapperService } from '../../../shared/services/task-wrapper.servic
 import { URLBuilderService } from '../../../shared/services/url-builder.service';
 import { PgCategoryService } from '../../shared/pg-category.service';
 import { Pool } from '../pool';
-import { PoolStats } from '../pool-stat';
+import { PoolStat, PoolStats } from '../pool-stat';
 
 const BASE_URL = 'pool';
 
@@ -169,7 +169,7 @@ export class PoolListComponent implements OnInit {
       {
         prop: 'stats.rd_bytes.rates',
         name: this.i18n('Read bytes'),
-        comparator: (_valueA, _valueB, rowA: Pool, rowB: Pool) =>
+        comparator: (_valueA: any, _valueB: any, rowA: Pool, rowB: Pool) =>
           compare('stats.rd_bytes.latest', rowA, rowB),
         cellTransformation: CellTemplate.sparkline,
         flexGrow: 3
@@ -177,7 +177,7 @@ export class PoolListComponent implements OnInit {
       {
         prop: 'stats.wr_bytes.rates',
         name: this.i18n('Write bytes'),
-        comparator: (_valueA, _valueB, rowA: Pool, rowB: Pool) =>
+        comparator: (_valueA: any, _valueB: any, rowA: Pool, rowB: Pool) =>
           compare('stats.wr_bytes.latest', rowA, rowB),
         cellTransformation: CellTemplate.sparkline,
         flexGrow: 3
@@ -232,7 +232,7 @@ export class PoolListComponent implements OnInit {
     });
   }
 
-  getPgStatusCellClass(_row, _column, value): object {
+  getPgStatusCellClass(_row: any, _column: any, value: string): object {
     return {
       'text-right': true,
       [`pg-${this.pgCategoryService.getTypeByStates(value)}`]: true
@@ -241,7 +241,7 @@ export class PoolListComponent implements OnInit {
 
   transformPoolsData(pools: any) {
     const requiredStats = ['bytes_used', 'max_avail', 'rd_bytes', 'wr_bytes', 'rd', 'wr'];
-    const emptyStat = { latest: 0, rate: 0, rates: [] };
+    const emptyStat: PoolStat = { latest: 0, rate: 0, rates: [] };
 
     _.forEach(pools, (pool: Pool) => {
       pool['pg_status'] = this.transformPgStatus(pool['pg_status']);
@@ -261,7 +261,7 @@ export class PoolListComponent implements OnInit {
       }
 
       ['rd_bytes', 'wr_bytes'].forEach((stat) => {
-        pool.stats[stat].rates = pool.stats[stat].rates.map((point) => point[1]);
+        pool.stats[stat].rates = pool.stats[stat].rates.map((point: any) => point[1]);
       });
       pool.cdIsBinary = true;
     });
@@ -270,7 +270,7 @@ export class PoolListComponent implements OnInit {
   }
 
   transformPgStatus(pgStatus: any): string {
-    const strings = [];
+    const strings: string[] = [];
     _.forEach(pgStatus, (count, state) => {
       strings.push(`${count} ${state}`);
     });
index 0808a89dcfe55c03f05bc8842239e8ed3c741c5f..b822812c19a2be6bc97731f867c8b91dc941db18 100644 (file)
@@ -67,7 +67,7 @@ export class Pool {
   cdIsBinary?: boolean;
   configuration: { source: number; name: string; value: string }[];
 
-  constructor(name) {
+  constructor(name: string) {
     this.pool_name = name;
   }
 }
index 7f28e4b53d0a2cc63fcd7ee4cd57cfec7612894b..0b6358568ad6bc12b8df74f419b4d7ddb914479f 100644 (file)
@@ -20,7 +20,7 @@ describe('RgwBucketFormComponent', () => {
   let component: RgwBucketFormComponent;
   let fixture: ComponentFixture<RgwBucketFormComponent>;
   let rgwBucketService: RgwBucketService;
-  let getPlacementTargetsSpy;
+  let getPlacementTargetsSpy: jasmine.Spy;
 
   configureTestBed({
     declarations: [RgwBucketFormComponent],
@@ -46,7 +46,7 @@ describe('RgwBucketFormComponent', () => {
   });
 
   describe('bucketNameValidator', () => {
-    const testValidator = (name, valid) => {
+    const testValidator = (name: string, valid: boolean) => {
       const validatorFn = component.bucketNameValidator();
       const ctrl = new FormControl(name);
       ctrl.markAsDirty();
@@ -136,7 +136,7 @@ describe('RgwBucketFormComponent', () => {
     });
 
     it('should get zonegroup and placement targets', () => {
-      const payload = {
+      const payload: Record<string, any> = {
         zonegroup: 'default',
         placement_targets: [
           {
index 685bd9e2e7da6a5fff35d4a9eaa71a05ffd6e1b1..34437e42a65f30c06092af7b522e4e3711c8670b 100644 (file)
@@ -25,11 +25,11 @@ export class RgwBucketFormComponent implements OnInit {
   editing = false;
   error = false;
   loading = false;
-  owners = null;
+  owners: string[] = null;
   action: string;
   resource: string;
   zonegroup: string;
-  placementTargets: Object[] = [];
+  placementTargets: object[] = [];
 
   constructor(
     private route: ActivatedRoute,
@@ -66,7 +66,7 @@ export class RgwBucketFormComponent implements OnInit {
 
     if (!this.editing) {
       // Get placement targets:
-      this.rgwSiteService.getPlacementTargets().subscribe((placementTargets) => {
+      this.rgwSiteService.getPlacementTargets().subscribe((placementTargets: any) => {
         this.zonegroup = placementTargets['zonegroup'];
         _.forEach(placementTargets['placement_targets'], (placementTarget) => {
           placementTarget['description'] = `${placementTarget['name']} (${this.i18n('pool')}: ${
@@ -95,7 +95,7 @@ export class RgwBucketFormComponent implements OnInit {
         // Get the default values.
         const defaults = _.clone(this.bucketForm.value);
         // Extract the values displayed in the form.
-        let value = _.pick(resp, _.keys(this.bucketForm.value));
+        let value: object = _.pick(resp, _.keys(this.bucketForm.value));
         value['placement-target'] = resp['placement_rule'];
         // Append default values.
         value = _.merge(defaults, value);
@@ -182,19 +182,19 @@ export class RgwBucketFormComponent implements OnInit {
         }
         const constraints = [];
         // - Bucket names cannot be formatted as IP address.
-        constraints.push((name) => {
+        constraints.push((name: AbstractControl) => {
           const validatorFn = CdValidators.ip();
           return !validatorFn(name);
         });
         // - Bucket names can be between 3 and 63 characters long.
-        constraints.push((name) => _.inRange(name.length, 3, 64));
+        constraints.push((name: string) => _.inRange(name.length, 3, 64));
         // - Bucket names must not contain uppercase characters or underscores.
         // - Bucket names must start with a lowercase letter or number.
         // - Bucket names must be a series of one or more labels. Adjacent
         //   labels are separated by a single period (.). Bucket names can
         //   contain lowercase letters, numbers, and hyphens. Each label must
         //   start and end with a lowercase letter or a number.
-        constraints.push((name) => {
+        constraints.push((name: string) => {
           const labels = _.split(name, '.');
           return _.every(labels, (label) => {
             // Bucket names must not contain uppercase characters or underscores.
@@ -211,7 +211,7 @@ export class RgwBucketFormComponent implements OnInit {
             });
           });
         });
-        if (!_.every(constraints, (func) => func(control.value))) {
+        if (!_.every(constraints, (func: Function) => func(control.value))) {
           resolve({ bucketNameInvalid: true });
           return;
         }
index ff9badf3d8977d14932ec283c66f48f73f5324f9..c78754890dbc5afd3d6b3ec94e809390af84b230 100644 (file)
@@ -38,7 +38,7 @@ export class RgwDaemonDetailsComponent implements OnChanges {
     if (_.isEmpty(this.serviceId)) {
       return;
     }
-    this.rgwDaemonService.get(this.serviceId).subscribe((resp) => {
+    this.rgwDaemonService.get(this.serviceId).subscribe((resp: any) => {
       this.metadata = resp['rgw_metadata'];
     });
   }
index d890aa902eeffd2b359a03452037411420a8dd81..7666fc85eccfd37239276b3e644614b0cca3c5c4 100644 (file)
@@ -74,7 +74,7 @@ export class RgwUserCapabilityModalComponent {
   setCapabilities(capabilities: RgwUserCapability[]) {
     // Parse the configured capabilities to get a list of types that
     // should be displayed.
-    const usedTypes = [];
+    const usedTypes: string[] = [];
     capabilities.forEach((capability) => {
       usedTypes.push(capability.type);
     });
index 9fc911669cfba21cccdeeac21d354df13938d525..12ce4da8c87e829ad528f613e351a0f8a341714e 100644 (file)
@@ -195,7 +195,7 @@ export class RgwUserFormComponent implements OnInit {
 
           // Process the capabilities.
           const mapPerm = { 'read, write': '*' };
-          resp[0].caps.forEach((cap) => {
+          resp[0].caps.forEach((cap: any) => {
             if (cap.perm in mapPerm) {
               cap.perm = mapPerm[cap.perm];
             }
@@ -278,7 +278,7 @@ export class RgwUserFormComponent implements OnInit {
    * Add/Update a subuser.
    */
   setSubuser(subuser: RgwUserSubuser, index?: number) {
-    const mapPermissions = {
+    const mapPermissions: Record<string, string> = {
       'full-control': 'full',
       'read-write': 'readwrite'
     };
@@ -592,7 +592,7 @@ export class RgwUserFormComponent implements OnInit {
    * configuration has been modified.
    */
   private _getUpdateArgs() {
-    const result = {};
+    const result: Record<string, string> = {};
     const keys = ['display_name', 'email', 'max_buckets', 'suspended'];
     for (const key of keys) {
       result[key] = this.userForm.getValue(key);
@@ -604,7 +604,7 @@ export class RgwUserFormComponent implements OnInit {
    * Helper function to get the arguments for the API request when the user
    * quota configuration has been modified.
    */
-  private _getUserQuotaArgs(): object {
+  private _getUserQuotaArgs(): Record<string, any> {
     const result = {
       quota_type: 'user',
       enabled: this.userForm.getValue('user_quota_enabled'),
@@ -627,7 +627,7 @@ export class RgwUserFormComponent implements OnInit {
    * Helper function to get the arguments for the API request when the bucket
    * quota configuration has been modified.
    */
-  private _getBucketQuotaArgs(): object {
+  private _getBucketQuotaArgs(): Record<string, any> {
     const result = {
       quota_type: 'bucket',
       enabled: this.userForm.getValue('bucket_quota_enabled'),
index 2626c168e2b38281d63c70c04d478292b6a94658..d16ee7cbe8d38d7d7328d80af5417b508b6bf3de 100644 (file)
@@ -16,7 +16,7 @@ export class DeviceListComponent implements OnInit {
   @Input()
   hostname = '';
   @Input()
-  osdId = null;
+  osdId: number = null;
 
   @ViewChild('deviceLocation', { static: true })
   locationTemplate: TemplateRef<any>;
@@ -40,7 +40,7 @@ export class DeviceListComponent implements OnInit {
   ) {}
 
   ngOnInit() {
-    const updateDevicesFn = (devices) => (this.devices = devices);
+    const updateDevicesFn = (devices: CdDevice[]) => (this.devices = devices);
     if (this.hostname) {
       this.hostService.getDevices(this.hostname).subscribe(updateDevicesFn);
     } else if (this.osdId !== null) {
index 5a71c208c083629dcb69f8652f2bb07233442ce1..fa185d045dda303e1b5da09391ff4c91e8e9f9d2 100644 (file)
@@ -26,7 +26,7 @@ describe('PgCategoryService', () => {
   });
 
   describe('getTypeByStates', () => {
-    const testMethod = (value, expected) =>
+    const testMethod = (value: string, expected: string) =>
       expect(service.getTypeByStates(value)).toEqual(expected);
 
     it(PgCategory.CATEGORY_CLEAN, () => {
index 79c2bcc984b5d957e6d6cf533f42fb532011658a..cf77649502a59b64687334a2642a120d88d48a20 100644 (file)
@@ -52,7 +52,7 @@ export class PgCategoryService {
     );
   }
 
-  private getPgStatesFromText(pgStatesText) {
+  private getPgStatesFromText(pgStatesText: string) {
     const pgStates = pgStatesText
       .replace(/[^a-z]+/g, ' ')
       .trim()
index a3a68564650789282019273ba9bba21a642bb207..d862c5ae9eea82c14b3162f33179c5af36860b2c 100644 (file)
@@ -2,9 +2,9 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
 import { SimpleChange, SimpleChanges } from '@angular/core';
 import { ComponentFixture, TestBed } from '@angular/core/testing';
 import { By } from '@angular/platform-browser';
-import { TabsetComponent, TabsetConfig, TabsModule } from 'ngx-bootstrap/tabs';
 
 import * as _ from 'lodash';
+import { TabsetComponent, TabsetConfig, TabsModule } from 'ngx-bootstrap/tabs';
 import { of } from 'rxjs';
 
 import { configureTestBed, i18nProviders } from '../../../../testing/unit-test-helper';
@@ -37,7 +37,7 @@ describe('OsdSmartListComponent', () => {
   const patchData = (path: string, newValue: any): any => {
     return _.reduce(
       _.cloneDeep(SMART_DATA_HDD_VERSION_1_0),
-      (result, dataObj, deviceId) => {
+      (result: object, dataObj, deviceId) => {
         result[deviceId] = _.set<any>(dataObj, path, newValue);
         return result;
       },
@@ -54,7 +54,7 @@ describe('OsdSmartListComponent', () => {
     patch: { [path: string]: any } = null,
     simpleChanges?: SimpleChanges
   ) => {
-    let data = null;
+    let data: HddSmartDataV1 | NvmeSmartDataV1;
     switch (dataType) {
       case 'hdd_v1':
         data = SMART_DATA_HDD_VERSION_1_0;
index 15734e9388ad022e6eebba6f85414b613b7e4eae..95281203cf519c9caa6e11fe01b4757ce0ee0253 100644 (file)
@@ -1,6 +1,8 @@
 import { Component, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core';
+
 import { I18n } from '@ngx-translate/i18n-polyfill';
 import * as _ from 'lodash';
+
 import { HostService } from '../../../shared/api/host.service';
 import { OsdService } from '../../../shared/api/osd.service';
 import { CdTableColumn } from '../../../shared/models/cd-table-column';
@@ -48,7 +50,7 @@ export class SmartListComponent implements OnInit, OnChanges {
     return _.get(data, 'device.protocol', '').toLowerCase() === 'ata';
   }
 
-  private fetchData(data) {
+  private fetchData(data: any) {
     const result: { [deviceId: string]: SmartDataResult | SmartErrorResult } = {};
     _.each(data, (smartData, deviceId) => {
       if (this.isSmartError(smartData)) {
index 70180ea5ebd68ed387d9f5ae9290abcaf99c2e1a..db095550f550e2b255c5bc0a53472e51e17a74f2 100644 (file)
@@ -40,7 +40,7 @@ export class LoginComponent implements OnInit {
       // Make sure notification sidebar is closed.
       this.notificationService.toggleSidebar(true);
 
-      let token = null;
+      let token: string = null;
       if (window.location.hash.indexOf('access_token=') !== -1) {
         token = window.location.hash.split('access_token=')[1];
         const uri = window.location.toString();
index 4a8e0268775749eb1a133288e90c01d38c0767b3..1ed0568f773bff6c020730de7ea1c93a81b51dc7 100644 (file)
@@ -66,9 +66,9 @@ export class RoleDetailsComponent implements OnChanges, OnInit {
     if (this.selection.hasSelection) {
       this.selectedItem = this.selection.first();
       // Build the scopes/permissions data used by the data table.
-      const scopes_permissions = [];
+      const scopes_permissions: any[] = [];
       _.each(this.scopes, (scope) => {
-        const scope_permission = { read: false, create: false, update: false, delete: false };
+        const scope_permission: any = { read: false, create: false, update: false, delete: false };
         scope_permission['scope'] = scope;
         if (scope in this.selectedItem['scopes_permissions']) {
           _.each(this.selectedItem['scopes_permissions'][scope], (permission) => {
index b5d36b5861e21832512af9186cb9e70011126533..10b5e3b776d720c2b0f830998089f0512cb384b1 100644 (file)
@@ -24,7 +24,7 @@ describe('RoleFormComponent', () => {
   let httpTesting: HttpTestingController;
   let roleService: RoleService;
   let router: Router;
-  const setUrl = (url) => Object.defineProperty(router, 'url', { value: url });
+  const setUrl = (url: string) => Object.defineProperty(router, 'url', { value: url });
 
   @Component({ selector: 'cd-fake', template: '' })
   class FakeComponent {}
index 1145a86dfff9c1ec41ac97364481424b1c11a1c8..a5b5fb7a9123d2f4440d6344db7a7605908418ae 100644 (file)
@@ -155,10 +155,10 @@ export class RoleFormComponent implements OnInit {
     // Create/Update the data which is used by the data table to display the
     // scopes/permissions every time the form field value has been changed.
     this.roleForm.get('scopes_permissions').valueChanges.subscribe((value) => {
-      const scopes_permissions = [];
+      const scopes_permissions: any[] = [];
       _.each(this.scopes, (scope) => {
         // Set the defaults values.
-        const scope_permission = { read: false, create: false, update: false, delete: false };
+        const scope_permission: any = { read: false, create: false, update: false, delete: false };
         scope_permission['scope'] = scope;
         // Apply settings from the given value if they exist.
         if (scope in value) {
@@ -214,7 +214,7 @@ export class RoleFormComponent implements OnInit {
     });
   }
 
-  onClickCellCheckbox(scope: string, property: string, event: Event = null) {
+  onClickCellCheckbox(scope: string, property: string, event: any = null) {
     // Use a copy of the form field data to do not trigger the redrawing of the
     // data table with every change.
     const scopes_permissions = _.cloneDeep(this.roleForm.getValue('scopes_permissions'));
@@ -241,7 +241,7 @@ export class RoleFormComponent implements OnInit {
     this.roleForm.get('scopes_permissions').setValue(scopes_permissions);
   }
 
-  onClickHeaderCheckbox(property: 'scope' | 'read' | 'create' | 'update' | 'delete', event: Event) {
+  onClickHeaderCheckbox(property: 'scope' | 'read' | 'create' | 'update' | 'delete', event: any) {
     // Use a copy of the form field data to do not trigger the redrawing of the
     // data table with every change.
     const scopes_permissions = _.cloneDeep(this.roleForm.getValue('scopes_permissions'));
index c4bc066254b6eb90604be5006a6f520645170b92..8e966cbaa56727818e20ceea49c04cb033c9e5f2 100644 (file)
@@ -160,7 +160,7 @@ export class RoleListComponent implements OnInit {
         ],
         titleText: this.i18n('Clone Role'),
         submitButtonText: this.i18n('Clone Role'),
-        onSubmit: (values) => {
+        onSubmit: (values: object) => {
           this.roleService.clone(name, values['newName']).subscribe(() => {
             this.getRoles();
             this.notificationService.show(
index ea32b634b3ec288465c88a6ea659cea8690bfa1e..9394174226527f8fd2c111780d598cafe967e8bf 100644 (file)
@@ -7,7 +7,7 @@ export class UserFormRoleModel implements SelectOption {
   scopes_permissions: object;
   enabled = true;
 
-  constructor(name, description) {
+  constructor(name: string, description: string) {
     this.name = name;
     this.description = description;
   }
index b106527aa8b8a9b52028ef37e57e274efa720d0f..75489abbb4003047faa292b3013a6ad9fc14a646 100644 (file)
@@ -33,7 +33,7 @@ describe('UserFormComponent', () => {
   let router: Router;
   let formHelper: FormHelper;
 
-  const setUrl = (url) => Object.defineProperty(router, 'url', { value: url });
+  const setUrl = (url: string) => Object.defineProperty(router, 'url', { value: url });
 
   @Component({ selector: 'cd-fake', template: '' })
   class FakeComponent {}
index 16a3094dfa18234832b15335a9645f9d358e025d..c1302a5ccc61629c74e4ae81c57fc54936b9c969 100644 (file)
@@ -16,7 +16,7 @@ export class UserTabsComponent implements OnInit {
     this.url = this.router.url;
   }
 
-  navigateTo(url) {
+  navigateTo(url: string) {
     this.router.navigate([url]);
   }
 }
index ccb92d13aec46ca886b2e3b49fa8c4f161930643..996accd2230b1acde5866c75e2d4c0e3915b88e4 100644 (file)
@@ -18,7 +18,7 @@ export class SummaryServiceMock {
   });
   summaryData$ = this.summaryDataSource.asObservable();
 
-  subscribe(call) {
+  subscribe(call: any) {
     return this.summaryData$.subscribe(call);
   }
 }
index 94f3c4ae4854204e4e4e490ddd8e19ae29a53cd7..52a1c2ded1c08a9b5ff7076b45f8c10f9a4d409c 100644 (file)
@@ -109,7 +109,7 @@ export class BreadcrumbsComponent implements OnDestroy {
   }
 
   postProcess(breadcrumbs: IBreadcrumb[]) {
-    const result = [];
+    const result: IBreadcrumb[] = [];
     breadcrumbs.forEach((element) => {
       const split = element.text.split('/');
       if (split.length > 1) {
index 0f1b86469c6be9e720e31d7aec783e7d3b950074..cb6d0085dc91c514cd7ab7babd75999187aa6730 100644 (file)
@@ -15,7 +15,7 @@ import { AboutComponent } from '../about/about.component';
 })
 export class DashboardHelpComponent implements OnInit {
   @ViewChild('docsForm', { static: true })
-  docsFormElement;
+  docsFormElement: any;
   docsUrl: string;
   modalRef: BsModalRef;
   icons = Icons;
index 8c10ed127eaa5a9cfaea2035c10651ca185c5805..77becb6f91bce21b7d133d1fbd3290f8dbd02828 100644 (file)
@@ -51,7 +51,7 @@ describe('CephfsService', () => {
   });
 
   it('should call getMdsCounters', () => {
-    service.getMdsCounters(1).subscribe();
+    service.getMdsCounters('1').subscribe();
     const req = httpTesting.expectOne('api/cephfs/1/mds_counters');
     expect(req.request.method).toBe('GET');
   });
index b851610103ed14687864091a8f51c538e977ecfc..d109ba32bc49214641874b2a485313bf989ebfb0 100644 (file)
@@ -21,7 +21,7 @@ export class CephfsService {
     return this.http.get(`${this.baseURL}`);
   }
 
-  lsDir(id, path?): Observable<CephfsDir[]> {
+  lsDir(id: number, path?: string): Observable<CephfsDir[]> {
     let apiPath = `${this.baseURL}/${id}/ls_dir?depth=2`;
     if (path) {
       apiPath += `&path=${encodeURIComponent(path)}`;
@@ -29,27 +29,27 @@ export class CephfsService {
     return this.http.get<CephfsDir[]>(apiPath);
   }
 
-  getCephfs(id) {
+  getCephfs(id: number) {
     return this.http.get(`${this.baseURL}/${id}`);
   }
 
-  getTabs(id) {
+  getTabs(id: number) {
     return this.http.get(`ui-api/cephfs/${id}/tabs`);
   }
 
-  getClients(id) {
+  getClients(id: number) {
     return this.http.get(`${this.baseURL}/${id}/clients`);
   }
 
-  evictClient(fsId, clientId) {
+  evictClient(fsId: number, clientId: number) {
     return this.http.delete(`${this.baseURL}/${fsId}/client/${clientId}`);
   }
 
-  getMdsCounters(id) {
+  getMdsCounters(id: string) {
     return this.http.get(`${this.baseURL}/${id}/mds_counters`);
   }
 
-  mkSnapshot(id, path, name?) {
+  mkSnapshot(id: number, path: string, name?: string) {
     let params = new HttpParams();
     params = params.append('path', path);
     if (!_.isUndefined(name)) {
@@ -58,14 +58,14 @@ export class CephfsService {
     return this.http.post(`${this.baseURL}/${id}/mk_snapshot`, null, { params });
   }
 
-  rmSnapshot(id, path, name) {
+  rmSnapshot(id: number, path: string, name: string) {
     let params = new HttpParams();
     params = params.append('path', path);
     params = params.append('name', name);
     return this.http.post(`${this.baseURL}/${id}/rm_snapshot`, null, { params });
   }
 
-  updateQuota(id, path, quotas: CephfsQuotas) {
+  updateQuota(id: number, path: string, quotas: CephfsQuotas) {
     let params = new HttpParams();
     params = params.append('path', path);
     return this.http.post(`${this.baseURL}/${id}/set_quotas`, quotas, {
index 01d95afcf604c9e9015db43a4842a995fdbd00ad..68be515101db17788f37452205cb5977ca3114a0 100644 (file)
@@ -10,14 +10,14 @@ import { ApiModule } from './api.module';
 export class ConfigurationService {
   constructor(private http: HttpClient) {}
 
-  private findValue(config, section: string) {
+  private findValue(config: any, section: string) {
     if (!config.value) {
       return undefined;
     }
-    return config.value.find((v) => v.section === section);
+    return config.value.find((v: any) => v.section === section);
   }
 
-  getValue(config, section: string) {
+  getValue(config: any, section: string) {
     let val = this.findValue(config, section);
     if (!val) {
       const indexOfDot = section.indexOf('.');
@@ -54,7 +54,7 @@ export class ConfigurationService {
     return this.http.delete(`api/cluster_conf/${configOption}?section=${section}`);
   }
 
-  bulkCreate(configOptions: Object) {
+  bulkCreate(configOptions: object) {
     return this.http.put('api/cluster_conf/', configOptions);
   }
 }
index 089a6a99d5ff781f7fe538ae393ac35f4d5b9756..01e432990e0e73de46e7ee732fb3d8c7d843b3b8 100644 (file)
@@ -21,11 +21,11 @@ export class HostService {
     return this.http.get(this.baseURL);
   }
 
-  add(hostname) {
+  add(hostname: string) {
     return this.http.post(this.baseURL, { hostname: hostname }, { observe: 'response' });
   }
 
-  remove(hostname) {
+  remove(hostname: string) {
     return this.http.delete(`${this.baseURL}/${hostname}`, { observe: 'response' });
   }
 
@@ -35,7 +35,7 @@ export class HostService {
       .pipe(map((devices) => devices.map((device) => this.deviceService.prepareDevice(device))));
   }
 
-  getSmartData(hostname) {
+  getSmartData(hostname: string) {
     return this.http.get<SmartDataResponseV1>(`${this.baseURL}/${hostname}/smart`);
   }
 }
index 6b31eaad23e702287d4609baba6aea2603bb4554..991b7e2e062064e828fa0af3f97e806b0746c15f 100644 (file)
@@ -15,11 +15,11 @@ export class IscsiService {
     return this.http.get(`api/iscsi/target`);
   }
 
-  getTarget(target_iqn) {
+  getTarget(target_iqn: string) {
     return this.http.get(`api/iscsi/target/${target_iqn}`);
   }
 
-  updateTarget(target_iqn, target) {
+  updateTarget(target_iqn: string, target: any) {
     return this.http.put(`api/iscsi/target/${target_iqn}`, target, { observe: 'response' });
   }
 
@@ -39,11 +39,11 @@ export class IscsiService {
     return this.http.get(`ui-api/iscsi/portals`);
   }
 
-  createTarget(target) {
+  createTarget(target: any) {
     return this.http.post(`api/iscsi/target`, target, { observe: 'response' });
   }
 
-  deleteTarget(target_iqn) {
+  deleteTarget(target_iqn: string) {
     return this.http.delete(`api/iscsi/target/${target_iqn}`, { observe: 'response' });
   }
 
@@ -51,7 +51,7 @@ export class IscsiService {
     return this.http.get(`api/iscsi/discoveryauth`);
   }
 
-  updateDiscovery(auth) {
+  updateDiscovery(auth: any) {
     return this.http.put(`api/iscsi/discoveryauth`, auth);
   }
 
index 3ed2a172643064d65059cdf57c4b1dfd34312ebb..7c3bdc586ec05e3ce14ffbce2b5f2c8a97a11d2c 100644 (file)
@@ -9,7 +9,7 @@ import { ApiModule } from './api.module';
 export class LoggingService {
   constructor(private http: HttpClient) {}
 
-  jsError(url, message, stack) {
+  jsError(url: string, message: string, stack: any) {
     const request = {
       url: url,
       message: message,
index 04dfa82a0551b7a920c9e7ae877b8f90345c6870..4571c37dfeb07367b0e23aede40cebfe8adac221 100644 (file)
@@ -13,7 +13,7 @@ export class LogsService {
     return this.http.get('api/logs/all');
   }
 
-  validateDashboardUrl(uid) {
+  validateDashboardUrl(uid: string) {
     return this.http.get(`api/grafana/validation/${uid}`);
   }
 }
index 782ee737b76e6edeef2e886fd6a10348adedf3a2..ef937d8d159fda85fef07c7e7ba93dbca243b2c1 100644 (file)
@@ -36,7 +36,7 @@ export class MgrModuleService {
    * @param {object} config The configuration.
    * @return {Observable<Object>}
    */
-  updateConfig(module: string, config: Object): Observable<Object> {
+  updateConfig(module: string, config: object): Observable<Object> {
     return this.http.put(`${this.url}/${module}`, { config: config });
   }
 
index 3ad1aadcd3c537077e7cd710766628058d108b26..1a53047ecdce0ea14f2bbc2d7a0d57ed9f7e1b09 100644 (file)
@@ -57,29 +57,29 @@ export class NfsService {
     return this.http.get(`${this.apiPath}/export`);
   }
 
-  get(clusterId, exportId) {
+  get(clusterId: string, exportId: string) {
     return this.http.get(`${this.apiPath}/export/${clusterId}/${exportId}`);
   }
 
-  create(nfs) {
+  create(nfs: any) {
     return this.http.post(`${this.apiPath}/export`, nfs, { observe: 'response' });
   }
 
-  update(clusterId, id, nfs) {
+  update(clusterId: string, id: string, nfs: any) {
     return this.http.put(`${this.apiPath}/export/${clusterId}/${id}`, nfs, { observe: 'response' });
   }
 
-  delete(clusterId, exportId) {
+  delete(clusterId: string, exportId: string) {
     return this.http.delete(`${this.apiPath}/export/${clusterId}/${exportId}`, {
       observe: 'response'
     });
   }
 
-  lsDir(root_dir) {
+  lsDir(root_dir: string) {
     return this.http.get(`${this.uiApiPath}/lsdir?root_dir=${root_dir}`);
   }
 
-  buckets(user_id) {
+  buckets(user_id: string) {
     return this.http.get(`${this.uiApiPath}/rgw/buckets?user_id=${user_id}`);
   }
 
index 0994ba5b223fc00c3ec102d3a7daf523bc28ed22..2a03ea66c655ef528e819dd876acdb3bcb8d21b8 100644 (file)
@@ -83,7 +83,7 @@ export class OsdService {
     return this.http.get<SmartDataResponseV1>(`${this.path}/${id}/smart`);
   }
 
-  scrub(id, deep) {
+  scrub(id: string, deep: boolean) {
     return this.http.post(`${this.path}/${id}/scrub?deep=${deep}`, null);
   }
 
index 5cf4207a05baba545ab16417fe92ff0aca14fea4..49c6816faee0f78252727232832b0efddf27b46b 100644 (file)
@@ -22,7 +22,7 @@ export class PerformanceCounterService {
 
   get(service_type: string, service_id: string) {
     return this.http.get(`${this.url}/${service_type}/${service_id}`).pipe(
-      mergeMap((resp) => {
+      mergeMap((resp: any) => {
         return observableOf(resp['counters']);
       })
     );
index 8d81b3167afbc3c3bac1a6f47d60e01ee2b0eeb1..4d85ec483374fd63b00a09388708f4805e9ff43b 100644 (file)
@@ -18,11 +18,11 @@ export class PoolService {
 
   constructor(private http: HttpClient, private rbdConfigurationService: RbdConfigurationService) {}
 
-  create(pool) {
+  create(pool: any) {
     return this.http.post(this.apiPath, pool, { observe: 'response' });
   }
 
-  update(pool) {
+  update(pool: any) {
     let name: string;
     if (pool.hasOwnProperty('srcpool')) {
       name = pool.srcpool;
@@ -36,11 +36,11 @@ export class PoolService {
     });
   }
 
-  delete(name) {
+  delete(name: string) {
     return this.http.delete(`${this.apiPath}/${name}`, { observe: 'response' });
   }
 
-  get(poolName) {
+  get(poolName: string) {
     return this.http.get(`${this.apiPath}/${poolName}`);
   }
 
@@ -63,7 +63,7 @@ export class PoolService {
     return this.http.get(`${this.apiPath}/_info` + (pool_name ? `?pool_name=${pool_name}` : ''));
   }
 
-  list(attrs = []) {
+  list(attrs: string[] = []) {
     const attrsStr = attrs.join(',');
     return this.http
       .get(`${this.apiPath}?attrs=${attrsStr}`)
index 93e3c43c0c896dccfa0d063fcc97ad8a4c3ad459..b7e4e565ac0578563231203f7e9c8db04106e0ed 100644 (file)
@@ -162,7 +162,7 @@ describe('PrometheusService', () => {
 
   describe('ifAlertmanagerConfigured', () => {
     let x: any;
-    let host;
+    let host: string;
 
     const receiveConfig = () => {
       const req = httpTesting.expectOne('api/settings/alertmanager-api-host');
@@ -200,7 +200,7 @@ describe('PrometheusService', () => {
 
   describe('ifPrometheusConfigured', () => {
     let x: any;
-    let host;
+    let host: string;
 
     const receiveConfig = () => {
       const req = httpTesting.expectOne('api/settings/prometheus-api-host');
index 08e8f6147a5cbfa27010a33a90acb09eb441a757..7b56161d4cfbaf5c561e6d13d54f8693c95f65e7 100644 (file)
@@ -25,7 +25,7 @@ export class PrometheusService {
 
   constructor(private http: HttpClient, private settingsService: SettingsService) {}
 
-  ifAlertmanagerConfigured(fn, elseFn?): void {
+  ifAlertmanagerConfigured(fn: (value?: string) => void, elseFn?: () => void): void {
     this.settingsService.ifSettingConfigured(this.settingsKey.alertmanager, fn, elseFn);
   }
 
@@ -33,7 +33,7 @@ export class PrometheusService {
     this.settingsService.disableSetting(this.settingsKey.alertmanager);
   }
 
-  ifPrometheusConfigured(fn, elseFn?): void {
+  ifPrometheusConfigured(fn: (value?: string) => void, elseFn?: () => void): void {
     this.settingsService.ifSettingConfigured(this.settingsKey.prometheus, fn, elseFn);
   }
 
@@ -65,7 +65,7 @@ export class PrometheusService {
   }
 
   setSilence(silence: AlertmanagerSilence) {
-    return this.http.post(`${this.baseURL}/silence`, silence, { observe: 'response' });
+    return this.http.post<object>(`${this.baseURL}/silence`, silence, { observe: 'response' });
   }
 
   expireSilence(silenceId: string) {
index 03f6b9d6557d3292cf730d8d26a8ba068e548e80..5bd9abad2e2048876d209b468c6b627bb7ac792f 100644 (file)
@@ -8,7 +8,7 @@ describe('RbdMirroringService', () => {
   let service: RbdMirroringService;
   let httpTesting: HttpTestingController;
 
-  const summary = {
+  const summary: Record<string, any> = {
     status: 0,
     content_data: {
       daemons: [],
@@ -46,7 +46,7 @@ describe('RbdMirroringService', () => {
   });
 
   it('should periodically poll summary', fakeAsync(() => {
-    const calledWith = [];
+    const calledWith: any[] = [];
     service.subscribeSummary((data) => {
       calledWith.push(data);
     });
index 0dd04e9798e990ddafc2f5e51318b8b4fb3f7246..d32b09487e867db48dcb383bf0c751b08789a446 100644 (file)
@@ -54,11 +54,11 @@ export class RbdMirroringService {
     return this.summaryData$.subscribe(next, error);
   }
 
-  getPool(poolName) {
+  getPool(poolName: string) {
     return this.http.get(`api/block/mirroring/pool/${poolName}`);
   }
 
-  updatePool(poolName, request) {
+  updatePool(poolName: string, request: any) {
     return this.http.put(`api/block/mirroring/pool/${poolName}`, request, { observe: 'response' });
   }
 
@@ -66,7 +66,7 @@ export class RbdMirroringService {
     return this.http.get(`api/block/mirroring/site_name`);
   }
 
-  setSiteName(@cdEncodeNot siteName) {
+  setSiteName(@cdEncodeNot siteName: string) {
     return this.http.put(
       `api/block/mirroring/site_name`,
       { site_name: siteName },
@@ -74,11 +74,15 @@ export class RbdMirroringService {
     );
   }
 
-  createBootstrapToken(poolName) {
+  createBootstrapToken(poolName: string) {
     return this.http.post(`api/block/mirroring/pool/${poolName}/bootstrap/token`, {});
   }
 
-  importBootstrapToken(poolName, @cdEncodeNot direction, @cdEncodeNot token) {
+  importBootstrapToken(
+    poolName: string,
+    @cdEncodeNot direction: string,
+    @cdEncodeNot token: string
+  ) {
     const request = {
       direction: direction,
       token: token
@@ -88,23 +92,23 @@ export class RbdMirroringService {
     });
   }
 
-  getPeer(poolName, peerUUID) {
+  getPeer(poolName: string, peerUUID: string) {
     return this.http.get(`api/block/mirroring/pool/${poolName}/peer/${peerUUID}`);
   }
 
-  addPeer(poolName, request) {
+  addPeer(poolName: string, request: any) {
     return this.http.post(`api/block/mirroring/pool/${poolName}/peer`, request, {
       observe: 'response'
     });
   }
 
-  updatePeer(poolName, peerUUID, request) {
+  updatePeer(poolName: string, peerUUID: string, request: any) {
     return this.http.put(`api/block/mirroring/pool/${poolName}/peer/${peerUUID}`, request, {
       observe: 'response'
     });
   }
 
-  deletePeer(poolName, peerUUID) {
+  deletePeer(poolName: string, peerUUID: string) {
     return this.http.delete(`api/block/mirroring/pool/${poolName}/peer/${peerUUID}`, {
       observe: 'response'
     });
index fb2497a8395a6427d694e9f1557e1ad2f2c89efa..5a3a8747e9a3e9103e19d479fa3ad55bee50c791 100644 (file)
@@ -17,11 +17,11 @@ import { RbdPool } from './rbd.model';
 export class RbdService {
   constructor(private http: HttpClient, private rbdConfigurationService: RbdConfigurationService) {}
 
-  isRBDPool(pool) {
+  isRBDPool(pool: any) {
     return _.indexOf(pool.application_metadata, 'rbd') !== -1 && !pool.pool_name.includes('/');
   }
 
-  create(rbd) {
+  create(rbd: any) {
     return this.http.post('api/block/image', rbd, { observe: 'response' });
   }
 
@@ -31,7 +31,7 @@ export class RbdService {
     });
   }
 
-  update(imageSpec: ImageSpec, rbd) {
+  update(imageSpec: ImageSpec, rbd: any) {
     return this.http.put(`api/block/image/${imageSpec.toStringEncoded()}`, rbd, {
       observe: 'response'
     });
@@ -60,7 +60,7 @@ export class RbdService {
     );
   }
 
-  copy(imageSpec: ImageSpec, rbd) {
+  copy(imageSpec: ImageSpec, rbd: any) {
     return this.http.post(`api/block/image/${imageSpec.toStringEncoded()}/copy`, rbd, {
       observe: 'response'
     });
@@ -76,7 +76,7 @@ export class RbdService {
     return this.http.get('api/block/image/default_features');
   }
 
-  createSnapshot(imageSpec: ImageSpec, @cdEncodeNot snapshotName) {
+  createSnapshot(imageSpec: ImageSpec, @cdEncodeNot snapshotName: string) {
     const request = {
       snapshot_name: snapshotName
     };
@@ -85,7 +85,7 @@ export class RbdService {
     });
   }
 
-  renameSnapshot(imageSpec: ImageSpec, snapshotName, @cdEncodeNot newSnapshotName) {
+  renameSnapshot(imageSpec: ImageSpec, snapshotName: string, @cdEncodeNot newSnapshotName: string) {
     const request = {
       new_snap_name: newSnapshotName
     };
@@ -98,7 +98,7 @@ export class RbdService {
     );
   }
 
-  protectSnapshot(imageSpec: ImageSpec, snapshotName, @cdEncodeNot isProtected) {
+  protectSnapshot(imageSpec: ImageSpec, snapshotName: string, @cdEncodeNot isProtected: boolean) {
     const request = {
       is_protected: isProtected
     };
@@ -111,7 +111,7 @@ export class RbdService {
     );
   }
 
-  rollbackSnapshot(imageSpec: ImageSpec, snapshotName) {
+  rollbackSnapshot(imageSpec: ImageSpec, snapshotName: string) {
     return this.http.post(
       `api/block/image/${imageSpec.toStringEncoded()}/snap/${snapshotName}/rollback`,
       null,
@@ -119,7 +119,7 @@ export class RbdService {
     );
   }
 
-  cloneSnapshot(imageSpec: ImageSpec, snapshotName, request) {
+  cloneSnapshot(imageSpec: ImageSpec, snapshotName: string, request: any) {
     return this.http.post(
       `api/block/image/${imageSpec.toStringEncoded()}/snap/${snapshotName}/clone`,
       request,
@@ -127,7 +127,7 @@ export class RbdService {
     );
   }
 
-  deleteSnapshot(imageSpec: ImageSpec, snapshotName) {
+  deleteSnapshot(imageSpec: ImageSpec, snapshotName: string) {
     return this.http.delete(`api/block/image/${imageSpec.toStringEncoded()}/snap/${snapshotName}`, {
       observe: 'response'
     });
@@ -137,24 +137,24 @@ export class RbdService {
     return this.http.get(`api/block/image/trash/`);
   }
 
-  createNamespace(pool, namespace) {
+  createNamespace(pool: string, namespace: string) {
     const request = {
       namespace: namespace
     };
     return this.http.post(`api/block/pool/${pool}/namespace`, request, { observe: 'response' });
   }
 
-  listNamespaces(pool) {
+  listNamespaces(pool: string) {
     return this.http.get(`api/block/pool/${pool}/namespace/`);
   }
 
-  deleteNamespace(pool, namespace) {
+  deleteNamespace(pool: string, namespace: string) {
     return this.http.delete(`api/block/pool/${pool}/namespace/${namespace}`, {
       observe: 'response'
     });
   }
 
-  moveTrash(imageSpec: ImageSpec, delay) {
+  moveTrash(imageSpec: ImageSpec, delay: number) {
     return this.http.post(
       `api/block/image/${imageSpec.toStringEncoded()}/move_trash`,
       { delay: delay },
@@ -162,7 +162,7 @@ export class RbdService {
     );
   }
 
-  purgeTrash(poolName) {
+  purgeTrash(poolName: string) {
     return this.http.post(`api/block/image/trash/purge/?pool_name=${poolName}`, null, {
       observe: 'response'
     });
index 25891d2649af94073c7738586b177962abdd5925..b58c15dffb4551ab21452d2cc1e714677e774f7e 100644 (file)
@@ -56,7 +56,7 @@ export class RgwUserService {
     return this.http.get(`${this.url}/${uid}/quota`);
   }
 
-  create(args: object) {
+  create(args: Record<string, string>) {
     let params = new HttpParams();
     _.keys(args).forEach((key) => {
       params = params.append(key, args[key]);
@@ -64,7 +64,7 @@ export class RgwUserService {
     return this.http.post(this.url, null, { params: params });
   }
 
-  update(uid: string, args: object) {
+  update(uid: string, args: Record<string, string>) {
     let params = new HttpParams();
     _.keys(args).forEach((key) => {
       params = params.append(key, args[key]);
@@ -72,7 +72,7 @@ export class RgwUserService {
     return this.http.put(`${this.url}/${uid}`, null, { params: params });
   }
 
-  updateQuota(uid: string, args: object) {
+  updateQuota(uid: string, args: Record<string, string>) {
     let params = new HttpParams();
     _.keys(args).forEach((key) => {
       params = params.append(key, args[key]);
@@ -84,7 +84,7 @@ export class RgwUserService {
     return this.http.delete(`${this.url}/${uid}`);
   }
 
-  createSubuser(uid: string, args: object) {
+  createSubuser(uid: string, args: Record<string, string>) {
     let params = new HttpParams();
     _.keys(args).forEach((key) => {
       params = params.append(key, args[key]);
@@ -110,7 +110,7 @@ export class RgwUserService {
     return this.http.delete(`${this.url}/${uid}/capability`, { params: params });
   }
 
-  addS3Key(uid: string, args: object) {
+  addS3Key(uid: string, args: Record<string, string>) {
     let params = new HttpParams();
     params = params.append('key_type', 's3');
     _.keys(args).forEach((key) => {
index 122f2691cfcd10ba6afbf4f742df4ad4413869d3..979671b3f9318fec7f3e0e7cff0c8fbc62ca0964 100644 (file)
@@ -39,7 +39,7 @@ describe('SettingsService', () => {
   });
 
   describe('getSettingsValue', () => {
-    const testMethod = (data, expected: string) => {
+    const testMethod = (data: object, expected: string) => {
       expect(service['getSettingsValue'](data)).toBe(expected);
     };
 
@@ -65,7 +65,7 @@ describe('SettingsService', () => {
   describe('isSettingConfigured', () => {
     let increment: number;
 
-    const testConfig = (url, value) => {
+    const testConfig = (url: string, value: string) => {
       service.ifSettingConfigured(
         url,
         (setValue) => {
index 75b88c61d266aa771ab6e6a0176dff7c65838546..7d591542a6990a24c8a1d642678a0f782fe062dd 100644 (file)
@@ -38,7 +38,7 @@ export class SettingsService {
   }
 
   // Easiest way to stop reloading external content that can't be reached
-  disableSetting(url) {
+  disableSetting(url: string) {
     this.settings[url] = '';
   }
 
@@ -46,7 +46,7 @@ export class SettingsService {
     return data.value || data.instance || '';
   }
 
-  validateGrafanaDashboardUrl(uid) {
+  validateGrafanaDashboardUrl(uid: string) {
     return this.http.get(`api/grafana/validation/${uid}`);
   }
 
index 9e23bd0cbcdead13986a8b7f7b2865f25c34d224..05c53de0cca2217b155a50ca61d3c768e2b94dc1 100644 (file)
@@ -30,7 +30,7 @@ export class UserService {
     return this.http.put(`api/user/${user.username}`, user);
   }
 
-  changePassword(username, oldPassword, newPassword) {
+  changePassword(username: string, oldPassword: string, newPassword: string) {
     // Note, the specified user MUST be logged in to be able to change
     // the password. The backend ensures that the password of another
     // user can not be changed, otherwise an error will be thrown.
index bc2d1ce33039805526513bad7f895cef7b0359bb..89019bf1d69a2a837ae8fa784a7715ead622f55f 100644 (file)
@@ -30,7 +30,7 @@ describe('ConfigOptionComponent', () => {
     fixture.detectChanges();
     configurationService = TestBed.get(ConfigurationService);
 
-    const configOptions = [
+    const configOptions: Record<string, any> = [
       {
         name: 'osd_scrub_auto_repair_num_errors',
         type: 'uint',
index 3c28b82761beb86bc93a71855aa863865b8b400e..7778deccb3cc5c06fc01eb6a11a3ba60acb7f00d 100644 (file)
@@ -58,7 +58,7 @@ export class ConfigOptionComponent implements OnInit {
 
   private loadStoredData() {
     this.configService.filter(this.optionNames).subscribe((data: any) => {
-      this.options = data.map((configOption) => {
+      this.options = data.map((configOption: any) => {
         const formControl = this.optionsForm.get(configOption.name);
         const typeValidators = ConfigOptionTypes.getTypeValidators(configOption);
         configOption.additionalTypeInfo = ConfigOptionTypes.getType(configOption.type);
index cfe1b4747f340ad0913e1e72d91825ade87ff5a0..eb1bce5748d221500387a67a6e05194d723d028a 100644 (file)
@@ -89,7 +89,10 @@ export class ConfigOptionTypes {
       return;
     }
 
-    const typeValidators = { validators: [], patternHelpText: typeParams.patternHelpText };
+    const typeValidators: Record<string, any> = {
+      validators: [],
+      patternHelpText: typeParams.patternHelpText
+    };
 
     if (typeParams.isNumberType) {
       if (configOption.max && configOption.max !== '') {
index ece9a5305ec7977c21a8af3f460853e379a5534b..f25c1ecdcd944183c88fb6a9ebfb1de3a8490ecb 100644 (file)
@@ -38,7 +38,7 @@ class MockComponent {
   // Normally private, but public is needed by tests
   constructor(public modalService: BsModalService) {}
 
-  private openModal(extendBaseState: object = {}) {
+  private openModal(extendBaseState = {}) {
     this.modalRef = this.modalService.show(ConfirmationModalComponent, {
       initialState: Object.assign(
         {
index 23a1bf1bc59db46fd97c96819e2b9ca79a45919d..87383eedff3d7ce5a85b518d08cee6f834111d03 100644 (file)
@@ -32,7 +32,7 @@ export class ConfirmationModalComponent implements OnInit, OnDestroy {
 
   constructor(public modalRef: BsModalRef, private modalService: BsModalService) {
     this.confirmationForm = new FormGroup({});
-    this.onHide = this.modalService.onHide.subscribe((e) => {
+    this.onHide = this.modalService.onHide.subscribe((e: any) => {
       if (this.onCancel && (e || this.canceled)) {
         this.onCancel();
       }
index faf48936bcfbcfdaf9a8545b7e57fad66c310296..adcb95632cd4c725e4f42434cb3c97e3f8bc231c 100644 (file)
@@ -151,7 +151,7 @@ describe('CriticalConfirmationModalComponent', () => {
   });
 
   describe('component functions', () => {
-    const changeValue = (value) => {
+    const changeValue = (value: boolean) => {
       const ctrl = component.deletionForm.get('confirmation');
       ctrl.setValue(value);
       ctrl.markAsDirty();
index 48dfb26fda8dba514575e1b2eecbb05365be16d9..227076c1bdb0cc5a6e8662a9230c51303900c830 100755 (executable)
@@ -20,7 +20,7 @@ describe('InputModalComponent', () => {
   let fixture: ComponentFixture<FormModalComponent>;
   let fh: FixtureHelper;
   let formHelper: FormHelper;
-  let submitted;
+  let submitted: object;
 
   const initialState = {
     titleText: 'Some title',
@@ -48,7 +48,7 @@ describe('InputModalComponent', () => {
       }
     ],
     submitButtonText: 'Submit button name',
-    onSubmit: (values) => (submitted = values)
+    onSubmit: (values: object) => (submitted = values)
   };
 
   configureTestBed({
index 6488819edbbbccb95945a8c28b1473d1daecc782..7bc5d06b7caf534eeb29cd59e9ded44fc510d676 100755 (executable)
@@ -5,10 +5,10 @@ import { I18n } from '@ngx-translate/i18n-polyfill';
 import * as _ from 'lodash';
 import { BsModalRef } from 'ngx-bootstrap/modal';
 
-import { DimlessBinaryPipe } from 'app/shared/pipes/dimless-binary.pipe';
 import { CdFormBuilder } from '../../forms/cd-form-builder';
 import { CdFormGroup } from '../../forms/cd-form-group';
 import { CdFormModalFieldConfig } from '../../models/cd-form-modal-field-config';
+import { DimlessBinaryPipe } from '../../pipes/dimless-binary.pipe';
 import { FormatterService } from '../../services/formatter.service';
 
 @Component({
@@ -40,7 +40,7 @@ export class FormModalComponent implements OnInit {
   }
 
   createForm() {
-    const controlsConfig = {};
+    const controlsConfig: Record<string, FormControl> = {};
     this.fields.forEach((field) => {
       controlsConfig[field.name] = this.createFormControl(field);
     });
@@ -94,7 +94,7 @@ export class FormModalComponent implements OnInit {
     return this.i18n('An error occurred.');
   }
 
-  onSubmitForm(values) {
+  onSubmitForm(values: any) {
     const binaries = this.fields
       .filter((field) => field.type === 'binary')
       .map((field) => field.name);
index a813653ee9e77502b50580a8da10cbec6dd63f02..4c4b5ecedfa2d0e462eca0de00bb90f1cff0f8f0 100644 (file)
@@ -24,7 +24,7 @@ export class GrafanaComponent implements OnInit, OnChanges {
   grafanaExist = false;
   mode = '&kiosk';
   loading = true;
-  styles = {};
+  styles: Record<string, string> = {};
   dashboardExist = true;
   time: string;
   grafanaTimes: any;
index a39868046c1829586c7c931e13906cf567142c1e..3eb95c9bbb49312f614e8c97222ff5831da5eb18 100644 (file)
@@ -34,7 +34,7 @@ describe('LanguageSelectorComponent', () => {
     expect(listLocales()).toEqual([]);\r
   });\r
 \r
-  const expectLanguageChange = (lang) => {\r
+  const expectLanguageChange = (lang: string) => {\r
     component.changeLanguage(lang);\r
     const cookie = document.cookie.split(';').filter((item) => item.includes(`cd-lang=${lang}`));\r
     expect(cookie.length).toBe(1);\r
index 032ae4207a66898f73208d64e1043bb9412ed992..b696405cafe0613da60d3ca2065e99e3e0517418 100644 (file)
@@ -16,7 +16,7 @@ export class LanguageSelectorComponent implements OnInit {
   @Input()\r
   isDropdown = true;\r
 \r
-  supportedLanguages: Object = SupportedLanguages;\r
+  supportedLanguages: Record<string, any> = SupportedLanguages;\r
   selectedLanguage: string;\r
 \r
   constructor(private localeService: BsLocaleService, private languageService: LanguageService) {}\r
index 59ce5963ec48ab0f9a4b6848622dfbd87c67c848..7bb1624b3219ac2b1d1ffd12e8dbc99a25a3e022 100644 (file)
@@ -130,7 +130,7 @@ export class NotificationsSidebarComponent implements OnInit, OnDestroy {
     this.notificationService.toggleSidebar(true);
   }
 
-  trackByFn(index) {
+  trackByFn(index: number) {
     return index;
   }
 }
index 5348a5d5973bc77a875706e1f273fa3da976e416..9c4e381aa9b3051701dbed9dbab921cddaa8c0e4 100644 (file)
@@ -6,6 +6,7 @@ import { I18n } from '@ngx-translate/i18n-polyfill';
 import { Icons } from '../../../shared/enum/icons.enum';
 import { SelectMessages } from '../select/select-messages.model';
 import { SelectOption } from '../select/select-option.model';
+import { SelectComponent } from '../select/select.component';
 
 @Component({
   selector: 'cd-select-badges',
@@ -30,7 +31,7 @@ export class SelectBadgesComponent {
   selection = new EventEmitter();
 
   @ViewChild('cdSelect', { static: true })
-  cdSelect;
+  cdSelect: SelectComponent;
 
   icons = Icons;
 
index d863199dd58d3ee07bb5802662d6971af016bce1..3a477f06589dd5e837051b04c5a66d6235f1d143 100644 (file)
@@ -36,7 +36,7 @@ export class SparklineComponent implements OnInit, OnChanges {
     }
   ];
 
-  options = {
+  options: Record<string, any> = {
     animation: {
       duration: 0
     },
@@ -56,7 +56,7 @@ export class SparklineComponent implements OnInit, OnChanges {
       intersect: false,
       custom: undefined,
       callbacks: {
-        label: (tooltipItem) => {
+        label: (tooltipItem: any) => {
           if (this.isBinary) {
             return this.dimlessBinaryPipe.transform(tooltipItem.yLabel);
           } else {
@@ -91,11 +91,11 @@ export class SparklineComponent implements OnInit, OnChanges {
   constructor(private dimlessBinaryPipe: DimlessBinaryPipe) {}
 
   ngOnInit() {
-    const getStyleTop = (tooltip) => {
+    const getStyleTop = (tooltip: any) => {
       return tooltip.caretY - tooltip.height - tooltip.yPadding - 5 + 'px';
     };
 
-    const getStyleLeft = (tooltip, positionX) => {
+    const getStyleLeft = (tooltip: any, positionX: number) => {
       return positionX + tooltip.caretX + 'px';
     };
 
@@ -111,7 +111,7 @@ export class SparklineComponent implements OnInit, OnChanges {
       borderColor: this.colors[0].pointBorderColor
     };
 
-    this.options.tooltips.custom = (tooltip) => {
+    this.options.tooltips.custom = (tooltip: any) => {
       chartTooltip.customTooltips(tooltip);
     };
   }
index 9e9f75f04f657ce39ffffcc078eda0de4b3db77f..5d62b892dd6acdf57600137dc660c1ad2839dc2b 100644 (file)
@@ -55,7 +55,7 @@ export class SubmitButtonComponent implements OnInit {
     });
   }
 
-  submit($event) {
+  submit($event: any) {
     this.focusButton();
 
     // Special handling for Template driven forms.
index 4b6e109a03608654cf560b3418f5d903f91ac91f..90511da46f5cc0762d98eb3aa4b2aa7a888798a1 100644 (file)
@@ -43,11 +43,12 @@ describe('TableKeyValueComponent', () => {
   it('should make key value object pairs out of arrays with length two', () => {
     component.data = [['someKey', 0], ['arrayKey', [1, 2, 3]], [3, 'something']];
     component.ngOnInit();
-    expect(component.tableData).toEqual([
+    const expected: any = [
       { key: 'arrayKey', value: '1, 2, 3' },
       { key: 'someKey', value: 0 },
       { key: 3, value: 'something' }
-    ]);
+    ];
+    expect(component.tableData).toEqual(expected);
   });
 
   it('should not show data supposed to be have hidden by key', () => {
@@ -60,7 +61,7 @@ describe('TableKeyValueComponent', () => {
   it('should remove items with objects as values', () => {
     component.data = [[3, 'something'], ['will be removed', { a: 3, b: 4, c: 5 }]];
     component.ngOnInit();
-    expect(component.tableData).toEqual([{ key: 3, value: 'something' }]);
+    expect(component.tableData).toEqual(<any>[{ key: 3, value: 'something' }]);
   });
 
   it('makes key value object pairs out of an object', () => {
@@ -88,7 +89,7 @@ describe('TableKeyValueComponent', () => {
   });
 
   it('tests makePairs()', () => {
-    const makePairs = (data) => component['makePairs'](data);
+    const makePairs = (data: any) => component['makePairs'](data);
     expect(makePairs([['dash', 'board']])).toEqual([{ key: 'dash', value: 'board' }]);
     const pair = [{ key: 'dash', value: 'board' }, { key: 'ceph', value: 'mimic' }];
     const pairInverse = [{ key: 'ceph', value: 'mimic' }, { key: 'dash', value: 'board' }];
@@ -98,14 +99,14 @@ describe('TableKeyValueComponent', () => {
   });
 
   it('tests makePairsFromArray()', () => {
-    const makePairsFromArray = (data) => component['makePairsFromArray'](data);
+    const makePairsFromArray = (data: any[]) => component['makePairsFromArray'](data);
     expect(makePairsFromArray([['dash', 'board']])).toEqual([{ key: 'dash', value: 'board' }]);
     const pair = [{ key: 'dash', value: 'board' }, { key: 'ceph', value: 'mimic' }];
     expect(makePairsFromArray(pair)).toEqual(pair);
   });
 
   it('tests makePairsFromObject()', () => {
-    const makePairsFromObject = (data) => component['makePairsFromObject'](data);
+    const makePairsFromObject = (data: object) => component['makePairsFromObject'](data);
     expect(makePairsFromObject({ dash: 'board' })).toEqual([{ key: 'dash', value: 'board' }]);
     expect(makePairsFromObject({ dash: 'board', ceph: 'mimic' })).toEqual([
       { key: 'dash', value: 'board' },
@@ -114,8 +115,8 @@ describe('TableKeyValueComponent', () => {
   });
 
   describe('tests convertValue()', () => {
-    const convertValue = (data) => component['convertValue'](data);
-    const expectConvertValue = (value, expectation) =>
+    const convertValue = (data: any) => component['convertValue'](data);
+    const expectConvertValue = (value: any, expectation: any) =>
       expect(convertValue(value)).toBe(expectation);
 
     it('should not convert strings', () => {
index b3b4acd2cb3a1e6825bad003deb352c976d21e92..38bd942b20ae4f4b18aa05be5c4c6d2533ddced9 100644 (file)
@@ -49,11 +49,11 @@ export class TableKeyValueComponent implements OnInit, OnChanges {
   @Input()
   hideEmpty = false;
   @Input()
-  hideKeys = []; // Keys of pairs not to be displayed
+  hideKeys: string[] = []; // Keys of pairs not to be displayed
 
   // If set, the classAddingTpl is used to enable different css for different values
   @Input()
-  customCss?: { [css: string]: number | string | ((any) => boolean) };
+  customCss?: { [css: string]: number | string | ((any: any) => boolean) };
 
   columns: Array<CdTableColumn> = [];
   tableData: KeyValueItem[];
@@ -130,7 +130,7 @@ export class TableKeyValueComponent implements OnInit, OnChanges {
   }
 
   private makePairsFromArray(data: any[]): KeyValueItem[] {
-    let temp = [];
+    let temp: any[] = [];
     const first = data[0];
     if (_.isArray(first)) {
       if (first.length === 2) {
@@ -157,7 +157,7 @@ export class TableKeyValueComponent implements OnInit, OnChanges {
     return temp;
   }
 
-  private makePairsFromObject(data: object): KeyValueItem[] {
+  private makePairsFromObject(data: any): KeyValueItem[] {
     return Object.keys(data).map((k) => ({
       key: k,
       value: data[k]
@@ -215,7 +215,7 @@ export class TableKeyValueComponent implements OnInit, OnChanges {
     return value;
   }
 
-  private isDate(s) {
+  private isDate(s: string) {
     const sep = '[ -:.TZ]';
     const n = '\\d{2}' + sep;
     //                            year     -    m - d - h : m : s . someRest  Z (if UTC)
index c4d9fc9b5fed0a4e57947f9b3a944164bf024bc1..e87467396733d58d2faf1fd51672a8a053d24cdb 100644 (file)
@@ -17,7 +17,7 @@ describe('TableComponent', () => {
   let component: TableComponent;
   let fixture: ComponentFixture<TableComponent>;
 
-  const createFakeData = (n) => {
+  const createFakeData = (n: number) => {
     const data = [];
     for (let i = 0; i < n; i++) {
       data.push({
@@ -413,7 +413,7 @@ describe('TableComponent', () => {
   });
 
   describe('after ngInit', () => {
-    const toggleColumn = (prop, checked) => {
+    const toggleColumn = (prop: string, checked: boolean) => {
       component.toggleColumn({
         target: {
           name: prop,
@@ -491,7 +491,7 @@ describe('TableComponent', () => {
     });
 
     it('should call fetchData callback function', () => {
-      component.fetchData.subscribe((context) => {
+      component.fetchData.subscribe((context: any) => {
         expect(context instanceof CdTableFetchDataContext).toBeTruthy();
       });
       component.reloadData();
@@ -499,7 +499,7 @@ describe('TableComponent', () => {
 
     it('should call error function', () => {
       component.data = createFakeData(5);
-      component.fetchData.subscribe((context) => {
+      component.fetchData.subscribe((context: any) => {
         context.error();
         expect(component.loadingError).toBeTruthy();
         expect(component.data.length).toBe(0);
@@ -511,7 +511,7 @@ describe('TableComponent', () => {
 
     it('should call error function with custom config', () => {
       component.data = createFakeData(10);
-      component.fetchData.subscribe((context) => {
+      component.fetchData.subscribe((context: any) => {
         context.errorConfig.resetData = false;
         context.errorConfig.displayError = false;
         context.error();
index cbde65c4aff5571f8a4a70ab1e4ae6d3b7260788..371893692dd2ecbffd49f7ec65f5948622ba04b6 100644 (file)
@@ -23,7 +23,7 @@ import {
 } from '@swimlane/ngx-datatable';
 import { getterForProp } from '@swimlane/ngx-datatable/release/utils';
 import * as _ from 'lodash';
-import { Observable, timer as observableTimer } from 'rxjs';
+import { Observable, Subject, Subscription, timer as observableTimer } from 'rxjs';
 
 import { Icons } from '../../../shared/enum/icons.enum';
 import { CellTemplate } from '../../enum/cell-template.enum';
@@ -124,7 +124,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
 
   // Only needed to set if the classAddingTpl is used
   @Input()
-  customCss?: { [css: string]: number | string | ((any) => boolean) };
+  customCss?: { [css: string]: number | string | ((any: any) => boolean) };
 
   // Columns that aren't displayed but can be used as filters
   @Input()
@@ -174,7 +174,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
     [key: string]: TemplateRef<any>;
   } = {};
   search = '';
-  rows = [];
+  rows: any[] = [];
   loadingIndicator = true;
   loadingError = false;
   paginationClasses = {
@@ -186,8 +186,8 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
   userConfig: CdUserConfig = {};
   tableName: string;
   localStorage = window.localStorage;
-  private saveSubscriber;
-  private reloadSubscriber;
+  private saveSubscriber: Subscription;
+  private reloadSubscriber: Subscription;
   private updating = false;
 
   // Internal variable to check if it is necessary to recalculate the
@@ -291,8 +291,8 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
     }
   }
 
-  _calculateUniqueTableName(columns) {
-    const stringToNumber = (s) => {
+  _calculateUniqueTableName(columns: any[]) {
+    const stringToNumber = (s: string) => {
       if (!_.isString(s)) {
         return 0;
       }
@@ -319,13 +319,13 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
   }
 
   _initUserConfigAutoSave() {
-    const source = Observable.create(this._initUserConfigProxy.bind(this));
+    const source: Observable<any> = Observable.create(this._initUserConfigProxy.bind(this));
     this.saveSubscriber = source.subscribe(this._saveUserConfig.bind(this));
   }
 
-  _initUserConfigProxy(observer) {
+  _initUserConfigProxy(observer: Subject<any>) {
     this.userConfig = new Proxy(this.userConfig, {
-      set(config, prop, value) {
+      set(config, prop: string, value) {
         config[prop] = value;
         observer.next(config);
         return true;
@@ -333,7 +333,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
     });
   }
 
-  _saveUserConfig(config) {
+  _saveUserConfig(config: any) {
     this.localStorage.setItem(this.tableName, JSON.stringify(config));
   }
 
@@ -430,7 +430,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
   doColumnFiltering() {
     const appliedFilters: CdTableColumnFiltersChange['filters'] = [];
     let data = [...this.data];
-    let dataOut = [];
+    let dataOut: any[] = [];
     this.columnFilters.forEach((filter) => {
       if (filter.value === undefined) {
         return;
@@ -528,7 +528,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
     this.useData();
   }
 
-  setLimit(e) {
+  setLimit(e: any) {
     const value = parseInt(e.target.value, 10);
     if (value > 0) {
       this.userConfig.limit = value;
@@ -560,7 +560,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
   }
 
   rowIdentity() {
-    return (row) => {
+    return (row: any) => {
       const id = row[this.identifier];
       if (_.isUndefined(id)) {
         throw new Error(`Wrong identifier "${this.identifier}" -> "${id}"`);
@@ -598,7 +598,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
     if (this.updateSelectionOnRefresh === 'never') {
       return;
     }
-    const newSelected = [];
+    const newSelected: any[] = [];
     this.selection.selected.forEach((selectedItem) => {
       for (const row of this.data) {
         if (selectedItem[this.identifier] === row[this.identifier]) {
@@ -616,7 +616,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
     this.onSelect(this.selection);
   }
 
-  onSelect($event) {
+  onSelect($event: any) {
     this.selection.selected = $event['selected'];
     this.updateSelection.emit(_.clone(this.selection));
   }
@@ -652,7 +652,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
     ];
   }
 
-  changeSorting({ sorts }) {
+  changeSorting({ sorts }: any) {
     this.userConfig.sorts = sorts;
   }
 
@@ -683,7 +683,7 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O
     this.rows = rows;
   }
 
-  subSearch(data: any[], currentSearch: string[], columns: CdTableColumn[]) {
+  subSearch(data: any[], currentSearch: string[], columns: CdTableColumn[]): any[] {
     if (currentSearch.length === 0 || data.length === 0) {
       return data;
     }
index a4aa06c24451430a8f069fbf1b435ff107e6ecdd..1c8dc15c5f03d6b18430a5cb4f1563dfd2402c79 100644 (file)
@@ -31,7 +31,7 @@ export function cdEncode(...args: any[]): any {
  * @param {string} propertyKey
  * @param {number} index
  */
-export function cdEncodeNot(target: Object, propertyKey: string, index: number) {
+export function cdEncodeNot(target: object, propertyKey: string, index: number) {
   const metadataKey = `__ignore_${propertyKey}`;
   if (Array.isArray(target[metadataKey])) {
     target[metadataKey].push(index);
index 6355fd74cd575bfa2bc93fa5099746d882cd4baa..011439248fa618f890f67d33f7a7e332de67e8be 100644 (file)
@@ -93,7 +93,7 @@ export class DimlessBinaryPerSecondDirective implements OnInit {
     }
   }
 
-  setValue(value) {
+  setValue(value: string) {
     if (/^[\d.]+$/.test(value)) {
       value += this.defaultUnit || 'm';
     }
@@ -109,7 +109,7 @@ export class DimlessBinaryPerSecondDirective implements OnInit {
     }
   }
 
-  round(size) {
+  round(size: number) {
     if (size !== null && size !== 0) {
       if (!_.isUndefined(this.minBytes) && size < this.minBytes) {
         return this.minBytes;
@@ -126,7 +126,7 @@ export class DimlessBinaryPerSecondDirective implements OnInit {
   }
 
   @HostListener('blur', ['$event.target.value'])
-  onBlur(value) {
+  onBlur(value: string) {
     this.setValue(value);
   }
 }
index efe7e8da2f2bb521c9d429f11ce4c3dc4e47c193..cda47925cc862b741605a89410843c7c2e266c6e 100644 (file)
@@ -83,7 +83,7 @@ export class DimlessBinaryDirective implements OnInit {
     this.setValue(this.el.value);
   }
 
-  setValue(value) {
+  setValue(value: string) {
     if (/^[\d.]+$/.test(value)) {
       value += this.defaultUnit || 'm';
     }
@@ -99,7 +99,7 @@ export class DimlessBinaryDirective implements OnInit {
     }
   }
 
-  round(size) {
+  round(size: number) {
     if (size !== null && size !== 0) {
       if (!_.isUndefined(this.minBytes) && size < this.minBytes) {
         return this.minBytes;
@@ -116,7 +116,7 @@ export class DimlessBinaryDirective implements OnInit {
   }
 
   @HostListener('blur', ['$event.target.value'])
-  onBlur(value) {
+  onBlur(value: string) {
     this.setValue(value);
   }
 }
index 5d5d22dba87e70d17865bd3e40ab7cf965d7bf02..4faf6916447b175c1ae8f6cc97d7065bffea6fe6 100644 (file)
@@ -25,7 +25,7 @@ export class IopsDirective implements OnInit {
   }
 
   @HostListener('blur', ['$event.target.value'])
-  onUpdate(value) {
+  onUpdate(value: string) {
     this.setValue(value);
   }
 }
index 4d84499bc8ae0cf8244b43a01b225d4b57bc8e2a..d5bb4aff52ae152110feaed8399d4a59ee6271d3 100644 (file)
@@ -25,7 +25,7 @@ export class MillisecondsDirective implements OnInit {
   }
 
   @HostListener('blur', ['$event.target.value'])
-  onUpdate(value) {
+  onUpdate(value: string) {
     this.setValue(value);
   }
 }
index eadac251a4a3c9a3035dc66f3aade2512f95a663..7731721dd902eeeaa4f2422b2c4c2ebb8cc62303 100644 (file)
@@ -10,7 +10,7 @@ export class TrimDirective {
   constructor(private ngControl: NgControl) {}
 
   @HostListener('input', ['$event.target.value'])
-  onInput(value) {
+  onInput(value: string) {
     this.setValue(value);
   }
 
index e9d4b204bdc0c4c236150bee1274513fcc169f80..240da3af84935f07c9488ec5dcab116d3ef2ccbc 100644 (file)
@@ -39,7 +39,7 @@ describe('CdFormGroup', () => {
   });
 
   describe('CdFormGroup tests', () => {
-    let x, nested, a, c;
+    let x: CdFormGroup, nested: CdFormGroup, a: FormControl, c: FormGroup;
 
     beforeEach(() => {
       a = new FormControl('a');
index 9f2c1e633542d639e531c7248f2a5bf302332de5..9869f398c82da442ced73848a1703be2ceeb7400 100644 (file)
@@ -30,7 +30,7 @@ export class CdFormGroup extends FormGroup {
     return control;
   }
 
-  _get(controlName): AbstractControl {
+  _get(controlName: string): AbstractControl {
     return (
       super.get(controlName) ||
       Object.values(this.controls)
index 3e68f44357a6781e9025611f0a9d4f83b09e7d34..6890a4d09a75198574543d546364ec83e0d086a2 100644 (file)
@@ -11,9 +11,9 @@ describe('CdValidators', () => {
   let formHelper: FormHelper;
   let form: CdFormGroup;
 
-  const expectValid = (value) => formHelper.expectValidChange('x', value);
-  const expectPatternError = (value) => formHelper.expectErrorChange('x', value, 'pattern');
-  const updateValidity = (controlName) => form.get(controlName).updateValueAndValidity();
+  const expectValid = (value: any) => formHelper.expectValidChange('x', value);
+  const expectPatternError = (value: any) => formHelper.expectErrorChange('x', value, 'pattern');
+  const updateValidity = (controlName: string) => form.get(controlName).updateValueAndValidity();
 
   beforeEach(() => {
     form = new CdFormGroup({
@@ -117,7 +117,7 @@ describe('CdValidators', () => {
   });
 
   describe('uuid validator', () => {
-    const expectUuidError = (value) =>
+    const expectUuidError = (value: string) =>
       formHelper.expectErrorChange('x', value, 'invalidUuid', true);
     beforeEach(() => {
       form.get('x').setValidators(CdValidators.uuid());
@@ -302,7 +302,7 @@ describe('CdValidators', () => {
     });
 
     it('should error because of successful condition', () => {
-      const conditionFn = (value) => {
+      const conditionFn = (value: string) => {
         return value === 'abc';
       };
       // Define prereqs that force the validator to validate the value of
@@ -321,10 +321,10 @@ describe('CdValidators', () => {
   describe('custom validation', () => {
     beforeEach(() => {
       form = new CdFormGroup({
-        x: new FormControl(3, CdValidators.custom('odd', (x) => x % 2 === 1)),
+        x: new FormControl(3, CdValidators.custom('odd', (x: number) => x % 2 === 1)),
         y: new FormControl(
           5,
-          CdValidators.custom('not-dividable-by-x', (y) => {
+          CdValidators.custom('not-dividable-by-x', (y: number) => {
             const x = (form && form.get('x').value) || 1;
             return y % x !== 0;
           })
@@ -352,8 +352,8 @@ describe('CdValidators', () => {
         y: new FormControl(5)
       });
       CdValidators.validateIf(form.get('x'), () => ((form && form.get('y').value) || 0) > 10, [
-        CdValidators.custom('min', (x) => x < 7),
-        CdValidators.custom('max', (x) => x > 12)
+        CdValidators.custom('min', (x: number) => x < 7),
+        CdValidators.custom('max', (x: number) => x > 12)
       ]);
       formHelper = new FormHelper(form);
     });
index 7ec202b0874ad875740586907b5bfe899b217de0..b0cd8133edad204d66ca8e813a813a6513c900e2 100644 (file)
@@ -103,7 +103,7 @@ export class CdValidators {
    *   argument. The function must return true to set the validation error.
    * @return {ValidatorFn} Returns the validator function.
    */
-  static requiredIf(prerequisites: Object, condition?: Function | undefined): ValidatorFn {
+  static requiredIf(prerequisites: object, condition?: Function | undefined): ValidatorFn {
     let isWatched = false;
 
     return (control: AbstractControl): ValidationErrors | null => {
@@ -150,7 +150,7 @@ export class CdValidators {
    *   into action when the prerequisites are met.
    * @return {ValidatorFn} Returns the validator function.
    */
-  static composeIf(prerequisites: Object, validators: ValidatorFn[]): ValidatorFn {
+  static composeIf(prerequisites: object, validators: ValidatorFn[]): ValidatorFn {
     let isWatched = false;
     return (control: AbstractControl): ValidationErrors | null => {
       if (!isWatched && control.parent) {
index eaa1454a3651805d1df5273efb589b41e5eac1da..1df472d660dc293d157102ff17fa7b87d2138de8 100644 (file)
@@ -3,7 +3,7 @@ export class CdPwdExpirationSettings {
   pwdExpirationWarning1: number;
   pwdExpirationWarning2: number;
 
-  constructor(data) {
+  constructor(data: any) {
     this.pwdExpirationSpan = data.user_pwd_expiration_span;
     this.pwdExpirationWarning1 = data.user_pwd_expiration_warning_1;
     this.pwdExpirationWarning2 = data.user_pwd_expiration_warning_2;
index 9b6552dd93c33e47d840ac9c25102180fdf23c69..93a259e79d62dfd1f04ff6d71dfb1b29e4849770 100644 (file)
@@ -5,7 +5,7 @@ export class ChartTooltip {
   chartEl: any;
   getStyleLeft: Function;
   getStyleTop: Function;
-  customColors = {
+  customColors: Record<string, any> = {
     backgroundColor: undefined,
     borderColor: undefined
   };
@@ -37,7 +37,7 @@ export class ChartTooltip {
    * @param {any} tooltip
    * @memberof ChartTooltip
    */
-  customTooltips(tooltip) {
+  customTooltips(tooltip: any) {
     // Hide if no tooltip
     if (tooltip.opacity === 0) {
       this.tooltipEl.style.opacity = 0;
@@ -55,18 +55,18 @@ export class ChartTooltip {
     // Set Text
     if (tooltip.body) {
       const titleLines = tooltip.title || [];
-      const bodyLines = tooltip.body.map((bodyItem) => {
+      const bodyLines = tooltip.body.map((bodyItem: any) => {
         return bodyItem.lines;
       });
 
       let innerHtml = '<thead>';
 
-      titleLines.forEach((title) => {
+      titleLines.forEach((title: string) => {
         innerHtml += '<tr><th>' + this.getTitle(title) + '</th></tr>';
       });
       innerHtml += '</thead><tbody>';
 
-      bodyLines.forEach((body, i) => {
+      bodyLines.forEach((body: string, i: number) => {
         const colors = tooltip.labelColors[i];
         let style = 'background:' + (this.customColors.backgroundColor || colors.backgroundColor);
         style += '; border-color:' + (this.customColors.borderColor || colors.borderColor);
@@ -105,11 +105,11 @@ export class ChartTooltip {
     this.tooltipEl.style.padding = tooltip.yPadding + 'px ' + tooltip.xPadding + 'px';
   }
 
-  getBody(body) {
+  getBody(body: string) {
     return body;
   }
 
-  getTitle(title) {
+  getTitle(title: string) {
     return title;
   }
 }
index fab76717f73d1bc133d559ebc774f1af5950aeff..0adec5a0f59a634fb1874ba7ed37967969ef76c5 100644 (file)
@@ -1,5 +1,5 @@
 export class Task {
-  constructor(name?, metadata?) {
+  constructor(name?: string, metadata?: object) {
     this.name = name;
     this.metadata = metadata;
   }
index 462907906f36776b4fe8e65f2007285f25ae07db..e73420f6a35c03eb2d752e5b16d7f7944020078e 100644 (file)
@@ -8,8 +8,7 @@ describe('EmptyPipe', () => {
   });
 
   it('transforms with empty value', () => {
-    const value = undefined;
-    expect(pipe.transform(value)).toBe('-');
+    expect(pipe.transform(undefined)).toBe('-');
   });
 
   it('transforms with some value', () => {
index 94e5f8bdfec61d7fbb7eea41d0a4f33cdd982e95..58d7ff95fcdbf77c44c27ee5493384081b1b8131 100644 (file)
@@ -12,7 +12,7 @@ describe('FilterPipe', () => {
     const filters = [
       {
         value: 'foo',
-        applyFilter: (row, val) => {
+        applyFilter: (row: any[], val: any) => {
           return row.indexOf(val) !== -1;
         }
       }
@@ -25,13 +25,13 @@ describe('FilterPipe', () => {
     const filters = [
       {
         value: 'foo',
-        applyFilter: (row, val) => {
+        applyFilter: (row: any[], val: any) => {
           return row.indexOf(val) !== -1;
         }
       },
       {
         value: 'bar',
-        applyFilter: (row, val) => {
+        applyFilter: (row: any[], val: any) => {
           return row.indexOf(val) !== -1;
         }
       }
index f3dd70f3fb70d7ef3ea219b6aeb0e5fd9d59673e..313ac4c0dc2db83c0683e4306a3f625abd00ab35 100644 (file)
@@ -5,10 +5,10 @@ import { Pipe, PipeTransform } from '@angular/core';
 })
 export class FilterPipe implements PipeTransform {
   transform(value: any, args?: any): any {
-    return value.filter((row) => {
+    return value.filter((row: any) => {
       let result = true;
 
-      args.forEach((filter): boolean | void => {
+      args.forEach((filter: any): boolean | void => {
         if (!filter.value) {
           return undefined;
         }
index a05657dde0bb372863b0079929f48b97bd8ae6e1..0bb7930893a6948fe42eef79d2db53f652d8cb8c 100644 (file)
@@ -10,8 +10,7 @@ describe('RelativeDatePipe', () => {
   });
 
   it('transforms without value', () => {
-    const value = undefined;
-    expect(pipe.transform(value)).toBe('unknown');
+    expect(pipe.transform(undefined)).toBe('unknown');
   });
 
   it('transforms "in 7 days"', () => {
index 744f2137b5a5faa0269b598d576bebf1ad64f364..8c6ec61743ddadf8cde25bde0f505e2357b9a356 100644 (file)
@@ -7,6 +7,7 @@ import { ToastrService } from 'ngx-toastr';
 
 import { configureTestBed, i18nProviders } from '../../../testing/unit-test-helper';
 import { AppModule } from '../../app.module';
+import { NotificationType } from '../enum/notification-type.enum';
 import { CdNotification, CdNotificationConfig } from '../models/cd-notification';
 import { ApiInterceptorService } from './api-interceptor.service';
 import { NotificationService } from './notification.service';
@@ -18,7 +19,7 @@ describe('ApiInterceptorService', () => {
   let router: Router;
   const url = 'api/xyz';
 
-  const httpError = (error, errorOpts, done = (_resp) => {}) => {
+  const httpError = (error: any, errorOpts: object, done = (_resp: any) => {}) => {
     httpClient.get(url).subscribe(
       () => {},
       (resp) => {
@@ -30,20 +31,30 @@ describe('ApiInterceptorService', () => {
     httpTesting.expectOne(url).error(error, errorOpts);
   };
 
-  const runRouterTest = (errorOpts, expectedCallParams) => {
+  const runRouterTest = (errorOpts: object, expectedCallParams: any[]) => {
     httpError(new ErrorEvent('abc'), errorOpts);
     httpTesting.verify();
     expect(router.navigate).toHaveBeenCalledWith(...expectedCallParams);
   };
 
-  const runNotificationTest = (error, errorOpts, expectedCallParams) => {
+  const runNotificationTest = (
+    error: any,
+    errorOpts: object,
+    expectedCallParams: CdNotification
+  ) => {
     httpError(error, errorOpts);
     httpTesting.verify();
     expect(notificationService.show).toHaveBeenCalled();
     expect(notificationService.save).toHaveBeenCalledWith(expectedCallParams);
   };
 
-  const createCdNotification = (type, title?, message?, options?, application?) => {
+  const createCdNotification = (
+    type: NotificationType,
+    title?: string,
+    message?: string,
+    options?: any,
+    application?: string
+  ) => {
     return new CdNotification(new CdNotificationConfig(type, title, message, options, application));
   };
 
@@ -170,7 +181,7 @@ describe('ApiInterceptorService', () => {
   });
 
   describe('interceptor error handling', () => {
-    const expectSaveToHaveBeenCalled = (called) => {
+    const expectSaveToHaveBeenCalled = (called: boolean) => {
       tick(510);
       if (called) {
         expect(notificationService.save).toHaveBeenCalled();
index f93cffc5ec52c941e5d613a645cea2fa631c5554..c65f8c051882729ca601da4c9da20e9b25a89d7d 100644 (file)
@@ -92,7 +92,7 @@ export class ApiInterceptorService implements HttpInterceptor {
     );
   }
 
-  private prepareNotification(resp): number {
+  private prepareNotification(resp: any): number {
     return this.notificationService.show(() => {
       let message = '';
       if (_.isPlainObject(resp.error) && _.isString(resp.error.detail)) {
index 79e11cda1a52e9a80f3a3e0c240d984284e72700..b603e7fec42feb8a9d2f57018ccb6854ad8a990d 100644 (file)
@@ -16,7 +16,7 @@ export class AuthStorageService {
   set(
     username: string,
     token: string,
-    permissions: object = {},
+    permissions = {},
     sso = false,
     pwdExpirationDate: number = null
   ) {
index 79927505e58a4aeb9f5517c913a0c4dd629ed7ec..ed8260761f83b6b174577eeb10c9c6321b6c0cb9 100644 (file)
@@ -18,7 +18,7 @@ describe('DeviceService', () => {
   });
 
   describe('should test getDevices pipe', () => {
-    let now = null;
+    let now: jasmine.Spy = null;
 
     const newDevice = (data: object): CdDevice => {
       const device: CdDevice = {
index 6665647bb2a9b9de2209c5567935ffd4f3bb36dd..474926ce952f039b89ca032e8f0acd43f50674f1 100644 (file)
@@ -46,7 +46,7 @@ describe('FeatureTogglesGuardService', () => {
     expect(service).toBeTruthy();
   });
 
-  function testCanActivate(path, feature_toggles_map) {
+  function testCanActivate(path: string, feature_toggles_map: object) {
     let result: boolean;
     spyOn(fakeFeatureTogglesService, 'get').and.returnValue(observableOf(feature_toggles_map));
 
index 2b9885aa8672cb2555bcc855adb46ecb8e892dcd..8ead06e646c5df25a4e81a0c555b2833f583a505 100644 (file)
@@ -4,7 +4,7 @@ import { Injectable, NgZone } from '@angular/core';
 import { Observable } from 'rxjs';
 import { shareReplay } from 'rxjs/operators';
 
-export type FeatureTogglesMap = Map<string, boolean>;
+export type FeatureTogglesMap = Record<string, boolean>;
 export type FeatureTogglesMap$ = Observable<FeatureTogglesMap>;
 
 @Injectable({
index 6c9ce12b20962cf88662d60d623b1fc5930557b4..67d6a17b0bfe1a8aadd33c809f0532735506bc81 100644 (file)
@@ -35,7 +35,7 @@ export class FormatterService {
    * @returns Returns the given value in bytes without any unit appended or the defined error value
    *          in case xof an error.
    */
-  toBytes(value: string, error_value = null): number | null {
+  toBytes(value: string, error_value: number = null): number | null {
     const base = 1024;
     const units = ['b', 'k', 'm', 'g', 't', 'p', 'e', 'z', 'y'];
     const m = RegExp('^(\\d+(.\\d+)?) ?([' + units.join('') + ']?(b|ib|B/s)?)?$', 'i').exec(value);
index 87e95bf6706ef2e9dbb024f3c311df578649cc5e..597e259f856ada9744d433ff8c16f65387238cf7 100644 (file)
@@ -5,7 +5,7 @@ import { LoggingService } from '../api/logging.service';
 export class JsErrorHandler implements ErrorHandler {
   constructor(private injector: Injector) {}
 
-  handleError(error) {
+  handleError(error: any) {
     const loggingService = this.injector.get(LoggingService);
     const url = window.location.href;
     const message = error && error.message;
index b1cdf8f17751279f5bfb367ab99b3c286ff3a8ec..da48ac0fbe6b98ebcea8fa2d6a55d5e766e9f434 100644 (file)
@@ -26,7 +26,7 @@ describe('NotificationService', () => {
       NotificationService,
       TaskMessageService,
       { provide: ToastrService, useValue: toastFakeService },
-      { provide: CdDatePipe, useValue: { transform: (d) => d } },
+      { provide: CdDatePipe, useValue: { transform: (d: any) => d } },
       i18nProviders,
       RbdService
     ],
@@ -64,7 +64,7 @@ describe('NotificationService', () => {
   }));
 
   describe('Saved notifications', () => {
-    const expectSavedNotificationToHave = (expected: {}) => {
+    const expectSavedNotificationToHave = (expected: object) => {
       tick(510);
       expect(service['dataSource'].getValue().length).toBe(1);
       const notification = service['dataSource'].getValue()[0];
@@ -73,7 +73,7 @@ describe('NotificationService', () => {
       });
     };
 
-    const addNotifications = (quantity) => {
+    const addNotifications = (quantity: number) => {
       for (let index = 0; index < quantity; index++) {
         service.show(NotificationType.info, `${index}`);
         tick(510);
@@ -82,7 +82,7 @@ describe('NotificationService', () => {
 
     beforeEach(() => {
       spyOn(service, 'show').and.callThrough();
-      service.cancel(service['justShownTimeoutId']);
+      service.cancel((<any>service)['justShownTimeoutId']);
     });
 
     it('should create a success notification and save it', fakeAsync(() => {
@@ -186,7 +186,7 @@ describe('NotificationService', () => {
     const n1 = new CdNotificationConfig(NotificationType.success, 'Some success');
     const n2 = new CdNotificationConfig(NotificationType.info, 'Some info');
 
-    const showArray = (arr) => arr.forEach((n) => service.show(n));
+    const showArray = (arr: any[]) => arr.forEach((n) => service.show(n));
 
     beforeEach(() => {
       spyOn(service, 'save').and.stub();
index 9f9c5e36bc819aaa6ac773eb7c7e742f33f59f92..fddc55f52f8c9a7f284874abf85ec08610a9c416 100644 (file)
@@ -219,7 +219,7 @@ export class NotificationService {
    * Prevent the notification from being shown.
    * @param {number} timeoutId A number representing the ID of the timeout to be canceled.
    */
-  cancel(timeoutId) {
+  cancel(timeoutId: number) {
     window.clearTimeout(timeoutId);
   }
 
index 100c8299d12116a44d925b346e1f00e603045078..8bf4c41a822276a3ca6a788c5efef55d52b047b5 100644 (file)
@@ -39,12 +39,12 @@ describe('PrometheusAlertService', () => {
   });
 
   describe('test failing status codes and verify disabling of the alertmanager', () => {
-    const isDisabledByStatusCode = (statusCode: number, expectedStatus: boolean, done) => {
+    const isDisabledByStatusCode = (statusCode: number, expectedStatus: boolean, done: any) => {
       service = TestBed.get(PrometheusAlertService);
       prometheusService = TestBed.get(PrometheusService);
       spyOn(prometheusService, 'ifAlertmanagerConfigured').and.callFake((fn) => fn());
       spyOn(prometheusService, 'getAlerts').and.returnValue(
-        Observable.create((observer) => observer.error({ status: statusCode, error: {} }))
+        Observable.create((observer: any) => observer.error({ status: statusCode, error: {} }))
       );
       const disableFn = spyOn(prometheusService, 'disableAlertmanagerConfig').and.callFake(() => {
         expect(expectedStatus).toBe(true);
index f8d70d1d0e9c2d09f5b13ddf012575f6c0d5aded..9e5e09a23038698b9013af37bb7058a65e7b51fb 100644 (file)
@@ -111,7 +111,7 @@ describe('PrometheusNotificationService', () => {
       tick(20);
     };
 
-    const expectShown = (expected: {}[]) => {
+    const expectShown = (expected: object[]) => {
       tick(500);
       expect(shown.length).toBe(expected.length);
       expected.forEach((e, i) =>
index 684a7daa193d849e606ba087a46ea54274288956..6ac93140243142a97677ca9632a119bef7bb131d 100644 (file)
@@ -19,7 +19,7 @@ describe('PrometheusSilenceMatcherService', () => {
     providers: [i18nProviders]
   });
 
-  const addMatcher = (name, value) => ({
+  const addMatcher = (name: string, value: any) => ({
     name: name,
     value: value,
     isRegex: false
@@ -40,7 +40,12 @@ describe('PrometheusSilenceMatcherService', () => {
   });
 
   describe('test rule matching with one matcher', () => {
-    const expectSingleMatch = (name, value, helpText, successClass: boolean) => {
+    const expectSingleMatch = (
+      name: string,
+      value: any,
+      helpText: string,
+      successClass: boolean
+    ) => {
       const match = service.singleMatch(addMatcher(name, value), rules);
       expect(match.status).toBe(helpText);
       expect(match.cssClass).toBe(successClass ? 'has-success' : 'has-warning');
@@ -85,7 +90,7 @@ describe('PrometheusSilenceMatcherService', () => {
   });
 
   describe('test rule matching with multiple matcher', () => {
-    const expectMultiMatch = (matchers, helpText, successClass: boolean) => {
+    const expectMultiMatch = (matchers: any[], helpText: string, successClass: boolean) => {
       const match = service.multiMatch(matchers, rules);
       expect(match.status).toBe(helpText);
       expect(match.cssClass).toBe(successClass ? 'has-success' : 'has-warning');
index d4439416d987302bf0d05838dc12c9a01a49e682..9741084b2a885fb4091f0f73d75fd6991452ebc5 100644 (file)
@@ -13,7 +13,7 @@ describe('SummaryService', () => {
   let summaryService: SummaryService;
   let authStorageService: AuthStorageService;
 
-  const summary = {
+  const summary: Record<string, any> = {
     executing_tasks: [],
     health_status: 'HEALTH_OK',
     mgr_id: 'x',
@@ -49,7 +49,7 @@ describe('SummaryService', () => {
   it('should call refresh', fakeAsync(() => {
     summaryService.enablePolling();
     authStorageService.set('foobar', undefined, undefined);
-    const calledWith = [];
+    const calledWith: any[] = [];
     summaryService.subscribe((data) => {
       calledWith.push(data);
     });
index 8124ecc8db42adf1f035ae24ead301dc671860d4..1d090d96d8dce823455bdcae583c92ad349040d5 100644 (file)
@@ -70,7 +70,7 @@ export class SummaryService {
     }
 
     if (_.isArray(current.executing_tasks)) {
-      const exists = current.executing_tasks.find((element) => {
+      const exists = current.executing_tasks.find((element: any) => {
         return element.name === task.name && _.isEqual(element.metadata, task.metadata);
       });
       if (!exists) {
index f18d9b6096ddcbb598f0c9edb3768b953dbbf92d..b25766f95c0c1ccec0dbf5a61e8ccf4b00f12f23 100644 (file)
@@ -24,7 +24,7 @@ describe('TaskListService', () => {
   let apiResp: any;
   let tasks: any[];
 
-  const addItem = (name) => {
+  const addItem = (name: string) => {
     apiResp.push({ name: name });
   };
 
@@ -58,7 +58,7 @@ describe('TaskListService', () => {
       (task) => task.name.startsWith('test'),
       (item, task) => item.name === task.metadata['name'],
       {
-        default: (metadata) => ({ name: metadata['name'] })
+        default: (metadata: object) => ({ name: metadata['name'] })
       }
     );
   });
index 05cd7398f302c20245ba96600a69ab64405b730a..6d1f74b9fb1f06961e5c50e77d42515d89b2968f 100644 (file)
@@ -15,7 +15,7 @@ export class TaskListService implements OnDestroy {
   setList: (_: any[]) => void;
   onFetchError: (error: any) => void;
   taskFilter: (task: ExecutingTask) => boolean;
-  itemFilter: (item, task: ExecutingTask) => boolean;
+  itemFilter: (item: any, task: ExecutingTask) => boolean;
   builders: object;
 
   constructor(
@@ -45,7 +45,7 @@ export class TaskListService implements OnDestroy {
     setList: (_: any[]) => void,
     onFetchError: (error: any) => void,
     taskFilter: (task: ExecutingTask) => boolean,
-    itemFilter: (item, task: ExecutingTask) => boolean,
+    itemFilter: (item: any, task: ExecutingTask) => boolean,
     builders: object
   ) {
     this.getUpdate = getUpdate;
index 1fab5d39e3cd9d078641872398acee555e221e87..235d001f12e4a5fc170bbfe05575c329f2f58e12 100644 (file)
@@ -7,7 +7,7 @@ import { configureTestBed } from '../../../testing/unit-test-helper';
 import { SummaryService } from './summary.service';
 import { TaskManagerService } from './task-manager.service';
 
-const summary = {
+const summary: Record<string, any> = {
   executing_tasks: [],
   health_status: 'HEALTH_OK',
   mgr_id: 'x',
@@ -25,7 +25,7 @@ export class SummaryServiceMock {
   refresh() {
     this.summaryDataSource.next(summary);
   }
-  subscribe(call) {
+  subscribe(call: any) {
     return this.summaryData$.subscribe(call);
   }
 }
index 20ecd9d9891d6c98b631cb45ffa770bfa91c213c..d23b5b49fb9a542dff1c11ecaaedf91502bf6794 100644 (file)
@@ -12,7 +12,7 @@ class TaskSubscription {
   metadata: object;
   onTaskFinished: (finishedTask: FinishedTask) => any;
 
-  constructor(name, metadata, onTaskFinished) {
+  constructor(name: string, metadata: object, onTaskFinished: any) {
     this.name = name;
     this.metadata = metadata;
     this.onTaskFinished = onTaskFinished;
@@ -47,7 +47,7 @@ export class TaskManagerService {
     });
   }
 
-  subscribe(name, metadata, onTaskFinished: (finishedTask: FinishedTask) => any) {
+  subscribe(name: string, metadata: object, onTaskFinished: (finishedTask: FinishedTask) => any) {
     this.subscriptions.push(new TaskSubscription(name, metadata, onTaskFinished));
   }
 
index 6ca2c4d02dcc53fe25b3ec9108b6ddf4d923d3da..a88bfbf14761cc4a9ede093a3f7567317b6dbaa0 100644 (file)
@@ -127,7 +127,7 @@ describe('TaskManagerMessageService', () => {
     });
 
     describe('rbd tasks', () => {
-      let metadata;
+      let metadata: Record<string, any>;
       let childMsg: string;
       let destinationMsg: string;
       let snapMsg: string;
index e5ef68377425048f08da1edd8a4e53603d5dfa2d..51d1ff06dfec148d27036c24c0a31c7d8e3d49b4 100644 (file)
@@ -23,29 +23,29 @@ class TaskMessage {
   i18n: I18n;
 
   operation: TaskMessageOperation;
-  involves: (object) => string;
-  errors: (metadata) => object;
+  involves: (object: any) => string;
+  errors: (metadata: any) => object;
 
-  failure(metadata): string {
+  failure(metadata: any): string {
     return this.i18n('Failed to {{failure}} {{metadata}}', {
       failure: this.operation.failure,
       metadata: this.involves(metadata)
     });
   }
 
-  running(metadata): string {
+  running(metadata: any): string {
     return `${this.operation.running} ${this.involves(metadata)}`;
   }
 
-  success(metadata): string {
+  success(metadata: any): string {
     return `${this.operation.success} ${this.involves(metadata)}`;
   }
 
   constructor(
     i18n: I18n,
     operation: TaskMessageOperation,
-    involves: (metadata) => string,
-    errors?: (metadata) => object
+    involves: (metadata: any) => string,
+    errors?: (metadata: any) => object
   ) {
     this.i18n = i18n;
     this.operation = operation;
@@ -103,11 +103,11 @@ export class TaskMessageService {
   };
 
   rbd = {
-    default: (metadata) =>
+    default: (metadata: any) =>
       this.i18n(`RBD '{{id}}'`, {
         id: `${metadata.image_spec}`
       }),
-    create: (metadata) => {
+    create: (metadata: any) => {
       const id = new ImageSpec(
         metadata.pool_name,
         metadata.namespace,
@@ -117,7 +117,7 @@ export class TaskMessageService {
         id: id
       });
     },
-    child: (metadata) => {
+    child: (metadata: any) => {
       const id = new ImageSpec(
         metadata.child_pool_name,
         metadata.child_namespace,
@@ -127,7 +127,7 @@ export class TaskMessageService {
         id: id
       });
     },
-    destination: (metadata) => {
+    destination: (metadata: any) => {
       const id = new ImageSpec(
         metadata.dest_pool_name,
         metadata.dest_namespace,
@@ -137,7 +137,7 @@ export class TaskMessageService {
         id: id
       });
     },
-    snapshot: (metadata) =>
+    snapshot: (metadata: any) =>
       this.i18n(`RBD snapshot '{{id}}'`, {
         id: `${metadata.image_spec}@${metadata.snapshot_name}`
       })
@@ -146,11 +146,11 @@ export class TaskMessageService {
   rbd_mirroring = {
     site_name: () => this.i18n('mirroring site name'),
     bootstrap: () => this.i18n('bootstrap token'),
-    pool: (metadata) =>
+    pool: (metadata: any) =>
       this.i18n(`mirror mode for pool '{{id}}'`, {
         id: `${metadata.pool_name}`
       }),
-    pool_peer: (metadata) =>
+    pool_peer: (metadata: any) =>
       this.i18n(`mirror peer for pool '{{id}}'`, {
         id: `${metadata.pool_name}`
       })
@@ -407,33 +407,33 @@ export class TaskMessageService {
 
   newTaskMessage(
     operation: TaskMessageOperation,
-    involves: (metadata) => string,
-    errors?: (metadata) => object
+    involves: (metadata: any) => string,
+    errors?: (metadata: any) => object
   ) {
     return new TaskMessage(this.i18n, operation, involves, errors);
   }
 
-  host(metadata) {
+  host(metadata: any) {
     return this.i18n(`host '{{hostname}}'`, {
       hostname: metadata.hostname
     });
   }
 
-  pool(metadata) {
+  pool(metadata: any) {
     return this.i18n(`pool '{{pool_name}}'`, {
       pool_name: metadata.pool_name
     });
   }
 
-  ecp(metadata) {
+  ecp(metadata: any) {
     return this.i18n(`erasure code profile '{{name}}'`, { name: metadata.name });
   }
 
-  iscsiTarget(metadata) {
+  iscsiTarget(metadata: any) {
     return this.i18n(`target '{{target_iqn}}'`, { target_iqn: metadata.target_iqn });
   }
 
-  nfs(metadata) {
+  nfs(metadata: any) {
     return this.i18n(`NFS {{nfs_id}}`, {
       nfs_id: `'${metadata.cluster_id}:${metadata.export_id ? metadata.export_id : metadata.path}'`
     });
index 747964e1c7eb2315a4383664fc2d56b79cfcc209..93800260d651036adbe297bdc58461b4de5926e8 100644 (file)
@@ -34,7 +34,7 @@ describe('TaskWrapperService', () => {
     let passed: boolean;
     let summaryService: SummaryService;
 
-    const fakeCall = (status?) =>
+    const fakeCall = (status?: number) =>
       new Observable((observer) => {
         if (!status) {
           observer.error({ error: 'failed' });
@@ -43,7 +43,7 @@ describe('TaskWrapperService', () => {
         observer.complete();
       });
 
-    const callWrapTaskAroundCall = (status, name) => {
+    const callWrapTaskAroundCall = (status: number, name: string) => {
       return service.wrapTaskAroundCall({
         task: new FinishedTask(name, { sth: 'else' }),
         call: fakeCall(status)
index 335b85cecddae3c6eee29e8ecdde0d1fe2ce204c..8909ca8edf62ca33c5dd06550fdc91d684065a86 100644 (file)
@@ -49,7 +49,7 @@ describe('TimeDiffService', () => {
     const days = 24 * hours;
 
     it('should allow different writings', () => {
-      const expectDurationToBeMs = (duration, ms) =>
+      const expectDurationToBeMs = (duration: string, ms: number) =>
         expect(service['getDurationMs'](duration)).toBe(ms);
       expectDurationToBeMs('2h', 2 * hours);
       expectDurationToBeMs('4 Days', 4 * days);
@@ -59,7 +59,7 @@ describe('TimeDiffService', () => {
     });
 
     it('should create duration string from ms', () => {
-      const expectMsToBeDuration = (ms, duration) =>
+      const expectMsToBeDuration = (ms: number, duration: string) =>
         expect(service['getDuration'](ms)).toBe(duration);
       expectMsToBeDuration(2 * hours, '2h');
       expectMsToBeDuration(4 * days, '4d');
index 4081a81829b3c76357e73942153ed74d5a4084af..8d3079a251cc30218f985a2266ed4b8134f2c295 100644 (file)
@@ -30,7 +30,7 @@ export class TimeDiffService {
     const m = date.getUTCMinutes();
     const d = Math.floor(ms / (24 * 3600 * 1000));
 
-    const format = (n, s) => (n ? n + s : n);
+    const format = (n: number, s: string) => (n ? n + s : n);
     return [format(d, 'd'), format(h, 'h'), format(m, 'm')].filter((x) => x).join(' ');
   }
 
@@ -50,8 +50,8 @@ export class TimeDiffService {
     return ((d * 24 + h) * 60 + m) * 60000;
   }
 
-  private getNumbersFromString(duration, prefix): number {
+  private getNumbersFromString(duration: string, prefix: string): number {
     const match = duration.match(new RegExp(`[0-9 ]+${prefix}`, 'i'));
-    return match ? parseInt(match, 10) : 0;
+    return match ? parseInt(match[0], 10) : 0;
   }
 }
index 6c6750adbbd56d31153d67238f0aa86e848702b1..3006ecaf7e9d5d14587405d51dc5fa69e47c0ba5 100644 (file)
@@ -1,9 +1,9 @@
 const mock = () => {
   let storage = {};
   return {
-    getItem: (key) => (key in storage ? storage[key] : null),
-    setItem: (key, value) => (storage[key] = value || ''),
-    removeItem: (key) => delete storage[key],
+    getItem: (key: string) => (key in storage ? storage[key] : null),
+    setItem: (key: string, value: any) => (storage[key] = value || ''),
+    removeItem: (key: string) => delete storage[key],
     clear: () => (storage = {})
   };
 };
index b21c5a2a8dc4ae3819214d015afe8ddfa3e7c6dd..c3e5750a3217141bc00a84f87c0cf0e826b03d91 100644 (file)
@@ -20,7 +20,7 @@ import {
 } from '../app/shared/models/prometheus-alerts';
 import { _DEV_ } from '../unit-test-configuration';
 
-export function configureTestBed(configuration, useOldMethod?) {
+export function configureTestBed(configuration: any, useOldMethod?: boolean) {
   if (_DEV_ && !useOldMethod) {
     const resetTestingModule = TestBed.resetTestingModule;
     beforeAll((done) =>
@@ -190,7 +190,7 @@ export class FormHelper {
  *
  * Please make sure to call this function *inside* your mock and return the reference at the end.
  */
-export function modalServiceShow(componentClass: Type<any>, modalConfig) {
+export function modalServiceShow(componentClass: Type<any>, modalConfig: any) {
   const ref = new BsModalRef();
   const fixture = TestBed.createComponent(componentClass);
   let component = fixture.componentInstance;
@@ -276,7 +276,7 @@ export class FixtureHelper {
 }
 
 export class PrometheusHelper {
-  createSilence(id) {
+  createSilence(id: string) {
     return {
       id: id,
       createdBy: `Creator of ${id}`,
@@ -293,7 +293,7 @@ export class PrometheusHelper {
     };
   }
 
-  createRule(name, severity, alerts: any[]): PrometheusRule {
+  createRule(name: string, severity: string, alerts: any[]): PrometheusRule {
     return {
       name: name,
       labels: {
@@ -303,7 +303,7 @@ export class PrometheusHelper {
     } as PrometheusRule;
   }
 
-  createAlert(name, state = 'active', timeMultiplier = 1): AlertmanagerAlert {
+  createAlert(name: string, state = 'active', timeMultiplier = 1): AlertmanagerAlert {
     return {
       fingerprint: name,
       status: { state },
@@ -321,7 +321,7 @@ export class PrometheusHelper {
     } as AlertmanagerAlert;
   }
 
-  createNotificationAlert(name, status = 'firing'): AlertmanagerNotificationAlert {
+  createNotificationAlert(name: string, status = 'firing'): AlertmanagerNotificationAlert {
     return {
       status: status,
       labels: {
@@ -342,7 +342,7 @@ export class PrometheusHelper {
     return { alerts, status } as AlertmanagerNotification;
   }
 
-  createLink(url) {
+  createLink(url: string) {
     return `<a href="${url}" target="_blank"><i class="${Icons.lineChart}"></i></a>`;
   }
 }
index 7c38858a5e04d37dc6a94f0b90b59202f8cbd16a..b72faa4b0f21383221471f6a09ec75d853124db9 100644 (file)
@@ -15,6 +15,8 @@
     "noFallthroughCasesInSwitch": true,
     "noImplicitThis": true,
     "noImplicitReturns": true,
+    "noImplicitAny": true,
+    "suppressImplicitAnyIndexErrors": true,
     "target": "es2015",
     "typeRoots": [
       "node_modules/@types"