Skip to content

Commit

Permalink
Merge branch 'release/2.5.8'
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirPal committed Feb 12, 2018
2 parents 721e1ad + 1a4f8e7 commit 72fdaf3
Show file tree
Hide file tree
Showing 12 changed files with 173 additions and 98 deletions.
34 changes: 34 additions & 0 deletions app/components/ErrorBoundary/ErrorBoundary.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
// @flow
import React, { Component } from 'react';
import Raven from 'raven-js';


class ErrorBoundary extends Component<any, any> {
state = {
hasError: false,
}

componentDidCatch(error: any, info: any) {
this.setState({
hasError: true,
});
Raven.captureException(
error,
{
extra: {
info,
debugData: this.props.debugData,
},
},
);
}

render() {
if (this.state.hasError) {
return <h1>Something went wrong.</h1>;
}
return this.props.children;
}
}

export default ErrorBoundary;
4 changes: 4 additions & 0 deletions app/components/ErrorBoundary/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// @flow
import ErrorBoundary from './ErrorBoundary';

export default ErrorBoundary;
2 changes: 2 additions & 0 deletions app/components/index.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
// @flow
export Flex from './Flex';
export {
AutosizableList,
Expand All @@ -9,6 +10,7 @@ export {
IssueViewPlaceholder,
RecentItemsPlaceholder,
} from './Placeholders';
export ErrorBoundary from './ErrorBoundary';
export Img from './Img';
export Calendar from './Calendar';
export TextField from './TextField';
Expand Down
35 changes: 22 additions & 13 deletions app/containers/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ import {
AppWrapper,
FullPageSpinner,
} from 'styles';
import {
ErrorBoundary,
} from 'components';
import AuthForm from './AuthForm';
import Main from './Main';

Expand All @@ -31,19 +34,25 @@ type Props = {
};

const App: StatelessFunctionalComponent<Props> = (props: Props): Node => (
<AppWrapper>
{props.initializeInProcess ?
<FullPageSpinner>
<Spinner size="xlarge" />
</FullPageSpinner> :
<MaxHeight>
{props.isAuthorized ?
<Main /> :
<AuthForm />
}
</MaxHeight>
}
</AppWrapper>
<ErrorBoundary
debugData={{
props,
}}
>
<AppWrapper>
{props.initializeInProcess ?
<FullPageSpinner>
<Spinner size="xlarge" />
</FullPageSpinner> :
<MaxHeight>
{props.isAuthorized ?
<Main /> :
<AuthForm />
}
</MaxHeight>
}
</AppWrapper>
</ErrorBoundary>
);

function mapStateToProps(state): Props {
Expand Down
75 changes: 44 additions & 31 deletions app/containers/IssueView/IssueView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ import type {
import {
getUiState,
getTimerState,
getSelectedIssue,
} from 'selectors';
import {
IssueViewPlaceholder,
ErrorBoundary,
} from 'components';
import {
uiActions,
Expand All @@ -44,6 +46,7 @@ import IssueViewTabs from './IssueViewTabs';

type Props = {
selectedIssueId: Id | null,
issueForDebug: any,
currentTab: string,
timerRunning: boolean,
dispatch: Dispatch,
Expand All @@ -58,48 +61,58 @@ const tabs = [

const IssueView: StatelessFunctionalComponent<Props> = ({
selectedIssueId,
issueForDebug,
currentTab,
timerRunning,
dispatch,
}: Props): Node => (selectedIssueId
? (
<IssueViewContainer column>
{timerRunning &&
<TrackingBar />
}
<IssueContainer>
<IssueViewHeader />
<IssueViewTabs
onTabClick={(tab) => {
dispatch(uiActions.setUiState('issueViewTab', tab));
}}
currentTab={currentTab}
tabs={tabs}
/>
<IssueViewTabContainer>
{(() => {
switch (currentTab) {
case 'Details':
return <IssueDetails />;
case 'Comments':
return <IssueComments />;
case 'Worklogs':
return <IssueWorklogs />;
case 'Reports':
return <IssueWorklogs />;
default:
return <IssueReport />;
}
})()}
</IssueViewTabContainer>
</IssueContainer>
</IssueViewContainer>
<ErrorBoundary
debugData={{
selectedIssueId,
currentTab,
issueForDebug,
}}
>
<IssueViewContainer column>
{timerRunning &&
<TrackingBar />
}
<IssueContainer>
<IssueViewHeader />
<IssueViewTabs
onTabClick={(tab) => {
dispatch(uiActions.setUiState('issueViewTab', tab));
}}
currentTab={currentTab}
tabs={tabs}
/>
<IssueViewTabContainer>
{(() => {
switch (currentTab) {
case 'Details':
return <IssueDetails />;
case 'Comments':
return <IssueComments />;
case 'Worklogs':
return <IssueWorklogs />;
case 'Reports':
return <IssueWorklogs />;
default:
return <IssueReport />;
}
})()}
</IssueViewTabContainer>
</IssueContainer>
</IssueViewContainer>
</ErrorBoundary>
)
: <IssueViewPlaceholder />);

function mapStateToProps(state) {
return {
selectedIssueId: getUiState('selectedIssueId')(state),
issueForDebug: getSelectedIssue(state),
currentTab: getUiState('issueViewTab')(state),
timerRunning: getTimerState('running')(state),
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ const IssuesSourcePicker: StatelessFunctionalComponent<Props> = ({
dispatch(uiActions.setUiState('issuesSprintId', null));
dispatch(uiActions.setUiState('issuesSourceId', item.value));
dispatch(uiActions.setUiState('issuesSourceType', type));
dispatch(uiActions.setIssuesFilters('assignee', []));
dispatch(uiActions.setIssuesFilters('status', []));
dispatch(uiActions.setIssuesFilters('type', []));
if (type === 'scrum') {
dispatch(resourcesActions.clearResourceList({
resourceName: 'issues',
Expand Down
56 changes: 31 additions & 25 deletions app/containers/Sidebar/SidebarIssues/IssueItem/IssueItem.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,31 +68,37 @@ const IssueItem: StatelessFunctionalComponent<Props> = ({
{issue.fields.summary}
</IssueDescription>
<IssueFieldsContainer>
<Tooltip
description={issue.fields.issuetype.name}
position="bottom"
>
<IssueType
type={issue.fields.issuetype.name}
src={issue.fields.issuetype.iconUrl}
alt="type"
/>
</Tooltip>
<Tooltip
description={issue.fields.priority.name}
position="bottom"
>
<IssuePriority
priority={issue.fields.priority.name}
src={issue.fields.priority.iconUrl}
alt="priority"
/>
</Tooltip>
<IssueLabel
backgroundColor={getStatusColor(issue.fields.status.statusCategory.colorName)}
>
{issue.fields.status.name.toUpperCase()}
</IssueLabel>
{issue.fields.issuetype &&
<Tooltip
description={issue.fields.issuetype.name}
position="bottom"
>
<IssueType
type={issue.fields.issuetype.name}
src={issue.fields.issuetype.iconUrl}
alt="type"
/>
</Tooltip>
}
{issue.fields.priority &&
<Tooltip
description={issue.fields.priority.name}
position="bottom"
>
<IssuePriority
priority={issue.fields.priority.name}
src={issue.fields.priority.iconUrl}
alt="priority"
/>
</Tooltip>
}
{issue.fields.status &&
<IssueLabel
backgroundColor={getStatusColor(issue.fields.status.statusCategory.colorName)}
>
{issue.fields.status.name.toUpperCase()}
</IssueLabel>
}
</IssueFieldsContainer>
</IssueContainer>;

Expand Down
35 changes: 19 additions & 16 deletions app/containers/Sidebar/SidebarIssues/SidebarIssues.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import {
} from 'selectors';
import {
IssueItemPlaceholder,
ErrorBoundary,
} from 'components';
import {
issuesActions,
Expand Down Expand Up @@ -127,22 +128,24 @@ const SidebarAllItems: StatelessFunctionalComponent<Props> = ({
const item: ?Issue = issues[index];
return (
<div style={style} key={key}>
{item ?
<IssueItem
issue={item}
active={selectedIssueId === item.id}
tracking={trackingIssueId === item.id}
selectIssue={(issueId) => {
dispatch(
uiActions.setUiState('selectedIssueId', issueId),
);
dispatch(
uiActions.setUiState('selectedWorklogId', null),
);
}}
/> :
<IssueItemPlaceholder />
}
<ErrorBoundary debugData={item}>
{item ?
<IssueItem
issue={item}
active={selectedIssueId === item.id}
tracking={trackingIssueId === item.id}
selectIssue={(issueId) => {
dispatch(
uiActions.setUiState('selectedIssueId', issueId),
);
dispatch(
uiActions.setUiState('selectedWorklogId', null),
);
}}
/> :
<IssueItemPlaceholder />
}
</ErrorBoundary>
</div>
);
}}
Expand Down
2 changes: 1 addition & 1 deletion app/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Chronos",
"productName": "Chronos",
"version": "2.5.7",
"version": "2.5.8",
"description": "Native app for time-tracking fully integrated with JIRA",
"main": "./main.prod.js",
"scripts": {
Expand Down
21 changes: 11 additions & 10 deletions app/sagas/issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,17 +294,18 @@ export function* fetchIssues({
},
},
);
} else {
yield put(resourcesActions.setResourceMeta({
resourceName: 'issues',
meta: {
filterIssuesTotalCount: 0,
},
}));
yield put(actions.succeeded({
resources: [],
}));
yield call(throwError, err);
}
yield put(resourcesActions.setResourceMeta({
resourceName: 'issues',
meta: {
filterIssuesTotalCount: 0,
},
}));
yield put(actions.succeeded({
resources: [],
}));
yield call(throwError, err);
}
}

Expand Down
2 changes: 1 addition & 1 deletion app/sagas/storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const prefixedKeys = [
'issuesSourceId',
'issuesSourceType',
'issuesSprintId',
'issuesFilters',
'issuesFiltersBySourceId',
];

export const storageGetPromise = (key: string): Promise<mixed> => new Promise((resolve) => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Chronos",
"version": "2.5.7",
"version": "2.5.8",
"description": "Full functionality time tracking software with direct JIRA integration",
"scripts": {
"build": "concurrently \"yarn build-main\" \"yarn build-renderer\"",
Expand Down

0 comments on commit 72fdaf3

Please sign in to comment.