mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
chore: Switch releaseChannel to not use Initializable at all
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
1 parent
6fa9e2cde6
commit
fc18c61d36
8 files changed
+14
-64
No files matched your search
+2
-2
@@ -2,13 +2,13 @@
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import releaseChannelInjectable from "../../../../common/vars/release-channel.injectable";
|
||||
import { updateChannels } from "../update-channels";
|
||||
import { createInitializableState } from "../../../../common/initializable-state/create";
|
||||
import releaseChannelInjectable from "../../../vars/common/release-channel.injectable";
|
||||
|
||||
const defaultUpdateChannelInjectable = createInitializableState({
|
||||
id: "default-update-channel",
|
||||
init: (di) => updateChannels[di.inject(releaseChannelInjectable).get()],
|
||||
init: (di) => updateChannels[di.inject(releaseChannelInjectable)],
|
||||
});
|
||||
|
||||
export default defaultUpdateChannelInjectable;
|
||||
+2
-2
@@ -4,8 +4,8 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { computed } from "mobx";
|
||||
import releaseChannelInjectable from "../../../vars/common/release-channel.injectable";
|
||||
import selectedUpdateChannelInjectable from "../../common/selected-update-channel/selected-update-channel.injectable";
|
||||
import releaseChannelInjectable from "../../../../common/vars/release-channel.injectable";
|
||||
|
||||
const updateCanBeDowngradedInjectable = getInjectable({
|
||||
id: "update-can-be-downgraded",
|
||||
@@ -16,7 +16,7 @@ const updateCanBeDowngradedInjectable = getInjectable({
|
||||
|
||||
return computed(() => (
|
||||
selectedUpdateChannel.value.get().id === "latest"
|
||||
&& releaseChannel.get() !== "latest"
|
||||
&& releaseChannel !== "latest"
|
||||
));
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
/**
|
||||
* Copyright (c) OpenLens Authors. All rights reserved.
|
||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import { semanticBuildVersionInitializable } from "../semantic-build-version/common/token";
|
||||
|
||||
const releaseChannelInjectable = getInjectable({
|
||||
id: "release-channel",
|
||||
instantiate: (di) => {
|
||||
const buildSemanticVersion = di.inject(semanticBuildVersionInitializable.stateToken);
|
||||
const currentReleaseChannel = buildSemanticVersion.prerelease[0];
|
||||
|
||||
switch (currentReleaseChannel) {
|
||||
case "latest":
|
||||
case "beta":
|
||||
case "alpha":
|
||||
return currentReleaseChannel;
|
||||
default:
|
||||
return "latest";
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
export default releaseChannelInjectable;
|
||||
Reference in new issue
Block a user