mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Introduce a tray item for updating application
Signed-off-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
13 files changed
+359
-2
No files matched your search
@@ -0,0 +1,35 @@
|
||||
/**
|
||||
* 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 { computed } from "mobx";
|
||||
import { trayMenuItemInjectionToken } from "../tray/tray-menu-item/tray-menu-item-injection-token";
|
||||
import updateIsAvailableInjectable from "./update-is-available.injectable";
|
||||
import triggerApplicationUpdateInjectable from "./trigger-application-update.injectable";
|
||||
|
||||
const triggerApplicationUpdateTrayItemInjectable = getInjectable({
|
||||
id: "trigger-application-update-tray-item",
|
||||
|
||||
instantiate: (di) => {
|
||||
const updateIsAvailable = di.inject(updateIsAvailableInjectable);
|
||||
const triggerApplicationUpdate = di.inject(triggerApplicationUpdateInjectable);
|
||||
|
||||
return {
|
||||
id: "trigger-application-update",
|
||||
parentId: null,
|
||||
orderNumber: 50,
|
||||
label: "Trigger update",
|
||||
enabled: computed(() => true),
|
||||
visible: computed(() => updateIsAvailable.get()),
|
||||
|
||||
click: () => {
|
||||
triggerApplicationUpdate();
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
injectionToken: trayMenuItemInjectionToken,
|
||||
});
|
||||
|
||||
export default triggerApplicationUpdateTrayItemInjectable;
|
||||
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* 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 quitAndInstallUpdateInjectable from "../electron-app/features/quit-and-install-update.injectable";
|
||||
|
||||
const triggerApplicationUpdateInjectable = getInjectable({
|
||||
id: "trigger-application-update",
|
||||
|
||||
instantiate: (di) => {
|
||||
const quitAndInstallUpdate = di.inject(quitAndInstallUpdateInjectable);
|
||||
|
||||
return () => {
|
||||
quitAndInstallUpdate();
|
||||
};
|
||||
},
|
||||
});
|
||||
|
||||
export default triggerApplicationUpdateInjectable;
|
||||
@@ -0,0 +1,13 @@
|
||||
/**
|
||||
* 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 { observable } from "mobx";
|
||||
|
||||
const updateIsAvailableState = getInjectable({
|
||||
id: "update-is-available-state",
|
||||
instantiate: () => observable.box<boolean>(false),
|
||||
});
|
||||
|
||||
export default updateIsAvailableState;
|
||||
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* 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 { computed } from "mobx";
|
||||
import updateIsAvailableStateInjectable from "./update-is-available-state.injectable";
|
||||
|
||||
const updateIsAvailableInjectable = getInjectable({
|
||||
id: "update-is-available",
|
||||
|
||||
instantiate: (di) => {
|
||||
const updateIsAvailableState = di.inject(updateIsAvailableStateInjectable);
|
||||
|
||||
return computed(() => updateIsAvailableState.get());
|
||||
},
|
||||
});
|
||||
|
||||
export default updateIsAvailableInjectable;
|
||||
Reference in new issue
Block a user