mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
- Correctly handle the case where `undefined` is returned by the fetch because of a 403: Unauthorized being returned from the Kube Api due to only having list permissions in some of the namespaces - Fix rendering of Pod Secrets in the details view to handle correctly the case where the user doesn't have list or get secrets permissions - Remove CancelablePromise<T> as it was only used in one place and the return types where wrong causing a crash while debugging the above. - Move HelmChartDetails to create its own AbortController for cancelling its request itself as that was the only instance of the cancel() method being called - Significantly improve the typing of `isJsonApiData` and `isJsonApiDataList` so that they actually make sure that the form of the data matches the assertion they make. This also removes a crash from incorrectly assuming that `any` could not be `undefined`. - Add tests for the above two functions - Significantly improve the readability of the isKubeJson* functions - add doc comments for `ItemStore.prototype.sortItems` - add many more helper functions for type narrowing - Add some more handling of error cases with RBAC - Add notifications when errors occur (which leave lists in the loading state) - properly set response codes when an error occurs for listing helm releases - support kube API 1.20 with now optional selfLink - fix KubeObjectStore.subscribe not waiting for the corisponding load to occur Signed-off-by: Sebastian Malton <sebastian@malton.name>
14 lines
400 B
TypeScript
14 lines
400 B
TypeScript
import { AbortSignal } from "abort-controller";
|
|
|
|
/**
|
|
* Creates a new promise that will be rejected when the signal rejects.
|
|
*
|
|
* Useful for `Promise.race()` applications.
|
|
* @param signal The AbortController's signal to reject with
|
|
*/
|
|
export function rejectPromiseBy(signal: AbortSignal): Promise<void> {
|
|
return new Promise((_, reject) => {
|
|
signal.addEventListener("abort", reject);
|
|
});
|
|
}
|