mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Make releaseChannelInjectable consistent in name and ID
Signed-off-by: Sebastian Malton <sebastian@malton.name>
This commit is contained in:
parent
a52d95a165
commit
6b5f310f4b
@ -3,17 +3,12 @@
|
|||||||
* Licensed under MIT License. See LICENSE in root directory for more information.
|
* Licensed under MIT License. See LICENSE in root directory for more information.
|
||||||
*/
|
*/
|
||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import currentReleaseIdInjectable from "../../vars/release-channel.injectable";
|
import releaseChannelInjectable from "../../vars/release-channel.injectable";
|
||||||
import { updateChannels } from "../update-channels";
|
import { updateChannels } from "../update-channels";
|
||||||
|
|
||||||
const defaultUpdateChannelInjectable = getInjectable({
|
const defaultUpdateChannelInjectable = getInjectable({
|
||||||
id: "default-update-channel",
|
id: "default-update-channel",
|
||||||
|
instantiate: (di) => updateChannels[di.inject(releaseChannelInjectable)],
|
||||||
instantiate: (di) => {
|
|
||||||
const currentReleaseId = di.inject(currentReleaseIdInjectable);
|
|
||||||
|
|
||||||
return updateChannels[currentReleaseId ?? "latest"];
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export default defaultUpdateChannelInjectable;
|
export default defaultUpdateChannelInjectable;
|
||||||
|
|||||||
@ -6,9 +6,9 @@ import { getInjectable } from "@ogre-tools/injectable";
|
|||||||
import type { UpdateChannelId } from "../application-update/update-channels";
|
import type { UpdateChannelId } from "../application-update/update-channels";
|
||||||
import appSemanticVersionInjectable from "./app-semantic-version.injectable";
|
import appSemanticVersionInjectable from "./app-semantic-version.injectable";
|
||||||
|
|
||||||
const currentReleaseIdInjectable = getInjectable({
|
const releaseChannelInjectable = getInjectable({
|
||||||
id: "release-channel",
|
id: "release-channel",
|
||||||
instantiate: (di): UpdateChannelId | undefined => {
|
instantiate: (di): UpdateChannelId => {
|
||||||
const appSemanticVersion = di.inject(appSemanticVersionInjectable);
|
const appSemanticVersion = di.inject(appSemanticVersionInjectable);
|
||||||
const currentReleaseChannel = appSemanticVersion.prerelease[0];
|
const currentReleaseChannel = appSemanticVersion.prerelease[0];
|
||||||
|
|
||||||
@ -18,9 +18,9 @@ const currentReleaseIdInjectable = getInjectable({
|
|||||||
case "alpha":
|
case "alpha":
|
||||||
return currentReleaseChannel;
|
return currentReleaseChannel;
|
||||||
default:
|
default:
|
||||||
return undefined;
|
return "latest";
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export default currentReleaseIdInjectable;
|
export default releaseChannelInjectable;
|
||||||
|
|||||||
@ -5,28 +5,19 @@
|
|||||||
import { getInjectable } from "@ogre-tools/injectable";
|
import { getInjectable } from "@ogre-tools/injectable";
|
||||||
import { computed } from "mobx";
|
import { computed } from "mobx";
|
||||||
import selectedUpdateChannelInjectable from "../../../common/application-update/selected-update-channel/selected-update-channel.injectable";
|
import selectedUpdateChannelInjectable from "../../../common/application-update/selected-update-channel/selected-update-channel.injectable";
|
||||||
import currentReleaseIdInjectable from "../../../common/vars/release-channel.injectable";
|
import releaseChannelInjectable from "../../../common/vars/release-channel.injectable";
|
||||||
|
|
||||||
const updateCanBeDowngradedInjectable = getInjectable({
|
const updateCanBeDowngradedInjectable = getInjectable({
|
||||||
id: "update-can-be-downgraded",
|
id: "update-can-be-downgraded",
|
||||||
|
|
||||||
instantiate: (di) => {
|
instantiate: (di) => {
|
||||||
const selectedUpdateChannel = di.inject(selectedUpdateChannelInjectable);
|
const selectedUpdateChannel = di.inject(selectedUpdateChannelInjectable);
|
||||||
const releaseChannel = di.inject(currentReleaseIdInjectable);
|
const releaseChannel = di.inject(releaseChannelInjectable);
|
||||||
|
|
||||||
return computed(() => {
|
return computed(() => (
|
||||||
if (!releaseChannel) {
|
selectedUpdateChannel.value.get().id === "latest"
|
||||||
return false;
|
&& releaseChannel !== "latest"
|
||||||
}
|
));
|
||||||
|
|
||||||
const currentSelectedChannel = selectedUpdateChannel.value.get().id;
|
|
||||||
|
|
||||||
if (currentSelectedChannel !== "latest") {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return releaseChannel !== "latest";
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user