mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
auto-update notifications on the status bar (#5361)
* auto-update notifications on the status bar Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * integrated with new and improved autoupdate code Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * lint Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * refactored to include AutoUpdateComponent in the statusBarItemsInjectable Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * refactor to use a registrator Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * fix lint, remove unused code Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * refactored for the simplified logic for injecting many instances PR Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * using the update syncBox injectables directly for status bar notifications Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * removed update broadcasting/listening, updated snapshots Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * fixing tests Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * fixed tests Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * cleanup after rebase to master Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * address review comments Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * fixed incorrect injectable id Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * address review comments Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com> * Tweak code-style Signed-off-by: Janne Savolainen <janne.savolainen@live.fi> Co-authored-by: Janne Savolainen <janne.savolainen@live.fi>
This commit is contained in:
1 parent
165bf57380
commit
3480b517c1
47 files changed
+1999
-792
No files matched your search
@@ -1,57 +0,0 @@
|
||||
/**
|
||||
* 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 type { ApplicationUpdateStatusChannel, ApplicationUpdateStatusEventId } from "../../common/application-update/application-update-status-channel.injectable";
|
||||
import applicationUpdateStatusChannelInjectable from "../../common/application-update/application-update-status-channel.injectable";
|
||||
import showInfoNotificationInjectable from "../components/notifications/show-info-notification.injectable";
|
||||
import type { MessageChannelListener } from "../../common/utils/channel/message-channel-listener-injection-token";
|
||||
import { messageChannelListenerInjectionToken } from "../../common/utils/channel/message-channel-listener-injection-token";
|
||||
|
||||
const applicationUpdateStatusListenerInjectable = getInjectable({
|
||||
id: "application-update-status-listener",
|
||||
|
||||
instantiate: (di): MessageChannelListener<ApplicationUpdateStatusChannel> => {
|
||||
const channel = di.inject(applicationUpdateStatusChannelInjectable);
|
||||
const showInfoNotification = di.inject(showInfoNotificationInjectable);
|
||||
|
||||
const eventHandlers: Record<ApplicationUpdateStatusEventId, { handle: (version?: string) => void }> = {
|
||||
"checking-for-updates": {
|
||||
handle: () => {
|
||||
showInfoNotification("Checking for updates...");
|
||||
},
|
||||
},
|
||||
|
||||
"no-updates-available": {
|
||||
handle: () => {
|
||||
showInfoNotification("No new updates available");
|
||||
},
|
||||
},
|
||||
|
||||
"download-for-update-started": {
|
||||
handle: (version) => {
|
||||
showInfoNotification(`Download for version ${version} started...`);
|
||||
},
|
||||
},
|
||||
|
||||
"download-for-update-failed": {
|
||||
handle: () => {
|
||||
showInfoNotification("Download of update failed");
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
return {
|
||||
channel,
|
||||
|
||||
handler: ({ eventId, version }) => {
|
||||
eventHandlers[eventId].handle(version);
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
injectionToken: messageChannelListenerInjectionToken,
|
||||
});
|
||||
|
||||
export default applicationUpdateStatusListenerInjectable;
|
||||
Reference in new issue
Block a user