Skip to content
Browse files

Merge branch 'master' into EnableChat

  • Loading branch information...
2 parents b5cc7a6 + 90fbb09 commit 984dc4f555550255ac5f2045c9bd45393c9d2c0d @aeng aeng committed
View
2 functional-test/src/test/java/org/zanata/feature/CreateSampleProjectTest.java
@@ -74,7 +74,7 @@ public void canCreateProjectAndVersion()
}
- @Test(expectedExceptions = RuntimeException.class, expectedExceptionsMessageRegExp = "This slug is not available")
+ @Test(expectedExceptions = RuntimeException.class, expectedExceptionsMessageRegExp = "This Project ID is not available")
public void cannotCreateProjectWithSameProjectId() {
new LoginWorkFlow().signIn("admin", "admin");
ProjectWorkFlow projectWorkFlow = new ProjectWorkFlow();
View
2 pom.xml
@@ -21,7 +21,7 @@
<properties>
<zanata.api.version>1.6.0</zanata.api.version>
<zanata.client.version>1.6.0</zanata.client.version>
- <zanata.common.version>1.6.0</zanata.common.version>
+ <zanata.common.version>1.6.1-SNAPSHOT</zanata.common.version>
<!--delombok properties-->
<lombok.source.dir>${project.build.sourceDirectory}/org/zanata</lombok.source.dir>
View
8 zanata-war/src/main/java/org/zanata/action/ProjectHome.java
@@ -26,7 +26,6 @@
import javax.faces.event.ValueChangeEvent;
import javax.persistence.EntityNotFoundException;
-import javax.persistence.NoResultException;
import org.hibernate.Session;
import org.hibernate.criterion.NaturalIdentifier;
@@ -112,7 +111,7 @@ public boolean validateSlug(String slug, String componentId)
{
if (!isSlugAvailable(slug))
{
- FacesMessages.instance().addToControl(componentId, "This slug is not available");
+ FacesMessages.instance().addToControl(componentId, "This Project ID is not available");
return false;
}
return true;
@@ -216,6 +215,11 @@ else if (customizedItems != null)
}
}
+ public boolean isProjectActive()
+ {
+ return getInstance().getStatus() == EntityStatus.ACTIVE;
+ }
+
public boolean isReadOnly(HProjectIteration iteration)
{
if (getInstance().getStatus() == EntityStatus.READONLY || (iteration != null && iteration.getStatus() == EntityStatus.READONLY))
View
8 zanata-war/src/main/java/org/zanata/action/ProjectIterationHome.java
@@ -25,7 +25,6 @@
import javax.faces.event.ValueChangeEvent;
import javax.persistence.EntityNotFoundException;
-import javax.persistence.NoResultException;
import org.hibernate.criterion.NaturalIdentifier;
import org.hibernate.criterion.Restrictions;
@@ -35,6 +34,7 @@
import org.jboss.seam.core.Events;
import org.jboss.seam.faces.FacesMessages;
import org.jboss.seam.log.Log;
+import org.zanata.common.EntityStatus;
import org.zanata.dao.ProjectDAO;
import org.zanata.model.HIterationProject;
import org.zanata.model.HLocale;
@@ -124,7 +124,7 @@ public boolean validateSlug(String slug, String componentId)
{
if (!isSlugAvailable(slug))
{
- FacesMessages.instance().addToControl(componentId, "This slug is not available");
+ FacesMessages.instance().addToControl(componentId, "This Version ID is not available");
return false;
}
return true;
@@ -177,6 +177,10 @@ public String update()
return state;
}
+ public boolean isProjectActive()
+ {
+ return getInstance().getProject().getStatus() == EntityStatus.ACTIVE;
+ }
private void updateOverrideLocales()
{
View
18 zanata-war/src/main/java/org/zanata/action/VersionGroupHome.java
@@ -25,7 +25,6 @@
import javax.faces.event.ValueChangeEvent;
import javax.faces.model.SelectItem;
-import javax.persistence.NoResultException;
import org.hibernate.Session;
import org.hibernate.criterion.NaturalIdentifier;
@@ -38,6 +37,7 @@
import org.zanata.model.HAccount;
import org.zanata.model.HIterationGroup;
import org.zanata.model.HProjectIteration;
+import org.zanata.service.SlugEntityService;
/**
* @author Alex Eng <a href="mailto:aeng@redhat.com">aeng@redhat.com</a>
@@ -53,6 +53,9 @@
@In(required = false, value = JpaIdentityStore.AUTHENTICATED_USER)
HAccount authenticatedAccount;
+ @In
+ SlugEntityService slugEntityServiceImpl;
+
@Override
protected HIterationGroup loadInstance()
{
@@ -110,7 +113,7 @@ public boolean validateSlug(String slug, String componentId)
{
if (!isSlugAvailable(slug))
{
- FacesMessages.instance().addToControl(componentId, "This slug is not available");
+ FacesMessages.instance().addToControl(componentId, "This Group ID is not available");
return false;
}
return true;
@@ -118,16 +121,7 @@ public boolean validateSlug(String slug, String componentId)
public boolean isSlugAvailable(String slug)
{
- try
- {
- getEntityManager().createQuery("from HIterationGroup g where g.slug = :slug").setParameter("slug", slug).getSingleResult();
- return false;
- }
- catch (NoResultException e)
- {
- // pass
- }
- return true;
+ return slugEntityServiceImpl.isSlugAvailable(slug, HIterationGroup.class);
}
@Override
View
4 zanata-war/src/main/java/org/zanata/webtrans/client/view/GlossaryView.java
@@ -167,6 +167,10 @@ public void renderTable()
glossaryTable.addColumn(detailsColumn, messages.detailsLabel());
glossaryTable.addColumn(copyColumn);
+ Label noResult = new Label("Found no glossary results");
+ noResult.setStyleName("boldFont");
+ glossaryTable.setEmptyTableWidget(noResult);
+
final NoSelectionModel<GlossaryResultItem> selectionModel = new NoSelectionModel<GlossaryResultItem>();
final DefaultSelectionEventManager<GlossaryResultItem> manager = DefaultSelectionEventManager.createBlacklistManager(0, 1, 2);
glossaryTable.setSelectionModel(selectionModel, manager);
View
4 zanata-war/src/main/java/org/zanata/webtrans/client/view/TransMemoryView.java
@@ -209,6 +209,10 @@ private void renderTable()
tmTable.addColumn(new SimilarityColumn<TransMemoryResultItem>(), messages.similarityLabel());
tmTable.addColumn(detailsColumn, messages.detailsLabel());
+ Label noResult = new Label("Found no translation memory results");
+ noResult.setStyleName("boldFont");
+ tmTable.setEmptyTableWidget(noResult);
+
final NoSelectionModel<TransMemoryResultItem> selectionModel = new NoSelectionModel<TransMemoryResultItem>();
final DefaultSelectionEventManager<TransMemoryResultItem> manager = DefaultSelectionEventManager.createBlacklistManager(0, 1, 2);
tmTable.setSelectionModel(selectionModel, manager);
View
3 zanata-war/src/main/resources/messages.properties
@@ -302,6 +302,7 @@ jsf.NoErrors=No errors
jsf.NoLocaleExists=No locale exists.
jsf.NoProjectExists=No project exists.
jsf.NoGroupExists=No group exists.
+jsf.NoResultToDisplayProjectSearch=No results to display. Please check whether the desired project contains any versions.
jsf.NoMaintainersDefined=(No maintainers defined)
jsf.NotGenerated=(Not generated)
jsf.ObsoleteVersions=Obsolete versions
@@ -403,4 +404,4 @@ jsf.YourLanguageMissing=Your language missing?
jsf.Zanata=Zanata
jsf.ZanataAdministrator=Zanata Administrator
jsf.ZanataMainTitle=#{messages['jsf.Zanata']}
-jsf.ZanataMainDescription=Zanata
+jsf.ZanataMainDescription=Zanata
View
5 zanata-war/src/main/resources/org/zanata/webtrans/public/Application.css
@@ -888,4 +888,9 @@ td.FuzzyStateDecoration div div pre, td.ApprovedStateDecoration div div pre
.notificationPanel
{
border:none;
+}
+
+.boldFont
+{
+ font-weight:bold;
}
View
7 zanata-war/src/main/webapp/language/language.xhtml
@@ -98,7 +98,7 @@
</a4j:form>
</rich:panel>
- <rich:modalPanel id="userAddPanel" width="530" height="320" autosized="true">
+ <rich:modalPanel id="userAddPanel" width="530" height="420">
<f:subview id="personSearch">
<a4j:form>
<h1>Find Users To Add</h1>
@@ -116,8 +116,7 @@
</a4j:form>
<a4j:region>
<a4j:status id="searchStatus" startText="Searching..." stopText="" />
- <a4j:outputPanel id="searchResults" layout="block"
- style="overflow:auto;">
+ <a4j:outputPanel id="searchResults" layout="block" style="overflow:auto;height:320px">
<h:outputText id="noResultsMessage" rendered="#{empty languageTeamAction.searchResults}" value="No results to display." />
<h:form rendered="#{not empty languageTeamAction.searchResults}">
<rich:dataTable id="personTable"
@@ -135,7 +134,7 @@
<f:facet name="header">#{messages['jsf.Actions']}</f:facet>
<a4j:commandButton value="#{messages['jsf.Add']}"
action="#{languageTeamAction.addTeamMember(person.id)}"
- rendered="#{!languageTeamAction.isPersonInTeam(person.id)}" reRender="userAddPanel, memberPanel" />
+ rendered="#{!languageTeamAction.isPersonInTeam(person.id)}" reRender="searchResults, memberPanel" />
<h:outputText value="#{messages['jsf.AlreadyInTeam']}"
rendered="#{languageTeamAction.isPersonInTeam(person.id)}" />
</rich:column>
View
10 zanata-war/src/main/webapp/project/add_iteration.xhtml
@@ -19,8 +19,14 @@
</h1>
- <ui:include src="../WEB-INF/layout/iteration_edit_form.xhtml" />
-
+ <s:fragment rendered="#{projectIterationHome.isProjectActive()}">
+ <ui:include src="../WEB-INF/layout/iteration_edit_form.xhtml"/>
+ </s:fragment>
+
+ <s:fragment rendered="#{!projectIterationHome.isProjectActive()}">
+ <rich:spacer height="20px"/>
+ <span class="errors">#{projectIterationHome.instance.project.name} is not active.</span>
+ </s:fragment>
</ui:define>
</ui:composition>
View
2 zanata-war/src/main/webapp/project/project.xhtml
@@ -128,7 +128,7 @@
<s:link styleClass="action_link" rendered="#{s:hasRole('admin')}" value="#{messages['jsf.project.EditHomePage.label']}" view="/project/homepage_edit.xhtml" title="#{messages['jsf.project.EditHomePage.tooltip']}" propagation="none">
<f:param name="slug" value="#{projectHome.instance.slug}"/>
</s:link>
- <s:link styleClass="action_link" rendered="#{s:hasPermission(projectHome.instance, 'add-iteration')}" view="/project/add_iteration.xhtml" value="#{messages['jsf.CreateVersion']}" propagation="none">
+ <s:link styleClass="action_link" rendered="#{s:hasPermission(projectHome.instance, 'add-iteration') and projectHome.isProjectActive()}" view="/project/add_iteration.xhtml" value="#{messages['jsf.CreateVersion']}" propagation="none">
<f:param name="projectSlug" value="#{projectHome.instance.slug}"/>
</s:link>
<s:link styleClass="action_link" rendered="#{s:hasPermission(projectHome.instance, 'update')}" view="/project/assign_maintainer.xhtml" value="#{messages['jsf.ManageMaintainers']}" propagation="none">
View
6 zanata-war/src/main/webapp/version-group/version_group.xhtml
@@ -82,7 +82,7 @@
</rich:dataList>
</rich:panel>
- <rich:modalPanel id="versionAddPanel" width="530" height="320" autosized="true">
+ <rich:modalPanel id="versionAddPanel" width="530" height="420">
<f:subview id="projectVersionSearch">
<a4j:form>
<h1>Find Project Version</h1>
@@ -100,8 +100,8 @@
</a4j:form>
<a4j:region>
<a4j:status id="searchStatus" startText="Searching..." stopText="" />
- <a4j:outputPanel id="searchResults" layout="block" style="overflow:auto;">
- <h:outputText id="noResultsMessage" rendered="#{empty versionGroupAction.searchResults}" value="No results to display." />
+ <a4j:outputPanel id="searchResults" layout="block" style="overflow:auto;height:320px">
+ <h:outputText id="noResultsMessage" rendered="#{empty versionGroupAction.searchResults and versionGroupAction.searchResults != null}" value="#{messages['jsf.NoResultToDisplayProjectSearch']}" />
<h:form rendered="#{not empty versionGroupAction.searchResults}">
<rich:dataTable id="resultTable"
value="#{versionGroupAction.searchResults}" var="projectIteration">

0 comments on commit 984dc4f

Please sign in to comment.
Something went wrong with that request. Please try again.