Skip to content

Commit

Permalink
Merge branch 'release/2.5.11'
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirPal committed Feb 20, 2018
2 parents 607043e + 77cd6b7 commit 8edec0e
Show file tree
Hide file tree
Showing 21 changed files with 315 additions and 38 deletions.
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
<a name="2.5.11"></a>
## [2.5.11](https://github.com/web-pal/chronos-timetracker/compare/v2.5.9...v2.5.11) (2018-02-20)


### Bug Fixes

* **Browsing Issues:** extra fetch request ([a705116](https://github.com/web-pal/chronos-timetracker/commit/a705116))
* **Browsing Issues:** issuesFetching for header depends on sidebarType ([94cecb1](https://github.com/web-pal/chronos-timetracker/commit/94cecb1))
* **Issue Detail View:** critical bug during refetch tracking issue ([b4e97f6](https://github.com/web-pal/chronos-timetracker/commit/b4e97f6))
* **Tracking:** fix empty worklogs ([dd41d81](https://github.com/web-pal/chronos-timetracker/commit/dd41d81))


### Features

* **Issue Detail View:** render comments properly ([1964b07](https://github.com/web-pal/chronos-timetracker/commit/1964b07))
* **Tracking:** control remaining estimates ([ebda033](https://github.com/web-pal/chronos-timetracker/commit/ebda033)), closes [#73](https://github.com/web-pal/chronos-timetracker/issues/73)



<a name="2.5.9"></a>
## [2.5.9](https://github.com/web-pal/chronos-timetracker/compare/v2.5.7...v2.5.9) (2018-02-15)

Expand Down
1 change: 1 addition & 0 deletions app/actions/actionTypes/ui.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @flow

export const SET_UI_STATE = 'ui/SET_UI_STATE';
export const RESET_UI_STATE = 'ui/RESET_UI_STATE';
export const SET_MODAL_STATE = 'ui/SET_MODAL_STATE';
export const SET_ISSUES_FILTER = 'ui/SET_ISSUES_FILTER';
export const CHECK_FOR_UPDATES_REQUEST = 'ui/CHECK_FOR_UPDATES_REQUEST';
Expand Down
9 changes: 9 additions & 0 deletions app/actions/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ export const setUiState = (
},
});

export const resetUiState = (
keys: Array<string>,
): UiAction => ({
type: actionTypes.RESET_UI_STATE,
payload: {
keys,
},
});

export const setModalState = (
modalName: string,
state: boolean,
Expand Down
1 change: 1 addition & 0 deletions app/components/ErrorBoundary/ErrorBoundary.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class ErrorBoundary extends Component<any, any> {
}

componentDidCatch(error: any, info: any) {
console.error(error);
this.setState({
hasError: true,
});
Expand Down
111 changes: 111 additions & 0 deletions app/components/RemainingEstimatePicker/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
// @flow
import React from 'react';

import {
AkFieldRadioGroup as RadioButtonGroup,
} from '@atlaskit/field-radio-group';

import {
stj,
} from 'time-util';

import {
path,
} from 'ramda';

import type {
Issue,
} from 'types';

import {
Flex,
TextField,
} from 'components';

import {
InputExample,
} from './styled';

type Props = {
issue: Issue,
value: 'auto' | 'new' | 'leave' | 'manual',
onChange: Function,
onReduceByChange: Function,
onNewChange: Function,
newValue: string,
reduceByValue: string,
};

const RemainingEstimatePicker = ({
issue,
value,
onChange,
onReduceByChange,
onNewChange,
newValue,
reduceByValue,
}: Props) => {
const timeestimate = path(['fields', 'timeestimate'], issue);

const remainingEstimateOptions = [
{
name: 'auto',
value: 'auto',
label: 'Adjust automatically',
isSelected: value === 'auto',
},
{
name: 'leave',
value: 'leave',
label: `Use existing estimate of ${stj((timeestimate || 0))}`,
isSelected: value === 'leave',
},
{
name: 'new',
value: 'new',
label: (
<Flex alignCenter>
Set to&nbsp;
<TextField
value={newValue}
onChange={e => onNewChange(e.target.value)}
isLabelHidden
isDisabled={value !== 'new'}
/>
<InputExample>(eg. 2h 10m)</InputExample>
</Flex>
),
isSelected: value === 'new',
},
{
name: 'manual',
value: 'manual',
label: (
<Flex alignCenter style={{ marginTop: 4 }}>
Reduce by&nbsp;
<TextField
value={reduceByValue}
onChange={e => onReduceByChange(e.target.value)}
isLabelHidden
isDisabled={value !== 'manual'}
/>
<InputExample>(eg. 40m)</InputExample>
</Flex>
),
isSelected: value === 'manual',
},
];

return !!timeestimate &&
(
<Flex column>
<RadioButtonGroup
label="Remaining Estimate"
items={remainingEstimateOptions}
onRadioChange={e => onChange(e.target.value)}
/>
</Flex>
);
};

export default RemainingEstimatePicker;
5 changes: 5 additions & 0 deletions app/components/RemainingEstimatePicker/styled/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import styled from 'styled-components2';

export const InputExample = styled.span`
margin-left: 5px;
`;
1 change: 1 addition & 0 deletions app/components/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ export Calendar from './Calendar';
export TextField from './TextField';
export SingleSelect from './SingleSelect';
export * as ReduxFormComponents from './ReduxFormComponents';
export RemainingEstimatePicker from './RemainingEstimatePicker';
4 changes: 3 additions & 1 deletion app/containers/Header/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,14 +163,16 @@ const Header: StatelessFunctionalComponent<Props> = ({


function mapStateToProps(state) {
const sidebarType = getUiState('sidebarType')(state);
const request = sidebarType === 'recent' ? 'recentIssues' : 'filterIssues';
return {
userData: getUserData(state),
host: getUiState('host')(state),
updateAvailable: getUiState('updateAvailable')(state),
updateFetching: getUiState('updateFetching')(state),
issuesFetching: getResourceStatus(
state,
'issues.requests.filterIssues.status',
`issues.requests.${request}.status`,
).pending,
};
}
Expand Down
19 changes: 15 additions & 4 deletions app/containers/IssueView/IssueComments/IssueComments.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class IssueComments extends Component<Props, State> {
selectedIssueId,
dispatch,
}: Props = this.props;
console.log(comments);
return (
<ActivitySection>
<Flex column>
Expand Down Expand Up @@ -112,10 +113,20 @@ class IssueComments extends Component<Props, State> {
</Flex>
<Flex column>
<CommentBody>
<ReactMarkdown
softBreak="br"
source={comment.body}
/>
{comment.renderedBody
? (
<div
dangerouslySetInnerHTML={{
__html: comment.renderedBody,
}}
/>
) : (
<ReactMarkdown
softBreak="br"
source={comment.body}
/>
)
}
</CommentBody>
</Flex>
</Commentd>
Expand Down
23 changes: 23 additions & 0 deletions app/containers/IssueView/TrackingBar/TrackingBar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import type {
import type {
Issue,
Dispatch,
RemainingEstimate,
} from 'types';

import {
Expand Down Expand Up @@ -51,6 +52,9 @@ type Props = {
screenshotsAllowed: boolean,
trackingIssue: Issue,
worklogComment: string,
remainingEstimateValue: RemainingEstimate,
remainingEstimateNewValue: string,
remainingEstimateReduceByValue: string,
dispatch: Dispatch,
}

Expand All @@ -72,6 +76,9 @@ const TrackingBar: StatelessFunctionalComponent<Props> = ({
screenshotsAllowed,
trackingIssue,
worklogComment,
remainingEstimateValue,
remainingEstimateNewValue,
remainingEstimateReduceByValue,
dispatch,
}: Props): Node => (
<Transition
Expand All @@ -84,9 +91,22 @@ const TrackingBar: StatelessFunctionalComponent<Props> = ({
<Flex row alignCenter>
<WorklogCommentDialog
comment={worklogComment}
remainingEstimateValue={remainingEstimateValue}
remainingEstimateNewValue={remainingEstimateNewValue}
remainingEstimateReduceByValue={remainingEstimateReduceByValue}
issue={trackingIssue}
onSetComment={(comment) => {
dispatch(uiActions.setUiState('worklogComment', comment));
}}
onRemainingEstimateChange={(value) => {
dispatch(uiActions.setUiState('remainingEstimateValue', value));
}}
onRemainingEstimateNewChange={(value) => {
dispatch(uiActions.setUiState('remainingEstimateNewValue', value));
}}
onRemainingEstimateReduceByChange={(value) => {
dispatch(uiActions.setUiState('remainingEstimateReduceByValue', value));
}}
/>
{screenshotsAllowed &&
<div style={{ marginLeft: 10 }}>
Expand Down Expand Up @@ -149,6 +169,9 @@ function mapStateToProps(state) {
screenshotsAllowed: false,
trackingIssue: getTrackingIssue(state),
worklogComment: getUiState('worklogComment')(state),
remainingEstimateValue: getUiState('remainingEstimateValue')(state),
remainingEstimateNewValue: getUiState('remainingEstimateNewValue')(state),
remainingEstimateReduceByValue: getUiState('remainingEstimateReduceByValue')(state),
};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@
import React, { PureComponent } from 'react';

import InlineDialog from '@atlaskit/inline-dialog';
import SingleLineTextInput from '@atlaskit/input';

import type {
Issue,
RemainingEstimate,
} from 'types';

import {
InlineEditStateless,
} from '@atlaskit/inline-edit';
import SingleLineTextInput from '@atlaskit/input';

import {
Flex,
RemainingEstimatePicker,
} from 'components';

import {
Expand All @@ -18,8 +25,15 @@ import {


type Props = {
issue: Issue,
comment: string | null,
remainingEstimateValue: RemainingEstimate,
remainingEstimateNewValue: string,
remainingEstimateReduceByValue: string,
onSetComment: (comment: string) => void,
onRemainingEstimateChange: Function,
onRemainingEstimateNewChange: Function,
onRemainingEstimateReduceByChange: Function,
};

type State = {
Expand Down Expand Up @@ -64,7 +78,7 @@ class WorklogCommentDialog extends PureComponent<Props, State> {
};

renderDialog = () => (
<div className="worklog-edit-popup" style={{ width: 300 }}>
<div className="worklog-edit-popup" style={{ width: 350 }}>
<h5>Edit worklog</h5>
<Flex column>
<InlineEditStateless
Expand Down Expand Up @@ -92,6 +106,15 @@ class WorklogCommentDialog extends PureComponent<Props, State> {
onConfirm={this.onConfirm}
onCancel={this.onCancel}
/>
<RemainingEstimatePicker
issue={this.props.issue}
value={this.props.remainingEstimateValue}
onChange={this.props.onRemainingEstimateChange}
onReduceByChange={this.props.onRemainingEstimateReduceByChange}
onNewChange={this.props.onRemainingEstimateNewChange}
newValue={this.props.remainingEstimateNewValue}
reduceByValue={this.props.remainingEstimateReduceByValue}
/>
</Flex>
</div>
)
Expand Down
Loading

0 comments on commit 8edec0e

Please sign in to comment.