Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into auto-updater
Browse files Browse the repository at this point in the history
  • Loading branch information
topliceanurazvan committed Jul 6, 2023
2 parents 3962858 + acfc2f5 commit 1bad654
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 12 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions electron/app/ipc/ipcMainRedux.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};

Expand Down
7 changes: 6 additions & 1 deletion electron/app/utils/git.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {readFileSync} from 'fs';
import log from 'loglevel';
import path from 'path';
import {SimpleGit} from 'simple-git';

Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/components/organisms/StartPage/StartPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const StartPage: React.FC = () => {
}, []);

const openNewsFeedItem = (url: string) => {
trackEvent('app_start/select_news_item', {itemUrl: url});
shell.openExternal(url);
};

Expand Down
18 changes: 14 additions & 4 deletions src/components/organisms/StartPage/useNewsFeed.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -17,10 +19,18 @@ 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
.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) {
log.warn('Error retrieving news feed', e.toString());
}
});

return newsFeed;
Expand Down
9 changes: 8 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -21,7 +22,8 @@ import reportWebVitals from './reportWebVitals';

declare global {
interface Window {
debug_logs: Function;
debug_logs: (value: boolean) => void;
get_machine_id: () => string;
}
}

Expand All @@ -40,6 +42,11 @@ window.debug_logs = (value: boolean) => {
}
};

window.get_machine_id = () => {
const machineId = machineIdSync();
return machineId;
};

ignoreKnownErrors();

ReactDOM.render(
Expand Down
12 changes: 7 additions & 5 deletions src/redux/validation/validation.listeners.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions src/shared/models/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/shared/utils/segment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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});
}
};

Expand Down

0 comments on commit 1bad654

Please sign in to comment.