Skip to content

Commit

Permalink
Merge branch 'release/3.2.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirPal committed May 6, 2019
2 parents 50763e3 + 2be2fdf commit 4e4738e
Show file tree
Hide file tree
Showing 26 changed files with 443 additions and 248 deletions.
6 changes: 3 additions & 3 deletions app/package.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
{
"name": "Chronos",
"version": "3.2.2",
"version": "3.2.3",
"description": "Native app for time-tracking fully integrated with JIRA",
"main": "./dist/main.prod.js",
"author": {
"name": "Webpal",
"url": "https://github.com/web-pal"
},
"license": "CCL",
"license": "ISC",
"repository": {
"type": "git",
"url": "https://github.com/web-pal/chronos-timetracker.git"
},
"dependencies": {
"desktop-idle": "1.1.2",
"keytar": "4.4.1"
"keytar": "4.6.0"
}
}
7 changes: 7 additions & 0 deletions app/renderer/api/enhancedFetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,19 @@ function EnhancedFetchError({
response,
}) {
if (Error.captureStackTrace) {
Error.call(this);
Error.captureStackTrace(this, this.constructor);
} else {
this.stack = (new Error()).stack || '';
}
this.name = this.constructor.name;
this.json = json;
this.response = response;
this.extra = {
json,
response,
};
this.error = new Error('Custom fetch error');
}


Expand Down
21 changes: 21 additions & 0 deletions app/renderer/api/jiraApi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ function apiFactory({ makeRequest }) {
['getBoardProjects', '/board/{boardId}/project', 'GET', '/rest/agile/1.0'],
['getBoardSprints', '/board/{boardId}/sprint', 'GET', '/rest/agile/1.0'],
['getSprintById', '/sprint/{sprintId}', 'GET', '/rest/agile/1.0'],
['saveWorklogActivity', '/worklogActivity', 'POST', '/plugins/servlet/chronos'],
['getWorklogActivity', '/worklogActivity', 'GET', '/plugins/servlet/chronos'],
['deleteScreenshot', '/deleteScreenshot', 'POST', '/plugins/servlet/chronos'],
];

let headers = {
Expand Down Expand Up @@ -147,6 +150,24 @@ function apiFactory({ makeRequest }) {
return mockMethods;
},

uploadScreenshotOnSelfServer({
image,
filename,
}) {
const formData = new FormData();
formData.append(
'file',
new File([image], filename),
);
return makeRequest(
`${rootApiUrl}/plugins/servlet/chronos/screenshots`,
{
method: 'POST',
body: formData,
},
);
},

...(
apiCommonMethods.reduce((
acc,
Expand Down
1 change: 1 addition & 0 deletions app/renderer/containers/AuthForm/TeamStep/TeamStep.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ class TeamStep extends Component<Props> {
{accounts.length > 0
&& (
<S.DefaultButton
type="button"
onClick={() => {
dispatch(uiActions.setUiState({
authFormStep: 0,
Expand Down
4 changes: 4 additions & 0 deletions app/renderer/containers/FlagsContainer/FlagsContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ const FlagsContainer: StatelessFunctionalComponent<Props> = ({
? <SpinnerContainer spinnerTitle={flag.spinnerTitle} />
: flag.title
}
isDismissAllowed
onDismissed={() => {
dispatch(uiActions.deleteFlag(flag.id));
}}
actions={flag.actions}
appearance={flag.appearance}
description={flag.description}
Expand Down
10 changes: 9 additions & 1 deletion app/renderer/containers/Modals/WorklogModal/WorklogModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,12 @@ class WorklogModal extends Component<Props, State> {
validateJiraTime = value => /^(?:\d{1,2}d{1}(?:\s{1}|$))?(?:\d{1,2}h{1}(?:\s{1}|$))?(?:\d{1,2}m{1}(?:\s{1}|$))?(?:\d{1,2}s{1}(?:\s{1}|$))?$/.test(value);

validate = () => {
const { errors, comment, timeSpent } = this.state;
const {
errors,
comment,
timeSpent,
startTime,
} = this.state;
let valid = true;

if (comment === '' && !this.props.allowEmptyComment) {
Expand All @@ -197,6 +202,9 @@ class WorklogModal extends Component<Props, State> {
} else {
errors.timeSpent = '';
}
if (!startTime) {
valid = false;
}

this.setState({ errors });

Expand Down
19 changes: 19 additions & 0 deletions app/renderer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,25 @@ if (process.env.NODE_ENV === 'production') {
dsn: process.env.SENTRY_DSN,
release: `${pjson.version}_${process.platform}`,
enableNative: false,
beforeSend(event, hint) {
if (
event.message.startsWith('Non-Error exception captured')
&& hint.originalException.error
&& hint.originalException.extra
) {
Sentry.withScope((scope) => {
scope.setExtra('nonErrorException', true);
Sentry.captureException(
hint.originalException.error,
{
extra: hint.originalException.extra,
},
);
});
return null;
}
return event;
},
});
}

Expand Down
14 changes: 8 additions & 6 deletions app/renderer/issueFormPreload.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ function* takeShowForm(): Generator<*, *, *> {
document.getElementsByClassName('jira-dialog')[0].style.display = 'none';
const formBody = issueForm.$form.children()[0];
const jiraDialog = issueForm.$popup[0];
formBody.style.maxHeight = (
`${(parseInt(formBody.style.maxHeight.replace('px', ''), 10) + 120).toString()}px`
);
jiraDialog.style.marginTop = (
`${(parseInt(jiraDialog.style.marginTop.replace('px', ''), 10) - 65).toString()}px`
);
if (formBody) {
formBody.style.maxHeight = (
`${(parseInt(formBody.style.maxHeight.replace('px', ''), 10) + 120).toString()}px`
);
jiraDialog.style.marginTop = (
`${(parseInt(jiraDialog.style.marginTop.replace('px', ''), 10) - 65).toString()}px`
);
}
issueForm.$popupHeading[0].lastElementChild.style.display = 'none';
}, 0);
setTimeout(() => {
Expand Down
24 changes: 10 additions & 14 deletions app/renderer/sagas/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,15 +69,19 @@ export function* authSelfHostedFlow(): Generator<*, *, *> {
}));
} catch (err) {
if (err && err.message) {
yield eff.put(uiActions.setUiState('authError', err.message));
yield eff.put(uiActions.setUiState({
authError: err.message,
}));
} else {
yield eff.put(uiActions.setUiState(
'authError',
'Can not authenticate user. Please try again',
));
}
yield eff.call(throwError, err);
yield eff.put(uiActions.setUiState('authRequestInProcess', false));
throwError(err);
yield eff.put(uiActions.setUiState({
authRequestInProcess: false,
}));
}
}
}
Expand Down Expand Up @@ -196,14 +200,7 @@ export function* authFlow(): Generator<*, *, *> {
trackMixpanel('Jira login');
incrementMixpanel('Jira login', 1);
} catch (err) {
if (err.debug) {
console.log(err.debug);
yield eff.put(authActions.addAuthDebugMessage([
{
json: err.debug,
},
]));
}
throwError(err);
yield eff.put(uiActions.setUiState({
authRequestInProcess: false,
authFormStep: 1,
Expand All @@ -212,7 +209,6 @@ export function* authFlow(): Generator<*, *, *> {
authorized: false,
authError: 'Can not authenticate user. Please try again',
}));
yield eff.call(throwError, err.result ? err.result : err);
}
}
}
Expand Down Expand Up @@ -301,7 +297,7 @@ export function* logoutFlow(): Generator<*, *, *> {
trackMixpanel('Logout');
incrementMixpanel('Logout', 1);
} catch (err) {
yield eff.call(throwError, err);
throwError(err);
}
}
}
Expand Down Expand Up @@ -381,7 +377,7 @@ export function* switchAccountFlow(): Generator<*, *, *> {
yield eff.put(uiActions.setUiState({
initializeInProcess: false,
}));
yield eff.call(throwError, err);
throwError(err);
}
}
}
4 changes: 2 additions & 2 deletions app/renderer/sagas/boards.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,8 @@ export function* fetchBoards(): Generator<*, void, *> {
),
}));
} catch (err) {
yield eff.call(throwError, err);
if (err.response.statusCode === 403) {
throwError(err);
if (err?.response?.statusCode === 403) {
const helpUrl = (
'https://web-pal.atlassian.net/wiki/spaces/CHRONOS/pages/173899778/Problem+with+loading+boards'
);
Expand Down
4 changes: 2 additions & 2 deletions app/renderer/sagas/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function* getIssueComments(issueId: Id): Generator<*, void, *> {
}));
yield eff.call(infoLog, `got comments for issue ${issueId}`, comments);
} catch (err) {
yield eff.call(throwError, err);
throwError(err);
}
}

Expand Down Expand Up @@ -100,14 +100,14 @@ export function* addIssueComment({
commentAdding: false,
}));
} catch (err) {
throwError(err);
yield eff.put(uiActions.setUiState({
commentAdding: false,
}));
yield eff.fork(notify, {

title: 'failed to add comment',
});
yield eff.call(throwError, err);
}
}

Expand Down
4 changes: 2 additions & 2 deletions app/renderer/sagas/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ export function* fetchFilters(): Generator<*, *, *> {
resources: filters,
}));
} catch (err) {
throwError(err);
yield err.fork(notify, {
title: 'Failed to load filters, check your permissions',
});
yield eff.call(throwError, err);
}
}

Expand Down Expand Up @@ -109,6 +109,7 @@ export function* saveFilter({
}));
yield eff.put(issuesActions.refetchIssuesRequest());
} catch (err) {
throwError(err);
yield eff.put(actions.failed());
const errObj = JSON.parse(err);
if (errObj.body.errorMessages.length > 0) {
Expand All @@ -125,7 +126,6 @@ export function* saveFilter({
description: R.values(errObj.body.errors).join('\n'),
});
}
yield eff.call(throwError, err);
}
}

Expand Down
12 changes: 11 additions & 1 deletion app/renderer/sagas/helpers.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as eff from 'redux-saga/effects';
import storage from 'electron-json-storage';

import config from 'config';
import {
getUiState,
} from 'selectors';
Expand Down Expand Up @@ -35,6 +34,17 @@ export const removeElectronStorage = key => (
})
);

export const clearElectronStorage = () => (
new Promise((resolve, reject) => {
storage.clear((err) => {
if (err) {
reject(new Error('Error clear storage'));
}
resolve();
});
})
);

export const getElectronStorage = (key, defaultValue) => (
new Promise((resolve, reject) => {
storage.get(key, (err, data) => {
Expand Down
Loading

0 comments on commit 4e4738e

Please sign in to comment.