Skip to content

Commit

Permalink
Ts types fix (#3315)
Browse files Browse the repository at this point in the history
* Add trivial ts types linter issues (explicit any, remove unused)

Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>

* Add comments to tsconfig file as in the autogenerated

Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>

* Remove unused field

Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>

* Run prettier

Signed-off-by: Antonio Gamez Diaz <agamez@vmware.com>
  • Loading branch information
antgamdia authored Aug 30, 2021
1 parent 419b7b8 commit 6dab204
Show file tree
Hide file tree
Showing 35 changed files with 142 additions and 130 deletions.
26 changes: 13 additions & 13 deletions dashboard/src/actions/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export function getApp(
const app = await App.getRelease(cluster, namespace, releaseName);
dispatch(selectApp(app));
return app;
} catch (e) {
} catch (e: any) {
dispatch(errorApp(new FetchError(e.message)));
return;
}
Expand All @@ -112,7 +112,7 @@ function getAppUpdateInfo(
currentVersion: string,
appVersion: string,
): ThunkAction<Promise<void>, IStoreState, null, AppsAction> {
return async (dispatch, getState) => {
return async dispatch => {
dispatch(requestAppUpdateInfo());
try {
const chartsInfo = await Chart.listWithFilters(
Expand Down Expand Up @@ -146,7 +146,7 @@ function getAppUpdateInfo(
};
}
dispatch(receiveAppUpdateInfo({ releaseName, updateInfo }));
} catch (e) {
} catch (e: any) {
const updateInfo: IChartUpdateInfo = {
error: e,
upToDate: false,
Expand Down Expand Up @@ -185,7 +185,7 @@ export function getAppWithUpdateInfo(
),
);
}
} catch (e) {
} catch (e: any) {
dispatch(errorApp(new FetchError(e.message)));
}
};
Expand All @@ -203,7 +203,7 @@ export function deleteApp(
await App.delete(cluster, namespace, releaseName, purge);
dispatch(receiveDeleteApp());
return true;
} catch (e) {
} catch (e: any) {
dispatch(errorApp(new DeleteError(e.message)));
return false;
}
Expand All @@ -221,7 +221,7 @@ export function fetchApps(
const apps = await App.listApps(cluster, ns);
dispatch(receiveAppList(apps));
return apps;
} catch (e) {
} catch (e: any) {
dispatch(errorApp(new FetchError(e.message)));
return [];
}
Expand All @@ -247,7 +247,7 @@ export function fetchAppsWithUpdateInfo(
),
),
);
} catch (e) {
} catch (e: any) {
dispatch(errorApp(new FetchError(e.message)));
}
};
Expand All @@ -262,7 +262,7 @@ export function deployChart(
values?: string,
schema?: JSONSchemaType<any>,
): ThunkAction<Promise<boolean>, IStoreState, null, AppsAction> {
return async (dispatch, getState) => {
return async dispatch => {
dispatch(requestDeployApp());
try {
if (values && schema) {
Expand All @@ -286,7 +286,7 @@ export function deployChart(
);
dispatch(receiveDeployApp());
return true;
} catch (e) {
} catch (e: any) {
dispatch(errorApp(new CreateError(e.message)));
return false;
}
Expand All @@ -302,7 +302,7 @@ export function upgradeApp(
values?: string,
schema?: JSONSchemaType<any>,
): ThunkAction<Promise<boolean>, IStoreState, null, AppsAction> {
return async (dispatch, getState) => {
return async dispatch => {
dispatch(requestUpgradeApp());
try {
if (values && schema) {
Expand All @@ -319,7 +319,7 @@ export function upgradeApp(
await App.upgrade(cluster, namespace, releaseName, chartNamespace, chartVersion, values);
dispatch(receiveUpgradeApp());
return true;
} catch (e) {
} catch (e: any) {
dispatch(errorApp(new UpgradeError(e.message)));
return false;
}
Expand All @@ -332,14 +332,14 @@ export function rollbackApp(
releaseName: string,
revision: number,
): ThunkAction<Promise<boolean>, IStoreState, null, AppsAction> {
return async (dispatch, getState) => {
return async dispatch => {
dispatch(requestRollbackApp());
try {
await App.rollback(cluster, namespace, releaseName, revision);
dispatch(receiveRollbackApp());
dispatch(getAppWithUpdateInfo(cluster, namespace, releaseName));
return true;
} catch (e) {
} catch (e: any) {
dispatch(errorApp(new RollbackError(e.message)));
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion dashboard/src/actions/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function authenticate(
if (oidc) {
dispatch(setSessionExpired(false));
}
} catch (e) {
} catch (e: any) {
dispatch(authenticationError(e.toString()));
}
};
Expand Down
20 changes: 10 additions & 10 deletions dashboard/src/actions/catalog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function provision(
filteredParams,
);
return true;
} catch (e) {
} catch (e: any) {
dispatch(errorCatalog(e, "create"));
return false;
}
Expand All @@ -110,7 +110,7 @@ export function addBinding(
filteredParams,
);
return true;
} catch (e) {
} catch (e: any) {
dispatch(errorCatalog(e, "create"));
return false;
}
Expand All @@ -128,7 +128,7 @@ export function removeBinding(
try {
await ServiceBinding.delete(currentCluster, namespace, name);
return true;
} catch (e) {
} catch (e: any) {
dispatch(errorCatalog(e, "delete"));
return false;
}
Expand All @@ -145,7 +145,7 @@ export function deprovision(
try {
await ServiceCatalog.deprovisionInstance(currentCluster, instance);
return true;
} catch (e) {
} catch (e: any) {
dispatch(errorCatalog(e, "deprovision"));
return false;
}
Expand All @@ -161,7 +161,7 @@ export function sync(
} = getState();
try {
await ServiceCatalog.syncBroker(kubeappsCluster, broker);
} catch (e) {
} catch (e: any) {
dispatch(errorCatalog(e, "update"));
}
};
Expand All @@ -178,7 +178,7 @@ export function getBindings(
try {
const bindingsWithSecrets = await ServiceBinding.list(kubeappsCluster, ns);
dispatch(receiveBindingsWithSecrets(bindingsWithSecrets));
} catch (e) {
} catch (e: any) {
dispatch(errorCatalog(e, "fetch"));
}
};
Expand All @@ -193,7 +193,7 @@ export function getBrokers(): ThunkAction<Promise<void>, IStoreState, null, Serv
try {
const brokers = await ServiceCatalog.getServiceBrokers(currentCluster);
dispatch(receiveBrokers(brokers));
} catch (e) {
} catch (e: any) {
dispatch(errorCatalog(e, "fetch"));
}
};
Expand All @@ -208,7 +208,7 @@ export function getClasses(): ThunkAction<Promise<void>, IStoreState, null, Serv
try {
const classes = await ServiceCatalog.getServiceClasses(currentCluster);
dispatch(receiveClasses(classes));
} catch (e) {
} catch (e: any) {
dispatch(errorCatalog(e, "fetch"));
}
};
Expand All @@ -225,7 +225,7 @@ export function getInstances(
try {
const instances = await ServiceInstance.list(currentCluster, ns);
dispatch(receiveInstances(instances));
} catch (e) {
} catch (e: any) {
dispatch(errorCatalog(e, "fetch"));
}
};
Expand All @@ -240,7 +240,7 @@ export function getPlans(): ThunkAction<Promise<void>, IStoreState, null, Servic
try {
const plans = await ServiceCatalog.getServicePlans(currentCluster);
dispatch(receivePlans(plans));
} catch (e) {
} catch (e: any) {
dispatch(errorCatalog(e, "fetch"));
}
};
Expand Down
14 changes: 7 additions & 7 deletions dashboard/src/actions/charts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export function fetchCharts(
totalPages: response.meta.totalPages,
}),
);
} catch (e) {
} catch (e: any) {
dispatch(errorChart(new FetchError(e.message)));
}
};
Expand All @@ -128,7 +128,7 @@ export function fetchChartCategories(
if (categories) {
dispatch(receiveChartCategories(categories));
}
} catch (e) {
} catch (e: any) {
dispatch(errorChartCatetories(new FetchError(e.message)));
}
};
Expand All @@ -147,7 +147,7 @@ export function fetchChartVersions(
dispatch(receiveChartVersions(versions));
}
return versions;
} catch (e) {
} catch (e: any) {
dispatch(errorChart(new FetchError(e.message)));
return [];
}
Expand All @@ -162,7 +162,7 @@ async function getChart(cluster: string, namespace: string, id: string, version:
try {
values = await Chart.getValues(cluster, namespace, id, version);
schema = await Chart.getSchema(cluster, namespace, id, version);
} catch (e) {
} catch (e: any) {
if (e.constructor !== NotFoundError) {
throw e;
}
Expand All @@ -184,7 +184,7 @@ export function getChartVersion(
if (chartVersion) {
dispatch(selectChartVersion(chartVersion, values, schema));
}
} catch (e) {
} catch (e: any) {
dispatch(errorChart(new FetchError(e.message)));
}
};
Expand All @@ -203,7 +203,7 @@ export function getDeployedChartVersion(
if (chartVersion) {
dispatch(receiveDeployedChartVersion(chartVersion, values, schema));
}
} catch (e) {
} catch (e: any) {
dispatch(errorChart(new FetchError(e.message)));
}
};
Expand Down Expand Up @@ -245,7 +245,7 @@ export function getChartReadme(
try {
const readme = await Chart.getReadme(cluster, namespace, id, version);
dispatch(selectReadme(readme));
} catch (e) {
} catch (e: any) {
dispatch(errorReadme(e.toString()));
}
};
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/actions/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function getConfig(): ThunkAction<Promise<void>, IStoreState, null, Confi
try {
const config = await Config.getConfig();
dispatch(receiveConfig(config));
} catch (e) {
} catch (e: any) {
dispatch(errorConfig(e));
}
};
Expand All @@ -40,7 +40,7 @@ export function getTheme(): ThunkAction<Promise<void>, IStoreState, null, Config
const theme = Config.getTheme(config);
Config.setTheme(theme);
dispatch(receiveTheme(theme));
} catch (e) {
} catch (e: any) {
dispatch(errorConfig(e));
}
};
Expand Down
4 changes: 2 additions & 2 deletions dashboard/src/actions/kube.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export function getResourceKinds(
const groups = await Kube.getAPIGroups(cluster);
const kinds = await Kube.getResourceKinds(cluster, groups);
dispatch(receiveResourceKinds(kinds));
} catch (e) {
} catch (e: any) {
dispatch(receiveKindsError(e));
}
};
Expand Down Expand Up @@ -108,7 +108,7 @@ export function getResource(
try {
const r = await ref.getResource();
dispatch(receiveResource({ key, resource: r as IResource }));
} catch (e) {
} catch (e: any) {
dispatch(receiveResourceError({ key, error: e }));
}
};
Expand Down
8 changes: 4 additions & 4 deletions dashboard/src/actions/namespace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export function fetchNamespaces(
}
dispatch(receiveNamespaces(cluster, namespaceStrings));
return namespaceStrings;
} catch (e) {
} catch (e: any) {
dispatch(errorNamespaces(cluster, e, "list"));
return [];
}
Expand All @@ -86,7 +86,7 @@ export function createNamespace(
dispatch(postNamespace(cluster, ns));
dispatch(fetchNamespaces(cluster));
return true;
} catch (e) {
} catch (e: any) {
dispatch(errorNamespaces(cluster, e, "create"));
return false;
}
Expand All @@ -103,7 +103,7 @@ export function getNamespace(
const namespace = await Namespace.get(cluster, ns);
dispatch(receiveNamespace(cluster, namespace));
return true;
} catch (e) {
} catch (e: any) {
dispatch(errorNamespaces(cluster, e, "get"));
return false;
}
Expand All @@ -127,7 +127,7 @@ export function canCreate(
try {
const allowed = await Kube.canI(cluster, "", "namespaces", "create", "");
dispatch(setAllowCreate(cluster, allowed));
} catch (e) {
} catch (e: any) {
dispatch(errorNamespaces(cluster, e, "get"));
}
};
Expand Down
Loading

0 comments on commit 6dab204

Please sign in to comment.