mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Disable kubectl download mirror options when not available (#3956)
This commit is contained in:
1 parent
125a073007
commit
cbffb85650
3 files changed
+32
-17
No files matched your search
@@ -136,12 +136,32 @@ const allowErrorReporting: PreferenceDescription<boolean> = {
|
||||
},
|
||||
};
|
||||
|
||||
export interface DownloadMirror {
|
||||
url: string;
|
||||
label: string;
|
||||
platforms: Set<NodeJS.Platform>;
|
||||
}
|
||||
|
||||
export const defaultPackageMirror = "default";
|
||||
export const packageMirrors = new Map<string, DownloadMirror>([
|
||||
[defaultPackageMirror, {
|
||||
url: "https://storage.googleapis.com/kubernetes-release/release",
|
||||
label: "Default (Google)",
|
||||
platforms: new Set(["darwin", "win32", "linux"]),
|
||||
}],
|
||||
["china", {
|
||||
url: "https://mirror.azure.cn/kubernetes/kubectl",
|
||||
label: "China (Azure)",
|
||||
platforms: new Set(["win32", "linux"]),
|
||||
}],
|
||||
]);
|
||||
|
||||
const downloadMirror: PreferenceDescription<string> = {
|
||||
fromStore(val) {
|
||||
return val ?? "default";
|
||||
return packageMirrors.has(val) ? val : defaultPackageMirror;
|
||||
},
|
||||
toStore(val) {
|
||||
if (!val || val === "default") {
|
||||
if (!val || val === defaultPackageMirror) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user