From 760dbd459ac5013453113396eb893906831e8fb1 Mon Sep 17 00:00:00 2001 From: Dev Catalin <20538711+devcatalin@users.noreply.github.com> Date: Wed, 5 Jul 2023 13:43:00 +0300 Subject: [PATCH 1/9] fix: validate incremental telemetry --- src/redux/validation/validation.listeners.tsx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/redux/validation/validation.listeners.tsx b/src/redux/validation/validation.listeners.tsx index 2d08895ce1..8f127aeaba 100644 --- a/src/redux/validation/validation.listeners.tsx +++ b/src/redux/validation/validation.listeners.tsx @@ -243,11 +243,13 @@ const incrementalValidationListener: AppListenerFn = listen => { incrementalValidationStatus.abortController?.signal.addEventListener('abort', () => response.abort()); await response; - trackEvent('validation/validate_incremental', { - actionType: _action.type, - resourcesCount: resourceIdentifiers.length, - executionTime: stopExecutionTimer(), - }); + if (!isAnyOf(updateMultipleClusterResources)(_action)) { + trackEvent('validation/validate_incremental', { + actionType: _action.type, + resourcesCount: resourceIdentifiers.length, + executionTime: stopExecutionTimer(), + }); + } incrementalValidationStatus.isRunning = false; incrementalValidationStatus.abortController = undefined; From 60ca820a49163f72bb39997769d1efe1b4153e92 Mon Sep 17 00:00:00 2001 From: Mahmoud Mortada Date: Wed, 5 Jul 2023 16:10:47 +0300 Subject: [PATCH 2/9] fix: prevent dispatch to destroyed window --- electron/app/ipc/ipcMainRedux.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/electron/app/ipc/ipcMainRedux.ts b/electron/app/ipc/ipcMainRedux.ts index 7ae16bdc5a..c5ac97ab65 100644 --- a/electron/app/ipc/ipcMainRedux.ts +++ b/electron/app/ipc/ipcMainRedux.ts @@ -18,6 +18,10 @@ export const dispatchToAllWindows = (action: AnyAction) => { }; export const dispatchToWindow = (window: BrowserWindow, action: AnyAction) => { + if (!window || window.isDestroyed()) { + return; + } + window.webContents.send('redux-dispatch', action); }; From ce089d958c3d7006eef121339abd5df54b9f0992 Mon Sep 17 00:00:00 2001 From: Mahmoud Mortada Date: Wed, 5 Jul 2023 16:23:27 +0300 Subject: [PATCH 3/9] fix: segment error handler --- src/shared/utils/segment.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/utils/segment.ts b/src/shared/utils/segment.ts index 65f5bcc2f1..662fcf25ef 100644 --- a/src/shared/utils/segment.ts +++ b/src/shared/utils/segment.ts @@ -13,7 +13,7 @@ export const getSegmentClient = () => client; export const enableSegment = () => { if (process.env.SEGMENT_API_KEY && !client) { log.info('Enabled Segment'); - client = new Analytics(process.env.SEGMENT_API_KEY, {flushAt: 1}); + client = new Analytics(process.env.SEGMENT_API_KEY, {flushAt: 1, errorHandler: log.error}); } }; From 19cecac60d6d318f8621978a1c13e833a2081cc8 Mon Sep 17 00:00:00 2001 From: Mahmoud Mortada Date: Wed, 5 Jul 2023 16:40:45 +0300 Subject: [PATCH 4/9] fix: read file safely --- electron/app/utils/git.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/electron/app/utils/git.ts b/electron/app/utils/git.ts index 200dd43485..126ea312d4 100644 --- a/electron/app/utils/git.ts +++ b/electron/app/utils/git.ts @@ -1,4 +1,5 @@ import {readFileSync} from 'fs'; +import log from 'loglevel'; import path from 'path'; import {SimpleGit} from 'simple-git'; @@ -46,7 +47,11 @@ export function formatGitChangedFiles( let modifiedContent = ''; if (fileType !== 'deleted') { - modifiedContent = readFileSync(path.join(gitFolderPath, gitFile.path), 'utf8'); + try { + modifiedContent = readFileSync(path.join(gitFolderPath, gitFile.path), 'utf8'); + } catch (e) { + log.error(`Error reading file ${path.join(gitFolderPath, gitFile.path)}`, e); + } } const fullGitPath = path.join(gitFolderPath, gitFile.path); From d65218818acc1d75889350142c4a77e3d7421bac Mon Sep 17 00:00:00 2001 From: Ole Lensmar Date: Wed, 5 Jul 2023 16:29:06 +0200 Subject: [PATCH 5/9] fix: ordering of news feed and click telemetry --- src/components/organisms/StartPage/StartPage.tsx | 1 + .../organisms/StartPage/useNewsFeed.ts | 16 ++++++++++++---- src/shared/models/telemetry.ts | 1 + 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/components/organisms/StartPage/StartPage.tsx b/src/components/organisms/StartPage/StartPage.tsx index b3057367d8..eda219b87e 100644 --- a/src/components/organisms/StartPage/StartPage.tsx +++ b/src/components/organisms/StartPage/StartPage.tsx @@ -84,6 +84,7 @@ const StartPage: React.FC = () => { }, []); const openNewsFeedItem = (url: string) => { + trackEvent('app_start/select_news_item', {itemUrl: url}); shell.openExternal(url); }; diff --git a/src/components/organisms/StartPage/useNewsFeed.ts b/src/components/organisms/StartPage/useNewsFeed.ts index 1df5097749..6ae1488829 100644 --- a/src/components/organisms/StartPage/useNewsFeed.ts +++ b/src/components/organisms/StartPage/useNewsFeed.ts @@ -1,6 +1,8 @@ import {useState} from 'react'; import {useAsync} from 'react-use'; +import log from 'loglevel'; + import {NewsFeedItem} from '@shared/models/newsfeed'; let cachedNewsFeed: NewsFeedItem[] | undefined; @@ -17,10 +19,16 @@ export function useNewsFeed() { if (!newsFeedUrl) { return; } - const response = await fetch(newsFeedUrl); - const data = await response.json(); - setNewsFeed(data); - cachedNewsFeed = data; + + try { + const response = await fetch(newsFeedUrl); + const data: NewsFeedItem[] = await response.json(); + const sortedFeed = data.sort((item1, item2) => Date.parse(item2.date) - Date.parse(item1.date)); + setNewsFeed(sortedFeed); + cachedNewsFeed = sortedFeed; + } catch (e: any) { + log.warn('Error retrieving news feed', e.toString()); + } }); return newsFeed; diff --git a/src/shared/models/telemetry.ts b/src/shared/models/telemetry.ts index 270b3bc137..69a11ba8c8 100644 --- a/src/shared/models/telemetry.ts +++ b/src/shared/models/telemetry.ts @@ -52,6 +52,7 @@ export type EventMap = { }; 'app_start/select_page': {page: string}; 'app_start/select_project': undefined; + 'app_start/select_news_item': {itemUrl: string}; 'project_list/open_project': undefined; 'project_list/pin_project': undefined; 'project_list/unpin_project': undefined; From c91c0a7de64490b9bea3510d7af79dc8b3331139 Mon Sep 17 00:00:00 2001 From: Ole Lensmar Date: Wed, 5 Jul 2023 16:35:24 +0200 Subject: [PATCH 6/9] fix: remove news items in the future --- src/components/organisms/StartPage/useNewsFeed.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/organisms/StartPage/useNewsFeed.ts b/src/components/organisms/StartPage/useNewsFeed.ts index 6ae1488829..1f85e7ad6a 100644 --- a/src/components/organisms/StartPage/useNewsFeed.ts +++ b/src/components/organisms/StartPage/useNewsFeed.ts @@ -23,7 +23,9 @@ export function useNewsFeed() { try { const response = await fetch(newsFeedUrl); const data: NewsFeedItem[] = await response.json(); - const sortedFeed = data.sort((item1, item2) => Date.parse(item2.date) - Date.parse(item1.date)); + const sortedFeed = data + .filter(item => Date.parse(item.date) - Date.now() < 0) + .sort((item1, item2) => Date.parse(item2.date) - Date.parse(item1.date)); setNewsFeed(sortedFeed); cachedNewsFeed = sortedFeed; } catch (e: any) { From c9ee1c8bdf32728db31cbc640340fb3b51c6dfd9 Mon Sep 17 00:00:00 2001 From: Topliceanu Razvan <47887589+topliceanurazvan@users.noreply.github.com> Date: Thu, 6 Jul 2023 10:38:41 +0300 Subject: [PATCH 7/9] chore: update version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 92124b7cbb..cf080a2891 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "monokle", - "version": "2.3.0", + "version": "2.2.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "monokle", - "version": "2.3.0", + "version": "2.2.0", "hasInstallScript": true, "dependencies": { "@ant-design/icons": "4.8.0", diff --git a/package.json b/package.json index 92c3ddc2f3..4bc67e5b78 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monokle", - "version": "2.3.0", + "version": "2.2.0", "author": "Kubeshop", "description": "UI for managing k8s manifests", "homepage": "./", From 54a8c8050962caf37db832ccf0bcbd2564ec3bc2 Mon Sep 17 00:00:00 2001 From: Dev Catalin <20538711+devcatalin@users.noreply.github.com> Date: Thu, 6 Jul 2023 10:45:24 +0300 Subject: [PATCH 8/9] chore: console function for machine id --- src/index.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index 01adf2c0ce..0724555ed3 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -6,6 +6,7 @@ import 'antd/dist/antd.less'; import 'allotment/dist/style.css'; import log from 'loglevel'; +import {machineIdSync} from 'node-machine-id'; import '@redux/ipcRendererRedux'; import store from '@redux/store'; @@ -21,7 +22,8 @@ import reportWebVitals from './reportWebVitals'; declare global { interface Window { - debug_logs: Function; + debug_logs: (value: boolean) => void; + get_machine_id: () => string; } } @@ -40,6 +42,11 @@ window.debug_logs = (value: boolean) => { } }; +window.get_machine_id = () => { + const machineId = machineIdSync(); + return machineId; +}; + ignoreKnownErrors(); ReactDOM.render( From 582b566a5aa4a879e877a41b10f8eb3ede59b63b Mon Sep 17 00:00:00 2001 From: Topliceanu Razvan <47887589+topliceanurazvan@users.noreply.github.com> Date: Thu, 6 Jul 2023 10:47:42 +0300 Subject: [PATCH 9/9] chore(release): 2.3.0 --- CHANGELOG.md | 9 +++++++++ package-lock.json | 4 ++-- package.json | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b6e9bd3a8..de869fafcb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [2.3.0](https://github.com/kubeshop/monokle/compare/v2.3.1-nightly-2023-07-06.0...v2.3.0) (2023-07-06) + + +### Bug Fixes + +* ordering of news feed and click telemetry ([d652188](https://github.com/kubeshop/monokle/commit/d65218818acc1d75889350142c4a77e3d7421bac)) +* remove news items in the future ([c91c0a7](https://github.com/kubeshop/monokle/commit/c91c0a7de64490b9bea3510d7af79dc8b3331139)) +* validate incremental telemetry ([760dbd4](https://github.com/kubeshop/monokle/commit/760dbd459ac5013453113396eb893906831e8fb1)) + ## [2.3.0](https://github.com/kubeshop/monokle/compare/v2.2.1-nightly-2023-07-05.0...v2.3.0) (2023-07-05) ## [2.2.0](https://github.com/kubeshop/monokle/compare/v2.1.2-nightly-2023-06-07.0...v2.2.0) (2023-06-07) diff --git a/package-lock.json b/package-lock.json index cf080a2891..92124b7cbb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "monokle", - "version": "2.2.0", + "version": "2.3.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "monokle", - "version": "2.2.0", + "version": "2.3.0", "hasInstallScript": true, "dependencies": { "@ant-design/icons": "4.8.0", diff --git a/package.json b/package.json index 4bc67e5b78..92c3ddc2f3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "monokle", - "version": "2.2.0", + "version": "2.3.0", "author": "Kubeshop", "description": "UI for managing k8s manifests", "homepage": "./",