ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgerg...@apache.org
Subject [2/2] ambari git commit: AMBARI-19863 Fix Log Search User Config bugs (mgergely)
Date Tue, 07 Feb 2017 09:01:24 GMT
AMBARI-19863 Fix Log Search User Config bugs (mgergely)

Change-Id: I0e84dc7f79d67ef492a78a88a6eef613bee052c1


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/e55a595a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/e55a595a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/e55a595a

Branch: refs/heads/trunk
Commit: e55a595ac10d9e822e1c8e27dc098f829ec2e2e7
Parents: 536192b
Author: Miklos Gergely <mgergely@hortonworks.com>
Authored: Tue Feb 7 10:01:12 2017 +0100
Committer: Miklos Gergely <mgergely@hortonworks.com>
Committed: Tue Feb 7 10:01:12 2017 +0100

----------------------------------------------------------------------
 .../logsearch/common/LogSearchConstants.java    |    1 -
 .../UserConfigRequestQueryConverter.java        |   17 +-
 .../ambari/logsearch/doc/DocConstants.java      |    3 -
 .../logsearch/manager/UserConfigManager.java    |   53 +-
 .../request/UserConfigParamDefinition.java      |    6 -
 .../model/request/impl/UserConfigRequest.java   |   15 +-
 .../model/response/UserConfigData.java          |   11 -
 .../logsearch/rest/UserConfigResource.java      |   17 +-
 .../ambari/logsearch/solr/SolrConstants.java    |    1 -
 .../scripts/views/common/DashboardLayout.js     |   80 --
 .../scripts/views/common/EventHistoryLayout.js  |    1 -
 .../views/dashboard/DashboardLayoutView.js      |  354 -----
 .../scripts/views/dashboard/MainLayoutView.js   | 1259 +++++++++---------
 .../views/dialog/ApplySearchFilterView.js       |   41 +-
 .../views/tabs/EventHistoryLayoutView.js        |    1 -
 .../dashboard/DashboardLayoutView_tmpl.html     |   28 -
 .../UserConfigRequestQueryConverterTest.java    |    9 +-
 17 files changed, 672 insertions(+), 1225 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e55a595a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
index 1e46ae9..a260ed0 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/common/LogSearchConstants.java
@@ -101,7 +101,6 @@ public class LogSearchConstants {
   public static final String REQUEST_PARAM_SOURCE_LOG_ID = "sourceLogId";
   public static final String REQUEST_PARAM_KEYWORD_TYPE = "keywordType";
   public static final String REQUEST_PARAM_TOKEN = "token";
-  public static final String REQUEST_PARAM_USER_ID = "userId";
   public static final String REQUEST_PARAM_FILTER_NAME = "filterName";
   public static final String REQUEST_PARAM_ROW_TYPE = "rowType";
   public static final String REQUEST_PARAM_UTC_OFFSET = "utcOffset";

http://git-wip-us.apache.org/repos/asf/ambari/blob/e55a595a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/UserConfigRequestQueryConverter.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/UserConfigRequestQueryConverter.java
b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/UserConfigRequestQueryConverter.java
index 082f45c..fc75a17 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/UserConfigRequestQueryConverter.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/converter/UserConfigRequestQueryConverter.java
@@ -30,8 +30,6 @@ import java.util.List;
 
 import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.FILTER_NAME;
 import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.ROW_TYPE;
-import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.SHARE_NAME_LIST;
-import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.USER_NAME;
 
 @Named
 public class UserConfigRequestQueryConverter extends AbstractConverterAware<UserConfigRequest,
SolrQuery> {
@@ -43,21 +41,16 @@ public class UserConfigRequestQueryConverter extends AbstractConverterAware<User
 
     int startIndex = StringUtils.isNotEmpty(userConfigRequest.getStartIndex()) &&
StringUtils.isNumeric(userConfigRequest.getStartIndex())
       ? Integer.parseInt(userConfigRequest.getStartIndex()) : 0;
-    int maxRows = StringUtils.isNotEmpty(userConfigRequest.getPageSize()) && StringUtils.isNumeric(userConfigRequest.getStartIndex())
-      ? Integer.parseInt(userConfigRequest.getStartIndex()) : 10;
+    int maxRows = StringUtils.isNotEmpty(userConfigRequest.getPageSize()) && StringUtils.isNumeric(userConfigRequest.getPageSize())
+      ? Integer.parseInt(userConfigRequest.getPageSize()) : 10;
 
     SolrQuery.ORDER order = userConfigRequest.getSortType() != null && SolrQuery.ORDER.desc.equals(SolrQuery.ORDER.valueOf(userConfigRequest.getSortType()))
       ? SolrQuery.ORDER.desc : SolrQuery.ORDER.asc;
-    String sortBy = StringUtils.isNotEmpty(userConfigRequest.getSortBy()) ? userConfigRequest.getSortBy():
FILTER_NAME;
+    String sortBy = StringUtils.isNotEmpty(userConfigRequest.getSortBy()) ? userConfigRequest.getSortBy()
: FILTER_NAME;
     String filterName = StringUtils.isBlank(userConfigRequest.getFilterName()) ? "*" : "*"
+ userConfigRequest.getFilterName() + "*";
 
-    userConfigQuery.addFilterQuery(String.format("%s:%s",
-      ROW_TYPE, userConfigRequest.getRowType()));
-    userConfigQuery.addFilterQuery(String.format("%s:%s OR %s:%s",
-      USER_NAME, userConfigRequest.getUserId(),
-      SHARE_NAME_LIST, userConfigRequest.getUserId()));
-    userConfigQuery.addFilterQuery(String.format("%s:%s",
-      FILTER_NAME, SolrUtil.makeSearcableString(filterName)));
+    userConfigQuery.addFilterQuery(String.format("%s:%s", ROW_TYPE, userConfigRequest.getRowType()));
+    userConfigQuery.addFilterQuery(String.format("%s:%s", FILTER_NAME, SolrUtil.makeSearcableString(filterName)));
     userConfigQuery.setStart(startIndex);
     userConfigQuery.setRows(maxRows);
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e55a595a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/doc/DocConstants.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/doc/DocConstants.java
b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/doc/DocConstants.java
index caf0636..713c9f6 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/doc/DocConstants.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/doc/DocConstants.java
@@ -100,19 +100,16 @@ public class DocConstants {
   }
 
   public class UserConfigDescriptions {
-    public static final String USER_ID_D = "Get config for a particular user id";
     public static final String FILTER_NAME_D = "The saved query as filter in Solr, search
is sopprted by this param";
     public static final String ROW_TYPE_D = "Row type is solr to identify as filter query";
   }
 
   public class UserConfigOperationDescriptions {
     public static final String SAVE_USER_CONFIG_OD = "Save user config";
-    public static final String UPDATE_USER_CONFIG_OD = "Update user config";
     public static final String DELETE_USER_CONFIG_OD = "Delete user config";
     public static final String GET_USER_CONFIG_OD = "Get user config";
     public static final String GET_USER_FILTER_OD = "Get user filter";
     public static final String UPDATE_USER_FILTER_OD = "Update user filter";
-    public static final String GET_USER_FILTER_BY_ID_OD = "Get user filter by id";
     public static final String GET_ALL_USER_NAMES_OD = "Get all user names";
   }
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e55a595a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
index 03535b1..a60fc5c 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/manager/UserConfigManager.java
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 
+import org.apache.ambari.logsearch.common.LogSearchContext;
 import org.apache.ambari.logsearch.common.MessageEnums;
 import org.apache.ambari.logsearch.dao.UserConfigSolrDao;
 import org.apache.ambari.logsearch.model.common.LogFeederDataMap;
@@ -32,6 +33,7 @@ import org.apache.ambari.logsearch.model.response.UserConfigData;
 import org.apache.ambari.logsearch.model.response.UserConfigDataListResponse;
 import org.apache.ambari.logsearch.util.RESTErrorUtil;
 import org.apache.ambari.logsearch.util.SolrUtil;
+import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.apache.solr.client.solrj.SolrQuery;
@@ -53,7 +55,6 @@ import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants
 import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.FILTER_NAME;
 import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.ROW_TYPE;
 import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.SHARE_NAME_LIST;
-import static org.apache.ambari.logsearch.solr.SolrConstants.UserConfigConstants.COMPOSITE_KEY;
 
 @Named
 public class UserConfigManager extends JsonManagerBase {
@@ -66,45 +67,25 @@ public class UserConfigManager extends JsonManagerBase {
   private ConversionService conversionService;
 
   public String saveUserConfig(UserConfigData userConfig) {
+    String filterName = userConfig.getFiltername();
 
     SolrInputDocument solrInputDoc = new SolrInputDocument();
     if (!isValid(userConfig)) {
       throw RESTErrorUtil.createRESTException("No FilterName Specified", MessageEnums.INVALID_INPUT_DATA);
     }
 
-    if (isNotUnique(userConfig) && !userConfig.isOverwrite()) {
+    if (isNotUnique(filterName)) {
       throw RESTErrorUtil.createRESTException( "Name '" + userConfig.getFiltername() + "'
already exists", MessageEnums.INVALID_INPUT_DATA);
     }
-    String loggedInUserName = userConfig.getUserName();
-    String filterName = userConfig.getFiltername();
-
     solrInputDoc.addField(ID, userConfig.getId());
-    solrInputDoc.addField(USER_NAME, loggedInUserName);
+    solrInputDoc.addField(USER_NAME, LogSearchContext.getCurrentUsername());
     solrInputDoc.addField(VALUES, userConfig.getValues());
     solrInputDoc.addField(FILTER_NAME, filterName);
     solrInputDoc.addField(ROW_TYPE, userConfig.getRowType());
     List<String> shareNameList = userConfig.getShareNameList();
-    if (shareNameList != null && !shareNameList.isEmpty()) {
+    if (CollectionUtils.isNotEmpty(shareNameList)) {
       solrInputDoc.addField(SHARE_NAME_LIST, shareNameList);
     }
-    // Check whether the Filter Name exists in solr
-    SolrQuery solrQuery = new SolrQuery();
-    solrQuery.setQuery("*:*");
-    solrQuery.addFilterQuery(String.format("%s:%s", FILTER_NAME, SolrUtil.makeSearcableString(filterName)));
-    solrQuery.addFilterQuery(String.format("%s:%s", USER_NAME, loggedInUserName));
-    try {
-      QueryResponse queryResponse = userConfigSolrDao.process(solrQuery);
-      if (queryResponse != null) {
-        SolrDocumentList documentList = queryResponse.getResults();
-        if (documentList != null && !documentList.isEmpty() && !userConfig.isOverwrite())
{
-          logger.error("Filtername is already present");
-          throw RESTErrorUtil.createRESTException("Filtername is already present", MessageEnums.INVALID_INPUT_DATA);
-        }
-      }
-    } catch (SolrException e) {
-      logger.error("Error in checking same filtername config", e);
-      throw RESTErrorUtil.createRESTException(MessageEnums.SOLR_ERROR.getMessage().getMessage(),
MessageEnums.ERROR_SYSTEM);
-    }
 
     try {
       userConfigSolrDao.addDocs(solrInputDoc);
@@ -115,14 +96,14 @@ public class UserConfigManager extends JsonManagerBase {
     }
   }
 
-  private boolean isNotUnique(UserConfigData userConfig) {
-    String filterName = userConfig.getFiltername();
-    String rowType = userConfig.getRowType();
+  private boolean isNotUnique(String filterName) {
 
-    if (filterName != null && rowType != null) {
+    if (filterName != null) {
       SolrQuery solrQuery = new SolrQuery();
       filterName = SolrUtil.makeSearcableString(filterName);
-      solrQuery.setQuery(COMPOSITE_KEY + ":" + filterName + "-" + rowType);
+      solrQuery.setQuery("*:*");
+      solrQuery.addFilterQuery(FILTER_NAME + ":" + filterName);
+      solrQuery.addFilterQuery(USER_NAME + ":" + LogSearchContext.getCurrentUsername());
       SolrUtil.setRowCount(solrQuery, 0);
       try {
         Long numFound = userConfigSolrDao.process(solrQuery).getResults().getNumFound();
@@ -139,7 +120,6 @@ public class UserConfigManager extends JsonManagerBase {
   private boolean isValid(UserConfigData vHistory) {
     return StringUtils.isNotBlank(vHistory.getFiltername())
         && StringUtils.isNotBlank(vHistory.getRowType())
-        && StringUtils.isNotBlank(vHistory.getUserName())
         && StringUtils.isNotBlank(vHistory.getValues());
   }
 
@@ -159,12 +139,9 @@ public class UserConfigManager extends JsonManagerBase {
       throw RESTErrorUtil.createRESTException("row type was not specified", MessageEnums.INVALID_INPUT_DATA);
     }
 
-    String userName = request.getUserId();
-    if (StringUtils.isBlank(userName)) {
-      throw RESTErrorUtil.createRESTException("user name was not specified", MessageEnums.INVALID_INPUT_DATA);
-    }
-
     SolrQuery userConfigQuery = conversionService.convert(request, SolrQuery.class);
+    userConfigQuery.addFilterQuery(String.format("%s:%s OR %s:%s", USER_NAME, LogSearchContext.getCurrentUsername(),
+        SHARE_NAME_LIST, LogSearchContext.getCurrentUsername()));
     SolrDocumentList solrList = userConfigSolrDao.process(userConfigQuery).getResults();
 
     Collection<UserConfigData> configList = new ArrayList<>();
@@ -199,10 +176,6 @@ public class UserConfigManager extends JsonManagerBase {
 
   }
 
-  public String updateUserConfig(UserConfigData userConfig) {
-    return saveUserConfig(userConfig);
-  }
-
   // ////////////////////////////LEVEL FILTER/////////////////////////////////////
 
   public LogFeederDataMap getUserFilter() {

http://git-wip-us.apache.org/repos/asf/ambari/blob/e55a595a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UserConfigParamDefinition.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UserConfigParamDefinition.java
b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UserConfigParamDefinition.java
index 23b350a..dd74b6f 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UserConfigParamDefinition.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/UserConfigParamDefinition.java
@@ -21,17 +21,11 @@ package org.apache.ambari.logsearch.model.request;
 import io.swagger.annotations.ApiParam;
 import org.apache.ambari.logsearch.common.LogSearchConstants;
 
-import static org.apache.ambari.logsearch.doc.DocConstants.UserConfigDescriptions.USER_ID_D;
 import static org.apache.ambari.logsearch.doc.DocConstants.UserConfigDescriptions.FILTER_NAME_D;
 import static org.apache.ambari.logsearch.doc.DocConstants.UserConfigDescriptions.ROW_TYPE_D;
 
 public interface UserConfigParamDefinition {
 
-  String getUserId();
-
-  @ApiParam(value = USER_ID_D, name = LogSearchConstants.REQUEST_PARAM_USER_ID)
-  void setUserId(String userId);
-
   String getFilterName();
 
   @ApiParam(value = FILTER_NAME_D, name = LogSearchConstants.REQUEST_PARAM_FILTER_NAME)

http://git-wip-us.apache.org/repos/asf/ambari/blob/e55a595a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/UserConfigRequest.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/UserConfigRequest.java
b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/UserConfigRequest.java
index c99ea75..cbbc6e6 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/UserConfigRequest.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/request/impl/UserConfigRequest.java
@@ -25,26 +25,13 @@ import javax.ws.rs.QueryParam;
 
 public class UserConfigRequest extends CommonSearchRequest implements UserConfigParamDefinition
{
 
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_USER_ID)
-  private String userId;
-
-  @QueryParam(LogSearchConstants.REQUEST_PARAM_FILE_NAME)
+  @QueryParam(LogSearchConstants.REQUEST_PARAM_FILTER_NAME)
   private String filterName;
 
   @QueryParam(LogSearchConstants.REQUEST_PARAM_ROW_TYPE)
   private String rowType;
 
   @Override
-  public String getUserId() {
-    return userId;
-  }
-
-  @Override
-  public void setUserId(String userId) {
-    this.userId = userId;
-  }
-
-  @Override
   public String getFilterName() {
     return filterName;
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e55a595a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigData.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigData.java
b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigData.java
index 1fca3ba..ef4e0be 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigData.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/model/response/UserConfigData.java
@@ -43,9 +43,6 @@ public class UserConfigData {
   @ApiModelProperty
   private String rowType;
 
-  @ApiModelProperty
-  private boolean isOverwrite = false;
-
   public UserConfigData() {
     id = String.valueOf(new Date().getTime());
   }
@@ -97,12 +94,4 @@ public class UserConfigData {
   public void setRowType(String rowType) {
     this.rowType = rowType;
   }
-
-  public boolean isOverwrite() {
-    return isOverwrite;
-  }
-
-  public void setOverwrite(boolean overwrite) {
-    isOverwrite = overwrite;
-  }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e55a595a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java
b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java
index 31f584d..19cfbed 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/rest/UserConfigResource.java
@@ -59,13 +59,6 @@ public class UserConfigResource {
     return userConfigManager.saveUserConfig(userConfig);
   }
 
-  @PUT
-  @Produces({"application/json"})
-  @ApiOperation(UPDATE_USER_CONFIG_OD)
-  public String updateUserConfig(UserConfigData userConfig) {
-    return userConfigManager.updateUserConfig(userConfig);
-  }
-
   @DELETE
   @Path("/{id}")
   @ApiOperation(DELETE_USER_CONFIG_OD)
@@ -88,18 +81,10 @@ public class UserConfigResource {
     return userConfigManager.getUserFilter();
   }
 
-  @POST
-  @Path("/filters")
-  @Produces({"application/json"})
-  @ApiOperation(UPDATE_USER_FILTER_OD)
-  public LogFeederDataMap createUserFilter(LogFeederDataMap request) {
-    return userConfigManager.saveUserFiter(request);
-  }
-
   @PUT
   @Path("/filters/{id}")
   @Produces({"application/json"})
-  @ApiOperation(GET_USER_FILTER_BY_ID_OD)
+  @ApiOperation(UPDATE_USER_FILTER_OD)
   public LogFeederDataMap updateUserFilter(LogFeederDataMap request) {
     return userConfigManager.saveUserFiter(request);
   }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e55a595a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/SolrConstants.java
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/SolrConstants.java
b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/SolrConstants.java
index 85554bc..39e134a 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/SolrConstants.java
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/java/org/apache/ambari/logsearch/solr/SolrConstants.java
@@ -107,7 +107,6 @@ public class SolrConstants {
     public static final String VALUES = "jsons";
     public static final String FILTER_NAME = "filtername";
     public static final String ROW_TYPE = "rowtype";
-    public static final String COMPOSITE_KEY = "composite_filtername-username";
     public static final String SHARE_NAME_LIST = "share_username_list";
   }
 }

http://git-wip-us.apache.org/repos/asf/ambari/blob/e55a595a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/DashboardLayout.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/DashboardLayout.js
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/DashboardLayout.js
deleted file mode 100644
index 7adfeb8..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/DashboardLayout.js
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- * http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
- 
-define(['require',
-	'backbone',
-	'communicator',
-	'modules/XALinks',
-	'hbs!tmpl/dashboard/DashboardLayout_tmpl'
-],function(require,Backbone,Communicator,XALinks,DashboardlayoutTmpl){
-    'use strict';
-
-	var DashboardLayout = Backbone.Marionette.Layout.extend(
-	/** @lends DashboardLayout */
-	{
-		_viewName : name,
-		
-    	template: DashboardlayoutTmpl,
-    	breadCrumbs : [XALinks.get('Dashboard')],
-        
-		/** Layout sub regions */
-    	regions: {},
-
-    	/** ui selector cache */
-    	ui: {},
-
-		/** ui events hash */
-		events: {},
-
-    	/**
-		* intialize a new DashboardLayout Layout 
-		* @constructs
-		*/
-		initialize: function(options) {
-			console.log("initialized a DashboardLayout Layout");
-
-			_.extend(this, _.pick(options, ''));
-			
-			this.bindEvents();
-		},
-
-		/** all events binding here */
-		bindEvents : function(){
-			/*this.listenTo(this.model, "change:foo", this.modelChanged, this);*/
-			/*this.listenTo(communicator.vent,'someView:someEvent', this.someEventHandler, this)'*/
-		},
-
-		/** on render callback */
-		onRender: function() {
-			this.initializePlugins();
-		},
-
-		/** all post render plugin initialization */
-		initializePlugins: function(){
-		},
-
-		/** on close */
-		onClose: function(){
-		}
-
-	});
-	
-	return DashboardLayout;
-});

http://git-wip-us.apache.org/repos/asf/ambari/blob/e55a595a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/EventHistoryLayout.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/EventHistoryLayout.js
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/EventHistoryLayout.js
index 89914ea..01e18b1 100644
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/EventHistoryLayout.js
+++ b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/common/EventHistoryLayout.js
@@ -228,7 +228,6 @@ define(['require',
             }
             params["time"] = timeType;
             var postObject = {
-                userName: "admin",
                 filtername: content.ui.filterName.val().trim(),
                 rowType: "history",
                 values: JSON.stringify(params)

http://git-wip-us.apache.org/repos/asf/ambari/blob/e55a595a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/DashboardLayoutView.js
----------------------------------------------------------------------
diff --git a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/DashboardLayoutView.js
b/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/DashboardLayoutView.js
deleted file mode 100644
index 6358eb2..0000000
--- a/ambari-logsearch/ambari-logsearch-portal/src/main/webapp/scripts/views/dashboard/DashboardLayoutView.js
+++ /dev/null
@@ -1,354 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-define(['require',
-    'backbone',
-    'utils/Utils',
-    'dashboard',
-    'utils/Globals',
-    'collections/VEventHistoryList',
-    'hbs!tmpl/dashboard/DashboardLayoutView_tmpl'
-], function(require, Backbone, Utils, dashboard, Globals, VEventHistory, DashboardLayoutView_Tmpl)
{
-    'use strict';
-
-    return Backbone.Marionette.Layout.extend(
-        /** @lends DashboardLayoutView */
-        {
-            _viewName: 'DashboardLayoutView',
-
-            template: DashboardLayoutView_Tmpl,
-
-
-            /** ui selector cache */
-            ui: {
-                gridClose: "[data-id='gridClose']",
-                saveData: "[data-id='save']",
-                loadData: "[data-id='load']",
-                enableHelp: "[data-id='enableHelp']"
-            },
-
-            /** ui events hash */
-            events: function() {
-                var events = {};
-                events['click ' + this.ui.gridClose] = 'onGridCloseClick';
-                events['click ' + this.ui.saveData] = 'onSaveDataClick';
-                events['click ' + this.ui.loadData] = 'onLoadDataClick';
-                events['change ' + this.ui.enableHelp] = 'onEnableHelpClick';
-                return events;
-            },
-            regions: {},
-
-            /**
-             * intialize a new DashboardLayoutView Layout
-             * @constructs
-             */
-            initialize: function(options) {
-                _.extend(this, _.pick(options, 'globalVent', 'params', 'componetList'));
-                this.bindEvents();
-                this.tabOpend = false;
-                this.graphIdCounter = 0;
-                this.dateUtil = Utils.dateUtil;
-                this.vent = new Backbone.Wreqr.EventAggregator();
-                this.storedValueCollection = new Backbone.Collection();
-                this.saveDahboardCollection = new VEventHistory();
-                this.gridHelp = true;
-            },
-            bindEvents: function() {
-                this.listenTo(this.globalVent, "tab:click", function($this) {
-                    if (!this.tabOpend) {
-                        this.tabOpend = true
-                        this.initializePlugin();
-                        //this.dashboard.bindEvent();
-                    }
-                }, this);
-            },
-            onRender: function() {
-                this.setSettingCheckbox();
-            },
-            addElement: function(el, data) {
-                var that = this;
-                //this.dashboard.addWidget($('<li class="new" data-type="' + type + '"></li>'),
3, 2);
-                var regionid = that.createRegion();
-                if (data) {
-                    el.attr('data-type', data.myData.type)
-                }
-
-                el.append('<div class="regionBox" data-regionid= "' + regionid + '"  id
= "' + regionid + '"> </div>')
-                el.attr('data-dataId', regionid)
-                var dataType = el.data();
-                if (dataType && dataType.type) {
-                    that.addRegion(regionid, dataType.type, data);
-                }
-
-            },
-            initializePlugin: function() {
-                var that = this;
-                this.dashboard = $(".gridster").dashboard({
-                    widget_margins: [10, 10],
-                    widget_base_dimensions: [140, 140],
-                    resize: {
-                        enabled: true,
-                        stop: function(e, ui, $widget) {
-                            $widget.resize();
-                        },
-                        axes: ['both']
-                    },
-                    max_cols: 7,
-                    avoid_overlapped_widgets: true,
-                    dock: {
-                        dockIcon: [{
-                                iClass: "fa fa-bar-chart",
-                                parentAttr: {
-                                    "data-type": Globals.graphType.HISTOGRAM.value,
-                                    "class": "icon"
-                                }
-                            }, {
-                                iClass: "fa fa-line-chart",
-                                parentAttr: {
-                                    "data-type": Globals.graphType.MULTILINE.value,
-                                    "class": "iconG"
-                                }
-                            }, {
-                                iClass: "fa fa-pie-chart",
-                                parentAttr: {
-                                    "data-type": Globals.graphType.PIE.value,
-                                    "class": "iconG"
-                                }
-                            },
-                            /* {
-                                    iClass: "fa fa-table",
-                                    parentAttr: {
-                                        "data-type": Globals.graphType.TABLE.value,
-                                        "class": "iconG"
-                                    }
-                            }*/
-                        ],
-                        position: 'right',
-                        dockClick: true,
-                        droppable: {
-                            /*  el: that.$(".dashboard .grid-container"),*/
-                            hoverClass: "over",
-                            accept: ".slideMenu li.iconG"
-                        },
-                        draggable: {
-                            /*el: that.$('.dashboard .slideMenu li.iconG'),*/
-                            cursor: "move",
-                            start: function(event, ui) {},
-                            appendTo: '.grid-container',
-                            scroll: false,
-                            helper: "clone"
-
-                        }
-                    },
-                    serialize_params: function($w, wgd) {
-                        return {
-                            myData: {
-                                type: $w.data('type'),
-                                dataId: $w.data('dataid')
-                            },
-                            col: wgd.col,
-                            row: wgd.row,
-                            size_x: wgd.size_x,
-                            size_y: wgd.size_y
-                        };
-                    },
-                    onLoaded: function() {
-                        //console.log('loaded')
-                        that.onLoadDataClick();
-                    },
-                    onAdded: function(el, data) {
-                        that.addElement(el, data);
-                    },
-                    onDeleted: function() {
-                        console.log("delete");
-                    },
-                    onAllDeleted: function() {
-                        console.log("onAllDeleted");
-                    }
-                }).data('dashboard');
-
-                /*   this.gridster = this.$(".gridster ul").gridster({
-                       widget_margins: [10, 10],
-                       widget_base_dimensions: [140, 140],
-                       resize: {
-                           enabled: true
-                       },
-                       draggable: {
-                           handle: '.Header'
-                       },
-                       resize: {
-                           enabled: true,
-                           stop: function(e, ui, $widget) {
-                               $widget.resize();
-                           }
-                       },
-                       avoid_overlapped_widgets: true,
-                       serialize_params: function($w, wgd) {
-                           return {
-                               myData: $w.data('type'),
-                               col: wgd.col,
-                               row: wgd.row,
-                               size_x: wgd.size_x,
-                               size_y: wgd.size_y
-                           };
-                       },
-
-                   }).data('gridster');*/
-
-                this.$('.dashboard').on('mouseenter', 'li.iconG', function() {
-                    that.$('.dashboard').find('.grid-container').addClass('droupAreaHoverEffect');
-                });
-                this.$('.dashboard').on('mouseleave', 'li.iconG', function() {
-                    that.$('.dashboard').find('.grid-container').removeClass('droupAreaHoverEffect');
-                });
-            },
-            addRegion: function(region_id, type, data) {
-                var that = this;
-                require(['views/graphs/GridGraphLayoutView', 'views/dashboard/GridTableLayoutView'],
function(GridGraphLayoutView, GridTableLayoutView) {
-                    var region = that.getRegion(region_id);
-                    var ViewtypeObj = type;
-                    var modalObj = that.storedValueCollection.add(new Backbone.Model({
-                        id: region_id
-                    }))
-                    if (data) {
-                        modalObj.set(data);
-                    }
-                    var options = {
-                        globalVent: that.globalVent,
-                        vent: that.vent,
-                        viewType: ViewtypeObj,
-                        model: modalObj,
-                        dashboard: that.dashboard,
-                        gridHelp: that.gridHelp
-
-                    }
-                    if (type == Globals.graphType.TABLE.value) {
-                        that.showRegion(region, new GridTableLayoutView(options));
-                    } else {
-                        that.showRegion(region, new GridGraphLayoutView(options));
-                    }
-
-                })
-
-            },
-            createRegion: function(rId) {
-                var id = (rId) ? (rId) : ("grid_histo" + (this.graphIdCounter++));
-                var region = {};
-                region[id] = '#' + id;
-                this.addRegions(region);
-                return id;
-
-            },
-            showRegion: function(region, layout) {
-                region.show(layout);
-            },
-            onSaveDataClick: function() {
-                var that = this;
-                var exportData = this.dashboard.exportData();
-
-                _.each(exportData, function(ref, i) {
-                    var obj = JSON.parse(JSON.stringify(ref));
-                    if (that.storedValueCollection.get(ref.myData.dataId)) {
-                        var id = ref.myData.dataId;
-                        exportData[i] = _.extend(that.storedValueCollection.get(id).attributes,
obj)
-                    }
-                });
-
-                var postObject = {
-                    userId: 0,
-                    name: "Temp",
-                    rowType: "dashboard",
-                    isOverwrite: true,
-                    values: JSON.stringify(exportData)
-                }
-
-                this.saveDahboardCollection.saveDashboard(postObject, {
-                    success: function(data, textStatus, jqXHR) {
-                        Utils.notifySuccess({
-                            content: "Dashboard saved successfully."
-                        });
-                    },
-                    error: function(jqXHR, textStatus, errorThrown) {
-                        Utils.notifyError({
-                            content: JSON.parse(jqXHR.responseText).msgDesc || "There is
some problem in Dashboard, Please try again later."
-                        });
-                    },
-                    complete: function() {
-                        that.$("#loaderEvent").hide();
-                        that.$(".loader").hide();
-                    }
-                });
-
-            },
-            onLoadDataClick: function() {
-                var that = this;
-                $.extend(this.saveDahboardCollection.queryParams, {
-                    userId: 0,
-                    rowType: "dashboard"
-                });
-                that.$(".loader").show();
-                this.saveDahboardCollection.fetch({
-                    error: function(jqXHR, textStatus, errorThrown) {
-                        Utils.notifyError({
-                            content: "There is some problem in Event History, Please try
again later."
-                        });
-
-                    },
-                    success: function(data, textStatus, jqXHR) {
-                    	if(that.saveDahboardCollection.length){
-                    		var dataObject = JSON.parse(that.saveDahboardCollection.models[0].get('values'));
-                            //that.saveDahboardCollection.reset(dataObject);
-                            //that.storedValueCollection.reset(dataObject);
-                            //var importData = that.storedValueCollection.toJSON();
-                            that.dashboard.importData(dataObject);
-                    	}
-                    },
-                    complete: function() {
-                        //that.$("#loaderEvent").hide();
-                        that.$(".loader").hide();
-                    }
-                });
-            },
-            onGridCloseClick: function(e) {
-                this.dashboard.deleteWidget($(e.currentTarget).parents('li'))
-            },
-            setSettingCheckbox: function() {
-                var gridHelp = Utils.localStorage.checkLocalStorage('gridHelp');
-                if (gridHelp && gridHelp.found && gridHelp.value) {
-                    if (gridHelp.value == "false") {
-                        this.gridHelp = false;
-                        this.ui.enableHelp.prop("checked", false);
-                    } else {
-                        this.gridHelp = true;
-                        this.ui.enableHelp.prop("checked", true);
-                    }
-                }
-            },
-            onEnableHelpClick: function(e) {
-                if (e.currentTarget.checked) {
-                    this.gridHelp = true;
-                    Utils.localStorage.setLocalStorage('gridHelp', true);
-                } else {
-                    this.gridHelp = false;
-                    Utils.localStorage.setLocalStorage('gridHelp', false);
-                }
-            },
-        });
-
-
-});


Mime
View raw message