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,29 +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 { MessageChannel } from "../utils/channel/message-channel-injection-token";
|
||||
import { messageChannelInjectionToken } from "../utils/channel/message-channel-injection-token";
|
||||
|
||||
export type ApplicationUpdateStatusEventId =
|
||||
| "checking-for-updates"
|
||||
| "no-updates-available"
|
||||
| "download-for-update-started"
|
||||
| "download-for-update-failed";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
||||
export type ApplicationUpdateStatusChannelMessage = { eventId: ApplicationUpdateStatusEventId; version?: string };
|
||||
export type ApplicationUpdateStatusChannel = MessageChannel<ApplicationUpdateStatusChannelMessage>;
|
||||
|
||||
const applicationUpdateStatusChannelInjectable = getInjectable({
|
||||
id: "application-update-status-channel",
|
||||
|
||||
instantiate: (): ApplicationUpdateStatusChannel => ({
|
||||
id: "application-update-status-channel",
|
||||
}),
|
||||
|
||||
injectionToken: messageChannelInjectionToken,
|
||||
});
|
||||
|
||||
export default applicationUpdateStatusChannelInjectable;
|
||||
+7
-7
@@ -5,21 +5,21 @@
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import createSyncBoxInjectable from "../../utils/sync-box/create-sync-box.injectable";
|
||||
import type { UpdateChannel } from "../update-channels";
|
||||
import type { SyncBox } from "../../utils/sync-box/sync-box-injection-token";
|
||||
import { syncBoxInjectionToken } from "../../utils/sync-box/sync-box-injection-token";
|
||||
|
||||
export type DiscoveredUpdateVersion = SyncBox<{ version: string; updateChannel: UpdateChannel } | null>;
|
||||
|
||||
const discoveredUpdateVersionInjectable = getInjectable({
|
||||
id: "discovered-update-version",
|
||||
|
||||
instantiate: (di) => {
|
||||
const createSyncBox = di.inject(createSyncBoxInjectable);
|
||||
|
||||
return createSyncBox<
|
||||
| { version: string; updateChannel: UpdateChannel }
|
||||
| null
|
||||
>(
|
||||
"discovered-update-version",
|
||||
null,
|
||||
);
|
||||
return createSyncBox(
|
||||
"discovered-update-version",
|
||||
null,
|
||||
) as DiscoveredUpdateVersion;
|
||||
},
|
||||
|
||||
injectionToken: syncBoxInjectionToken,
|
||||
|
||||
+4
@@ -4,12 +4,16 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import createSyncBoxInjectable from "../../utils/sync-box/create-sync-box.injectable";
|
||||
import type { SyncBox } from "../../utils/sync-box/sync-box-injection-token";
|
||||
import { syncBoxInjectionToken } from "../../utils/sync-box/sync-box-injection-token";
|
||||
|
||||
export interface ProgressOfDownload {
|
||||
percentage: number;
|
||||
failed?: string;
|
||||
}
|
||||
|
||||
export type ProgressOfUpdateDownload = SyncBox<ProgressOfDownload>;
|
||||
|
||||
const progressOfUpdateDownloadInjectable = getInjectable({
|
||||
id: "progress-of-update-download-state",
|
||||
|
||||
|
||||
+3
@@ -4,8 +4,11 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import createSyncBoxInjectable from "../../utils/sync-box/create-sync-box.injectable";
|
||||
import type { SyncBox } from "../../utils/sync-box/sync-box-injection-token";
|
||||
import { syncBoxInjectionToken } from "../../utils/sync-box/sync-box-injection-token";
|
||||
|
||||
export type UpdateIsBeingDownloaded = SyncBox<boolean>;
|
||||
|
||||
const updateIsBeingDownloadedInjectable = getInjectable({
|
||||
id: "update-is-being-downloaded",
|
||||
|
||||
|
||||
+3
@@ -4,8 +4,11 @@
|
||||
*/
|
||||
import { getInjectable } from "@ogre-tools/injectable";
|
||||
import createSyncBoxInjectable from "../../utils/sync-box/create-sync-box.injectable";
|
||||
import type { SyncBox } from "../../utils/sync-box/sync-box-injection-token";
|
||||
import { syncBoxInjectionToken } from "../../utils/sync-box/sync-box-injection-token";
|
||||
|
||||
export type UpdatesAreBeingDiscovered = SyncBox<boolean>;
|
||||
|
||||
const updatesAreBeingDiscoveredInjectable = getInjectable({
|
||||
id: "updates-are-being-discovered",
|
||||
|
||||
|
||||
Reference in new issue
Block a user