Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into ZNTA-2495
Browse files Browse the repository at this point in the history
  • Loading branch information
Kathryn Gough committed May 3, 2018
2 parents fa04604 + 8470fb7 commit fe2f8b2
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 47 deletions.
41 changes: 18 additions & 23 deletions server/services/src/main/java/org/zanata/dao/AccountDAO.java
Expand Up @@ -125,40 +125,35 @@ public List<HAccount> searchQuery(String searchQuery, int maxResults,
}

public List<String> getUserNames(String filter, int offset, int maxResults) {
StringBuilder queryBuilder =
new StringBuilder("select username from HAccount ");
if (!StringUtils.isEmpty(filter)) {
queryBuilder.append("where lower(username) like :filter");
}
Query query = getSession().createQuery(queryBuilder.toString());
if (!StringUtils.isEmpty(filter)) {
query.setParameter("filter", "%" + filter.toLowerCase() + "%");
}
query.setMaxResults(maxResults);
query.setFirstResult(offset);
query.setCacheable(true);
query.setComment("accountDAO.getUserNames");
Query query = createFilteredQuery(
"select distinct acc.username from HAccount acc ", filter)
.setMaxResults(maxResults)
.setFirstResult(offset)
.setComment("accountDAO.getUserNames");
@SuppressWarnings("unchecked")
List<String> list = query.list();
return list;
}

public int getUserCount(String filter) {
StringBuilder queryBuilder = new StringBuilder("select count(*) from HAccount ");
return ((Long) createFilteredQuery(
"select count(*) from HAccount acc ", filter)
.setComment("accountDAO.getUserCount").uniqueResult())
.intValue();
}

private Query createFilteredQuery(String queryBase, String filter) {
if (!StringUtils.isEmpty(filter)) {
queryBuilder.append("where lower(username) like :filter");
queryBase += "inner join acc.person as person " +
"where lower(acc.username) like :filter " +
"OR lower(person.email) like :filter " +
"OR lower(person.name) like :filter";
}
Query query = getSession().createQuery(queryBuilder.toString());
Query query = getSession().createQuery(queryBase).setCacheable(true);
if (!StringUtils.isEmpty(filter)) {
query.setParameter("filter", "%" + filter.toLowerCase() + "%");
}
query.setCacheable(true);
query.setComment("accountDAO.getUserCount");
Long totalCount = (Long) query.uniqueResult();
if (totalCount == null) {
return 0;
}
return totalCount.intValue();
return query;
}

public HAccount getByCredentialsId(String credentialsId) {
Expand Down
Expand Up @@ -61,7 +61,7 @@ exports[`Editor Storyshots ActivityFeedItem approved 1`] = `
className="s1"
dangerouslySetInnerHTML={
Object {
"__html": "<use xlink:href=\\"#Icon-copy\\" />",
"__html": "<use xlink:href=\\"#Icon-project\\" />",
}
}
style={
Expand Down Expand Up @@ -160,7 +160,7 @@ exports[`Editor Storyshots ActivityFeedItem comment 1`] = `
className="s1"
dangerouslySetInnerHTML={
Object {
"__html": "<use xlink:href=\\"#Icon-copy\\" />",
"__html": "<use xlink:href=\\"#Icon-project\\" />",
}
}
style={
Expand Down Expand Up @@ -266,7 +266,7 @@ exports[`Editor Storyshots ActivityFeedItem needswork 1`] = `
className="s1"
dangerouslySetInnerHTML={
Object {
"__html": "<use xlink:href=\\"#Icon-copy\\" />",
"__html": "<use xlink:href=\\"#Icon-project\\" />",
}
}
style={
Expand Down Expand Up @@ -399,7 +399,7 @@ exports[`Editor Storyshots ActivityFeedItem rejected - critical priority 1`] = `
className="s1"
dangerouslySetInnerHTML={
Object {
"__html": "<use xlink:href=\\"#Icon-copy\\" />",
"__html": "<use xlink:href=\\"#Icon-project\\" />",
}
}
style={
Expand Down Expand Up @@ -532,7 +532,7 @@ exports[`Editor Storyshots ActivityFeedItem rejected - major priority 1`] = `
className="s1"
dangerouslySetInnerHTML={
Object {
"__html": "<use xlink:href=\\"#Icon-copy\\" />",
"__html": "<use xlink:href=\\"#Icon-project\\" />",
}
}
style={
Expand Down Expand Up @@ -665,7 +665,7 @@ exports[`Editor Storyshots ActivityFeedItem rejected - minor priority 1`] = `
className="s1"
dangerouslySetInnerHTML={
Object {
"__html": "<use xlink:href=\\"#Icon-copy\\" />",
"__html": "<use xlink:href=\\"#Icon-project\\" />",
}
}
style={
Expand Down Expand Up @@ -771,7 +771,7 @@ exports[`Editor Storyshots ActivityFeedItem translated 1`] = `
className="s1"
dangerouslySetInnerHTML={
Object {
"__html": "<use xlink:href=\\"#Icon-copy\\" />",
"__html": "<use xlink:href=\\"#Icon-project\\" />",
}
}
style={
Expand Down
Expand Up @@ -22,8 +22,8 @@

table#languages-table {
margin: 0;
width: 100%;
}

select#sort-options {
width: inherit;
}
Expand Down
Expand Up @@ -135,6 +135,7 @@
margin-bottom: @spacing-rh;
margin-top: 0;
padding-right: @spacing-rh;
height: 100%;
}
#userProfile-matrix h2, #userProfile-matrix h3 {
color: @color-dark;
Expand Down
Expand Up @@ -255,7 +255,7 @@ class ActivityFeedItem extends Component {
<span className='u-pullRight'>
<button onClick={copyToClipboard}
className='Link Link--neutral' title='Copy'>
<Icon name='copy' className='s1' />
<Icon name='project' className='s1' />
</button>
</span>
</Well>
Expand Down
18 changes: 3 additions & 15 deletions server/zanata-frontend/src/app/styles/style.less
Expand Up @@ -62,7 +62,7 @@
overflow: hidden;
overflow-x: hidden;
-webkit-overflow-scrolling: touch;
max-width: 90%;
max-width: 100%;
width: inherit;
margin-left: 1rem;
padding-left: @spacing-base;
Expand All @@ -71,9 +71,6 @@
.wideView.languages, .wideView#glossary {
padding-bottom: 3rem;
}
.wideView#profile, .wideView#glossary {
max-width: 100%;
}
.gwtBase {
background-color: #fff;
font-size: 16px;
Expand Down Expand Up @@ -426,8 +423,8 @@
flex-direction: row;
display: inline-flex;
flex-wrap: wrap;
width: 90%;
line-height: 2rem;
max-width: 90%;
}
/* Icons and other svgs - not specific to Icon/s components so it should stay in this file */
.icon {
Expand Down Expand Up @@ -4127,7 +4124,7 @@
width: 300px;
}
.container {
width: @container-tablet;
width: 100%;
}
.content {
width: 65%;
Expand Down Expand Up @@ -4503,9 +4500,6 @@
.modal-lg {
width: 900px;
}
.container {
width: @container-desktop;
}
.col-md-1, .col-md-10, .col-md-11, .col-md-12, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9 {
float: left;
}
Expand Down Expand Up @@ -4662,9 +4656,6 @@
.col-md-offset-0 {
margin-left: 0;
}
.toolbar {
width: 100%;
}
}
@media (max-width: @screen-md-max) {
.hidden-xs {
Expand All @@ -4683,9 +4674,6 @@
}
}
@media (min-width: @screen-lg-min) {
.container {
width: @container-large-desktop;
}
.containerSidebar td.td-2 {
width: 16.6667%;
}
Expand Down

0 comments on commit fe2f8b2

Please sign in to comment.