Skip to content

Commit

Permalink
Merge branch 'master' into ZNTA-2313
Browse files Browse the repository at this point in the history
  • Loading branch information
kathryngo committed Feb 22, 2018
2 parents 5710f43 + e38d758 commit a5e569c
Show file tree
Hide file tree
Showing 49 changed files with 386 additions and 259 deletions.
@@ -0,0 +1,8 @@
<ruleset comparisonMethod="maven"
xmlns="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://mojo.codehaus.org/versions-maven-plugin/rule/2.0.0 http://mojo.codehaus.org/versions-maven-plugin/xsd/rule-2.0.0.xsd">
<!-- Thanks to Michael Piefel and Philip Helger: https://stackoverflow.com/a/22174801/14379 -->
<ignoreVersions>
<ignoreVersion type="regex">.*[-_\.](alpha|Alpha|ALPHA|b|beta|Beta|BETA|cr|CR|rc|RC|M|EA)[-_\.]?[0-9]*</ignoreVersion>
</ignoreVersions>
</ruleset>
25 changes: 24 additions & 1 deletion parent/pom.xml
Expand Up @@ -596,7 +596,17 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.2</version>
<version>2.5</version>
<configuration>
<rulesUri>classpath:///zanata-build-tools/versions-rules.xml</rulesUri>
</configuration>
<dependencies>
<dependency>
<groupId>org.zanata</groupId>
<artifactId>build-tools</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</plugin>

<plugin>
Expand Down Expand Up @@ -843,6 +853,19 @@
</executions>
</plugin>

<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.1</version>
<extensions>true</extensions>
<configuration>
<!-- The Base URL of Nexus instance where we want to stage -->
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<!-- The server "id" element from settings to use authentication from -->
<serverId>sonatype-staging</serverId>
</configuration>
</plugin>

<!-- Deploy javadocs to OSSRH -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
Expand Down
Expand Up @@ -35,17 +35,17 @@ public class TransReviewCriteria implements IsSerializable, Serializable {
private Long id;
private IssuePriority priority;
private String description;
private boolean editable;
private boolean commentRequired;

public TransReviewCriteria() {
}

public TransReviewCriteria(Long id, IssuePriority priority, String description,
boolean editable) {
boolean commentRequired) {
this.id = id;
this.priority = priority;
this.description = description;
this.editable = editable;
this.commentRequired = commentRequired;
}


Expand All @@ -57,8 +57,8 @@ public String getDescription() {
return description;
}

public boolean isEditable() {
return editable;
public boolean isCommentRequired() {
return commentRequired;
}

public Long getId() {
Expand Down
Expand Up @@ -80,7 +80,7 @@ protected ReviewService(ReviewCriteriaDAO reviewCriteriaDAO, UriInfo uriInfo, Ur

public static TransReviewCriteria fromModel(ReviewCriteria criteria) {
return new TransReviewCriteria(criteria.getId(), criteria.getPriority(),
criteria.getDescription(), criteria.isEditable());
criteria.getDescription(), criteria.isCommentRequired());
}

@POST
Expand All @@ -94,7 +94,7 @@ public Response addCriteria(TransReviewCriteria criteria) {
}
ReviewCriteria reviewCriteria =
new ReviewCriteria(criteria.getPriority(),
criteria.isEditable(), criteria.getDescription());
criteria.isCommentRequired(), criteria.getDescription());
reviewCriteriaDAO.makePersistent(reviewCriteria);
return Response.created(UriBuilder.fromUri(urlUtil.restPath(
uriInfo.getPath())).path(reviewCriteria.getId().toString()).build())
Expand All @@ -117,7 +117,7 @@ public Response editCriteria(@PathParam("id") Long id, TransReviewCriteria crite
return Response.status(Response.Status.NOT_FOUND).build();
}
reviewCriteria.setDescription(criteria.getDescription());
reviewCriteria.setEditable(criteria.isEditable());
reviewCriteria.setCommentRequired(criteria.isCommentRequired());
reviewCriteria.setPriority(criteria.getPriority());
return Response.ok(fromModel(reviewCriteria)).build();
}
Expand Down
@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.0.xsd">

<changeSet id="1" author="efloden@redhat.com">
<comment>Rename editable to commentRequired</comment>
<renameColumn tableName="ReviewCriteria" oldColumnName="editable"
newColumnName="commentRequired" columnDataType="boolean" />
</changeSet>
<changeSet id="2" author="efloden@redhat.com">
<comment>Make commentRequired non-null</comment>
<sql>
update ReviewCriteria set commentRequired = false where commentRequired is null;
</sql>
</changeSet>
<changeSet id="3" author="efloden@redhat.com">
<comment>Make commentRequired non-nullable</comment>
<addNotNullConstraint tableName="ReviewCriteria"
columnName="commentRequired" columnDataType="boolean" />
</changeSet>

</databaseChangeLog>
2 changes: 2 additions & 0 deletions server/services/src/main/resources/db/db.changelog.xml
Expand Up @@ -51,6 +51,8 @@
file="changelogs/db.changelog-4.3.xml" />
<include relativeToChangelogFile="true"
file="changelogs/db.changelog-4.4.xml" />
<include relativeToChangelogFile="true"
file="changelogs/db.changelog-4.5.xml" />

<!-- NB: triggers and validations must appear after all table changes -->
<!-- If the Liquibase version is being updated, please refer to the
Expand Down
1 change: 1 addition & 0 deletions server/zanata-frontend/pom.xml
Expand Up @@ -133,6 +133,7 @@
<resources>
<resource>
<directory>src/dist</directory>
<include>messages/*.json</include>
<include>editor.*.cache.js</include>
<include>editor.*.cache.css</include>
<include>editor.*.cache.css.map</include>
Expand Down
Expand Up @@ -27,7 +27,7 @@ exports[`Editor Storyshots ActivityFeedItem approved 1`] = `
>
<img
className="u-round ActivityAvatar"
src="http://www.gravatar.com/avatar/a961139da8db88c4ae10d6dacf6bea1e?s=72"
src="https://www.gravatar.com/avatar/a961139da8db88c4ae10d6dacf6bea1e?s=72"
/>
</a>
<span>
Expand Down Expand Up @@ -136,7 +136,7 @@ exports[`Editor Storyshots ActivityFeedItem comment 1`] = `
>
<img
className="u-round ActivityAvatar"
src="http://www.gravatar.com/avatar/a961139da8db88c4ae10d6dacf6bea1e?s=72"
src="https://www.gravatar.com/avatar/a961139da8db88c4ae10d6dacf6bea1e?s=72"
/>
</a>
<span>
Expand Down Expand Up @@ -238,7 +238,7 @@ exports[`Editor Storyshots ActivityFeedItem fuzzy 1`] = `
>
<img
className="u-round ActivityAvatar"
src="http://www.gravatar.com/avatar/a961139da8db88c4ae10d6dacf6bea1e?s=72"
src="https://www.gravatar.com/avatar/a961139da8db88c4ae10d6dacf6bea1e?s=72"
/>
</a>
<span>
Expand Down Expand Up @@ -347,7 +347,7 @@ exports[`Editor Storyshots ActivityFeedItem rejected - critical priority 1`] = `
>
<img
className="u-round ActivityAvatar"
src="http://www.gravatar.com/avatar/a961139da8db88c4ae10d6dacf6bea1e?s=72"
src="https://www.gravatar.com/avatar/a961139da8db88c4ae10d6dacf6bea1e?s=72"
/>
</a>
<span>
Expand Down Expand Up @@ -516,7 +516,7 @@ exports[`Editor Storyshots ActivityFeedItem rejected - major priority 1`] = `
>
<img
className="u-round ActivityAvatar"
src="http://www.gravatar.com/avatar/a961139da8db88c4ae10d6dacf6bea1e?s=72"
src="https://www.gravatar.com/avatar/a961139da8db88c4ae10d6dacf6bea1e?s=72"
/>
</a>
<span>
Expand Down Expand Up @@ -685,7 +685,7 @@ exports[`Editor Storyshots ActivityFeedItem rejected - minor priority 1`] = `
>
<img
className="u-round ActivityAvatar"
src="http://www.gravatar.com/avatar/a961139da8db88c4ae10d6dacf6bea1e?s=72"
src="https://www.gravatar.com/avatar/a961139da8db88c4ae10d6dacf6bea1e?s=72"
/>
</a>
<span>
Expand Down Expand Up @@ -854,7 +854,7 @@ exports[`Editor Storyshots ActivityFeedItem translated 1`] = `
>
<img
className="u-round ActivityAvatar"
src="http://www.gravatar.com/avatar/a961139da8db88c4ae10d6dacf6bea1e?s=72"
src="https://www.gravatar.com/avatar/a961139da8db88c4ae10d6dacf6bea1e?s=72"
/>
</a>
<span>
Expand Down
Expand Up @@ -19902,7 +19902,7 @@ exports[`Frontend Storyshots RejectionsForm admin screen 1`] = `
</div>
`;

exports[`Frontend Storyshots RejectionsForm editable 1`] = `
exports[`Frontend Storyshots RejectionsForm commentRequired 1`] = `
<form
className="rejectionsForm form-inline"
>
Expand Down
4 changes: 2 additions & 2 deletions server/zanata-frontend/src/app/actions/review-actions.js
Expand Up @@ -33,7 +33,7 @@ export function addNewCriterion (criterion) {
ADD_CRITERION_FAILURE]
const body = {
...criterion,
editable: criterion.isEditable
commentRequired: criterion.isCommentRequired
}
return {
[CALL_API]: buildAPIRequest(endpoint, 'POST', getJsonHeaders(), apiTypes,
Expand Down Expand Up @@ -63,7 +63,7 @@ export function editCriterion (criterion) {
const endpoint = `${apiUrl}/review/criteria/${criterion.id}`
const body = {
...criterion,
editable: criterion.isEditable
commentRequired: criterion.isCommentRequired
}
return {
[CALL_API]: buildAPIRequest(endpoint, 'PUT', getJsonHeaders(), types,
Expand Down
20 changes: 10 additions & 10 deletions server/zanata-frontend/src/app/components/RejectionsForm/index.js
Expand Up @@ -46,7 +46,7 @@ class RejectionsForm extends Component {
description: PropTypes.string.isRequired,
onSave: PropTypes.func.isRequired,
onDelete: PropTypes.func,
editable: PropTypes.bool,
commentRequired: PropTypes.bool,
// if it's in admin mode, we will allow user to update
isAdminMode: PropTypes.bool.isRequired,
// whether delete button shoud be displayed
Expand All @@ -57,7 +57,7 @@ class RejectionsForm extends Component {

static defaultProps = {
criterionId: 'review-criteria',
editable: false,
commentRequired: false,
description: '',
isAdminMode: false,
displayDelete: true,
Expand All @@ -69,15 +69,15 @@ class RejectionsForm extends Component {
super(props)
this.state = {
description: this.props.description,
isEditable: this.props.editable,
isCommentRequired: this.props.commentRequired,
priority: this.props.priority
}
}

onEditableChange = e => {
const checked = e.target.checked
this.setState(_prevState => ({
isEditable: checked
isCommentRequired: checked
}))
}
onTextChange = e => {
Expand All @@ -95,15 +95,15 @@ class RejectionsForm extends Component {
this.props.onSave({
...this.state,
id: this.props.entityId,
editable: this.state.isEditable
commentRequired: this.state.isCommentRequired
})
}
onDelete = () => {
this.props.onDelete(this.props.entityId)
}
render () {
const {
editable,
commentRequired,
className,
isAdminMode,
displayDelete,
Expand All @@ -113,7 +113,7 @@ class RejectionsForm extends Component {
const textState = priorityToTextState(this.state.priority)
const error = isEmpty(this.state.description)
const title = <span className={textState}>{this.state.priority}</span>
const priorityDisabled = !isAdminMode && !editable
const priorityDisabled = !isAdminMode && !commentRequired
const deleteBtn = displayDelete
? (
<OverlayTrigger placement='top' overlay={tooltipDelete}>
Expand All @@ -126,7 +126,7 @@ class RejectionsForm extends Component {
<FormGroup id='toggleComment' controlId='formInlineEditable'>
<ControlLabel>Comment required</ControlLabel><br />
<Toggle icons={false} onChange={this.onEditableChange}
checked={this.state.isEditable} />
checked={this.state.isCommentRequired} />
</FormGroup>
)
: DO_NOT_RENDER
Expand All @@ -146,7 +146,7 @@ class RejectionsForm extends Component {
<Form className='rejectionsForm' inline>
<FormGroup className='u-flexGrow1' controlId='formInlineCriteria'>
<ControlLabel>Criteria</ControlLabel><br />
<TextInput multiline editable={isAdminMode || editable}
<TextInput multiline editable={isAdminMode || commentRequired}
type='text' numberOfLines={2} onChange={this.onTextChange}
placeholder={criteriaPlaceholder} maxLength={255}
value={this.state.description} />
Expand All @@ -163,7 +163,7 @@ class RejectionsForm extends Component {
disabled={priorityDisabled}
/>
</FormGroup>
{editableToggle}
{commentToggle}
{formBtn}
</Form>
)
Expand Down
7 changes: 7 additions & 0 deletions server/zanata-frontend/src/app/config.js
Expand Up @@ -8,6 +8,12 @@ const rawConfig = window.config
const config = mapValues(rawConfig || {}, (value) =>
isJsonString(value) ? JSON.parse(value) : value)

export const DEFAULT_LOCALE = {
localeId: 'en-US',
name: 'English',
isRTL: false
}

// URL this app is deployed to
export const appUrl = config.appUrl || ''

Expand All @@ -27,3 +33,4 @@ export const isAdmin = config.permission
: false
export const user = config.user
export const allowRegister = config.allowRegister || false
export const appLocale = config.appLocale || DEFAULT_LOCALE['localeId']
4 changes: 2 additions & 2 deletions server/zanata-frontend/src/app/containers/Admin/Review.js
Expand Up @@ -18,7 +18,7 @@ const DO_NOT_RENDER = undefined
class AdminReview extends Component {
static propTypes = {
criteria: PropType.arrayOf(PropType.shape({
editable: PropType.bool.isRequired,
commentRequired: PropType.bool.isRequired,
description: PropType.string.isRequired,
priority: PropType.oneOf([MINOR, MAJOR, CRITICAL]).isRequired
})).isRequired,
Expand Down Expand Up @@ -48,7 +48,7 @@ class AdminReview extends Component {
render () {
const {criteria, deleteEntry, editEntry, notification} = this.props
const criteriaList = criteria.map((c, i) => <RejectionsForm key={i}
editable={c.editable} entityId={c.id} onDelete={deleteEntry}
commentRequired={c.commentRequired} entityId={c.id} onDelete={deleteEntry}
criteriaPlaceholder={c.description} isAdminMode displayDelete
onSave={editEntry} description={c.description}
priority={c.priority} />)
Expand Down
Expand Up @@ -4,8 +4,12 @@ export const TOGGLE_INFO_PANEL = 'TOGGLE_INFO_PANEL'
export const TOGGLE_HEADER = 'TOGGLE_HEADER'
export const TOGGLE_KEY_SHORTCUTS = 'TOGGLE_KEY_SHORTCUTS'
export const UI_LOCALES_FETCHED = 'UI_LOCALES_FETCHED'
export const APP_LOCALE_FETCHED = 'APP_LOCALE_FETCHED'
export const CHANGE_UI_LOCALE = 'CHANGE_UI_LOCALE'
export const DOCUMENT_SELECTED = 'DOCUMENT_SELECTED'
export const LOCALE_SELECTED = 'LOCALE_SELECTED'
export const STATS_FETCHED = 'STATS_FETCHED'
export const HEADER_DATA_FETCHED = 'HEADER_DATA_FETCHED'
export const LOCALE_MESSAGES_REQUEST = 'LOCALE_MESSAGES_REQUEST'
export const LOCALE_MESSAGES_SUCCESS = 'LOCALE_MESSAGES_SUCCESS'
export const LOCALE_MESSAGES_FAILURE = 'LOCALE_MESSAGES_FAILURE'

0 comments on commit a5e569c

Please sign in to comment.