]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Enable noImplicitReturns TS compiler option
authorTiago Melo <tmelo@suse.com>
Fri, 20 Dec 2019 12:15:34 +0000 (11:15 -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>
20 files changed:
src/pybind/mgr/dashboard/frontend/e2e/page-helper.po.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/mirroring/pool-edit-peer-modal/pool-edit-peer-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-namespace-list/rbd-namespace-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.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/hosts/hosts.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/mgr-modules/mgr-module-list/mgr-module-list.component.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.ts
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/components/pwd-expiration-notification/pwd-expiration-notification.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.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/pipes/filter.pipe.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/prometheus-silence-matcher.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/task-list.service.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/services/time-diff.service.ts
src/pybind/mgr/dashboard/frontend/tsconfig.json

index 464d61ed78a96fb75d9c98a3cd1e989ca1ba4f3f..45bbd7e6edef2469d50ab5fde6a5fcbb4cb0fecb 100644 (file)
@@ -197,7 +197,7 @@ export abstract class PageHelper {
   async clearInput(elem: ElementFinder) {
     const types = ['text', 'number'];
     if ((await elem.getTagName()) === 'input' && types.includes(await elem.getAttribute('type'))) {
-      await elem.sendKeys(
+      return await elem.sendKeys(
         protractor.Key.chord(protractor.Key.CONTROL, 'a'),
         protractor.Key.BACK_SPACE
       );
index 43e4124a19003e7a12e4e51d2cf6b0bd51218ae9..12a8b3be7c55e2cc40b1fa8b34fb45cee2c41158 100644 (file)
@@ -165,6 +165,8 @@ export class IscsiTargetListComponent implements OnInit, OnDestroy {
     if (first && _.isUndefined(first['info'])) {
       return this.i18n('Unavailable gateway(s)');
     }
+
+    return undefined;
   }
 
   getDeleteDisableDesc(): string | undefined {
@@ -178,6 +180,8 @@ export class IscsiTargetListComponent implements OnInit, OnDestroy {
     if (first && first['info'] && first['info']['num_sessions']) {
       return this.i18n('Target has active sessions');
     }
+
+    return undefined;
   }
 
   prepareResponse(resp: any): any[] {
index aefbebae11119459dd3419891f244c1c6b0d6c83..2181bc4a7e1b826b4807fd8bec2b53b8ffcf42a9 100644 (file)
@@ -67,18 +67,24 @@ export class PoolEditPeerModalComponent implements OnInit {
     if (!control.value.match(/^[\w\-_]*$/)) {
       return { invalidClusterName: { value: control.value } };
     }
+
+    return undefined;
   }
 
   validateClientID(control: AbstractControl) {
     if (!control.value.match(/^(?!client\.)[\w\-_.]*$/)) {
       return { invalidClientID: { value: control.value } };
     }
+
+    return undefined;
   }
 
   validateMonAddr(control: AbstractControl) {
     if (!control.value.match(/^[,; ]*([\w.\-_\[\]]+(:[\d]+)?[,; ]*)*$/)) {
       return { invalidMonAddr: { value: control.value } };
     }
+
+    return undefined;
   }
 
   validateKey(control: AbstractControl) {
index 3b140e07b43c75a019abdf7e753b7547fd99b19d..7c0830ce1cdc388377e535807187f24349f5a70a 100644 (file)
@@ -164,6 +164,8 @@ export class PoolListComponent implements OnInit, OnDestroy {
     if (pool && pool['peer_uuids']) {
       return pool['peer_uuids'][0];
     }
+
+    return undefined;
   }
 
   updateSelection(selection: CdTableSelection) {
index ca6bb9d137bf4c974ce427f6c13e8c70a04d6f22..36a241eb8322d350863fba68a650c36325141b8a 100644 (file)
@@ -158,5 +158,7 @@ export class RbdNamespaceListComponent implements OnInit {
         return this.i18n('Namespace contains images');
       }
     }
+
+    return undefined;
   }
 }
index bf3e89a680946b9da4cef1825a14a07638a9492b..3086a1a5a2acfd72da79b1ea180d737e93b8cfd4 100644 (file)
@@ -96,5 +96,7 @@ export class RbdSnapshotActionsModel {
     if (!featuresName.includes('layering')) {
       return this.i18n('Parent image must support Layering');
     }
+
+    return undefined;
   }
 }
index d17888d4ae206d47187ae9134e350c595aa87374..d0652cb00beba1a80647cb14f98091d3a8115e2e 100644 (file)
@@ -81,6 +81,8 @@ export class ConfigurationFormComponent implements OnInit {
 
       return typeValidators.validators;
     }
+
+    return undefined;
   }
 
   getStep(type: string, value: number): number | undefined {
index f22f4c6b59d0debbd11f4020d3f8105523739a12..40ccb8b8ddc224825f8d6f2afeef0b9366f9a931 100644 (file)
@@ -158,5 +158,7 @@ export class HostsComponent implements OnInit {
     if (!this.orchestratorAvailable) {
       return this.i18n('Host operation is disabled because orchestrator is unavailable');
     }
+
+    return undefined;
   }
 }
index 47635095d2cef58548b799ae9309991e136699d6..755f3e73d5f3b3a49b1f6081749b476139303ba3 100644 (file)
@@ -139,6 +139,8 @@ export class MgrModuleListComponent {
         return this.i18n('This Manager module is always on.');
       }
     }
+
+    return undefined;
   }
 
   /**
index ce02f7c4b66f518e0afb9b97e53af4447f35788f..78784867983dcb9932a2caf61e9e270d5c9c2ca7 100644 (file)
@@ -369,7 +369,7 @@ export class PoolFormComponent implements OnInit {
 
   getMinSize(): number {
     if (!this.info || this.info.osd_count < 1) {
-      return;
+      return undefined;
     }
     const rule = this.form.getValue('crushRule');
     if (rule) {
@@ -380,7 +380,7 @@ export class PoolFormComponent implements OnInit {
 
   getMaxSize(): number {
     if (!this.info || this.info.osd_count < 1) {
-      return;
+      return undefined;
     }
     const osds: number = this.info.osd_count;
     if (this.form.getValue('crushRule')) {
@@ -417,6 +417,8 @@ export class PoolFormComponent implements OnInit {
     if (sizeControl.valid && size > 0) {
       return pgs / size;
     }
+
+    return undefined;
   }
 
   private erasurePgCalc(pgs): number {
@@ -425,6 +427,8 @@ export class PoolFormComponent implements OnInit {
     if ((ecpControl.valid || ecpControl.disabled) && ecp) {
       return pgs / (ecp.k + ecp.m);
     }
+
+    return undefined;
   }
 
   private alignPgs(pgs = this.form.getValue('pgNum')) {
index 72a330c12504de74ccd7c4d8749d22bf0b003a8e..ee7cfe7a4619d82ddccb5fd8f7d6246b2fb2bd74 100644 (file)
@@ -291,5 +291,7 @@ export class PoolListComponent implements OnInit {
         'Pool deletion is disabled by the mon_allow_pool_delete configuration setting.'
       );
     }
+
+    return undefined;
   }
 }
index 2dfede6ca19037dc17d6d578747513be8ede799a..d13c4b1d3f65cf78a660a4061dee81cf22bbe05c 100644 (file)
@@ -71,6 +71,8 @@ export class NavigationComponent implements OnInit {
         return { color: '#f0ad4e' };
       }
     }
+
+    return undefined;
   }
 
   toggleSubMenu(menu: string) {
index 94e64b5ecf62a65a02a7028dda43941347f36fc8..676fe5148e83b3132d504e7f9f98f720b61677d0 100644 (file)
@@ -37,11 +37,9 @@ export class PwdExpirationNotificationComponent implements OnInit {
   }
 
   private getExpirationDays(pwdExpirationDate: number): number {
-    if (pwdExpirationDate) {
-      const current = new Date();
-      const expiration = new Date(pwdExpirationDate * 1000);
-      return Math.floor((expiration.valueOf() - current.valueOf()) / (1000 * 3600 * 24));
-    }
+    const current = new Date();
+    const expiration = new Date(pwdExpirationDate * 1000);
+    return Math.floor((expiration.valueOf() - current.valueOf()) / (1000 * 3600 * 24));
   }
 
   close() {
index 824c9b74edd0153d3253cd378e81fc046dbd1dd1..57714dbae6b14d48eb90cc59084e1592deeb68a9 100644 (file)
@@ -80,7 +80,7 @@ export class TableActionsComponent implements OnInit {
    */
   getCurrentButton(): CdTableAction {
     if (this.dropDownOnly) {
-      return;
+      return undefined;
     }
     let buttonAction = this.dropDownActions.find((tableAction) => this.showableAction(tableAction));
     if (!buttonAction && this.dropDownActions.length > 0) {
@@ -104,7 +104,7 @@ export class TableActionsComponent implements OnInit {
 
   useRouterLink(action: CdTableAction): string {
     if (!action.routerLink || this.disableSelectionAction(action)) {
-      return;
+      return undefined;
     }
     return _.isString(action.routerLink) ? action.routerLink : action.routerLink();
   }
index 8006bf721843f8e421fe99e52552bd796149377a..b3b4acd2cb3a1e6825bad003deb352c976d21e92 100644 (file)
@@ -112,7 +112,7 @@ export class TableKeyValueComponent implements OnInit, OnChanges {
   private makePairs(data: any): KeyValueItem[] {
     let result: KeyValueItem[] = [];
     if (!data) {
-      return; // Wait for data
+      return undefined; // Wait for data
     } else if (_.isArray(data)) {
       result = this.makePairsFromArray(data);
     } else if (_.isObject(data)) {
index 7425183f4b1d4720a0f83bfaa111f1360af7c641..f3dd70f3fb70d7ef3ea219b6aeb0e5fd9d59673e 100644 (file)
@@ -8,9 +8,9 @@ export class FilterPipe implements PipeTransform {
     return value.filter((row) => {
       let result = true;
 
-      args.forEach((filter) => {
+      args.forEach((filter): boolean | void => {
         if (!filter.value) {
-          return;
+          return undefined;
         }
 
         result = result && filter.applyFilter(row, filter.value);
index c9bb9729dd8e08230b78d65710b45df973f07c7a..548dd00c56542d4fc1f32b4cb5d00507d6f8ac25 100644 (file)
@@ -34,7 +34,7 @@ export class PrometheusSilenceMatcherService {
     rules: PrometheusRule[]
   ): AlertmanagerSilenceMatcherMatch {
     if (matchers.some((matcher) => matcher.isRegex)) {
-      return;
+      return undefined;
     }
     matchers.forEach((matcher) => {
       rules = this.getMatchedRules(matcher, rules);
index af3e924a786502a427125c451872f93a37c860b8..05cd7398f302c20245ba96600a69ab64405b730a 100644 (file)
@@ -88,7 +88,7 @@ export class TaskListService implements OnDestroy {
 
   private getTaskAction(tasks: ExecutingTask[]): string {
     if (tasks.length === 0) {
-      return;
+      return undefined;
     }
     return tasks
       .map((task) => {
index 0f882bc8f4d21020bfc91225037ed2bf8c68b3fb..4081a81829b3c76357e73942153ed74d5a4084af 100644 (file)
@@ -37,7 +37,7 @@ export class TimeDiffService {
   calculateDate(date: Date, duration: string, reverse?: boolean): Date {
     const time = +date;
     if (_.isNaN(time)) {
-      return;
+      return undefined;
     }
     const diff = this.getDurationMs(duration) * (reverse ? -1 : 1);
     return new Date(time + diff);
index 920370ad7eabb82b1f7cef7c6515d04d7c187dd6..7c38858a5e04d37dc6a94f0b90b59202f8cbd16a 100644 (file)
@@ -14,6 +14,7 @@
     "noUnusedParameters": true,
     "noFallthroughCasesInSwitch": true,
     "noImplicitThis": true,
+    "noImplicitReturns": true,
     "target": "es2015",
     "typeRoots": [
       "node_modules/@types"