mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Add ability to configure lens release channel (#3971)
This commit is contained in:
1 parent
b9cee0cbc7
commit
9c94c19a4f
4 files changed
+62
-1
No files matched your search
@@ -260,6 +260,32 @@ const editorConfiguration: PreferenceDescription<EditorConfiguration, EditorConf
|
||||
},
|
||||
};
|
||||
|
||||
const defaultUpdateChannel = "latest";
|
||||
const updateChannels = new Map([
|
||||
[defaultUpdateChannel, {
|
||||
label: "Stable"
|
||||
}],
|
||||
["beta", {
|
||||
label: "Beta"
|
||||
}],
|
||||
["alpha", {
|
||||
label: "Alpha"
|
||||
}],
|
||||
]);
|
||||
|
||||
const updateChannel: PreferenceDescription<string> = {
|
||||
fromStore(val) {
|
||||
return updateChannels.has(val) ? val : defaultUpdateChannel;
|
||||
},
|
||||
toStore(val) {
|
||||
if (!updateChannels.has(val) || val === defaultUpdateChannel) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return val;
|
||||
}
|
||||
};
|
||||
|
||||
type PreferencesModelType<field extends keyof typeof DESCRIPTORS> = typeof DESCRIPTORS[field] extends PreferenceDescription<infer T, any> ? T : never;
|
||||
type UserStoreModelType<field extends keyof typeof DESCRIPTORS> = typeof DESCRIPTORS[field] extends PreferenceDescription<any, infer T> ? T : never;
|
||||
|
||||
@@ -288,4 +314,10 @@ export const DESCRIPTORS = {
|
||||
syncKubeconfigEntries,
|
||||
editorConfiguration,
|
||||
terminalCopyOnSelect,
|
||||
updateChannel,
|
||||
};
|
||||
|
||||
export const CONSTANTS = {
|
||||
defaultUpdateChannel,
|
||||
updateChannels,
|
||||
};
|
||||
Reference in new issue
Block a user